Wednesday, November 23, 2016

Quick'n'dirty answer on Asterisk "Who hung up"?

Really fast and dirty solution for answer "Who put handset first?" on Asterisk. Idea based on "g" option in Dial, that works in a case if callee hangs up and not, if caller.

exten => _X.,1,Dial(SIP/Trunk/${EXTEN},,g)
 same => n,Set(HANGUP_CALLEE=True)

exten => h,1,GoToIf($["x${HANGUP_CALLEE}"="xTrue"]?hangup-callee)
 same => n,Set(CDR(userfield)=HANGUP_CALLER)
 same => n,GoTo(end)
 same => n(hangup-callee),Set(CDR(userfield)=HANGUP_CALLEE)
 same => n(end),NoOp

And in CDR in userfield we will get who hung up first, caller or callee.

1 comment:

  1. You just made my Day with this Solution ..
    Thank You!

    ReplyDelete