<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <tt>Hello!<br>
      <br>
      You should have mentioned that you can access only the first line.
      You can find the explanation in the documentation[1]:<br>
      <span style="color: rgb(0, 0, 0); font-family: Helvetica, Arial;
        font-size: 12px; font-style: normal; font-variant: normal;
        font-weight: normal; letter-spacing: normal; line-height:
        normal; orphans: 2; text-align: justify; text-indent: 0px;
        text-transform: none; white-space: normal; widows: 2;
        word-spacing: 0px; -webkit-text-size-adjust: auto;
        -webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
        255); display: inline !important; float: none; "></span>"Executes
      an external command. Each line from output of the command is saved
      in an AVP from 'avplist'."<br>
    </tt><tt><br>
      [1] <a
href="http://www.opensips.org/html/docs/modules/1.8.x/exec.html#id250135">http://www.opensips.org/html/docs/modules/1.8.x/exec.html#id250135</a><br>
      <br>
      Regards,</tt>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <br>
    <pre class="moz-signature" cols="72">--
Răzvan Crainea
OpenSIPS Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
    <br>
    On 04/23/2012 04:55 AM, GTS2010 wrote:
    <blockquote
      cite="mid:2a246277.12929d.136dce8c391.Coremail.GTS2010@126.com"
      type="cite">
      <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">
      <div><font face="宋体" color="#000000" size="3">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 &amp; Regards</div>
      <div> </div>
      <div>Li peng beijing China</div>
      <div align="left"><font face="Verdana" color="#c0c0c0" size="2">2012-04-23</font></div>
      <div align="left"><font face="Verdana" size="2">
          <hr style="WIDTH: 122px; HEIGHT: 2px" id="SignNameHR" size="2"
            align="left">
        </font></div>
      <div align="left"><font face="Verdana" color="#c0c0c0" size="2"><span
            id="_FlashSignName">GTS2010</span></font></div>
      <div><font face="Verdana" size="2">
          <hr>
        </font></div>
      <div><font face="Verdana" size="2"><strong>发件人:</strong>devel-request</font></div>
      <div><font face="Verdana" size="2"><strong>发送时间:</strong>2012-04-20 18:00</font></div>
      <div><font face="Verdana" size="2"><strong>主题:</strong>Devel
          Digest, Vol 46, Issue 37</font></div>
      <div><font face="Verdana" size="2"><strong>收件人:</strong>"devel"<a class="moz-txt-link-rfc2396E" href="mailto:devel@lists.opensips.org">&lt;devel@lists.opensips.org&gt;</a></font></div>
      <div><font face="Verdana" size="2"><strong>抄送:</strong></font></div>
      <div> </div>
      <div><font face="Verdana" size="2">
          <div>Send Devel mailing list submissions to </div>
          <div>    <a class="moz-txt-link-abbreviated" href="mailto:devel@lists.opensips.org">devel@lists.opensips.org</a> </div>
          <div> </div>
          <div>To subscribe or unsubscribe via the World Wide Web, visit </div>
          <div>    <a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/devel">http://lists.opensips.org/cgi-bin/mailman/listinfo/devel</a> </div>
          <div>or, via email, send a message with subject or body 'help' to </div>
          <div>    <a class="moz-txt-link-abbreviated" href="mailto:devel-request@lists.opensips.org">devel-request@lists.opensips.org</a> </div>
          <div> </div>
          <div>You can reach the person managing the list at </div>
          <div>    <a class="moz-txt-link-abbreviated" href="mailto:devel-owner@lists.opensips.org">devel-owner@lists.opensips.org</a> </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 <a class="moz-txt-link-rfc2396E" href="mailto:razvan@opensips.org">&lt;razvan@opensips.org&gt;</a> </div>
          <div>Subject: Re: [OpenSIPS-Devel] gts2010`s question </div>
          <div>To: <a class="moz-txt-link-abbreviated" href="mailto:devel@lists.opensips.org">devel@lists.opensips.org</a> </div>
          <div>Message-ID: <a class="moz-txt-link-rfc2396E" href="mailto:4F9121C7.3040602@opensips.org">&lt;4F9121C7.3040602@opensips.org&gt;</a> </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><a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a> </div>
          <div> </div>
          <div> </div>
          <div>On 04/20/2012 10:35 AM, GTS2010 wrote: </div>
          <div>&gt; Hi Paiu: </div>
          <div>&gt; As your words, "exec_avp("/usr/local/sbin/my_script.py $si",  </div>
          <div>&gt; "$avp(should_route)"); </div>
          <div>&gt; In my_script.py I can print a str such as "the script is running!" ,  </div>
          <div>&gt; but I can not print the $si , I what to know how could I get the $si  </div>
          <div>&gt; in my_script.py . I tried the sys.argv[1] , but I failed . And even  </div>
          <div>&gt; the sys.argv[0] was can not be print . If I only run the my_script.py  </div>
          <div>&gt; , I can get the sys.argv[0] and the sys.argv[1] be printed . </div>
          <div>&gt; Hoping for your help! </div>
          <div>&gt; Thanks &amp; Regards! </div>
          <div>&gt; Li Peng beijing China </div>
          <div>&gt; 2012-04-20 </div>
          <div>&gt; ------------------------------------------------------------------------ </div>
          <div>&gt; GTS2010 </div>
          <div>&gt; </div>
          <div>&gt; </div>
          <div>&gt; _______________________________________________ </div>
          <div>&gt; Devel mailing list </div>
          <div>&gt; <a class="moz-txt-link-abbreviated" href="mailto:Devel@lists.opensips.org">Devel@lists.opensips.org</a> </div>
          <div>&gt; <a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/devel">http://lists.opensips.org/cgi-bin/mailman/listinfo/devel</a> </div>
          <div>-------------- next part -------------- </div>
          <div>An HTML attachment was scrubbed... </div>
          <div>URL: <a class="moz-txt-link-rfc2396E" href="http://lists.opensips.org/pipermail/devel/attachments/20120420/b65989c5/attachment.html">&lt;http://lists.opensips.org/pipermail/devel/attachments/20120420/b65989c5/attachment.html&gt;</a> </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 <a class="moz-txt-link-rfc2396E" href="mailto:bogdan@opensips.org">&lt;bogdan@opensips.org&gt;</a> </div>
          <div>Subject: [OpenSIPS-Devel] SF.net SVN: opensips:[8947] </div>
          <div>    trunk/modules/b2b_logic/logic.c </div>
          <div>To: <a class="moz-txt-link-abbreviated" href="mailto:devel@lists.opensips.org">devel@lists.opensips.org</a> </div>
          <div>Message-ID: <a class="moz-txt-link-rfc2396E" href="mailto:E1SLA4V-0001vz-6l@sfp-svn-1.v30.ch3.sourceforge.com">&lt;E1SLA4V-0001vz-6l@sfp-svn-1.v30.ch3.sourceforge.com&gt;</a> </div>
          <div>Content-Type: text/plain; charset=UTF-8 </div>
          <div> </div>
          <div>Revision: 8947 </div>
          <div>          <a class="moz-txt-link-freetext" href="http://opensips.svn.sourceforge.net/opensips/?rev=8947&amp;view=rev">http://opensips.svn.sourceforge.net/opensips/?rev=8947&amp;view=rev</a> </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 <a class="moz-txt-link-rfc2396E" href="mailto:bogdan@opensips.org">&lt;bogdan@opensips.org&gt;</a> </div>
          <div>Subject: [OpenSIPS-Devel] SF.net SVN: opensips:[8948] </div>
          <div>    branches/1.8/modules/b2b_logic/logic.c </div>
          <div>To: <a class="moz-txt-link-abbreviated" href="mailto:devel@lists.opensips.org">devel@lists.opensips.org</a> </div>
          <div>Message-ID: <a class="moz-txt-link-rfc2396E" href="mailto:E1SLA61-0001yJ-IA@sfp-svn-1.v30.ch3.sourceforge.com">&lt;E1SLA61-0001yJ-IA@sfp-svn-1.v30.ch3.sourceforge.com&gt;</a> </div>
          <div>Content-Type: text/plain; charset=UTF-8 </div>
          <div> </div>
          <div>Revision: 8948 </div>
          <div>          <a class="moz-txt-link-freetext" href="http://opensips.svn.sourceforge.net/opensips/?rev=8948&amp;view=rev">http://opensips.svn.sourceforge.net/opensips/?rev=8948&amp;view=rev</a> </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>    <a class="moz-txt-link-freetext" href="http://opensips.svn.sourceforge.net/opensips/?rev=8947&amp;view=rev">http://opensips.svn.sourceforge.net/opensips/?rev=8947&amp;view=rev</a> </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><a class="moz-txt-link-abbreviated" href="mailto:Devel@lists.opensips.org">Devel@lists.opensips.org</a> </div>
          <div><a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/devel">http://lists.opensips.org/cgi-bin/mailman/listinfo/devel</a> </div>
          <div> </div>
          <div> </div>
          <div>End of Devel Digest, Vol 46, Issue 37 </div>
          <div>************************************* </div>
        </font></div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Devel@lists.opensips.org">Devel@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/devel">http://lists.opensips.org/cgi-bin/mailman/listinfo/devel</a>
</pre>
    </blockquote>
  </body>
</html>