[OpenSIPS-Devel] gts2010`s question

Razvan Crainea razvan at opensips.org
Fri Apr 20 10:43:51 CEST 2012


Hi, Li Peng!

You are running the script with the $si as first parameter, therefore you should access it in your Python script using sys.argv[1]. For example, if your script is:

#!/usr/bin/python
import sys
print sys.argv[1]

Then after executing the following commands in script, you should see the source IP of the message printed:

exec_avp("/usr/local/sbin/my_script.py $si", "$avp(should_route)");
xlog("Script printed $avp(should_route)\n");

Regards,

--
Ra(zvan Crainea
OpenSIPS Developer
http://www.opensips-solutions.com


On 04/20/2012 10:35 AM, GTS2010 wrote:
> Hi Paiu:
> As your words, "exec_avp("/usr/local/sbin/my_script.py $si", 
> "$avp(should_route)");
> In my_script.py I can print a str such as "the script is running!" , 
> but I can not print the $si , I what to know how could I get the $si 
> in my_script.py . I tried the sys.argv[1] , but I failed . And even 
> the sys.argv[0] was can not be print . If I only run the my_script.py 
> , I can get the sys.argv[0] and the sys.argv[1] be printed .
> Hoping for your help!
> Thanks & Regards!
> Li Peng beijing China
> 2012-04-20
> ------------------------------------------------------------------------
> GTS2010
>
>
> _______________________________________________
> Devel mailing list
> Devel at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/devel/attachments/20120420/b65989c5/attachment.htm>


More information about the Devel mailing list