Summary: | ASTERISK-20352: Incorrect handling of SIP 484 Address incomplete | ||
Reporter: | Alain RICHARD (arichard) | Labels: | |
Date Opened: | 2012-09-03 05:13:11 | Date Closed: | 2012-09-04 09:34:24 |
Priority: | Major | Regression? | No |
Status: | Closed/Complete | Components: | Channels/chan_sip/General |
Versions: | 1.8.15.0 1.8.15.1 | Frequency of Occurrence | Constant |
Related Issues: | |||
Environment: | Linux with asterisk 1.8.15.0 SIP provider trunk SIP consummer trunk | Attachments: | ( 0) ASTERISK-20352_log |
Description: | In my setup, asterisk is used only as a SIP router between a provider and a consummer. On an incoming call (from the provider to the consumer), if the consumer trunk return a SIP 484 Address incomplete (q.850 code 28), the error is forwarded by asterisk to the provider trunk as a SIP 503 Service unavail, although the included q.850 code is 28. This is a violation of RFC 3398 : Response received Cause value in the REL ----------------- ---------------------- ... 484 Address incomplete 28 Invalid Number Format (+) ... The problem is 100% reproductible. With the following code : sip.conf : [general] use_q850_reason=yes [provider] context=fromprovider [consumer] extensions.Conf : [fromprovider] exten => _123456,1,Nop(Call the consumer) same => n,Dial(SIP/${EXTEN}@comsumer) same => n,Verbose(2,DIALSTATUS = ${DIALSTATUS}) same => n,Verbose(2,HANGUPCAUSE = ${HANGUPCAUSE}) When the call is coming, I get the following process : 1 Call is ringging from provider to consumer 2 Consumer returns a SIP 484 Address incomplete 3 The verbose output shows : DIALSTATUS=CHANUNAVAIL, HANGUPCAUSE=28 4 asterisk returns to the provider : 503 Service unavailable, q.850 code=28 So here it seams to be at least two error : - On step 4, the returned code for HANGUPCAUSE 28 to the provider is SIP 503 instead of SIP 484 as requested by RFC 3398. - On step 3, the DIAL app should have returned DIALSTATUS=CONGESTION instead of CHANUNAVAIL I have succeed to implement a counter measure : exten => _123456,1,Nop(Call the consumer) same => n,Dial(SIP/${EXTEN}@comsumer) same => n,Verbose(2,DIALSTATUS = ${DIALSTATUS}) same => n,GotoIf($[${HANGUPCAUSE}=28] & $[${DIALSTATUS}!="CONGESTION"]?setcongestion:continue) same => n(setcongestion),Set(DIALSTATUS="CONGESTION") same => n,Verbose(2,DIALSTATUS = ${DIALSTATUS}) same => n(continue),Verbose(2,HANGUPCAUSE = ${HANGUPCAUSE}) In that case, the provider will receive the correct SIP response (SIP 484 and q.850 code 28). I don't know if the problem is within dial_app, chan_sip or on the generic handling of HANGUP CAUSE 28, but this violate the RFCs. Regards, Alain RICHARD | ||
Comments: | By: David Woolley (davidw) 2012-09-03 05:58:04.886-0500 The response you get depends on whether the dialplan allows more digits to be entered. I think you need to follow this up further through support channels before declaring a bug. By: Alain RICHARD (arichard) 2012-09-03 07:32:38.395-0500 Here asterisk is just used as a SIP router, and just forwards the reply from the customer PABX (in fact a patton gateway) to the provider trunk. It is not supposed to interpret the numbers. In fact the PABX generates a 484 reply because the SDA is not implemented on the PABX, but this is not the subject. The patton gateway generate an RFC3398 compliant result : <--- SIP read from UDP:3.3.3.251:5060 ---> SIP/2.0 484 Address Incomplete Via: SIP/2.0/UDP 2.2.2.2:5060;branch=z9hG4bK4acf49d4;rport=5060;received=2.2.2.2 From: "987654" <sip:987654@2.2.2.2>;tag=as2eff6979 To: <sip:123456@3.3.3.251>;tag=3169669864 Call-ID: 27f7d0e862a52b933eeaf4c357b041bd@2.2.2.2:5060 CSeq: 102 INVITE Server: Patton SN4638 5BIS 00A0BA06BAEF R6.1 2012-05-09 H323 SIP BRI M5T SIP Stack/4.0.30.30 Content-Length: 0 and asterisk change it to a non RFC3398 compliant result : <--- Reliably Transmitting (NAT) to 1.1.1.104:5060 ---> SIP/2.0 503 Service Unavailable Via: SIP/2.0/UDP 1.1.1.104;branch=z9hG4bK1166.4a4d19f6.1;received=1.1.1.104;rport=5060 Via: SIP/2.0/UDP 1.1.1.116:5060;rport=5060;branch=z9hG4bK-77ef-1346673299-2623-361 From: "987654"<sip:987654@1.1.1.116>;tag=95ffcd055e0f78f7d5d397020e89288d9808247e To: <sip:123456@1.1.1.104:5060>;tag=as4447fef1 Call-ID: 2c00-4b2-832012115459-ACKBAR-0-1.1.1.116 CSeq: 1 INVITE Server: Asterisk Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH Supported: replaces, timer Session-Expires: 1800;refresher=uas Reason: Q.850;cause=28 X-Asterisk-HangupCause: Invalid number format X-Asterisk-HangupCauseCode: 28 Content-Length: 0 You'll find enclosed the full log of the exchange. By: Alain RICHARD (arichard) 2012-09-03 07:33:13.688-0500 Full log of the SIP problem. By: David Woolley (davidw) 2012-09-04 05:31:35.952-0500 Asterisk is NOT a SIP router (i.e. proxy). It is a back to back user agent, and terminates the protocol on each leg. By: Matt Jordan (mjordan) 2012-09-04 09:34:17.375-0500 Exactly what David said. You can relay a 484 back to the original UA by inspecting the HANGUPCAUSE and by careful usage of the Incomplete application. By: Alain RICHARD (arichard) 2012-09-05 08:20:37.656-0500 Hi, I have investigated a little bit more the problem and it seams it has nothing to do with Address incompletes or a bad usage of asterisk as a SIP router. I have successfully reproduced the problem with the following scenario : - asterisk is used as an IPBX - phone1 is a SIP phone - provider is a SIP provider Process : 1 - phone1 calls 00444518779. The first 0 is for line access. 2 - asterisk send this to the SIP provider (Dial(SIP/${EXTEN:1}@provider) 3 - The provider tries to reach the called number, but this one is non existant and the provider return SIP 404 Not Found, q850 cause=1 4 - Asterisk returns to phone 1 a SIP/2.0 503 Service Unavailable; q850 cause=1 I think this is a perfect usage of asterisk as a PABX, and asterisk generates a SIP reply that is not compliant with RFC3398 : SIP/2.0 503 Service Unavailable Via: SIP/2.0/UDP 195.189.65.250:51023;branch=z9hG4bK-d8754z-b84080c4add209f5-1---d8754z-;received=192.168.240.34;rport=51023 From: "0000FFFF0002"<sip:0000FFFF0002@192.168.240.251;transport=UDP>;tag=eaa14d45 To: <sip:00444518779@192.168.240.251;transport=UDP>;tag=as10aad6d8 Call-ID: MTUzZjVlNGQ1YTNlNmU1OTU1ZGQ4YzE4Y2IxZWJlMTI. CSeq: 2 INVITE Server: Asterisk Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH Supported: replaces, timer Reason: Q.850;cause=1 X-Asterisk-HangupCause: Unallocated (unassigned) number X-Asterisk-HangupCauseCode: 1 Content-Length: 0 I am not accustomized with the asterisk developpment process, so please if this is not the right place to discuss this issue, on which list should i submit this ? Regards, |