HP-UX C SIP Stack Programmer's Guide (Novembery 2007)
Event Notification 257
Sending a Notification
RvChar *strFrom = "sip:user1@172.20.0.1:5060";
RvChar *strTo = "sip:user2@172.20.10.11:5060";
RvChar *strEvent = "hp.event; id=222";
RvInt32 expiresVal = 3000;
RvStatus rv;
/*--------------------------
Creates a new subscription.
----------------------------*/
rv = RvSipSubsMgrCreateSubscription(hSubsMgr, NULL, NULL, &hSubs);
if(rv != RV_OK)
{
printf("Failed to create new subscription\n");
return;
}
printf("Subscriber subscription %x was created\n",hSubs);
/*-----------------------------------------------------------
Calls the init function with the To, From and Event strings.
-----------------------------------------------------------*/
rv = RvSipSubsInitStr(hSubs, strFrom, strTo, expiresVal, strEvent);
if(rv != RV_OK)
{
printf("Failed to initiate new subscription\n");
return;
}
printf("Sending a SUBSCRIBE request: %s ->
%s\n",strFrom,strTo);
rv = RvSipSubsSubscribe(hSubs);
if(rv != RV_OK)
{
printf("Subscribe failed for subscription %x", hSubs);
return;
}
}
/*==================================================================================*/
SENDING A
N
OTIFICATION
The following steps describe how to create and send a NOTIFY request: