Dialogic Dialogic Global Call IP IP Phone User Manual


 
138 Dialogic
®
Global Call IP Technology Guide — November 2007
Dialogic Corporation
IP-Specific Operations
Via: SIP/2.0/UDP 146.152.84.1:5060;received=146.152.84.2;branch=z9hG4bK-28795-9e19f19-554d9dc4
Supported: replaces
Contact: "forward1" <sip:forward1@146.152.84.124>;q=0.7;expires=3600,"forward2"
<sip:forward2@146.152.84.124>;q=0.5;expires=60
Content-Length: 0
4.4.4.2 Receiving and Handling a Redirect Response
After receiving a GCEV_DISCONNECTED event, the application can check the cause of the
event. If the disconnection was because of call redirection, the application can further check the
extra data associated with the event for redirect URIs in the form of a Contact header contained in
an IPSET_SIP_MSGINFO/IPPARM_SIP_HDR parameter element. After completing the drop call
on this channel, the application can make a new call to any of the redirect URIs if it wishes.
According to RFC 3261, applications receiving a 3xx response have great latitude in determining
how (or whether) to generate new requests to the redirect URIs. An application can choose which
of the suggested URIs to add to its target list, and in what order to add them. The application may
generate new requests to the URIs in the target list serially or in parallel. If a new request fails
(receives a result code greater than 399), the application should try the next URI in the target list
until the call succeeds or until all URIs have produced a failure result. If any of the redirected
requests produces a 3xx redirect response, the application can choose to add to its target list any of
the URIs that are contained in the 3xx response as long as the URI is not already in the target list.
RFC 3261 recommends that the new requests use the same To, From, and Call-ID used in the
original, redirected request, but the application may update the Call-ID if it wishes.
In the following example, the parser assumes the redirect URI is in <> and only returns the first
URI in the Contact header.
void processEvtHandler()
{
METAEVENT metaEvent;
GC_PARM_BLK *parmblkp = NULL;
GC_PARM_DATAPt_gcParmDatap = NULL;
.
.
.
switch (evtType)
{
case GCEV_DISCONNECTED:
/* check for call redirection */
if(true == checkCallRedirected())
{
parmblkp = (GC_PARM_BLK *) metaEvent.extevtdatap;
while (t_gcParmDatap = gc_util_next_parm(parmblkp, t_gcParmDatap))
{
switch(t_gcParmDatap->set_ID)
{
case IPSET_SIP_MSGINFO:
switch(t_gcParmDatap->parm_ID)
{
case IPPARM_SIP_HDR:
/* check for first contact URI */
Char* addr = checkRedirectedAddress(t_gcParmDatap);
if(NULL != addr)
{
printf("Redirect URI is %s",addr);
}