[Home]

Summary:ASTERISK-01520: [patch] SIP Register response without Expires: header not parsing Contact: and Dynamic expiry guard time calculation
Reporter:slepp (slepp)Labels:
Date Opened:2004-05-02 19:06:59Date Closed:2008-01-15 14:53:19.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) chan_sip_1_359.patch
Description:According to the RFC section 6.13, Contact: headers may contain all the expires information, and that the Expires: header is therefore not mandatory. In chan_sip, on a register response, it reads only the expires header, and if it is not there, sets to default expiry.

This patch fixes that and parses for a contact header matching p->our_contact (since I noticed with FWD, it sends two contact headers, one of which doesn't apply to us).
This patch also adds in a __get_header_cnt which finds the header that is the 'index' copy of the same name (get_header_cnt(req, "Contact", 1) gets the second Contact header).

Also now as part of this patch, the expires time is modified according to three thresholds, instead of just outright doing a -EXPIRY_GUARD_SECS. If it's below EXPIRY_GUARD_MIN, it will set expires to 1. If it's below EXPIRY_GUARD_LIMIT, it will calculate a percentage based on EXPIRY_GUARD_PCT, and if above EXPIRY_GUARD_LIMIT, it uses the classical EXPIRY_GUARD_SECS.

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

From section 6.13 of RFC 2543:

  REGISTER requests: REGISTER requests MAY contain a Contact header
       field indicating at which locations the user is reachable. The
       REGISTER request defines a wildcard Contact field, "*", which
       MUST only be used with Expires: 0 to remove all registrations
       for a particular user. An optional "expires" parameter indicates
       the desired expiration time of the registration. If a Contact
       entry does not have an "expires" parameter, the Expires header
       field is used as the default value. If neither of these
       mechanisms is used, SIP URIs are assumed to expire after one
       hour. Other URI schemes have no expiration times.

  REGISTER 2xx responses: A REGISTER response MAY return all locations
       at which the user is currently reachable.  An optional "expires"
       parameter indicates the expiration time of the registration. If
       a Contact entry does not have an "expires" parameter, the value
       of the Expires header field indicates the expiration time. If
       neither mechanism is used, the expiration time specified in the
       request, explicitly or by default, is used.

Comments:By: slepp (slepp) 2004-05-02 19:49:45

Updated the information for the revised patch.

By: slepp (slepp) 2004-05-02 22:11:20

Updated the patch to use __get_header() now that it makes sense as to how to use that. Also cleaned it up just a touch.

By: Mark Spencer (markster) 2004-05-02 22:14:44

Added to CVS.  Nicely done.

By: Digium Subversion (svnbot) 2008-01-15 14:53:19.000-0600

Repository: asterisk
Revision: 2866

U   trunk/channels/chan_sip.c

------------------------------------------------------------------------
r2866 | markster | 2008-01-15 14:53:18 -0600 (Tue, 15 Jan 2008) | 2 lines

Merge slepp's REGISTER RFC compliance fixes (bug ASTERISK-1520)

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

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