Dialogic 05-2239-009 User Manual

Page of 604
280
Dialogic Corporation
4.22.4.1
Registration Example
The following code example shows how to populate a GC_PARM_BLK structure that can be used 
to register an endpoint with a gatekeeper (H.323) or registrar (SIP). The GC_PARM_BLK structure 
contains the following registration information: 
two mandatory parameters required by the generic gc_ReqService( ) function 
the protocol type (H.323 or SIP) 
the type of operation (register/deregister) and sub-operation (set information, add information, 
delete by value, delete all) 
the IP address to be registered 
the endpoint type to register as 
a number of local aliases 
a number of supported prefixes 
int boardRegistration(IN LINEDEV boarddev, IN char protocol)
{
   GC_PARM_BLKP pParmBlock = NULL;
   int frc = GC_SUCCESS;
   if (protocol != IP_PROTOCOL_H323 && protocol != IP_PROTOCOL_SIP )
   {
      printf("failed bad protocol identifier.\n");
      return GC_ERROR;
   }
   /****** Two (mandatory) elements that are not related directly to 
    the server-client negotiation ********/
   frc = gc_util_insert_parm_val(&pParmBlock,
                                 GCSET_SERVREQ,
                                 PARM_REQTYPE,
                                 sizeof(char),
                                 IP_REQTYPE_REGISTRATION);
   frc = gc_util_insert_parm_val(&pParmBlock,
                                 GCSET_SERVREQ,
                                 PARM_ACK,
                                 sizeof(char),
                                 1);
   /******Setting the protocol target***********/
   frc = gc_util_insert_parm_val(&pParmBlock,
                                 IPSET_PROTOCOL,
                                 IPPARM_PROTOCOL_BITMASK,
                                 sizeof(char),
                                 protocol);  /*can be H323 or SIP*/
   /****** Setting the operation to perform ***********/
   frc = gc_util_insert_parm_val(&pParmBlock,
                                 IPSET_REG_INFO,
                                 IPPARM_OPERATION_REGISTER, /* can be Register or Deregister */
                                 sizeof(char),
                                 IP_REG_SET_INFO);  /* can be other relevant "sub" operations */