Which channel caused the hang-up?

Hi everyone,

I was wandering if there is any way to determine which channel terminated an ongoing call - my efforts to do so failed so far.

My setup is simple - an Asterisk 11 instance between two trunks: – BRI – (*) – SIP –
So any call ongoing will have two bridged channels, in this case one SIP and one ISDN/BRI.

I tried using the manager events to find out - there are two particularly interesting events there: HangupRequest and SoftHangupRequest that (as far as I understand) are supposed to tell you exactly that a hangup request was received on a particular channel. Thing is that SIP raises a HangupEvent but DAHDI does not - please see the event logs int the following posts:

One other related problem that I have is how to detect when the call was terminated because of a set time limit was reached (e.g. L flag in the Dial application). As far as I can see, the hangup cause in this case is 16 - normal clearing, which is somewhat correct.

Any ideas would be greatly appreciated.

Thank you,
Andrei

CALL TERMINATION SEQUENCE WHEN INITIATED BY CALLER (SIP: 1415083836.4):

EVENT: HangupRequest:
[Event] = [HangupRequest]
[Privilege] = [call,all]
[Channel] = [SIP/pbx-00000002]
[Uniqueid] = [1415083836.4]

EVENT: Bridge:
[Event] = [Bridge]
[Privilege] = [call,all]
[Bridgestate] = [Unlink]
[Bridgetype] = [core]
[Channel1] = [SIP/pbx-00000002]
[Channel2] = [DAHDI/i1/14004-3]
[Uniqueid1] = [1415083836.4]
[Uniqueid2] = [1415083836.5]
[CallerID1] = [pbx]
[CallerID2] = [14004]

EVENT: Hangup:
[Event] = [Hangup]
[Privilege] = [call,all]
[Channel] = [DAHDI/i1/14004-3]
[Uniqueid] = [1415083836.5]
[CallerIDNum] = [14004]
[CallerIDName] = []
[ConnectedLineNum] = [pbx]
[ConnectedLineName] = [263734]
[AccountCode] = []
[Cause] = [16]
[Cause-txt] = [Normal Clearing]

EVENT: Dial:
[Event] = [Dial]
[Privilege] = [call,all]
[SubEvent] = [End]
[Channel] = [SIP/pbx-00000002]
[UniqueID] = [1415083836.4]
[DialStatus] = [ANSWER]

EVENT: SoftHangupRequest:
[Event] = [SoftHangupRequest]
[Privilege] = [call,all]
[Channel] = [SIP/pbx-00000002]
[Uniqueid] = [1415083836.4]
[Cause] = [16]

EVENT: Hangup:
[Event] = [Hangup]
[Privilege] = [call,all]
[Channel] = [SIP/pbx-00000002]
[Uniqueid] = [1415083836.4]
[CallerIDNum] = [pbx]
[CallerIDName] = [263734]
[ConnectedLineNum] = [14004]
[ConnectedLineName] = []
[AccountCode] = []
[Cause] = [16]

CALL TERMINATION SEQUENCE WHEN INITIATED BY CALLEE (SIP: 1415083763.3):

EVENT: Bridge:
[Event] = [Bridge]
[Privilege] = [call,all]
[Bridgestate] = [Unlink]
[Bridgetype] = [core]
[Channel1] = [SIP/pbx-00000001]
[Channel2] = [DAHDI/i1/14004-2]
[Uniqueid1] = [1415083763.2]
[Uniqueid2] = [1415083763.3]
[CallerID1] = [pbx]
[CallerID2] = [14004]

EVENT: Hangup:
[Event] = [Hangup]
[Privilege] = [call,all]
[Channel] = [DAHDI/i1/14004-2]
[Uniqueid] = [1415083763.3]
[CallerIDNum] = [14004]
[CallerIDName] = []
[ConnectedLineNum] = [pbx]
[ConnectedLineName] = [263734]
[AccountCode] = []
[Cause] = [16]
[Cause-txt] = [Normal Clearing]

EVENT: Dial:
[Event] = [Dial]
[Privilege] = [call,all]
[SubEvent] = [End]
[Channel] = [SIP/pbx-00000001]
[UniqueID] = [1415083763.2]
[DialStatus] = [ANSWER]

EVENT: SoftHangupRequest:
[Event] = [SoftHangupRequest]
[Privilege] = [call,all]
[Channel] = [SIP/pbx-00000001]
[Uniqueid] = [1415083763.2]
[Cause] = [16]

EVENT: Hangup:
[Event] = [Hangup]
[Privilege] = [call,all]
[Channel] = [SIP/pbx-00000001]
[Uniqueid] = [1415083763.2]
[CallerIDNum] = [pbx]
[CallerIDName] = [263734]
[ConnectedLineNum] = [14004]
[ConnectedLineName] = []
[AccountCode] = []
[Cause] = [16]
[Cause-txt] = [Normal Clearing]

CALL TERMINATION SEQUENCE WHEN INITIATED BY TIME LIMIT:

EVENT: Bridge:
[Event] = [Bridge]
[Privilege] = [call,all]
[Bridgestate] = [Unlink]
[Bridgetype] = [core]
[Channel1] = [SIP/pbx-00000000]
[Channel2] = [DAHDI/i1/14004-1]
[Uniqueid1] = [1415083684.0]
[Uniqueid2] = [1415083684.1]
[CallerID1] = [pbx]
[CallerID2] = [14004]

EVENT: Hangup:
[Event] = [Hangup]
[Privilege] = [call,all]
[Channel] = [DAHDI/i1/14004-1]
[Uniqueid] = [1415083684.1]
[CallerIDNum] = [14004]
[CallerIDName] = []
[ConnectedLineNum] = [pbx]
[ConnectedLineName] = [263734]
[AccountCode] = []
[Cause] = [16]
[Cause-txt] = [Normal Clearing]

EVENT: Dial:
[Event] = [Dial]
[Privilege] = [call,all]
[SubEvent] = [End]
[Channel] = [SIP/pbx-00000000]
[UniqueID] = [1415083684.0]
[DialStatus] = [ANSWER]

EVENT: SoftHangupRequest:
[Event] = [SoftHangupRequest]
[Privilege] = [call,all]
[Channel] = [SIP/pbx-00000000]
[Uniqueid] = [1415083684.0]
[Cause] = [16]

EVENT: Hangup:
[Event] = [Hangup]
[Privilege] = [call,all]
[Channel] = [SIP/pbx-00000000]
[Uniqueid] = [1415083684.0]
[CallerIDNum] = [pbx]
[CallerIDName] = [263734]
[ConnectedLineNum] = [14004]
[ConnectedLineName] = []
[AccountCode] = []
[Cause] = [16]
[Cause-txt] = [Normal Clearing]