Hi, 

Here is some more information on the error, I have tried to print all the 
processing steps.. 

DEBUG: init_mod: app_python
 0(10480) ERROR: app_python [python_mod.c:102]: lengths of different names  
script_name = 34, mod_init_fname = 8, child_init_mname 10
 0(10480) ERROR: app_python [python_mod.c:109]: tname = 
/usr/local/etc/kamailio/handler.py
 0(10480) ERROR: app_python [python_mod.c:111]: dname = /usr/local/etc/kamailio
 0(10480) ERROR: app_python [python_mod.c:116]: base name = handler.py
 0(10480) ERROR: app_python [python_mod.c:128]: base name after being processed 
for .py extension = handler
 0(10480) ERROR: app_python [python_mod.c:134]: python is initialized and 
thread state is stored
 0(10480) ERROR: app_python [python_mod.c:143]: Router module is initialized 
successfully
 0(10480) ERROR: app_python [python_mod.c:152]: System Object path is 
successfully imported
 0(10480) ERROR: app_python [python_mod.c:160]: directory is successfully 
loaded in object
 0(10480) ERROR: app_python [python_mod.c:164]: directory and system path is 
inserted in Python list
 0(10480) ERROR: app_python [python_mod.c:168]: cannot import handler
 0(10480) 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  

If any one can please help, that shall be great.. 

Regards,
Nasir
-----Original Message-----
From: Muhammad Nasir Bhutta 
Sent: 12 October 2011 11:17
To: 'Timo Reimann'; Development mailing list of the sip-router project
Cc: sr-users@lists.sip-router.org; Tim Couper
Subject: RE: [sr-dev] enabling app_python module in Kamailio

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.reim...@1und1.de]
Sent: 12 October 2011 10:38
To: Development mailing list of the sip-router project
Cc: Muhammad Nasir Bhutta; sr-users@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

_______________________________________________
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

Reply via email to