<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<STYLE type=text/css> <!--@import url(scrollbar.css); --></STYLE>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<STYLE>                        body{FONT-SIZE:12pt; FONT-FAMILY:宋体,serif;}                </STYLE>
<META name=GENERATOR content="MSHTML 8.00.6001.19222"><BASE
target=_blank></HEAD>
<BODY
style="LINE-HEIGHT: 1.3; BORDER-RIGHT-WIDTH: 0px; MARGIN: 12px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px"
marginheight="0" marginwidth="0">
<DIV><FONT color=#000000 size=3 face=宋体>Hi:</FONT></DIV>
<DIV> </DIV>
<DIV>I think I know the problem , In my script :</DIV>
<DIV>
<DIV>#!/usr/bin/python </DIV>
<DIV>import sys </DIV>
<DIV> </DIV>
<DIV>print "this is a test script!\n"</DIV>
<DIV>print sys.argv[1] </DIV>
<DIV> </DIV>
<DIV>I can not get the $si. When I change it to :</DIV>
<DIV>
<DIV>#!/usr/bin/python </DIV>
<DIV>import sys </DIV>
<DIV> </DIV>
<DIV>print sys.argv[1] </DIV>
<DIV> </DIV>
<DIV>Then I can get the $si. Now I want to know why ? In the srcrpt only allow
one print ?</DIV></DIV></DIV>
<DIV> </DIV>
<DIV>Hoping for your help!</DIV>
<DIV>Thanks & Regards</DIV>
<DIV> </DIV>
<DIV>Li peng beijing China</DIV>
<DIV align=left><FONT color=#c0c0c0 size=2 face=Verdana>2012-04-23</FONT></DIV>
<DIV align=left><FONT size=2 face=Verdana>
<HR style="WIDTH: 122px; HEIGHT: 2px" id=SignNameHR align=left SIZE=2>
</FONT></DIV>
<DIV align=left><FONT color=#c0c0c0 size=2 face=Verdana><SPAN
id=_FlashSignName>GTS2010</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Verdana>
<HR>
</FONT></DIV>
<DIV><FONT size=2 face=Verdana><STRONG>发件人:</STRONG>devel-request</FONT></DIV>
<DIV><FONT size=2
face=Verdana><STRONG>发送时间:</STRONG>2012-04-20 18:00</FONT></DIV>
<DIV><FONT size=2 face=Verdana><STRONG>主题:</STRONG>Devel Digest, Vol 46, Issue
37</FONT></DIV>
<DIV><FONT size=2
face=Verdana><STRONG>收件人:</STRONG>"devel"<devel@lists.opensips.org></FONT></DIV>
<DIV><FONT size=2 face=Verdana><STRONG>抄送:</STRONG></FONT></DIV>
<DIV><FONT size=2 face=Verdana></FONT> </DIV>
<DIV><FONT size=2 face=Verdana>
<DIV>Send Devel mailing list submissions to </DIV>
<DIV> devel@lists.opensips.org </DIV>
<DIV> </DIV>
<DIV>To subscribe or unsubscribe via the World Wide Web, visit </DIV>
<DIV> http://lists.opensips.org/cgi-bin/mailman/listinfo/devel </DIV>
<DIV>or, via email, send a message with subject or body 'help' to </DIV>
<DIV> devel-request@lists.opensips.org </DIV>
<DIV> </DIV>
<DIV>You can reach the person managing the list at </DIV>
<DIV> devel-owner@lists.opensips.org </DIV>
<DIV> </DIV>
<DIV>When replying, please edit your Subject line so it is more specific </DIV>
<DIV>than "Re: Contents of Devel digest..." </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>Today's Topics: </DIV>
<DIV> </DIV>
<DIV> 1. Re: gts2010`s question (Razvan Crainea) </DIV>
<DIV> 2. SF.net SVN: opensips:[8947] trunk/modules/b2b_logic/logic.c </DIV>
<DIV> (Bogdan-Andrei Iancu) </DIV>
<DIV> 3. SF.net SVN: opensips:[8948] </DIV>
<DIV> branches/1.8/modules/b2b_logic/logic.c (Bogdan-Andrei Iancu) </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>---------------------------------------------------------------------- </DIV>
<DIV> </DIV>
<DIV>Message: 1 </DIV>
<DIV>Date: Fri, 20 Apr 2012 11:43:51 +0300 </DIV>
<DIV>From: Razvan Crainea <razvan@opensips.org> </DIV>
<DIV>Subject: Re: [OpenSIPS-Devel] gts2010`s question </DIV>
<DIV>To: devel@lists.opensips.org </DIV>
<DIV>Message-ID: <4F9121C7.3040602@opensips.org> </DIV>
<DIV>Content-Type: text/plain; charset="iso-8859-1"; Format="flowed" </DIV>
<DIV> </DIV>
<DIV>Hi, Li Peng! </DIV>
<DIV> </DIV>
<DIV>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: </DIV>
<DIV> </DIV>
<DIV>#!/usr/bin/python </DIV>
<DIV>import sys </DIV>
<DIV>print sys.argv[1] </DIV>
<DIV> </DIV>
<DIV>Then after executing the following commands in script, you should see the source IP of the message printed: </DIV>
<DIV> </DIV>
<DIV>exec_avp("/usr/local/sbin/my_script.py $si", "$avp(should_route)"); </DIV>
<DIV>xlog("Script printed $avp(should_route)\n"); </DIV>
<DIV> </DIV>
<DIV>Regards, </DIV>
<DIV> </DIV>
<DIV>-- </DIV>
<DIV>Ra(zvan Crainea </DIV>
<DIV>OpenSIPS Developer </DIV>
<DIV>http://www.opensips-solutions.com </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>On 04/20/2012 10:35 AM, GTS2010 wrote: </DIV>
<DIV>> Hi Paiu: </DIV>
<DIV>> As your words, "exec_avp("/usr/local/sbin/my_script.py $si", </DIV>
<DIV>> "$avp(should_route)"); </DIV>
<DIV>> In my_script.py I can print a str such as "the script is running!" , </DIV>
<DIV>> but I can not print the $si , I what to know how could I get the $si </DIV>
<DIV>> in my_script.py . I tried the sys.argv[1] , but I failed . And even </DIV>
<DIV>> the sys.argv[0] was can not be print . If I only run the my_script.py </DIV>
<DIV>> , I can get the sys.argv[0] and the sys.argv[1] be printed . </DIV>
<DIV>> Hoping for your help! </DIV>
<DIV>> Thanks & Regards! </DIV>
<DIV>> Li Peng beijing China </DIV>
<DIV>> 2012-04-20 </DIV>
<DIV>> ------------------------------------------------------------------------ </DIV>
<DIV>> GTS2010 </DIV>
<DIV>> </DIV>
<DIV>> </DIV>
<DIV>> _______________________________________________ </DIV>
<DIV>> Devel mailing list </DIV>
<DIV>> Devel@lists.opensips.org </DIV>
<DIV>> http://lists.opensips.org/cgi-bin/mailman/listinfo/devel </DIV>
<DIV>-------------- next part -------------- </DIV>
<DIV>An HTML attachment was scrubbed... </DIV>
<DIV>URL: <http://lists.opensips.org/pipermail/devel/attachments/20120420/b65989c5/attachment.html> </DIV>
<DIV> </DIV>
<DIV>------------------------------ </DIV>
<DIV> </DIV>
<DIV>Message: 2 </DIV>
<DIV>Date: Fri, 20 Apr 2012 09:24:07 +0000 </DIV>
<DIV>From: Bogdan-Andrei Iancu <bogdan@opensips.org> </DIV>
<DIV>Subject: [OpenSIPS-Devel] SF.net SVN: opensips:[8947] </DIV>
<DIV> trunk/modules/b2b_logic/logic.c </DIV>
<DIV>To: devel@lists.opensips.org </DIV>
<DIV>Message-ID: <E1SLA4V-0001vz-6l@sfp-svn-1.v30.ch3.sourceforge.com> </DIV>
<DIV>Content-Type: text/plain; charset=UTF-8 </DIV>
<DIV> </DIV>
<DIV>Revision: 8947 </DIV>
<DIV> http://opensips.svn.sourceforge.net/opensips/?rev=8947&view=rev </DIV>
<DIV>Author: bogdan_iancu </DIV>
<DIV>Date: 2012-04-20 09:24:06 +0000 (Fri, 20 Apr 2012) </DIV>
<DIV>Log Message: </DIV>
<DIV>----------- </DIV>
<DIV>- fixed handling of Replace header in REFER methods - if the dialog to be replaced by REFER is not found in b2b, simply do not change it. </DIV>
<DIV> </DIV>
<DIV>Modified Paths: </DIV>
<DIV>-------------- </DIV>
<DIV> trunk/modules/b2b_logic/logic.c </DIV>
<DIV> </DIV>
<DIV>This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>------------------------------ </DIV>
<DIV> </DIV>
<DIV>Message: 3 </DIV>
<DIV>Date: Fri, 20 Apr 2012 09:25:41 +0000 </DIV>
<DIV>From: Bogdan-Andrei Iancu <bogdan@opensips.org> </DIV>
<DIV>Subject: [OpenSIPS-Devel] SF.net SVN: opensips:[8948] </DIV>
<DIV> branches/1.8/modules/b2b_logic/logic.c </DIV>
<DIV>To: devel@lists.opensips.org </DIV>
<DIV>Message-ID: <E1SLA61-0001yJ-IA@sfp-svn-1.v30.ch3.sourceforge.com> </DIV>
<DIV>Content-Type: text/plain; charset=UTF-8 </DIV>
<DIV> </DIV>
<DIV>Revision: 8948 </DIV>
<DIV> http://opensips.svn.sourceforge.net/opensips/?rev=8948&view=rev </DIV>
<DIV>Author: bogdan_iancu </DIV>
<DIV>Date: 2012-04-20 09:25:41 +0000 (Fri, 20 Apr 2012) </DIV>
<DIV>Log Message: </DIV>
<DIV>----------- </DIV>
<DIV>backport from trunk (rev #8947) </DIV>
<DIV>- fixed handling of Replace header in REFER methods - if the dialog to be replaced by REFER is not found in b2b, simply do not change it. </DIV>
<DIV> </DIV>
<DIV>Revision Links: </DIV>
<DIV>-------------- </DIV>
<DIV> http://opensips.svn.sourceforge.net/opensips/?rev=8947&view=rev </DIV>
<DIV> </DIV>
<DIV>Modified Paths: </DIV>
<DIV>-------------- </DIV>
<DIV> branches/1.8/modules/b2b_logic/logic.c </DIV>
<DIV> </DIV>
<DIV>This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>------------------------------ </DIV>
<DIV> </DIV>
<DIV>_______________________________________________ </DIV>
<DIV>Devel mailing list </DIV>
<DIV>Devel@lists.opensips.org </DIV>
<DIV>http://lists.opensips.org/cgi-bin/mailman/listinfo/devel </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>End of Devel Digest, Vol 46, Issue 37 </DIV>
<DIV>************************************* </DIV></FONT></DIV></BODY></HTML>