I am issuing an AGI call in extensions.conf as follows: exten => 2000,1,Answer exten => 2000,n,AGI(script.pl) exten => 2000,n,Hangup Asterisk perl is installed. "script.pl" is a valid perl script in /var/lib/asterisk/agi-bin Output is: -- Executing Answer("SIP/2034-e908", "") in new stack -- Executing AGI("SIP/2034-e908", "script.pl") in new stack -- Launched AGI Script /var/lib/asterisk/agi-bin/script.pl -- AGI Script script.pl completed, returning 0 -- Executing Hangup("SIP/2034-e908", "") in new stack == Spawn extension (intl-access, 2000, 3) exited non-zero on 'SIP/2034-e908' The problem is that the logic in the script is not executing. So, in extensions.conf, I replaced "script.pl" with "null.pl", as follows: exten => 2000,1,Answer exten => 2000,n,AGI(null.pl) exten => 2000,n,Hangup Note that "null.pl" does not actually exist in /var/lib/asterisk/agi-bin. Surprisingly, I get the exact same output: -- Executing Answer("SIP/2034-dfce", "") in new stack -- Executing AGI("SIP/2034-dfce", "null.pl") in new stack -- Launched AGI Script /var/lib/asterisk/agi-bin/null.pl -- AGI Script null.pl completed, returning 0 -- Executing Hangup("SIP/2034-dfce", "") in new stack == Spawn extension (intl-access, 2000, 3) exited non-zero on 'SIP/2034-dfce' How can this be? I've got to be missing something obvious here! Please help. Thanks, Adam The contents of this email message and any attachments are confidential and are intended solely for addressee. The information may also be legally privileged. This transmission is sent in trust, for the sole purpose of delivery to the intended recipient. If you have received this transmission in error, any use, reproduction or dissemination of this transmission is strictly prohibited. If you are not the intended recipient, please immediately notify the sender by reply email and delete this message and its attachments, if any. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20050405/40673cec/attachment.htm
On Tuesday 05 April 2005 3:24 pm, Adam Robins wrote:> I am issuing an AGI call in extensions.conf as follows: > > exten => 2000,1,Answer > exten => 2000,n,AGI(script.pl) > exten => 2000,n,Hangup > > Asterisk perl is installed. "script.pl" is a valid perl script in > /var/lib/asterisk/agi-bin > > Output is: > > -- Executing Answer("SIP/2034-e908", "") in new stack > -- Executing AGI("SIP/2034-e908", "script.pl") in new stack > -- Launched AGI Script /var/lib/asterisk/agi-bin/script.pl > -- AGI Script script.pl completed, returning 0 > -- Executing Hangup("SIP/2034-e908", "") in new stack > == Spawn extension (intl-access, 2000, 3) exited non-zero on > 'SIP/2034-e908' > > The problem is that the logic in the script is not executing. >Check the following: -The script is executable (chmod +x /var/lib/asterisk/agi-bin/script.pl) -The script has the right interpreter in the head. (#!/bin/perl or whatever `which perl` gives you - put this on the first line of script.pl) -If that doesnt work, run 'perl script.pl' from a shell on your asterisk box and check for syntax errors. (Make sure to have 'use strict;' in script.pl). -If no syntax errors, try stepping through it by issuing AGI result codes to the script if that what your script is expecting (e.g. "200 result=0" or whatever the rest of the codes are) and check for undefined subs or something. It helps to 'use strict;' in your AGI scripts so that the interpreter does variable name checking for you and it shows up when you run your script from the command line. -josiah -- Josiah Bryan IT Coordinator Productive Concepts, Inc. jbryan@productiveconcepts.com (765) 964-6009, ext. 224
Thanks! Use strict; unveiled a syntax error! -----Original Message----- From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Josiah Bryan Sent: Tuesday, April 05, 2005 3:38 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [Asterisk-Users] AGI call problem On Tuesday 05 April 2005 3:24 pm, Adam Robins wrote:> I am issuing an AGI call in extensions.conf as follows: > > exten => 2000,1,Answer > exten => 2000,n,AGI(script.pl) > exten => 2000,n,Hangup > > Asterisk perl is installed. "script.pl" is a valid perl script in > /var/lib/asterisk/agi-bin > > Output is: > > -- Executing Answer("SIP/2034-e908", "") in new stack > -- Executing AGI("SIP/2034-e908", "script.pl") in new stack > -- Launched AGI Script /var/lib/asterisk/agi-bin/script.pl > -- AGI Script script.pl completed, returning 0 > -- Executing Hangup("SIP/2034-e908", "") in new stack > == Spawn extension (intl-access, 2000, 3) exited non-zero on > 'SIP/2034-e908' > > The problem is that the logic in the script is not executing. >Check the following: -The script is executable (chmod +x /var/lib/asterisk/agi-bin/script.pl) -The script has the right interpreter in the head. (#!/bin/perl or whatever `which perl` gives you - put this on the first line of script.pl) -If that doesnt work, run 'perl script.pl' from a shell on your asterisk box and check for syntax errors. (Make sure to have 'use strict;' in script.pl). -If no syntax errors, try stepping through it by issuing AGI result codes to the script if that what your script is expecting (e.g. "200 result=0" or whatever the rest of the codes are) and check for undefined subs or something. It helps to 'use strict;' in your AGI scripts so that the interpreter does variable name checking for you and it shows up when you run your script from the command line. -josiah -- Josiah Bryan IT Coordinator Productive Concepts, Inc. jbryan@productiveconcepts.com (765) 964-6009, ext. 224 _______________________________________________ Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users The contents of this email message and any attachments are confidential and are intended solely for addressee. The information may also be legally privileged. This transmission is sent in trust, for the sole purpose of delivery to the intended recipient. If you have received this transmission in error, any use, reproduction or dissemination of this transmission is strictly prohibited. If you are not the intended recipient, please immediately notify the sender by reply email and delete this message and its attachments, if any.
check file permissions, if not turn off any (or as much) outputting to the console you can. On Apr 5, 2005 1:24 PM, Adam Robins <arobins@pharmacentra.com> wrote:> > I am issuing an AGI call in extensions.conf as follows: > > exten => 2000,1,Answer > exten => 2000,n,AGI(script.pl) > exten => 2000,n,Hangup > > Asterisk perl is installed. "script.pl" is a valid perl script in > /var/lib/asterisk/agi-bin > > Output is: > > -- Executing Answer("SIP/2034-e908", "") in new stack > -- Executing AGI("SIP/2034-e908", "script.pl") in new stack > -- Launched AGI Script > /var/lib/asterisk/agi-bin/script.pl > -- AGI Script script.pl completed, returning 0 > -- Executing Hangup("SIP/2034-e908", "") in new stack > == Spawn extension (intl-access, 2000, 3) exited non-zero on > 'SIP/2034-e908' > > The problem is that the logic in the script is not executing. > > > So, in extensions.conf, I replaced "script.pl" with "null.pl", as follows: > > > exten => 2000,1,Answer > exten => 2000,n,AGI(null.pl) > exten => 2000,n,Hangup > > Note that "null.pl" does not actually exist in /var/lib/asterisk/agi-bin. > > Surprisingly, I get the exact same output: > > -- Executing Answer("SIP/2034-dfce", "") in new stack > -- Executing AGI("SIP/2034-dfce", "null.pl") in new stack > -- Launched AGI Script > /var/lib/asterisk/agi-bin/null.pl > -- AGI Script null.pl completed, returning 0 > -- Executing Hangup("SIP/2034-dfce", "") in new stack > == Spawn extension (intl-access, 2000, 3) exited non-zero on > 'SIP/2034-dfce' > > How can this be? I've got to be missing something obvious here! > > Please help. > > Thanks, > Adam > > The contents of this email message and any attachments are confidential and > are intended solely for addressee. The information may also be legally > privileged. This transmission is sent in trust, for the sole purpose of > delivery to the intended recipient. If you have received this transmission > in error, any use, reproduction or dissemination of this transmission is > strictly prohibited. If you are not the intended recipient, please > immediately notify the sender by reply email and delete this message and its > attachments, if any. > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users > To UNSUBSCRIBE or update options visit: > > http://lists.digium.com/mailman/listinfo/asterisk-users > >