Set custom Hangup Cause


#1

Hello, to all, I want to changed asterisk hangup caused, for all hangup I want to it will return 503 to the caller party, below is my dial-plan & sip debug log please check if I am correct, if not please guide me.

exten => h,1,Hangup(41)
exten => h,n,NoOp(Dial Status is {DIALSTATUS}) exten => h,n,NoOp(Hangup cause is {HANGUPCAUSE})

    -- Executing [2347062681248@simpro:417] NoOp("SIP/Georgia-Carrier-00001128", "--Condition Hangup 503 Error Code--") in new stack
    -- Executing [2347062681248@simpro:418] Hangup("SIP/Georgia-Carrier-00001128", "41") in new stack
  == Spawn extension (simpro, 2347062681248, 418) exited non-zero on 'SIP/Georgia-Carrier-00001128'
    -- Executing [h@simpro:1] NoOp("SIP/Georgia-Carrier-00001128", "Dial Status is ") in new stack
    -- Executing [h@simpro:2] NoOp("SIP/Georgia-Carrier-00001128", "Hangup cause is 41") in new stack
Scheduling destruction of SIP dialog 'bfeafefhjnafpa2601327@185.106.240.xxx' in 6400 ms (Method: INVITE)

<--- Reliably Transmitting (no NAT) to 185.106.240.xxx:5060 --->
SIP/2.0 603 Declined
Via: SIP/2.0/UDP 185.106.240.xxx:5060;branch=z9hG4bK-J1059-daf4-bfjhcehe;received=185.106.240.xxx
From: "16502851001"<sip:16502851001@185.106.240.xxx:5060>;tag=265165689J62M
To: <sip:2347062681248@159.69.216.78:6030>;tag=as6b377320
Call-ID: bfeafefhjnafpa2601327@185.106.240.xxx
CSeq: 100447231 INVITE
Server: SimPro-v3
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0


<------------>

<--- SIP read from UDP:185.106.240.xxx:5060 --->
ACK sip:2347062681248@159.69.216.78:6030 SIP/2.0
Via: SIP/2.0/UDP 185.106.240.xxx:5060;branch=z9hG4bK-J1059-daf4-bfjhcehe
From: "16502851001"<sip:16502851001@185.106.240.xxx:5060>;tag=265165689J62M
To: <sip:2347062681248@159.69.216.78:6030>;tag=as6b377320
Call-Id: bfeafefhjnafpa2601327@185.106.240.xxx
CSeq: 100447231 ACK
Max-Forwards: 70
Content-Length: 0

<------------->

I want for any reason of hangup asterisk will return 503

41 503 NORMAL_TEMPORARY_FAILURE temporary failure [Q.850]

This cause indicates that the network is not functioning correctly and that the condition is not likely to last a long period of time; e.g. the user may wish to try another call attempt almost immediately.

https://freeswitch.org/confluence/display/FREESWITCH/Hangup+Cause+Code+Table

as you can see I am still getting SIP/2.0 603 Declined please help me


#2

Although the ISDN interworking isn’t really there for your intended purposes, but rather to give a reasonable approximation of the ISDN clearing cause, have you tried the other codes in https://tools.ietf.org/html/rfc3398 that translate to 503.

Failing that look for the switch that does the translation, in the source code. In earlier versions, it is in hanugp_cause2sip() in chan_sip.c, but that file has been restructure and split, since.