Dialogic Dialogic Global Call IP IP Phone User Manual


 
186 Dialogic
®
Global Call IP Technology Guide — November 2007
Dialogic Corporation
IP-Specific Operations
Call utility functions.to retrieve the message type information and individual SIP header fields of
interest.
Note: The application must retrieve the necessary SIP message header field information by copying the
GC_PARM_BLK into its own buffer with gc_util_copy_parm_blk( ) before the next call to
gc_GetMetaEvent( ). Once the next gc_GetMetaEvent( ) call is issued, the header information no
longer available from the metaevent buffer.
Refer to Table 9, “Common Header Fields in Inbound SIP Messages”, on page 175, to see the
correspondence between SIP message type and Global Call event type for common SIP header
fields.
If the application has registered one or more SIP header fields to be received (as described in
Section 4.9.4, “Registering SIP Header Fields to be Retrieved”, on page 180), the
GC_PARM_BLK contains a separate parameter element for each registered field that was present
in the received message. Each of these elements contains the IPSET_SIP_MSGINFO set ID and
the IPPARM_SIP_HDR parameter ID. The associated data buffer contains the entire header field,
complete with name, value, and any optional parameters. It is the application’s responsibility to
parse the data to determine the type of the header field.
Note: If a header field that the application has registered to receive is longer than the maximum parameter
length (as configured via IPCCLIB_STARTDATA.max_parm_data_size at library start-up), the
header field will be truncated in the IPSET_SIP_MSGINFO / IPPARM_SIP_HDR parameter
element. Applications can check for this situation by calling gc_ResultInfo( ) upon receiving any
Global Call event that corresponds to a SIP message. A result value of IPEC_SipHeaderTruncation
indicates that one or more of the SIP header values in the GC_PARM_BLK associated with the
event were truncated.
If the received message contains multiple header field rows with the same field name, there will be
a corresponding multiple set of parameter elements in the GC_PARM_BLK in the same order in
which the multiple rows were arranged in the message header. If any header field contains multiple
values as a comma-delimited list, it is the application’s responsibility to parse the retrieved list and
extract the separate values, as appropriate
The following code snippet illustrates how an application retrieves registered SIP header fields
when a Global Call event has been received. The example assumes that the header field name has
been registered and that the event has already been received.
char siphdr[IP_SIP_HDR_MAXLEN];
GC_PARM_DATA_EXT parm_data;
INIT_GC_PARM_DATA_EXT(&parm_data);
while ((ret = gc_util_next_parm_ex(pParmBlock, &parm_data)) == GC_SUCCESS)
{
switch (parm_data.parm_ID)
{
case IPPARM_SIP_HDR:
strncpy(siphdr, (char*)parm_data.pData, parm_data.data_size);
siphdr[parm_data.data_size]='\0';
sprintf(m_DisplayString, "\t\tGeneric Sip Header = %s", siphdr);
printf("%s", m_DisplayString);
break;
}
}