Hello,
not using app_python, but from its readme file I understand that the
script is loaded at startup, then you can execute methods (functions)
from it at runtime.
Is setflow() a function inside the setflow.py script?
Cheers,
Daniel
On 05/11/14 14:21, Azamat Ailbayev wrote:
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
_______________________________________________
sr-dev mailing list
sr-dev(a)lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
--
Daniel-Constantin Mierla
http://twitter.com/#!/miconda -
http://www.linkedin.com/in/miconda
Kamailio Advanced Training, Nov 24-27, Berlin -
http://www.asipto.com