[Home]

Summary:ASTERISK-03257: Wrong response to MESSAGE to non exisiting user
Reporter:klaus3000 (klaus3000)Labels:
Date Opened:2005-01-12 02:27:03.000-0600Date Closed:2008-01-15 15:21:24.000-0600
Priority:TrivialRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:If I send a MESSAGE to asterisk (I do this for keep-alive testing), asterisk anwers 200 OK, regardless if the requested user exists or not. See below:

MESSAGE sip:nonexistinguser@83.136.32.165:5060 SIP/2.0.
Via: SIP/2.0/UDP graham.labbss.nic.at:58979;rport.
From: sip:sipsak@graham.labbss.nic.at:58979;tag=7ff7455b.
To: sip:nonexistinguser@83.136.32.165:5060.
Call-ID: 2146911579@graham.labbss.nic.at.
CSeq: 2 MESSAGE.
Content-Type: text/plain.
Content-Length: 56.
Max-Forwards: 70.
User-Agent: sipsak 0.8.11.
.
usrloc test message from SIPsak for user nonexistinguser0.

SIP/2.0 200 OK.
Via: SIP/2.0/UDP graham.labbss.nic.at:58979.
From: sip:sipsak@graham.labbss.nic.at:58979;tag=7ff7455b.
To: sip:nonexistinguser@83.136.32.165:5060;tag=as4cfe5980.
Call-ID: 2146911579@graham.labbss.nic.at.
CSeq: 2 MESSAGE.
User-Agent: Asterisk PBX.
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER.
Contact: .
Content-Length: 0.


This is wrong: It should response with "404 not found" or - as asterisk probably does not handle MESSAGE - with "501 Not Implemented".
Comments:By: Mark Spencer (markster) 2005-01-12 09:34:39.000-0600

Asterisk handles messages within the context of a call.  It does not do anything with them outside the context of a call.  What is the proper response for that behavior?  Something about an invalid call state?  If there isn't anything more appropriate, I think 200 OK is just fine.  The message made it to asterisk, which promptly drops it on the floor :)

By: klaus3000 (klaus3000) 2005-01-12 09:54:55.000-0600

From RFC3428:
  If the UAC receives a 200 OK response to a MESSAGE request, it may
  assume the message has been delivered to the final destination.  It
  MUST NOT assume that the recipient has actually read the instant
  message.  If the UAC receives a 202 Accepted response, the message
  has been delivered to a gateway, store and forward server, or some
  other service that may eventually deliver the message

So, 202 would be better.

IMO perfect would be 404 if the user/extension does not exist. If the extension exists, asterisk may proxy the MESSAGE to the final destination (if this is possible on the outgoing channel, e.g. SIP, SMS?) or answers with another failure code, e.g. "405 Method Not Allowed".

By: Mark Spencer (markster) 2005-01-12 16:55:46.000-0600

Okay I made it 405 for now.  We can work on something else later.

By: Russell Bryant (russell) 2005-01-12 20:56:33.000-0600

fixed in 1.0

By: Digium Subversion (svnbot) 2008-01-15 15:21:23.000-0600

Repository: asterisk
Revision: 4771

U   trunk/channels/chan_sip.c

------------------------------------------------------------------------
r4771 | markster | 2008-01-15 15:21:23 -0600 (Tue, 15 Jan 2008) | 2 lines

Send 405 Method Not Allowed when message received outside of call (bug ASTERISK-3257, commited from within the plane to huntsville)

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

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

By: Digium Subversion (svnbot) 2008-01-15 15:21:24.000-0600

Repository: asterisk
Revision: 4772

U   branches/v1-0/channels/chan_sip.c

------------------------------------------------------------------------
r4772 | russell | 2008-01-15 15:21:24 -0600 (Tue, 15 Jan 2008) | 2 lines

Send "405 Method Not Allowed" if a message is received outside of a call (bug ASTERISK-3257)

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

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