Hi,<br>
<br>
I have developed a custom agi and connect to it by placing a call
through a sip phone. The agi issues the "STREAM FILE" command from a
number of places in code to play out prerecorded messages. The problem
is if the agi tries to play a file, using the STREAM FILE command,
after the caller has dropped the call, the agi crashes midway.<br>
<br>
After issuing a "agi debug" command on the console here is what I observed.<br>
1. Whenever a caller drops a call no interrupt is fired from asterisk
to the agi to notify a hangup event. This prevents me from taking
precautionary measures before issuing any command.<br>
<br>
2. Even after the caller has dropped the call, I still see an
active channel (verified using the "show channels" command). This
is probably due to the fact that the agi is still connected.<br>
<br>
3. When I send the STREAM FILE command from my agi this is what is shown on the asterisk console:<br>
<br>
AGI Rx << STREAM FILE file1 "#" 0<br>
Mar 6 23:50:22 WARNING[5978]: file.c:583 ast_readaudio_callback: Failed to write frame<br>
AGI Tx >> 200 result=-1 endpos=6400<br>
Spawn extension ........ exited non-zero on 'SIP/101-6600'<br>
<br>
As I understand, when asterisk receives the STREAM FILE command its has
no channel to play it to and hence the warning is issued. <br>
Asterisk does send a -1 result but straight away kills the agi process
( I deduce this from the last line) which causes the agi to crash.<br>
<br>
Now I am totally clueless on how to handle such erroneous conditions. Any help will be appreciated.<br>
<br>
Thanks,<br>
Danish<br>
<br>