HP-UX C SIP Stack Programmer's Guide (Novembery 2007)

258 HP-UX C SIP Stack Programmers Guide
Sending a Notification
1. Declare a handle for the new notification and for the NOTIFY
request message.
2. Call RvSipSubsCreateNotify(). This function enables you to
exchange handles with the SIP Stack.
3. Call RvSipNotifyGetOutboundMsg() to get the NOTIFY
message.
4. Set the Subscription-State header in the message.
5. Set the event status information in the message.
6. Call RvSipNotifySend(). This function sends the NOTIFY
request to the remote party.
Sample Code
The following sample code demonstrates an implementation of the notify
sending procedure.
/*==================================================================================*/
RvStatus AppCreateNotification(RvSipSubsHandle hSubs,
RvSipSubscriptionSubstate eSubsState,
RvSipSubscriptionReason eReason)
{
/* The handle to the notification object */
RvSipNotifyHandle hNotify;
/*The handle to the NOTIFY message */
RvSipMsgHandle hNotifyMsg;
RvStatus rv;
/*------------------------------
Creates the notification object.
------------------------------*/
rv = RvSipSubsCreateNotify(hSubs,
(RvSipAppNotifyHandle)hSubs,
&hNotify);
if(rv != RV_OK)
{
printf("Failed to create a new notification");
return rv;
}
/*------------------------------------------------------------------
Sets the Subscription-State header parameters in the NOTIFY message.
--------------------------------------------------------------------*/