Summary:ASTERISK-04842: SIP 404 returns ${DIALSTATUS}=CONGESTION
Reporter:Brett Nemeroff (brettnem)Labels:
Date Opened:2005-08-15 16:55:24Date Closed:2011-06-07 14:10:38
Versions:Frequency of
Description:I pondered if this belonged as a feature request or a bug. The more I think about it, the more it feels like a bug.

If I dial out and get a 404 back, DIALSTATUS is set to CONGESTION. This is just plain wrong. The upstream server is reporting something very useful that we should be able to tell our endpoints.

I realize that this must apply to all channels. So I'm not entirely sure how to report it.
Comments:By: Olle Johansson (oej) 2005-08-16 02:44:30

According to the SIP/ISDN compatibility standard we should deliver AST_CAUSE_UNALLOCATED, which we do in CVS HEAD. However, I found several places where the cause is not set and is working to fix that. That way, you could check hangupcause as a complement to DIALSTATUS.

I don't know if CHANUNAVAIL would be better.

By: Olle Johansson (oej) 2005-08-16 08:21:58

MikeJ: Why post 1.2 - there's no patch here, and we don't know if it is a bug that we need to fix in 1.0/HEAD or the coming 1.2???

By: mdu113 (mdu113) 2005-08-19 15:50:36

I'd vote for CHANUNAVAIL as this is consistent with what asterisk does when tries to Dial local peer and peer is unregistered.

By: Michael Jerris (mikej) 2005-08-19 16:13:18

I was understanding this as a feature request.. Sorry.

By: Olle Johansson (oej) 2005-08-21 04:16:10

404 tells us "you dialled the wrong number" where chanisunavail is saying "you dialled something that should work, but the line is disconnected".

AST_CAUSE_UNALLOCATED means unallocated phone number, wrong number. Which should lead to congestion.

If SIP delivers the proper cause to the dialplan (as well as the other channels) you can solve this in the dialplan by reading the hangupcause, which gives a bit more information than DIALSTATUS.

By: mdu113 (mdu113) 2005-08-21 15:30:31

Hm. Actually 404 doesn't tell us that "number is wrong".
It says that number cannot be found among registered users, which means either "number is wrong" or "user unregistered".
I beilieve 604 is telling that number is wrong.
What I mean is that if have your users registered to asterisk and try to dial a friend DIALSTATUS will be set to CHANUNAVAIL for unregistered users.
If you couple asterisk with sip proxy and have your users registered there, then proxy will reply 404 for INVITEs to currently unregistered users and then DIALSTATUS will be set CONGESTION.
In my opinion it's better to have it consistent and CHANUNVAIL is good for it.
What I'd really like to have is to be able to find out last final reply received in SIP dialog from dialplan. Or to have DIALSTATUS/HANGUPCAUSE values
to be clearly translateable to SIP replies.

By: Olle Johansson (oej) 2005-08-22 00:49:48

404 is Not found. User does not exist - which is basically "wrong number". According to the RFC, it has nothing to do with registred users.

480 is temporarily unavailable, not logged in - again according to the RFC. If a SIP proxy returns 404 for an otherwise valid URI it is propably misconfigured or configured that way for another reason.

Since the RFC is pretty big, I could be wrong again... ;-) I checked section 21.4.

By: mdu113 (mdu113) 2005-08-22 11:33:57

For 480 reply RFC says:
"The callee's end system was contacted successfully but the callee is
currently unavailable (for example, is not logged in, logged in but
n a state that precludes communication with the callee, or has
activated the "do not disturb" feature)".
This is not the case for valid, but unregistered users.

I'm not an RFC expert, it's more from experience that proxies most often (if not always) will return 404 for valid, but unregistered users. Taking a quick look through RFC I couldn't find anything to prove me right. RFC on reply 404 says "user does not exist in the specified domain".
If you know better suited reply for valid, but unregistered users please point it out.
It was my understanding that 404 used as "not found among registered users" and 604 used as "number is invalid"

By: Olle Johansson (oej) 2005-09-06 00:48:04

Well, this is more of a discussion than a bug report at this point. Closing this issue, we will not change the behaviour for 1.2 now.