[OpenSIPS-Devel] 回复: Devel Digest, Vol 46, Issue 37

Razvan Crainea razvan at opensips.org
Mon Apr 23 09:48:04 CEST 2012


Hello!

You should have mentioned that you can access only the first line. You 
can find the explanation in the documentation[1]:
"Executes an external command. Each line from output of the command is 
saved in an AVP from 'avplist'."

[1] http://www.opensips.org/html/docs/modules/1.8.x/exec.html#id250135

Regards,

--
Răzvan Crainea
OpenSIPS Developer
http://www.opensips-solutions.com


On 04/23/2012 04:55 AM, GTS2010 wrote:
> Hi:
> I think I know the problem , In my script :
> #!/usr/bin/python
> import sys
> print "this is a test script!\n"
> print sys.argv[1]
> I can not get the $si. When I change it to :
> #!/usr/bin/python
> import sys
> print sys.argv[1]
> Then I can get the $si. Now I want to know why ? In the srcrpt only 
> allow one print ?
> Hoping for your help!
> Thanks & Regards
> Li peng beijing China
> 2012-04-23
> ------------------------------------------------------------------------
> GTS2010
> ------------------------------------------------------------------------
> *发件人:*devel-request
> *发送时间:*2012-04-20 18:00
> *主题:*Devel Digest, Vol 46, Issue 37
> *收件人:*"devel"<devel at lists.opensips.org>
> *抄送:*
> Send Devel mailing list submissions to
>     devel at lists.opensips.org
> To subscribe or unsubscribe via the World Wide Web, visit
>     http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
> or, via email, send a message with subject or body 'help' to
>     devel-request at lists.opensips.org
> You can reach the person managing the list at
>     devel-owner at lists.opensips.org
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Devel digest..."
> Today's Topics:
>    1. Re: gts2010`s question (Razvan Crainea)
>    2. SF.net SVN: opensips:[8947]    trunk/modules/b2b_logic/logic.c
>       (Bogdan-Andrei Iancu)
>    3. SF.net SVN: opensips:[8948]
>       branches/1.8/modules/b2b_logic/logic.c (Bogdan-Andrei Iancu)
> ----------------------------------------------------------------------
> Message: 1
> Date: Fri, 20 Apr 2012 11:43:51 +0300
> From: Razvan Crainea <razvan at opensips.org>
> Subject: Re: [OpenSIPS-Devel] gts2010`s question
> To: devel at lists.opensips.org
> Message-ID: <4F9121C7.3040602 at opensips.org>
> Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
> 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.html> 
>
> ------------------------------
> Message: 2
> Date: Fri, 20 Apr 2012 09:24:07 +0000
> From: Bogdan-Andrei Iancu <bogdan at opensips.org>
> Subject: [OpenSIPS-Devel] SF.net SVN: opensips:[8947]
>     trunk/modules/b2b_logic/logic.c
> To: devel at lists.opensips.org
> Message-ID: <E1SLA4V-0001vz-6l at sfp-svn-1.v30.ch3.sourceforge.com>
> Content-Type: text/plain; charset=UTF-8
> Revision: 8947
>           http://opensips.svn.sourceforge.net/opensips/?rev=8947&view=rev
> Author:   bogdan_iancu
> Date:     2012-04-20 09:24:06 +0000 (Fri, 20 Apr 2012)
> Log Message:
> -----------
> - 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. 
>
> Modified Paths:
> --------------
>     trunk/modules/b2b_logic/logic.c
> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. 
>
> ------------------------------
> Message: 3
> Date: Fri, 20 Apr 2012 09:25:41 +0000
> From: Bogdan-Andrei Iancu <bogdan at opensips.org>
> Subject: [OpenSIPS-Devel] SF.net SVN: opensips:[8948]
>     branches/1.8/modules/b2b_logic/logic.c
> To: devel at lists.opensips.org
> Message-ID: <E1SLA61-0001yJ-IA at sfp-svn-1.v30.ch3.sourceforge.com>
> Content-Type: text/plain; charset=UTF-8
> Revision: 8948
>           http://opensips.svn.sourceforge.net/opensips/?rev=8948&view=rev
> Author:   bogdan_iancu
> Date:     2012-04-20 09:25:41 +0000 (Fri, 20 Apr 2012)
> Log Message:
> -----------
> backport from trunk (rev #8947)
> - 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. 
>
> Revision Links:
> --------------
>     http://opensips.svn.sourceforge.net/opensips/?rev=8947&view=rev
> Modified Paths:
> --------------
>     branches/1.8/modules/b2b_logic/logic.c
> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. 
>
> ------------------------------
> _______________________________________________
> Devel mailing list
> Devel at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
> End of Devel Digest, Vol 46, Issue 37
> *************************************
>
>
> _______________________________________________
> 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/20120423/cba13653/attachment.htm>


More information about the Devel mailing list