Re: [SR-Users] Executing a C function from the Kamailio Script
On 12/04/2015 12:25 PM, Mack Hendricks wrote: Thanks…that what I was thinking, but the customer has the logic in a C function already and he would like to reuse it. Fair enough. So, why can't you take this C function and wrap it in a Kamailio module? -- Alex Balashov | Principal | Evariste Systems LLC 303 Perimeter Center North, Suite 300 Atlanta, GA 30346 United States Tel: +1-800-250-5920 (toll-free) / +1-678-954-0671 (direct) Web: http://www.evaristesys.com/, http://www.csrpswitch.com/ ___ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Re: [SR-Users] Executing a C function from the Kamailio Script
Hey Alex, Thanks…that what I was thinking, but the customer has the logic in a C function already and he would like to reuse it. > On Dec 4, 2015, at 12:22 PM, Alex Balashovwrote: > > Mack, > > The language modules take advantage of the fact that those other languages > (e.g. Lua, Python) are higher-level, _interpreted_ languages, and that their > interpreters provide an API for embedding them into C programs. One cannot > easily embed an on-the-fly C compiler into a C program. > > Writing a Kamailio module is certainly the easiest way to call a custom C > function from route script, and it's not terribly hard to get started. If > your needs are very simple, you don't have to make extensive study of the > module API. Just follow/modify this example module: > > https://github.com/kamailio/kamailio/tree/master/modules/print > > 'print' is a stub that doesn't do anything, but provides a skeleton from > which you can build your own module. > > I suppose you could also embed your C function into a library that can be > called from an interpreted language supported by Kamailio (Lua, Python, Perl, > etc.), but that seems like it would be vastly more complicated than writing a > Kamailio module. > > Finally, are you one hundred percent sure that the functionality you need > cannot be achieved any other way? > > -- Alex > > -- > Alex Balashov | Principal | Evariste Systems LLC > 303 Perimeter Center North, Suite 300 > Atlanta, GA 30346 > United States > > Tel: +1-800-250-5920 (toll-free) / +1-678-954-0671 (direct) > Web: http://www.evaristesys.com/, http://www.csrpswitch.com/ > > ___ > SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list > sr-users@lists.sip-router.org > http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users ___ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Re: [SR-Users] Executing a C function from the Kamailio Script
Mack, The language modules take advantage of the fact that those other languages (e.g. Lua, Python) are higher-level, _interpreted_ languages, and that their interpreters provide an API for embedding them into C programs. One cannot easily embed an on-the-fly C compiler into a C program. Writing a Kamailio module is certainly the easiest way to call a custom C function from route script, and it's not terribly hard to get started. If your needs are very simple, you don't have to make extensive study of the module API. Just follow/modify this example module: https://github.com/kamailio/kamailio/tree/master/modules/print 'print' is a stub that doesn't do anything, but provides a skeleton from which you can build your own module. I suppose you could also embed your C function into a library that can be called from an interpreted language supported by Kamailio (Lua, Python, Perl, etc.), but that seems like it would be vastly more complicated than writing a Kamailio module. Finally, are you one hundred percent sure that the functionality you need cannot be achieved any other way? -- Alex -- Alex Balashov | Principal | Evariste Systems LLC 303 Perimeter Center North, Suite 300 Atlanta, GA 30346 United States Tel: +1-800-250-5920 (toll-free) / +1-678-954-0671 (direct) Web: http://www.evaristesys.com/, http://www.csrpswitch.com/ ___ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
[SR-Users] Executing a C function from the Kamailio Script
We have some logic in a C function that we would like to execute from the Kamailio script. I see there are modules for calling functions in other languages. But, I don’t see anything for C. Is creating a module the only way to leverage this C function? Thanks, -Mack ___ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users