[SR-Users] [sr-dev] enabling app_python module in Kamailio

Muhammad Nasir Bhutta mbhutta at btlnet.co.uk
Wed Oct 12 12:16:36 CEST 2011


Hi Timo, 
Yes, I have investigated it a bit more. The problem is not that warning it is an error which stops the Kamailio to start.. 
The error is 
"0(25062) DEBUG: <core> [sr_module.c:885]: DEBUG: init_mod: app_python
 0(25062) ERROR: app_python [python_mod.c:158]: cannot import handler
 0(25062) ERROR: <core> [sr_module.c:889]: init_mod(): Error while initializing module app_python (/usr/local/lib64/kamailio/modules/app_python.so)
ERROR: error while initializing modules"

I have tried to investigate a bit more, and the problem is that it is not able to find the handler.py file..  
The error is occurring in init_mod() function which is trying to call a function called "PyImport_ImportModule(bname)" function..  The file tries to set the absolute path in the start .. The absolute path was setup with reference to "sip-router" folder which is old.. So, I changed the path to Kamailio folder..  But, the module can't be loaded... 

To investigate this loading problem, I have seen the functions being called. PyImport_ImportModule takes the name of module to load..  if "." is used that specifies the sub modules..so, this function is being passed just the word "handler"..  The absolute path in the start is setup for a file called "handler.py".. This file is trying to push the directory path in the path as well, but I think maybe there is some problem lying.. I tried to load by passing full path name to PyImport_ImportModule() as well but, in vain.. 

Hope this clarifies things more.. 

Regards,
Nasir

-----Original Message-----
From: Timo Reimann [mailto:timo.reimann at 1und1.de] 
Sent: 12 October 2011 10:38
To: Development mailing list of the sip-router project
Cc: Muhammad Nasir Bhutta; sr-users at lists.sip-router.org; Tim Couper
Subject: Re: [sr-dev] enabling app_python module in Kamailio

On 11.10.2011 15:08, Muhammad Nasir Bhutta wrote:
> I am trying to enable the app_python module in Kamailio to run a 
> simple python script externally parallel with Kamailio proxy,
> 
>  
> 
> While I try to load the module "app_python.so" in configuration file, 
> the Kamailio server fails to start.. I can't see what is the problem ..
> 
>  
> 
> The steps, I am following are that:
> 
>  
> 
> -          Script written in python saved in home directory.
> 
> -          Loadmodule "app_python.so" statement in configuration file.
> 
> -          Modparam("app_python", "script_name", "location of script")
> 
> -          Python_exec("function", "parameters list") ..
> 
>  
> 
> I have also tried to check the Kamailio configuration option, It gives 
> following warning,
> 
> 0(2942) WARNING: <core> [sr_module.c:584]:
> /usr/local/lib64/kamailio/modules/app_python.so: exports dlflags 
> interface is deprecated and it will not be supported in newer 
> versions; consider using mod_register() instead

Is there no other error message? What you provided is just a WARNING which shouldn't be a show stopper.


--Timo



More information about the sr-users mailing list