Summary:ASTERISK-12810: [patch] When unregistering a UA, 200 OK response from Asterisk is not SIP compliant
Reporter:Herve JOURDAIN (hjourdain)Labels:
Date Opened:2008-10-02 01:04:16Date Closed:2008-12-10 11:50:39.000-0600
Versions:Frequency of
is related toASTERISK-22428 [patch] SIP unregister does not fully unregister when using Realtime sip peers and Expires not 0 on 200ok
Environment:Attachments:( 0) chan_sip.c.diff
Description:When Asterisk is used as a registrar, and a registered UA is sending a REGISTER with Expires header set to 0, then usually Asterisk will send back a 200 OK response, containing a Contact header with the contact to be removed, and an expires parameter that is set to the previous expiration value!!!
This is not compliant with RFC 3261!


- It can be reproduced "easily" when you register, then unregister a few seconds later, a UA (Eyebeam for example)
- Version used is 1.4.22-rc5
- Only quick code check on SVN, doesn't seem to be anything about it

- Proposed patch: set pvt->expiry to 0 in case of unregistration

<Inline code removed.  Code must be attached to the issue>
Comments:By: Mark Michelson (mmichelson) 2008-10-08 16:49:56

Could you cite the portion of RFC 3261 that this violates? Also, is this actually causing a problem, or is it just that the RFC is violated?

By: Herve JOURDAIN (hjourdain) 2008-10-09 01:03:05

It's section 10.3, item 8, p.66.
It states that the 200 OK must contain contact header field values enumerating all current bindings.
If there is no binding, there should be none! Or maybe if the binding is set in the contact, then the expires parameter should be set to 0.
I think most implementations I've seen - including previous versions of Asterisk - don't send back a contact parameter...

The current behaviour is causing some problems with one of the stacks I use, since it checks the content of the contact header to see if de-registration has been complete - a little pedantic maybe, but quite compliant...

That's why I came up with this patch.

By: Digium Subversion (svnbot) 2008-12-10 11:50:38.000-0600

Repository: asterisk
Revision: 162738

U   branches/1.4/channels/chan_sip.c

r162738 | file | 2008-12-10 11:50:38 -0600 (Wed, 10 Dec 2008) | 6 lines

When a SIP peer unregisters set the expiry time back to 0 so that the 200 OK contains an expires of 0.
(closes issue ASTERISK-12810)
Reported by: hjourdain
     chan_sip.c.diff uploaded by hjourdain (license 583)