${HANGUPCAUSE} of SIP Calls almost ever return 34

Hi,

I’m using Asterisk 1.8.12 under Debian Squeeze 6.0.6 to test a SIP Carrier to make mobile phone calls.
The tests are fine, but Asterisk return HANGUPCAUSE=34 when SIP protocol receive SIP/2.0 404 Not Found or SIP/2.0 403 Forbidden.

The correct return must be HANGUPCAUSE=1 to 404 Not Found and HANGUPCAUSE=21 to 403 Forbidden.

On channels/chan_sip.c, line 20277 (403 Forbidden) and line 20285 (404 Not Found) where the channel call the function ast_queue_hangup_with_cause, the hangup cause is hard coded AST_CAUSE_CONGESTION (34).

That is the reason the return is almost ever HANGUPCAUSE=34.
The same thing with many 4XX SIP responses.

Is it a problem or is it deliberate?
Is it a version problem? If is, someone knowns on which version the problem was solved?

Call Log

[code] == Using SIP RTP CoS mark 5
– Executing [984048045@iax-trunk:1] Dial(“SIP/MTXCTR01-00000000”, “SIP/CARRIER/984048045,g”) in new stack
== Using SIP RTP CoS mark 5
Audio is at 10136
Adding codec 0x4 (ulaw) to SDP
Adding codec 0x8 (alaw) to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (NAT) to CARRIER:5060:
INVITE sip:984048045@CARRIER SIP/2.0
Via: SIP/2.0/UDP 145.0.100.25:5060;branch=z9hG4bK5d1b73bf;rport
Max-Forwards: 70
From: “3343” sip:1234567890@145.0.100.25;tag=as6d3b0df6
To: sip:984048045@CARRIER
Contact: sip:1234567890@145.0.100.25:5060
Call-ID: 51a364612aff3ff32d8769bc00e740cc@145.0.100.25:5060
CSeq: 103 INVITE
User-Agent: Asterisk PBX 1.8.12.0
Authorization: ###
Date: Mon, 04 Feb 2013 17:52:05 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 259

v=0
o=root 191557193 191557194 IN IP4 145.0.100.25
s=Asterisk PBX 1.8.12.0
c=IN IP4 145.0.100.25
t=0 0
m=audio 10136 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

-- Called SIP/CARRIER/984048045

<— SIP read from UDP:CARRIER:5060 —>
SIP/2.0 100 Trying
Via: SIP/2.0/UDP CARRIER:5060;branch=z9hG4bK5d1b73bf;received=CARRIER;rport=5060
From: “3343” sip:1234567890@145.0.100.25;tag=as6d3b0df6
To: sip:984048045@CARRIER
Call-ID: 51a364612aff3ff32d8769bc00e740cc@145.0.100.25:5060
CSeq: 103 INVITE
Server: Asterisk PBX 1.6.2.13
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Require: timer
Session-Expires: 1800;refresher=uas
Contact: sip:984048045@CARRIER:5060
Content-Length: 0

<------------->
— (13 headers 0 lines) —

<— SIP read from UDP:CARRIER:5060 —>
SIP/2.0 183 Session Progress
Via: SIP/2.0/UDP CARRIER:5060;branch=z9hG4bK5d1b73bf;received=CARRIER;rport=5060
From: “3343” sip:1234567890@145.0.100.25;tag=as6d3b0df6
To: sip:984048045@CARRIER;tag=as24b3e20b
Call-ID: 51a364612aff3ff32d8769bc00e740cc@145.0.100.25:5060
CSeq: 103 INVITE
Server: Asterisk PBX 1.6.2.13
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Require: timer
Session-Expires: 1800;refresher=uas
Contact: sip:984048045@CARRIER:5060
Content-Type: application/sdp
Content-Length: 290

v=0
o=root 1848884802 1848884802 IN IP4 CARRIER
s=Asterisk PBX 1.6.2.13
c=IN IP4 CARRIER
t=0 0
m=audio 24460 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv
<------------->
— (14 headers 13 lines) —
list_route: hop: sip:984048045@CARRIER:5060
Found RTP audio format 0
Found RTP audio format 8
Found RTP audio format 101
Found audio description format PCMU for ID 0
Found audio description format PCMA for ID 8
Found audio description format telephone-event for ID 101
Capabilities: us - 0xc (ulaw|alaw), peer - audio=0xc (ulaw|alaw)/video=0x0 (nothing)/text=0x0 (nothing), combined - 0xc (ulaw|alaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)
Peer audio RTP is at port CARRIER:24460
– SIP/CARRIER-00000001 is making progress passing it to SIP/MTXCTR01-00000000
MTXTST00CLI>
MTXTST00
CLI>
MTXTST00CLI>
MTXTST00
CLI>

<— SIP read from UDP:CARRIER:5060 —>
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP CARRIER:5060;branch=z9hG4bK5d1b73bf;received=CARRIER;rport=5060
From: “3343” sip:1234567890@145.0.100.25;tag=as6d3b0df6
To: sip:984048045@CARRIER;tag=as24b3e20b
Call-ID: 51a364612aff3ff32d8769bc00e740cc@145.0.100.25:5060
CSeq: 103 INVITE
Server: Asterisk PBX 1.6.2.13
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Require: timer
Session-Expires: 1800;refresher=uas
Contact: sip:984048045@CARRIER:5060
Content-Length: 0

<------------->
— (13 headers 0 lines) —
list_route: hop: sip:984048045@CARRIER:5060
– SIP/CARRIER-00000001 is ringing

<— SIP read from UDP:CARRIER:5060 —>
SIP/2.0 403 Forbidden
Via: SIP/2.0/UDP CARRIER:5060;branch=z9hG4bK5d1b73bf;received=CARRIER;rport=5060
From: “3343” sip:1234567890@145.0.100.25;tag=as6d3b0df6
To: sip:984048045@CARRIER;tag=as24b3e20b
Call-ID: 51a364612aff3ff32d8769bc00e740cc@145.0.100.25:5060
CSeq: 103 INVITE
Server: Asterisk PBX 1.6.2.13
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Length: 0

<------------->
— (10 headers 0 lines) —
set_destination: Parsing sip:984048045@CARRIER for address/port to send to
set_destination: set destination to CARRIER:5060
Transmitting (NAT) to CARRIER:5060:
ACK sip:984048045@CARRIER:5060 SIP/2.0
Via: SIP/2.0/UDP 145.0.100.25:5060;branch=z9hG4bK5d1b73bf;rport
Max-Forwards: 70
From: “3343” sip:1234567890@145.0.100.25;tag=as6d3b0df6
To: sip:984048045@CARRIER;tag=as24b3e20b
Contact: sip:1234567890@145.0.100.25:5060
Call-ID: 51a364612aff3ff32d8769bc00e740cc@145.0.100.25:5060
CSeq: 103 ACK
User-Agent: Asterisk PBX 1.8.12.0
Content-Length: 0


[Feb 4 15:52:27] WARNING[6145]: chan_sip.c:20274 handle_response_invite: Received response: “Forbidden” from '“3343” sip:1234567890@145.0.100.25;tag=as6d3b0df6’
Scheduling destruction of SIP dialog ‘51a364612aff3ff32d8769bc00e740cc@145.0.100.25:5060’ in 6400 ms (Method: INVITE)
== Everyone is busy/congested at this time (1:0/1/0)
– Executing [984048045@iax-trunk:2] NoOp(“SIP/MTXCTR01-00000000”, “DIALSTATUS: CONGESTION, HANGUPCAUSE: 34”) in new stack
– Executing [984048045@iax-trunk:3] Hangup(“SIP/MTXCTR01-00000000”, “34”) in new stack
== Spawn extension (iax-trunk, 984048045, 3) exited non-zero on ‘SIP/MTXCTR01-00000000’[/code]

Certainly doesn’t seem to agree with RFC 3398. However, this is the wrong forum for support questions, and this is the wrong place for bug reports.

As you have identified the issue in the code, you can use svn blame on the trunk version to see if it still exists there and in which revision the change was made, if it does not. The log entry for that revision may identify the issue number if the changes was done in response to an open source version bug report, and that may tell you which version the fix was applied to. Otherwise you would need to do a binary chop of the tag versions.

A similar approach can be used to find out when it was introduced, if it wasn’t present in early versions.

The best place to find out if it was intentional would be the developer mailing list.