Dialogic IP Phone 05-2239-009 User Manual

Page of 604
4.13.3
Receiving an INFO Message
When the SIP stack receives an incoming SIP INFO message, it generates a GCEV_CALLINFO 
event to the application. 
The application can extract standard message header fields from the parameter block associated 
with the GCEV_CALLINFO event using the technique described in 
, on page 185. If the message contains MIME-encoded information in its 
body (as many INFO messages do), the application can use the technique described in 
, on page 191 to extract the information. 
The application must retrieve the necessary SIP message header and body information by copying 
it into its own buffer before the next call to 
. Once the next 
 call is issued, the message information is no longer available from the 
metaevent buffer. 
The following code snippet illustrates the essential process for extracting INFO message header 
information from a Call Info event.
switch(metaeventp->evttype)
{
   case GCEV_CALLINFO:
      pParmBlock = (GC_PARM_BLK*)(metaeventp->extevtdatap);
      parmp = NULL;
      /* going thru each parameter block data*/
      while ((parmp = gc_util_next_parm(pParmBlock,parmp)) != 0)
      {
         switch (parmp->set_ID)
         {
            /* Handle SIP message information */
            case IPSET_SIP_MSGINFO:
               switch (parmp->parm_ID)
               {
                  case IPPARM_REQUEST_URI:
                     strncpy(requestURI,(char*)parmp->value_buf,parmp->value_size);
                     sprintf(str, "gc_util_next_parm() Success, Request URI = %s",requestURI);
                     break;
                  case IPPARM_CONTACT_URI:
                     .
                     .
                     break;
                  case IPPARM_DIVERSION_URI:
                     .
                     .
                     break;
                   .
                   .
               }
               break;
            .
            .
         // etc.
            .
            .
         }
         break;
      }
      break;
}