I can share my solution, using app_python. I'm using this in production
environment during 2 years.
loadmodule "app_python.so"
modparam("app_python", "script_name",
"/opt/kamailio/python/sdp.py")
modparam("app_python", "mod_init_function", "mod_init")
modparam("app_python", "child_init_method", "child_init")
and put in route():
python_exec("ParseSDP", $mb);
Here I shared sdp.py:
http://paste.debian.net/99473/
Note, that it is just for reference only, you need to know what to
remove/replace. That script is not exactly what are you're looking for!