[asterisk-dev] Response to Subscribe with Expire set to 0.

Philipp Kempgen philipp.kempgen at amooma.de
Wed May 9 18:35:03 MST 2007


Ray Chen wrote:

> Hi, I found out that asterisk responses a sip endpoint Subscribe msg a
> 200 OK with Expire set to 0 (the Expire header in the Subscribe msg was
> 3600). The sip endpoint will resend the subscribe msg when it receives
> the 200 response because it believes that the subscription has expired on
> the server.

After reading RFC 3265 I think this behavior is wrong (and
you are right).

> Sip endpoints flush sub. msgs to the server because of this
> response.The problem is in chan_sip.c function sip_alloc. When receiving
> a Subscribe msg handle_request_subscribe creats a new sip_pvt without
> setting its member "expiry" - 0 is assumed as default. When custruct 200
> OK it set header Expire with the value expiry in the newly construected
> sip_pvt which is 0. Initiate sip_pvt with its member expiry being set to
> DEFAULT_MAX_EXPIRY will fix this problem.

---cut---
   200-class responses to SUBSCRIBE requests also MUST contain an
   "Expires" header.  The period of time in the response MAY be shorter
   but MUST NOT be longer than specified in the request.  The period of
   time in the response is the one which defines the duration of the
   subscription.
---cut---
So care must be taken that Asterisk doesn't send a response with
an Expires duration longer than what was requested in the SUBSCRIBE
(3600 in your example).

Regards,
  Philipp

-- 
amooma GmbH - Bachstr. 126 - 56566 Neuwied - http://www.amooma.de
     Let's use IT to solve problems and not to create new ones.
           Asterisk? -> http://www.das-asterisk-buch.de

Geschäftsführer: Stefan Wintermeyer
Handelsregister: Neuwied B 14998


More information about the asterisk-dev mailing list