Hello, using 1.8.4. using a very simple local AGI script in bash which has only one line in it: echo -e 'STREAM FILE welcome 123 \n' dialplan: exten => 5150,1,Answer() same => n,Set(CHANNEL(language)=en_AU) same => n,AGI(testagi.sh) same => n,Hangup console output: -- Executing [5150 at AllPhones:1] Answer("SIP/PBX-00000024", "") in new stack -- Executing [5150 at AllPhones:2] Set("SIP/PBX-00000024", "CHANNEL(language)=en_AU") in new stack -- Executing [5150 at AllPhones:3] AGI("SIP/PBX-00000024", "testagi.sh") in new stack -- Launched AGI Script /var/lib/asterisk/agi-bin/testagi.sh -- Playing 'welcome' (escape_digits=1) (sample_offset 0) -- <SIP/PBX-00000024>AGI Script testagi.sh completed, returning 0 -- Executing [5150 at AllPhones:4] Hangup("SIP/PBX-00000024", "") in new stack == Spawn extension (AllPhones, 5150, 4) exited non-zero on 'SIP/PBX-00000024' But nothing happens...as in even when it says that it's playing the file (as verified in the asterisk 'full' log), I hear nothing on the phone What gives? spent 2 hrs Googling but nothing! :( Thx \A -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20110606/3c624a1a/attachment.htm>
On Mon, Jun 6, 2011 at 9:42 AM, A E [Gmail] <all.eforums at gmail.com> wrote:> Hello, > using 1.8.4. using a very simple local AGI script in bash which has only > one line in it: > > echo -e 'STREAM FILE welcome 123 \n' > > dialplan: > exten => 5150,1,Answer() > same => n,Set(CHANNEL(language)=en_AU) > same => n,AGI(testagi.sh) >same => n,Hangup>Try this below dilaplan> exten => 5150,1,Answer() > same => n,Set(CHANNEL(language)=en_AU) > same => n,AGI(testagi) > same => n,Hangup >> console output: > -- Executing [5150 at AllPhones:1] Answer("SIP/PBX-00000024", "") in new > stack > -- Executing [5150 at AllPhones:2] Set("SIP/PBX-00000024", > "CHANNEL(language)=en_AU") in new stack > -- Executing [5150 at AllPhones:3] AGI("SIP/PBX-00000024", "testagi.sh") > in new stack > -- Launched AGI Script /var/lib/asterisk/agi-bin/testagi.sh > -- Playing 'welcome' (escape_digits=1) (sample_offset 0) > -- <SIP/PBX-00000024>AGI Script testagi.sh completed, returning 0 > -- Executing [5150 at AllPhones:4] Hangup("SIP/PBX-00000024", "") in new > stack > == Spawn extension (AllPhones, 5150, 4) exited non-zero on > 'SIP/PBX-00000024' > > But nothing happens...as in even when it says that it's playing the file > (as verified in the asterisk 'full' log), I hear nothing on the phone > > What gives? spent 2 hrs Googling but nothing! :( > > Thx > \A > > > -- > _____________________________________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > New to Asterisk? Join us for a live introductory webinar every Thurs: > http://www.asterisk.org/hello > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >-- Best Regards, Mahesh Katta *BUZZ**WORKS* Business Services Private Limited BANGALORE | CHENNAI | HYDERABAD | MUMBAI| DELHI 201, Crystal Tower, 75 Gundavali Cross Lane, Andheri Kurla Road, Andheri (E) Mumbai 400069 GSM +91.97029.70779 | Phone +91.22.4229.2634 | Fax +91.22.4229.2634 Web http://www.buzzworks.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20110606/43647272/attachment.htm>
On Mon, 6 Jun 2011, A E [Gmail] wrote:> Hello,using 1.8.4. using a very simple local AGI script in bash which > has only one line in it: > > echo -e 'STREAM FILE welcome 123 \n' > > What gives? spent 2 hrs Googling but nothing! :(Maybe 1.5 hrs should have been spent reading :) One line does not an AGI make. AGI is an interface. It consists of reading the AGI environment from STDIN and then, writing requests on STDOUT and reading the response from STDIN. If you don't follow these 3 steps in order (steps 2 and 3 can be repeated) then your program has violated the protocol and will not function reliably if at all. Please use an existing AGI library for the language of your choice. Nobody gets it right the first time. -- Thanks in advance, ------------------------------------------------------------------------- Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000
On Mon, Jun 6, 2011 at 12:12 AM, A E [Gmail] <all.eforums at gmail.com> wrote:> Hello, > using 1.8.4. using a very simple local AGI script in bash which has only > one line in it: > > echo -e 'STREAM FILE welcome 123 \n' > > dialplan: > exten => 5150,1,Answer() > same => n,Set(CHANNEL(language)=en_AU) > same => n,AGI(testagi.sh) > same => n,Hangup > > console output: > -- Executing [5150 at AllPhones:1] Answer("SIP/PBX-00000024", "") in new > stack > -- Executing [5150 at AllPhones:2] Set("SIP/PBX-00000024", > "CHANNEL(language)=en_AU") in new stack > -- Executing [5150 at AllPhones:3] AGI("SIP/PBX-00000024", "testagi.sh") > in new stack > -- Launched AGI Script /var/lib/asterisk/agi-bin/testagi.sh > -- Playing 'welcome' (escape_digits=1) (sample_offset 0) > -- <SIP/PBX-00000024>AGI Script testagi.sh completed, returning 0 > -- Executing [5150 at AllPhones:4] Hangup("SIP/PBX-00000024", "") in new > stack > == Spawn extension (AllPhones, 5150, 4) exited non-zero on > 'SIP/PBX-00000024' > > But nothing happens...as in even when it says that it's playing the file > (as verified in the asterisk 'full' log), I hear nothing on the phone > > What gives? spent 2 hrs Googling but nothing! :( > > Thx > \A > > Bizarre, I found a bunch of other agi scripts in the defaultdirectory...modified the agi-test.agi (perl script) so it played my file, no joy! then I used a php script I found somewhere else asa tutorial to writing AGI scripts in php, modified that to play my script and it works. I don't get it. esp. when everything (with agi debug set on) looks exactly the same with my bash script and this php script except that with the php script, I see this ONE line that's extra <SIP/PBX-0000002b>AGI Rx << STREAM FILE welcome # -- Playing 'welcome' (escape_digits=#) (sample_offset 0) <SIP/PBX-0000002b>AGI Tx >> 200 result=35 endpos=87200 that I don't see with my bash script which does this <SIP/PBX-0000002e>AGI Rx << STREAM FILE welcome # -- Playing 'welcome' (escape_digits=#) (sample_offset 0) -- <SIP/PBX-0000002e>AGI Script streamcontact.sh completed, returning 0 -- Executing [5150 at AllPhones:5] Hangup("SIP/PBX-0000002e", "") in new stack So confused!! -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20110606/a17105b1/attachment-0001.htm>
In article <BANLkTikPxC_JK5xVHYX9aKakLtVL0v6e7g at mail.gmail.com>, A E [Gmail] <all.eforums at gmail.com> wrote:> Hello, > using 1.8.4. using a very simple local AGI script in bash which has only one > line in it: > > echo -e 'STREAM FILE welcome 123 \n' > > dialplan: > exten => 5150,1,Answer() > same => n,Set(CHANNEL(language)=en_AU) > same => n,AGI(testagi.sh) > same => n,Hangup > > console output: > -- Executing [5150 at AllPhones:1] Answer("SIP/PBX-00000024", "") in new > stack > -- Executing [5150 at AllPhones:2] Set("SIP/PBX-00000024", > "CHANNEL(language)=en_AU") in new stack > -- Executing [5150 at AllPhones:3] AGI("SIP/PBX-00000024", "testagi.sh") in > new stack > -- Launched AGI Script /var/lib/asterisk/agi-bin/testagi.sh > -- Playing 'welcome' (escape_digits=1) (sample_offset 0) > -- <SIP/PBX-00000024>AGI Script testagi.sh completed, returning 0 > -- Executing [5150 at AllPhones:4] Hangup("SIP/PBX-00000024", "") in new > stack > == Spawn extension (AllPhones, 5150, 4) exited non-zero on > 'SIP/PBX-00000024' > > But nothing happens...as in even when it says that it's playing the file (as > verified in the asterisk 'full' log), I hear nothing on the phone > > What gives? spent 2 hrs Googling but nothing! :(Firstly, you need to check that you can successfully play files outside of the AGI environment. Replace the AGI command with: same => n,Playback(welcome) If that doesn't work, the problem is nothing to do with AGI. However, I think what else is happening is that your AGI script is sending the STREAM FILE command and then immediately exiting. This goes back to the dialplan and executes a hangup when only a tiny fraction of the welcome file has been played. You could test this theory in two different ways, as I'm not sure whether it's the exiting of the AGI or the subsequent hangup that is aborting the playback. a) Put a "sleep 5" in your agitest.sh after the echo. As others have said, you should really use a proper library that reads responses to AGI commands, but for testing, a sleep will keep the AGI script alive while the message plays. b) Put a "same => n,Wait(5)" after the AGI command. If the AGI leaves the message playing, this would give it some time to play before you hang up the line. Hope this helps! Tony -- Tony Mountifield Work: tony at softins.co.uk - http://www.softins.co.uk Play: tony at mountifield.org - http://tony.mountifield.org