Dialogic IP Phone 05-2239-009 User Manual

Page of 604
329
Dialogic Corporation
      break;
     :
   }
 :
}
4.26.9
Receiving a Request to Switch from T.38 Fax to Audio
An application may receive a request to switch from a T.38 Fax session back to an audio session. 
The request is received as a GCEV_EXTENSION event that is triggered by a RequestMode 
(H.323) or re-INVITE (SIP) message. Before accepting the incoming request, the application must 
disassociate the T.38 Fax device from the Media device using the gc_SetUserInfo( ) function, then 
continue accepting the request as described in 
INT32 processEvtHandler()
{
   METAEVENT        metaEvent;
   GC_PARM_BLK      *parmblkp = NULL;
   GC_PARM_DATAP    t_gcParmDatap = NULL;
   GC_PARM_BLK      *parmblkp2 = NULL;
   EXTENSIONEVTBLK  *ext_evtblkp = NULL;
   IP_CONNECT       ipConnect;
   :
   switch (evtType)
   {
      case GCEV_EXTENSION:
         /* received extension event, parse PARM_BLK examine 
          * extension data 
          */
         ext_evtblkp = (EXTENSIONEVTBLK *) metaEvent.extevtdatap;
         parmblkp = &ext_evtblkp->parmblk;
         while (t_gcParmDatap = gc_util_next_parm(parmblkp, t_gcParmDatap))
         {
            switch(t_gcParmDatap->set_ID)
            {
               case IPSET_SWITCH_CODEC:
                  switch(t_gcParmDatap->parm_ID)
                  {
                     case IPPARM_AUDIO_REQUESTED:
                        /* disconnect the media and fax devices */
                        ipConnect.version = 0x100;
                        ipConnect.mediaHandle = pline->mediaH;
                        
                        gc_util_insert_parm_ref(&parmblkp2, IPSET_FOIP, IPPARM_T38_DISCONNECT,
                                                sizeof(IP_CONNECT), (void *)(&ipConnect));
                        gc_SetUserInfo(GCTGT_GCLIB_CRN, pline->crn, parmblkp, GC_SINGLECALL);
                        gc_util_delete_parm_blk(parmblkp2);
                        /* accept audio request by example 4.3.3 */
                        acceptCodecSwitchRequest();
                     break;
                     case IPPARM_READY:
                        /* Ready to send and receive audio */
                        gc_Listen();
                     break;
                  }
               break;
               :
            }
         }