Problem with broken pipe in AGI when caller cancels the call
-
dilshodm
Hi,
I think the problem is solved.
I found out that this error never more happens when I use DeadAGI instead of AGI.
Previous extensions.conf, where it was error:
[ahntest]
exten =>_X.,1,AGI(agi://127.0.0.1)
The new extensions.conf, where there is no more such error:
[ahntest]
exten =>_X.,1,Answer
exten =>_X.,n,DeadAGI(agi://127.0.0.1)
exten =>_X.,n,Hangup
-
Jay Phillips
- State changed from new to open
When the channel for which an AGI request was made hangs up, the socket closes and it's up to the AGI process to "clean up" as best it can. The clean up process shouldn't simply stop the thread dead (e.g. kill() or other_thread.raise) because there may be resources that need to be freed, etc. This is where timeout.rb in the Ruby standard library fails -- it aggressively tries to screw with other threads.
Instead, it's a safe assumption I think to only raise the exception when trying to read/write to the socket. This happens with the "Broken pipe error".
This is a known issue and is actually one of the ways Adhearsion's threads safely degrade. I know it's a little noisy with the backtrace but exceptions are safe as long as they're accounted for. Honestly, I've never had this become an issue personally (especially with smart use of begin/ensure closures).
Maybe Adhearsion's AGI server could catch this and report something a little more friendly, though there are other exceptions that get raised when the socket is down such as "no method blah on NilClass"...
-
dilshodm
Actually, the problem is not the exception itself. It was arised when I need to retrieve some information from Asterisk by AGI, however the connection was closed.
This is natural.
The solution to this - is to use DeadAGI instead of AGI.
Then after hangup we still can retrieve it's dialstatus, etc. and make database updates.
-
Jay Phillips
- Tag set to dialplan
- State changed from open to resolved
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.