Closed chewi closed 11 years ago
So, what is happening here is that #dial
is attempting to hang up the call, and Punchblock is executing this request as an AMI Hangup action. In the time between sending the action and it being executed, Asterisk is firing a hangup event because the originate failed. The Hangup action is then failing, and we're passing on the error, instead of swallowing as we should. This is a regression, because we used to ignore AMI errors. We don't any more, but we don't necessarily handle cases like this correctly.
This is being triggered by the overlapping timeouts. We instruct Asterisk to timeout the originate after 10s, triggering the Hangup event, but we also keep our own timeout of 10s which is triggering the Hangup command. This is for safety, since we don't want to be at the mercy of Asterisk failing to hangup in time.
Fix coming shortly.
Time for another episode of Chewi vs the Race Conditions! This one occurs when a dial command times out. Sometimes a :timeout result is returned (correct) and sometimes a Punchblock::ProtocolError exception is raised (bad!). It seems about 50/50. Feel free to use the SIP destination in this example. My server actually listens on a non-standard port.
This log shows the first attempt timing out correctly and the second attempt raising an exception, thus ending the call.