Dialogic 05-2239-009 User Manual

Page of 604
281
Dialogic Corporation
   /****** Setting address information ***********/
   IP_REGISTER_ADDRESS registerAddress;
   memset(registerAddress, 0, sizeof(IP_REGISTER_ADDRESS));
   strcpy(registerAddress.reg_server,"101.102.103.104"); /* set server address*/
   if (protocol == IP_PROTOCOL_SIP)
   {
      strcpy(registerAddress.reg_client,"user@10.20.30.40"); /* set alias for SIP*/
   }
   registerAddress.max_hops = regMulticastHops;
   registerAddress.time_to_live = regTimeToLive;
   frc = gc_util_insert_parm_ref(&pParmBlock,
                                 IPSET_REG_INFO,
                                 IPPARM_REG_ADDRESS,
                                 (UINT8)sizeof(IP_REGISTER_ADDRESS),
                                 &registerAddress);
   if (protocol == IP_PROTOCOL_H323)
   {
      /**** SIP does not allow setting of these parm elements ****/
      /****** Setting endpoint type to GATEWAY ***********/
      gc_util_insert_parm_val(&pParmBlock,
                              IPSET_REG_INFO,
                              IPPARM_REG_TYPE,
                              (unsigned char)sizeof(EPType),
                              IP_REG_GATEWAY);
      /****** Setting supportedPrefixes information ***********/
      /****   This parm block may be repeated with different ****
       ****   supported prefixes and supported prefix types  ****/
      frc = gc_util_insert_parm_ref(&pParmBlock,
                                    IPSET_SUPPORTED_PREFIXES,
                                    (unsigned short)IPPARM_ADDRESS_PHONE,
                                    (UINT8)(strlen("011972")+1),
                                    "011972");
   }
   /**** Setting terminalAlias information ****/
   /**** May repeat this line with different addresses and address types ****/
   frc = gc_util_insert_parm_ref (&pParmBlock,
                                  IPSET_LOCAL_ALIAS,
                                  (unsigned short)IPPARM_ADDRESS_EMAIL,
                                  (UINT8)(strlen("someone@someplace.com")+1),
                                  "someone@someplace.com");
   /****** Send the request ***********/
   unsigned long serviceID ;
   int rc = gc_ReqService(GCTGT_CCLIB_NETIF,
                          boarddev,
                          &serviceID,
                          pParmBlock,
                          NULL,
                          EV_ASYNC);
   if (rc != GC_SUCCESS)
   {
      printf("failed in gc_ReqService\n");
      return GC_ERROR;
   }
   gc_util_delete_parm_blk(pParmBlock);
   return GC_SUCCESS;
}