Skip to content

Instantly share code, notes, and snippets.

@lgaetz
Last active August 7, 2024 19:51
Show Gist options
  • Save lgaetz/480582a1827cc98db1ee539c249f074b to your computer and use it in GitHub Desktop.
Save lgaetz/480582a1827cc98db1ee539c249f074b to your computer and use it in GitHub Desktop.
[send-sip-response-code]
; Context to send a specific SIP response code and terminate the channel
; Create Custom Destination in FreePBX with a dial string of the format
; send-sip-response-code,404,1
; substitute the appropriate response code in place of the 404
; Reference: https://wiki.asterisk.org/wiki/display/AST/Hangup+Cause+Mappings
;
; latest version: https://gist.github.com/lgaetz/480582a1827cc98db1ee539c249f074b
;
; License GPL/2
;
; History 2019-10-08 First attempt supports 404, 480 and 486
; 2023-04-14 added 501
exten => 404,1,NoOp(Entering user defined context send-sip-response-code in extensions_custom.conf)
exten => 404,n,NoOp(Sending SIP 404 Not Found)
exten => 404,n,hangup(1)
exten => 480,1,NoOp(Entering user defined context send-sip-response-code in extensions_custom.conf)
exten => 480,n,NoOp(Sending SIP 480 Temporarily Unavailable)
exten => 480,n,hangup(19)
exten => 486,1,NoOp(Entering user defined context send-sip-response-code in extensions_custom.conf)
exten => 486,n,NoOp(Sending SIP 486 Busy)
exten => 486,n,hangup(17)
exten => 501,1,NoOp(Entering user defined context send-sip-response-code in extensions_custom.conf)
exten => 501,n,NoOp(Sending SIP 501 Busy)
exten => 501,n,hangup(29)
; end context send-sip-response-code
@lgaetz
Copy link
Author

lgaetz commented Aug 7, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment