Santhana,
I think you are trying to make this more complex than necessary, and
missing the point.
The main thing you need to understand is that there is no special case
for an expires value of zero. SUBSCRIBE works the same way with an
expires value of zero as it does for a non-zero value:
- if the SUBSCRIBE outside an existing subscription, it establishes a
new subscription. (This is true (conceptually anyway) even if the
expires value is zero.) State for that subscription is derived from the
request: the expiration time is derived from the expires value; and
filters, if any, are set from the body of the message.
- if the SUBSCRIBE is within an existing subscription dialog, the state
for that subscription is revised based on the content of the SUBSCRIBE
message.
- regardless of the expiration value (zero or not) and initial NOTIFY is
sent.
And when a time equal to the expiration time passes, a final NOTIFY is
sent and the subscription is ended.
The case where the expires value in the SUBSCRIBE is zero is a
degenerate case of the above. It means that the ending of the
subscription happens immediately when the SUBSCRIBE is processed. So the
final NOTIFY needs to be sent at the same time as the initial NOTIFY. So
a single NOTIFY serves both purposes.
You can use this common behavior to achieve a variety of different goals:
- if you want to poll (fetch) the state of the event but don't want to
maintain an ongoing subscription, send a SUBSCRIBE out-of-dialog with
expires=0. You will get one NOTIFY and will have no ongoing subscription.
- if you want to maintain an ongoing awareness of the state of an event,
then send a SUBSCRIBE with a non-zero expires value. Capture and save
the value of the first NOTIFY. Then each time you get a subsequent
NOTIFY, update your saved value with it. Keep track of when the
subscription will expire. Before it does, send another SUBSCRIBE within
the dialog established by the first one. Again include a non-zero
expires value. When you no longer want to track the state of the event,
send an in-dialog SUBSCRIBE with expires=0.
- if you have a previously established subscription but you have
forgotten the latest value (or want to double check it), send another
SUBSCRIBE within the dialog established by the first one. Again include
a non-zero expires value.
Good Luck,
Paul
On 12/10/12 4:35 AM, Santhana Krishnan wrote:
> Hi,
> I have copied some statements from few RFCs as shown below.
>
>>From RFC 3265
> A natural consequence of the behavior described in the preceding
> sections is that an immediate fetch without a persistent subscription
> may be effected by sending a SUBSCRIBE with an "Expires" of 0.
> Of course, an immediate fetch while a subscription is active may be
> effected by sending a SUBSCRIBE with an "Expires" equal to the number
> of seconds remaining in the subscription.
>
>>From RFC 3680
>
> However, notifications triggered as a result of a fetch operation (a
> SUBSCRIBE with Expires of 0) SHOULD result in the full state of all
> contacts for all registrations to be present in the NOTIFY.
>
> 1) From above paras, Is the Fetch operation done by sending Initial(First)
> SUBSCRIBE with Expires: 0 ? Which should return in NOTIFY with FULL state.
> How to effect the Fetch operation in the middle of an active dialog from
> above. How to send this Expires: with remaining seconds in the subscription.
> This may create race condition with the Notifier, while calculating the
> "remaining seconds in the subscription).
>
>>From RFC 3856
>
> In fact,
> behavior of the presence agent for handling a SUBSCRIBE request with
> Expires of zero is no different than for any other expiration value;
> pending or authorized SUBSCRIBE requests result in a triggered NOTIFY
> with the current presentity and subscription state.
>
> It is also possible to fetch the current presence state, resulting in
>
> a one-time notification containing the current state. This is
> accomplished by sending a SUBSCRIBE request with an immediate
> expiration.
>
> 2) From first para here, In case a SUBSCRIBE with Expires: 0 is sent, then
> NOTIFY with current presentity state is received from the Notifier. But
> before this NOTIFY if 200 OK response is received from the Notifier for that
> SUBSCRIBE(with Expires:0), then the dialog would have been cleared by the
> Subscriber. Then what is the use of this NOTIFY ? What is the use case here ?
>
>
> 3) From second para here, As per this RFC, a SUBSCRIBE with immediate
> expiration will result in Fetch operation returning FULL state. What does
> this immediate expiration mean here ? Is it some small expiration value ? If
> so then the Notifier may take this as a newly requested Subscribe duration
> and may honor it also, which may not be desired by the Subscriber.
>
>
> Any clarity on the above statements is appreciated.
>
> thanks & regards
> Santhana
> _______________________________________________
> Sip-implementors mailing list
> [email protected]
> https://lists.cs.columbia.edu/cucslists/listinfo/sip-implementors
>
_______________________________________________
Sip-implementors mailing list
[email protected]
https://lists.cs.columbia.edu/cucslists/listinfo/sip-implementors