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

Advanced Features 371
High Availability
RvSipSubsStoreActiveSubs—copies all subscription
parameters from a given subscription to a given buffer. This
buffer should be supplied when restoring the subscription.
RvSipSubsRestoreActiveSubs—restores all subscription
parameters from a given buffer. The subscription will assume
the ACTIVE state.
Sample Code
The following code replaces a connected call-leg with a newly created call-leg
using the store/restore mechanism. The sample assumes that the received call-
leg is in the CONNECTED state. The new call-leg is returned.
/*=====================================================================================*/
RvSipCallLegHandle AppStoreRestoreConnectedCall(
IN RvSipCallLegMgrHandle hCallLegMgr,
IN RvSipCallLegHandle hCallLeg)
{
RvInt32 storageSize;
void* storageBuffer;
RvSipCallLegHandle hNewCallLeg;
RvStatus rv;
/*Gets the size of the storage buffer.*/
RvSipCallLegGetConnectedCallStorageSize(hCallLeg, &storageSize);
storageBuffer = malloc(storageSize);
/*Stores the call information.*/
rv = RvSipCallLegStoreConnectedCall(hCallLeg, storageBuffer,storageSize);
if(rv != RV_OK)
{
printf("Failed in RvSipCallLegStoreConnectedCall call=0x%x (rv=%d)", hCallLeg,rv);
return NULL;
}
/*Terminates the call and creates a new call.*/
RvSipCallLegTerminate(hCallLeg);
RvSipCallLegMgrCreateCallLeg(hCallLegMgr, NULL, &hNewCallLeg);
/*Restores the terminated call-leg parameters into the newly created call-leg.*/
rv = RvSipCallLegRestoreConnectedCall (hNewCallLeg,storageBuffer,storageSize);
if(rv != RV_OK)
{
printf("Failed in RvSipCallLegRestoreConnectedCall (rv=%d)", rv);
return NULL;
}