Dialogic Dialogic Global Call IP IP Phone User Manual


 
Dialogic
®
Global Call IP Technology Guide — November 2007 137
Dialogic Corporation
IP-Specific Operations
None of the URIs in the Contact header field can be equal to the one in the Request-URI.
For a 301 or 302, the response may contain the same location and username that was targeted
in the original request, but additional transport parameters to try, such as a different multicast
address or a different transport protocol.
A Contact header field can point to a different resource than the one originally called, and can
use any suitable URI (not just SIP URIs).
Each Contact header field can include an “expires” parameter to indicate how long the URI is
valid (in seconds). If this parameter is not provided, the value of the Expires header field
determines the length of the validity.
The following code example shows how an application can set two alternative URIs to send in a
302 Moved Temporarily response.
void redirectChannel(int channel)
{
char contact1[] = "Contact: \"forward1\" <sip:forward1@146.152.84.124>;q=0.7;expires=3600";
char contact2[] = "Contact: \"forward2\" <sip:forward2@146.152.84.124>;q=0.5;expires=60";
//Set contact header
GC_PARM_BLKP pParmBlock = NULL;
gc_util_insert_parm_ref_ex(&pParmBlock,
IPSET_SIP_MSGINFO,
IPPARM_SIP_HDR,
(unsigned long) (strlen(contact1)+1),
contact1);
gc_util_insert_parm_ref_ex(&pParmBlock,
IPSET_SIP_MSGINFO,
IPPARM_SIP_HDR,
(unsigned long) (strlen(contact2)+1),
contact2);
int frc = gc_SetUserInfo(GCTGT_GCLIB_CRN, session[channel].crn,pParmBlock,GC_SINGLECALL);
if(GC_SUCCESS != frc)
{
printf("[%d] gc_SetUserInfo failed\n",channel);
gc_util_delete_parm_blk(pParmBlock);
return;
}
int rc = gc_DropCall(session[channel].crn,
IPEC_SIPReasonStatus302MovedTemporarily,
EV_ASYNC);
if(GC_SUCCESS != rc)
{
printf("[%d] gc_DropCall failed \n",channel);
return;
}
}
The SIP message sent by in this example would look something like the following:
SIP/2.0 302 Moved Temporarily
From: HMP-From<sip:146.152.84.1:5060>;tag=52a52b0-0-13c4-28795-17aef347-28795
To: HMP-To<sip:146.152.84.2>;tag=52a5468-0-13c4-28795-783983a2-28795;myname
Call-ID: 52ebbf8-0-13c4-28795-14daf9c6-28795@146.152.84.1
CSeq: 1 INVITE