[SR-Users] FW: App_python Module

Daniel-Constantin Mierla miconda at gmail.com
Tue Nov 1 23:21:04 CET 2011


Hello,

I am not an user of this module, I tried to fix some issues of this 
module in the past purely based on C programming, so I add here some 
comments.

On 11/1/11 2:54 PM, Muhammad Nasir Bhutta wrote:
>
> Hi,
>
> I am a new user of Kamailio, and I am working on enabling the 
> App_Python module in Kamailio..
>
> While searching on google, I came acroos your email on the forum where 
> you people are trying to patch the App_Python module..
>
There was a patch I applied in the past, like few month ago. I think 
there is another on our issue tracker that seemed to be the same, I will 
double check it soon.
>
> I am wandering whether you can please help a bit ..
>
> 1-How to do the configuration to enable the App_python module ? .. At 
> the moment, I am just adding the following line in the configuration 
> file, loadmodule "app_python.so" and just correcting the path to 
> handler.py to the right directory in the code for script path.
>
> 2-What output we should expect when we enable the app_python module ? 
> .. I have seen the handler.py script written in python which is 
> printing some sip message information ? ..
>
> 3-How the SIP Message structure is being passed to handler.py ? ... 
> How we are accessing the Router module in handler.py script and LM_ERR 
> function from Kamailio ? ..
>
> Any help in this regards shall be really helpful .. In any case, 
> whether you can solve this issue or not, please reply the email..
>
I guess that once your python script is loaded properly, you can use in 
kamailio.cfg the function python_exec() to execute functions from your 
python script. LM_ERR is unlikely to get it executed from python script 
since it is a C define (unless it was exported explicitly by app_python 
module), but you can probably execute any function exported by kamailio 
modules.

It will help you to look at C code of app_python module to see what and 
how you can execute from Kamailio, unfortunately this module is not very 
documented, I am not the author of it, so I cannot help you more that 
this for the moment.

Maybe it will help to look at perl or app_lua modules, they have better 
documentation with some examples that can get you started, but of course 
it is not python, so you have to use perl or lua to build your script.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla -- http://www.asipto.com
Kamailio Advanced Training, Dec 5-8, Berlin: http://asipto.com/u/kat
http://linkedin.com/in/miconda -- http://twitter.com/miconda

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20111101/d1c68eb1/attachment.htm>


More information about the sr-users mailing list