Event Subscription and Notification
RFC 3265 extends the SIP specification, RFC 3261, to support a general mechanism allowing subscription to asynchronous events. Such events can include statistics, alarms, and so on.
The two types of event subscriptions are in-dialog and out-of-dialog. A subscription that uses the Call-ID of an existing dialog is an in-dialog subscription, whereas the out-of-dialog subscription carries a Call-ID that is not part of the existing ongoing dialogs. Figure 5-6 shows an example of out-of-dialog subscription.
Figure 5-6 Subscribe and Notify
Event Notification Through SUBSCRIBE
|
UA-1 |
UA-2 |
|||
|
SUBSCRIBE (Event Package: Alarms) |
||||
|
200 OK |
||||
|
Notify (No Events Yet) |
||||
|
200 OK |
||||
Subscription Done for 'Alarms'
Notify (Alarms)
Subscription Done for 'Alarms'
Notify (Alarms)
200 OK
Initiate Subscription Termination
|
SUBSCRIBE (Expires-Time Set to 0) |
||
|
200 OK |
||
|
In Example 5-3, UA-1 is sending a SUBSCRIBE to UA-2 and subscribes for an event package called alarms. Event packages are implementation-dependent and are not defined in the specifications. Example 5-3 SUBSCRIBE from UA-1 to UA-2 SUBSCRIBE sip:[email protected] SIP/2.0 Via: SIP/2.0/UDP 172.27.14.4:5070; branch=z9hG4bKhWn9PFlB2yaZbsvppn2Xlw—34 Max-Forwards: 70 To: <sip:[email protected]> From: <sip:[email protected]>;tag=ds7c86cbb5 Example 5-3 SUBSCRIBE from UA-1 to UA-2 (Continued) Call-ID: 1bbd7b2:1009fdd37c1:[email protected] CSeq: 1 SUBSCRIBE Content-Length: 0 Content-Type: Expires: 600 Event: alarms A UA interested in event notification sends a SUBSCRIBE message to a SIP server (a SIP server could be just another SIP UA but provides additional services). The SUBSCRIBE message establishes a dialog, and the server immediately replies to this message using the 200 OK response. At this point, the dialog is established. The server sends a NOTIFY request to the user every time the event to which the user subscribed changes. NOTIFY messages are sent within the dialog established by the SUBSCRIBE. The NOTIFY messages usually carry an XML body that describes the event. As part of the message exchange to establish a subscription, the server sends a NOTIFY message to the client with an indication of no events. Subscriptions have a limited life span (note the Expires header set in Example 5-3) and therefore must be periodically refreshed. A SUBSCRIBE with an Expires value of 0 indicates unsubscription. |
||
Continue reading here: Session Description Protocol
Was this article helpful?