[SR-Users] python_exec and parameters

Daniel-Constantin Mierla miconda at gmail.com
Fri Feb 10 12:14:25 CET 2017


OK.

>From the code, I noticed that the old API (before kemi), it exports a
getHeader(...) method to Python API.

Just for sake of completion - starting with 5.0, there are more methods
available, including a method to retrieve the value of any kamailio cfg
variable, like in:

  -
https://github.com/kamailio/kamailio/blob/master/misc/examples/kemi/kamailio-basic-kemi-python.py#L93

Cheers,
Daniel


On 10/02/2017 11:52, gmele wrote:
> I tested passing the parameter as suggested by Konstantin and it works fine:
>
> In kamailio.cfg :
>
> /python_exec("SendPushNotification", $_s($tU@$td!!$fU@$fd!!$ci));
> /
>
> In our python script:
>
>  /   def SendPushNotification(self, msg, parameters):
>         requestUri = ""
>         fromUri = ""
>         callId = ""
>
>         try:
>             # Extract the message fields
>             requestUri, fromUri, callId = parameters.split("!!")
>             *...
> */
>
> All is working fine on our servers...
>
> Regards
>
>
> Giovanni
>
>
>
> --
> View this message in context: http://sip-router.1086192.n5.nabble.com/python-exec-and-parameters-tp155803p155914.html
> Sent from the Users mailing list archive at Nabble.com.
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - Mar 6-8 (Europe) and Mar 20-22 (USA) - www.asipto.com
Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com




More information about the sr-users mailing list