[asterisk-bugs] [Asterisk 0013501]: Cannot send more than one variable to a python script

Asterisk Bug Tracker noreply at bugs.digium.com
Wed Sep 17 08:51:39 CDT 2008


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=13501 
====================================================================== 
Reported By:                tjma2001
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   13501
Category:                   Applications/app_system
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
Asterisk Version:           1.4.17 
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             2008-09-17 07:09 CDT
Last Modified:              2008-09-17 08:51 CDT
====================================================================== 
Summary:                    Cannot send more than one variable to a python
script
Description: 
I run my python script using the following command

exten = s,3,System(/usr/share/asterisk/agi-bin/something.py 
"'${CDR(clid)) ${CDR(lastapp)}'")

and I get this error.

-- Executing [s at voicemenu-custom-1:3] System("SIP/6000-b6401e18",
"/usr/share/asterisk/agi-bin/smsgateway.py  " Answer"") in new stack
Traceback (most recent call last):
  File "/usr/share/asterisk/agi-bin/smsgateway.py", line 19, in ?
    lastapp = sys.argv[2]
IndexError: list index out of range

The script works fine on the command line if is use two input variables.
It also works in asterisk if i write it this way:

exten = s,3,System(/usr/share/asterisk/agi-bin/something.py 
"'${CDR(clid)}'" "'${CDR(lastapp)}'")

====================================================================== 

---------------------------------------------------------------------- 
 (0092617) Corydon76 (administrator) - 2008-09-17 08:51
 http://bugs.digium.com/view.php?id=13501#c92617 
---------------------------------------------------------------------- 
This is a python message, and I can tell immediately WHY.  The problem is
that the reporter quoted the argument, so both variables come into python
as a single argument.  Hence, there is no second argument to get. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2008-09-17 08:51 Corydon76      Note Added: 0092617                          
======================================================================




More information about the asterisk-bugs mailing list