Skip to content

Instantly share code, notes, and snippets.

@mdavey
Last active December 9, 2020 20:20
Show Gist options
  • Save mdavey/fe11f42fd0ac9d5265f8 to your computer and use it in GitHub Desktop.
Save mdavey/fe11f42fd0ac9d5265f8 to your computer and use it in GitHub Desktop.
Simple hangup detection (Asterisk)
; Detect which party hungup an Asterisk call
; If we (the caller) hangup after Dial() we jump directly to h
; Because of the 'g' option if the other party hangs up we continue on
exten => s,1,Set(whoHungUp=CALLER)
exten => s,n,Dial(IAX2/provider/${number},,g)
exten => s,n,Set(whoHungUp=OTHERPARTY)
exten => s,n,Hangup
exten => h,1,NoOp(whoHungUp ${whoHungUp})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment