HP-UX C SIP Stack Programmer's Guide (Novembery 2007)
374 HP-UX C SIP Stack Programmer’s Guide
Replaces Header
Sample Code
The following sample code demonstrates the State Changed callback.
/*======================================================================================*/
void RVCALLCONV AppCallLegStateChangedEv(
IN RvSipCallLegHandle hCallLeg,
IN RvSipAppCallLegHandle hAppCallLeg,
IN RvSipCallLegState eState,
IN RvSipCallLegStateChangeReason eReason)
{
RvInt16 responseCode = 0;
switch (eState)
{
case RVSIP_CALL_LEG_STATE_OFFERING:
if(eReason == RVSIP_CALL_LEG_REASON_REMOTE_INVITING_REPLACES)
{
RvSipCallLegHandle hMatchedCallLeg = NULL;
RvSipCallLegReplacesReason eReplacesReason =
RVSIP_CALL_LEG_REPLACES_REASON_UNDEFINED;
/*Looks for the call-leg to be replaced.*/
RvSipCallLegReplacesGetMatchedCallExt(hCallLeg,
&eReplacesReason,
&hMatchedCallLeg);
if(hMatchedCallLeg != NULL &&
eReplacesReason == RVSIP_CALL_LEG_REPLACES_REASON_DIALOG_FOUND_OK)
{
/* found the correct call-leg to replace.
1. Accepts the new call-leg
2. Disconnect the replaced call-leg. */
RvSipCallLegAccept(hCallLeg);
RvSipCallLegDisconnect(hMatchedCallLeg);
return;
}
/* Replaced call-leg was not found. Decide on the correct response */
switch(eReplacesReason)
{
case RVSIP_CALL_LEG_REPLACES_REASON_FOUND_CONFIRMED_DIALOG:
responseCode = 486;