Summary:ASTERISK-22060: Assertion triggered in CDR code when called channel is redirected using AMI
Reporter:Mark Michelson (mmichelson)Labels:
Date Opened:2013-07-09 15:34:57Date Closed:2013-07-13 18:35:01
Versions:12 Frequency of
Environment:Attachments:( 0) cdr.txt
Description:I can reliably trigger an assertion in CDR code by performing an AMI redirect of a called party.

My scenario is as follows:

# Alice places a call to Bob
# Bob answers the call from Alice
# An AMI Redirect action is issued to redirect Bob to 6000@defuault, priority 1.
# The redirection causes Carol's phone to ring.
# When Carol answers the call, the assertion is triggered.

I am including CDR debug of the issue as an attachment.
Comments:By: Matt Jordan (mjordan) 2013-07-13 15:30:59.031-0500

There's two problems here:

# The way I'm doing dial handling in CDRs is over-complicated and prone to failure. If A dials B, A should always be Party A and B should always Party B. Right now, if some channel flags stick around or otherwise not what we expect, the ordering of A/B in the CDR can swap between Dial Begin and Dial End - which results in the FRACK.
# Somehow, when a channel leaves a bridge due to an externally initiated transfer (which an AMI Redirect counts as - but I've also reproduced this with a SIP Blind Transfer), the channel's flags are set such that {{ast_check_hangup}} thinks the channel is hung up. This prevents the "am I an outbound channel who was dialed" flag from being removed from the channel - so we still think it's an outbound channel even when it now has a PBX thread and is executing dialplan.