[Home]

Summary:ASTERISK-12221: Asterisk should reply 480(instead of 404) when a called user is not registered
Reporter:Iñaki Baz Castillo (ibc)Labels:
Date Opened:2008-06-18 17:14:06Date Closed:2008-07-08 15:20:22
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Channels/chan_sip/Interoperability
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20080701__bug12885__2.diff.txt
( 1) sip_debug_404_Not_Found.txt
Description:Imagine we have 2 SIP users (201 and 202) and this dialplan:

 exten => _2XX,1,Dial(SIP/${EXTEN})
 exten => _2XX,n,Hangup

If 200 calls 201 and 201 is not registered then Asterisk will reply a "404 Not Found".

Well, even if this code is very extended for this purpose I'm sure that is incorrect:

---------------
21.4.5 404 Not Found

  The server has definitive information that the user does not exist at
  the domain specified in the Request-URI.  This status is also
  returned if the domain in the Request-URI does not match any of the
  domains handled by the recipient of the request.

21.4.18 480 Temporarily Unavailable

  The callee's end system was contacted successfully but the callee is
  currently unavailable (for example, is not logged in, ...
---------------

In the example above, 200 called a user whose end system is Asterisk, so "the callee's end system was contacted successfully but the callee is currently unavailable (for example, is not logged in)".

"404 Not Found" should be replied when the server/proxy has, permanently, no info about the dialed extension.

So:
- If 200 calls 201 (and 201 is not registered) Asterisk should reply "480".
- If 200 calls to 333 Asterisk should reply "404".
- If 200 calls to 202 (non existing SIP user but a valid extension) I'm not sure if it's better a 404 or 480. Probably a 404.

Also note the SIP/ISUP mapping of RFC 3398:

---------------
  404 Not found                          1 Unallocated number
  480 Temporarily unavailable           18 No user responding
---------------


****** ADDITIONAL INFORMATION ******

An issue could occur with realtime dynamic users since AFAIK sometimes they just don't exist for Asterisk until they register.
Comments:By: Iñaki Baz Castillo (ibc) 2008-06-18 17:15:40

Sorry, in the first line of the report I mean:
 "Imagine we have 2 SIP users (200 and 201) and this dialplan"
(instead of "201 and 202").

By: Tilghman Lesher (tilghman) 2008-06-18 19:02:23

I need to see the output of your "sip set debug on" when you're getting this 404 response.

By: Olle Johansson (oej) 2008-07-01 06:54:49

I wonder if we have a proper hangupcause that we can set for this "not registered" case.

By: Olle Johansson (oej) 2008-07-01 07:06:14

Found the problem in the code. Thanks for reporting this!

By: Olle Johansson (oej) 2008-07-01 07:08:33

I thought...

The issue here is that AST_CAUSE_UNREGISTERED is a synonym for AST_CAUSE_NO_ROUTE_DESTINATION, which is a 404 in the translation table. I wonder if we can change that without causing too much harm.

By: Olle Johansson (oej) 2008-07-01 07:19:27

To explain: Since we're a multiprotocol pbx, everything is translated while going through the core. If we change something in the SIP channel, it affects not only the dial application (that reads AST_CAUSE_UNREGISTERED) but also other channels. It's not easy to fix.

By: Tilghman Lesher (tilghman) 2008-07-01 08:02:29

I'm going to suggest this patch, which defines a new cause in line with the ISUP code translation table, using Q.931 code 20, which isn't defined in the Q.931 spec, but which RFC 3398 maps to SIP code 480 and defines as "Subscriber Absent".

By: Olle Johansson (oej) 2008-07-01 08:15:57

I have a similar patch, but wanted to check with you guys how this affects the rest of the channels... If you think it's ok, I agree with you.

By: Iñaki Baz Castillo (ibc) 2008-07-01 08:21:27

Corydon76's patch seems ok IMHO.

By: Digium Subversion (svnbot) 2008-07-08 15:20:19

Repository: asterisk
Revision: 129149

U   branches/1.4/apps/app_dial.c
U   branches/1.4/channels/chan_sip.c
U   branches/1.4/include/asterisk/causes.h

------------------------------------------------------------------------
r129149 | tilghman | 2008-07-08 15:20:17 -0500 (Tue, 08 Jul 2008) | 8 lines

Cause SIP to return a 480 instead of a 404 when a sip peer exists, but is not
registered.
(closes issue ASTERISK-12221)
Reported by: ibc
Patches:
      20080701__bug12885__2.diff.txt uploaded by Corydon76 (license 14)
Tested by: ibc

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=129149