<div dir="ltr"><div class="gmail_quote">On Mon, Jun 6, 2011 at 10:39 AM, Tony Mountifield <span dir="ltr"><<a href="mailto:tony@mountifield.org">tony@mountifield.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
In article <<a href="mailto:BANLkTikPxC_JK5xVHYX9aKakLtVL0v6e7g@mail.gmail.com">BANLkTikPxC_JK5xVHYX9aKakLtVL0v6e7g@mail.gmail.com</a>>,<br>
<div class="im">A E [Gmail] <<a href="mailto:all.eforums@gmail.com">all.eforums@gmail.com</a>> wrote:<br>
</div><div><div></div><div class="h5">> Hello,<br>
> using 1.8.4. using a very simple local AGI script in bash which has only one<br>
> line in it:<br>
><br>
> echo -e 'STREAM FILE welcome 123 \n'<br>
><br>
> dialplan:<br>
> exten => 5150,1,Answer()<br>
> same => n,Set(CHANNEL(language)=en_AU)<br>
> same => n,AGI(testagi.sh)<br>
> same => n,Hangup<br>
><br>
> console output:<br>
> -- Executing [5150@AllPhones:1] Answer("SIP/PBX-00000024", "") in new<br>
> stack<br>
> -- Executing [5150@AllPhones:2] Set("SIP/PBX-00000024",<br>
> "CHANNEL(language)=en_AU") in new stack<br>
> -- Executing [5150@AllPhones:3] AGI("SIP/PBX-00000024", "testagi.sh") in<br>
> new stack<br>
> -- Launched AGI Script /var/lib/asterisk/agi-bin/testagi.sh<br>
> -- Playing 'welcome' (escape_digits=1) (sample_offset 0)<br>
> -- <SIP/PBX-00000024>AGI Script testagi.sh completed, returning 0<br>
> -- Executing [5150@AllPhones:4] Hangup("SIP/PBX-00000024", "") in new<br>
> stack<br>
> == Spawn extension (AllPhones, 5150, 4) exited non-zero on<br>
> 'SIP/PBX-00000024'<br>
><br>
> But nothing happens...as in even when it says that it's playing the file (as<br>
> verified in the asterisk 'full' log), I hear nothing on the phone<br>
><br>
> What gives? spent 2 hrs Googling but nothing! :(<br>
<br>
</div></div>Firstly, you need to check that you can successfully play files<br>
outside of the AGI environment. Replace the AGI command with:<br>
<br>
same => n,Playback(welcome)<br>
<br></blockquote><div><font class="Apple-style-span" face="'trebuchet ms', sans-serif" color="#000099">Yes, had done that as first order of business before even trying AGI</font></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
If that doesn't work, the problem is nothing to do with AGI.<br>
<br>
However, I think what else is happening is that your AGI script is<br>
sending the STREAM FILE command and then immediately exiting. This goes<br>
back to the dialplan and executes a hangup when only a tiny fraction of<br>
the welcome file has been played. You could test this theory in two<br>
different ways, as I'm not sure whether it's the exiting of the AGI or<br>
the subsequent hangup that is aborting the playback.<br></blockquote><div><br></div><div><font class="Apple-style-span" face="'trebuchet ms', sans-serif" color="#000099">I thought so too, didn't know what to do about it</font> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
a) Put a "sleep 5" in your agitest.sh after the echo. As others have<br>
said, you should really use a proper library that reads responses to<br>
AGI commands, but for testing, a sleep will keep the AGI script alive<br>
while the message plays.<br>
<br></blockquote><div><font class="Apple-style-span" color="#000099" face="'trebuchet ms', sans-serif">This works!</font></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
b) Put a "same => n,Wait(5)" after the AGI command. If the AGI leaves<br>
the message playing, this would give it some time to play before you<br>
hang up the line.<br>
<br></blockquote><div><font class="Apple-style-span" face="'trebuchet ms', sans-serif" color="#000099">This doesn't work</font></div><div><font class="Apple-style-span" face="'trebuchet ms', sans-serif" color="#000099"><br>
</font></div><div><font class="Apple-style-span" face="'trebuchet ms', sans-serif" color="#000099">Thanks for the help. I just need some sort of a wait loop there (as I don't really know how to pick up the "200 result=0") till the prompt finishes. </font></div>
</div></div>