[SR-Users] Executing a C function from the Kamailio Script

Mack Hendricks ap at goflyball.com
Fri Dec 4 18:25:33 CET 2015


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 Balashov <abalashov at evaristesys.com> wrote:
> 
> 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 at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users




More information about the sr-users mailing list