4.12.5. Deregistration Code Example
The following code example shows how to populate a GC_PARM_DATA structure that can be used to deregister an endpoint with a gatekeeper (H.323). The GC_PARM_DATA structure contains the following deregistration information:
- The type of operation (in this case, deregister) and sub-operation (do not retain the registration information locally).
- Two mandatory parameters required by the generic gc_ReqService( ) function
- The protocol type, in this case H.323.
void unregister() { GC_PARM_BLKP pParmBlock = NULL; unsigned long serviceID = 1; int rc,frc; int gc_error; // GC error code int cclibid; // Call Control library ID for gc_ErrorValue long cc_error; // Call Controll library error code char *resultmsg; // String associated with cause code char *lib_name; // Library name for cclibid gc_util_insert_parm_val(&pParmBlock, IPSET_REG_INFO, IPPARM_OPERATION_DEREGISTER, sizeof(unsigned char), IP_REG_DELETE_ALL); frc = gc_util_insert_parm_val(&pParmBlock, GCSET_SERVREQ, PARM_REQTYPE, sizeof(unsigned char), IP_REQTYPE_REGISTRATION); if (frc != GC_SUCCESS) { printf("failed in PARM_REQTYPE\n"); termapp(); } frc = gc_util_insert_parm_val(&pParmBlock, GCSET_SERVREQ, PARM_ACK, sizeof(unsigned char), IP_REQTYPE_REGISTRATION); if (frc != GC_SUCCESS) { printf("failed in PARM_ACK\n"); termapp(); } frc = gc_util_insert_parm_val(&pParmBlock, IPSET_PROTOCOL, IPPARM_PROTOCOL_BITMASK, sizeof(char), IP_PROTOCOL_H323); /*can be H323, SIP or Both*/ if (frc != GC_SUCCESS) { printf("failed in IPSET_PROTOCOL\n"); termapp(); } rc = gc_ReqService(GCTGT_CCLIB_NETIF, brddev, &serviceID, pParmBlock, NULL, EV_ASYNC); if ( GC_SUCCESS != rc) { printf("gc_ReqService failed while unregestering\n"); if (gc_ErrorValue(&gc_error, &cclibid, &cc_error) != GC_SUCCESS) { printf("gc_Start() failed: Unable to retrieve error value\n"); } else { gc_ResultMsg(LIBID_GC, (long) gc_error, &resultmsg); printf("gc_ReqService() failed: gc_error=0x%X: %s\n", gc_error, resultmsg); gc_ResultMsg(cclibid, cc_error, &resultmsg); gc_CCLibIDToName(cclibid, &lib_name); printf("%s library had error 0x%lx - %s\n", lib_name, cc_error, resultmsg); } gc_util_delete_parm_blk(pParmBlock); exit(0); } printf("Unregister request to the GK was sent ...\n"); printf("the application will not be able to make calls !!! so it will EXIT\n"); gc_util_delete_parm_blk(pParmBlock); return; }
Click here to contact Telecom Support Resources
Copyright 2003, Intel Corporation