Thread: [Asterisk-java-users] How to handle this exception?
Brought to you by:
srt
From: preetha A. <pre...@gm...> - 2008-05-21 08:58:32
|
Hi, In Agiscript,I am using for loop to play a streamfile until the call is picked up by the extension.But when remote party hangs up the call,I am getting the following error continuously.Is there anyway asterisk java can handle that exception and end the agiscript. Error: org.asteriskjava.fastagi.AgiNetworkException: Unable to send command to Asterisk: Broken pipe at org.asteriskjava.fastagi.internal.AgiWriterImpl.sendCommand(AgiWriterImpl.java:51) at org.asteriskjava.fastagi.internal.AgiChannelImpl.sendCommand(AgiChannelImpl.java:99) at org.asteriskjava.fastagi.internal.AgiChannelImpl.streamFile(AgiChannelImpl.java:233) at org.asteriskjava.fastagi.AgiOperations.streamFile(AgiOperations.java:296) at CallerId.service(CallerId.java:81) at org.asteriskjava.fastagi.internal.AgiConnectionHandler.runScript(AgiConnectionHandler.java:151) at org.asteriskjava.fastagi.internal.AgiConnectionHandler.run(AgiConnectionHandler.java:116) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) at java.lang.Thread.run(Thread.java:619) Caused by: java.net.SocketException: Broken pipe at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92) at java.net.SocketOutputStream.write(SocketOutputStream.java:136) at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202) at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:272) at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:276) at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:122) at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:212) at java.io.BufferedWriter.flush(BufferedWriter.java:236) at org.asteriskjava.util.internal.SocketConnectionFacadeImpl.flush(SocketConnectionFacadeImpl.java:101) at org.asteriskjava.fastagi.internal.AgiWriterImpl.sendCommand(AgiWriterImpl.java:47) -- Preetha.A |
From: Stefan R. <ste...@re...> - 2008-05-21 09:06:22
Attachments:
signature.asc
|
preetha Ayyappan wrote: > In Agiscript,I am using for loop to play a streamfile until the call is > picked up by the extension.But when remote party hangs up the call,I am > getting the following error continuously.Is there anyway asterisk java > can handle that exception and end the agiscript. No, this is the responsibility of your code, you should wrap the calls to streamfile with a try/catch and handle the exception, if you don't it will show up in the logs. =Stefan -- reuter network consulting Neusser Str. 110 50760 Koeln Germany Telefon: +49 221 1305699-0 Telefax: +49 221 1305699-90 E-Mail: ste...@re... Jabber: ste...@re... WWW: http://www.reucon.com Steuernummern 215/5140/1791 USt-IdNr. DE220701760 |
From: Thameem A. <tha...@ya...> - 2008-07-01 18:11:19
|
Actually if you are using asterisk 1.4 and using "AGI" to call your agi server script then if a remote party hangsup this exception will occur. The reason is, in asterisk 1.4 they changed the behaviour of not continuing the script even though the remote channel hungup. This is the default behaviour till asterisk 1.2.14 (i believe). If you use DEADAGI to call your agi script even remote party hangsup your script will continue and you will have all the parameters from agi channel. But using DeadAgi on a live channel is not recommended warning will popup in asterisk CLI but you can ignore it. Don't be happy... the DeadAgi will be deprecated and removed in 1.6 so we will have to find alternate way to fix this issue. Most people will calculate the cdr after dial status is returned and if they use 1.4 and the remote party hangsup please be aware that your cdr records will not be there as asterisk removes everything associated to that channel and terminate the script. This is a big change in asterisk 1.4 onwards and everyone should be aware of this. The alternate way is to write a manager script which will only listen for cdr events and update the cdr once the call is completed. You can set cdr custom parameters from agi script and calculate the cost etc in the cdr listener. This way, you don't need to worry about asterisk behaviour. Thanks, Thameem --- On Wed, 5/21/08, Stefan Reuter <ste...@re...> wrote: From: Stefan Reuter <ste...@re...> Subject: Re: [Asterisk-java-users] How to handle this exception? To: ast...@li... Date: Wednesday, May 21, 2008, 2:06 AM preetha Ayyappan wrote: > In Agiscript,I am using for loop to play a streamfile until the call is > picked up by the extension.But when remote party hangs up the call,I am > getting the following error continuously.Is there anyway asterisk java > can handle that exception and end the agiscript. No, this is the responsibility of your code, you should wrap the calls to streamfile with a try/catch and handle the exception, if you don't it will show up in the logs. =Stefan -- reuter network consulting Neusser Str. 110 50760 Koeln Germany Telefon: +49 221 1305699-0 Telefax: +49 221 1305699-90 E-Mail: ste...@re... Jabber: ste...@re... WWW: http://www.reucon.com Steuernummern 215/5140/1791 USt-IdNr. DE220701760------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/_______________________________________________ Asterisk-java-users mailing list Ast...@li... https://lists.sourceforge.net/lists/listinfo/asterisk-java-users |