Which (caller or callee) side hanged up the call?

My question is pretty simple, but I have no idea where to start.
How can I know which side (caller or callee) hanged up the call?

I searched in this forum and didn’t fine question related to it.

Thanks in advanced if anyone show me the way.

Search harder. It has been asked several times.

Originally I think you needed to use Dialplan options to ensure that both channels continued after Dial. I believe there is now a way using the enhanced call detail logging mechanisms, but I use an older version, so don’t have a lot of experience of these.

Use g on the Dial command
> Proceeds in the context when the target channel has been hung up.

The simplest way

[whohangup]
exten=>_XXX,1,Dial(SIp/${EXTEN},10,g)
same=>n,Set(CDR(userfield)=callee)
same=>n,Hangup()

If callee hangup the CDR’s userfiled will be set to calle

Thank you both.

I came up with this partial solution:

exten => X.,1,Answer()
same => n,Dial(SIP/${EXTEN},g)
same => n,Set(releasedir=term)
same => n,Hangup()

exten => h,1,Set(CHANNEL(userfield)=CAUSE_CODE=${HANGUPCAUSE}, DIAL_STATUS=${DIALSTATUS}, RELEASE_DIRECTION=${releasedir})

I haven’t tried in a real environment yet.

Posting here as maybe will help someone else too.

Thanks again.

The hangup cause[1] functionality allows you to query for the available hangup information for the channels involved.

[1] https://wiki.asterisk.org/wiki/display/AST/Hangup+Cause

2 Likes

How “Hangup Cause” can help to determine which side (caller or callee) hung up first?

In my test it returns the same info regardless who hung up.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.