[sr-dev] Executing python script under certain conditions (whether it is audio or video) in Kamailio SIP CS

Azamat Ailbayev vko.boran at mail.ru
Wed Nov 5 14:21:06 CET 2014


 Dear All,
 
I am trying to execute python script from the kamailio. According to documentation I have initialized everything and it works. As soon as I run the Kamailio the python script is executed. 
 
However, according to my task I need to execute the script based on session media type (WebRTC communication type) whether it is audio or video.
 
For that purpose there was used SDPOPS module with function sdp_with_media("video"). 
 
So, in config file it looks like: 
 
#!ifdef WITH_WEBSOCKETS
loadmodule "xhttp.so"
loadmodule "websocket.so"
loadmodule "nathelper.so"
loadmodule "sdpops.so"
loadmodule "app_python.so"
#!endif
......
modparam("app_python", "script_name", "/usr/local/etc/sip-router/setflow.py")
modparam("app_python", "mod_init_function", "mod_init")
modparam("app_python", "child_init_method", "child_init")
......
......
request_route {
 
 
if (sdp_with_media("video")){
       python_exec("setflow");
}
..........
..........
 
Basically, this python script should be executed if the media session is video. For that it should have analyzed SDP body during the session establishment. However, it is executed as soon as kamailio is running. There was no any session establishment procedure (no INVITE), three way handshake, etc.  
How it is possible to solve this issue? Do I need to execute it under certain conditions or am I missing something? Why the script is executed even though it is in "if" statement? I thought that it would execute the script if condition is true. 
 
Thank you in advance.
 
Cheers,
Azat

Best Regards,
Azamat Ailbayev
Mob.: +49 (0) 15215023005
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20141105/fb326ecc/attachment-0001.html>


More information about the sr-dev mailing list