3.4.11. gc_MakeCall( )
Global Call supports multiple IP protocols on a single device. See Section 2.2, Device Types and Usage for more information. When using multi-protocol devices only, the protocol can be specified in the associated GC_MAKECALL_BLK structure. The set ID and parameter ID that should be included in the parameter block are:
When making calls on devices that support multiple protocols, if the application does not explicitly specify a protocol in the makecall block, the default protocol is IP_PROTOCOL_H323. When making calls on devices that support only one protocol, it is not necessary to include an IPSET_PROTOCOL element in the makecall block. If the application tries to include an IPSET_PROTOCOL element in the makecall block that conflicts with the protocol supported by the device, the application receives an error.
Call parameters can be specified when using the gc_MakeCall( ) function. The parameters values specified are only valid for the duration of the current call. At the end of the current call, the default parameter values for the specific line device override these parameter values. Table 2 shows the parameters that are configurable when using H.323 or SIP.
The makecallp parameter of the gc_MakeCall( ) function is a pointer to the GC_MAKECALL_BLK structure. The GC_MAKECALL_BLK structure has a gclib field that points to a GCLIB_MAKECALL_BLK structure. The ext_datap field within the GCLIB_MAKECALL_BLK structure points to a GC_PARM_BLK structure with a list of the parameters to be set as call values. Table 2 describes the parameters that can be accessed through the ext_datap pointer.
- Notes:
- 1. In Table 2, the term "String" implies the normal definition of a character string which can contain letters, numbers, white space, and a null (for termination).
2. The parameter names in Table 2 are more closely associated with H.323 terminology. Corresponding SIP terminology is described in http://www.ietf.org/rfc/rfc3261.txt?number=3261.
GCSET_CHAN_CAPABILITY Note: If no transmit/receive coder type is specified, any supported coder type is accepted.
- IPPARM_LOCAL_CAPABILITY
Datatype: IP_CAPABILITY. See Section 7.4, IP_CAPABILITY for more information.H.323 and SIP IPSET_CALLINFOSee Section 6.3, IPSET_CALLINFO Parameter Set for more information. See Section 4.2, Using Fast Start and Slow Start Setup for more information.
- IPPARM_CONNECTIONMETHOD
Datatype: Enumeration, with one of the following values: IPPARM_CONNECTIONMETHOD_
FASTSTART or IPPARM_CONNECTIONMETHOD_
SLOWSTARTH.323 and SIP H.323 and SIP See Section 4.16, Enabling and Disabling Tunneling in H.323 for more information.
- IPPARM_H245TUNNELING
Datatype: Enumeration with one of the following values: IP_H245TUNNELING_ON or IP_H245TUNNELING_OFF.H.323 only H.323 and SIP H.323 only IPSET_CONFERENCE IPPARM_CONFERENCE_GOAL
Datatype: Enumeration with one of the following values:H.323 only IPSET_NONSTANDARDDATASee Section 6.14, IPSET_NONSTANDARDDATA Parameter Set for more information. EITHER OR
- IPPARM_NONSTANDARDDATA_DATA
Datatype: String, max. length = MAX_NS_PARM_DATA_LENGTH (128).
AND- IPPARM_NONSTANDARDDATA_OBJID
Datatype: Unsigned Int[ ], max. length = MAX_NS_PARM_OBJID_LENGTH (40).H.323 only IPSET_NONSTANDARDCONTROLSee Section 6.15, IPSET_NONSTANDARDCONTROL Parameter Set for more information. EITHER OR
- IPPARM_NONSTANDARDDATA_DATA
Datatype: String, max. length = MAX_NS_PARM_DATA_LENGTH (128).
AND- IPPARM_NONSTANDARDDATA_OBJID
Datatype: Unsigned Int[ ], max. length = MAX_NS_PARM_OBJID_LENGTH (40).H.323 only Forming a Destination Address String for an H.323 Call
The destination address is formed by concatenating values from three different sources: the GC_MAKECALL_BLK, the numberstr parameter of gc_MakeCall( ), and the phone list. The order or precedence of these elements and the rules for forming a destination address are described below.
- Notes:
- 1. The following description refers to a delimited string. The delimiter is configurable by setting the value of the delimiter field in the IP_CCLIB_START_DATA structure used by the gc_Start( ) function.
2. The total length of the address string is limited by the value MAX_ADDRESS_LEN (defined in gclib.h).
3. The destination address must be a valid address that can be translated by the remote node.The destination information string is delimited concatenation of the following strings in the order of precedence shown:
- A string constructed from the destination field of type GCLIB_ADDRESS_BLK in the GCLIB_MAKECALL_BLK.
When specifying the destination information in the GCLIB_ADDRESS_BLK, the address field contains the actual address information and the address_type field defines the type (IP address, name, telephone number) in the address. For example, if the address field is "127.0.0.1", the address_type field must be GCADDRTYPE_IP. Other supported address types are:
- GCADDRTYPE_INTL - International telephone number
- GCADDRTYPE_NAT - National telephone number
- GCADDRTYPE_LOCAL - Local telephone number
- GCADDRTYPE_DOMAIN - Domain name
- GCADDRTYPE_URL - URL name
- GCADDRTYPE_EMAIL - email address
- The numberstr parameter in the gc_MakeCall( ) function. The numberstr parameter is treated as a free string that may be a delimited concatenation of more than one section. The application may include a prefix in a section that maps to a corresponding field in the Setup message. See the Destination Address Interpretation for H.323 and Forming a Destination Address String for a SIP Call sections for more information.
- Phone list as described in Table 2, Configurable Call Parameters (and set using IPSET_CALLINFO, IPPARM_PHONELIST). Phone List is treated as a free string that may be a delimited concatenation of more than one section. The application may prefix a section that maps to a corresponding field in the Setup message. See for more information. See the Destination Address Interpretation for H.323 and Forming a Destination Address String for a SIP Call sections for more information.
Destination Address Interpretation for H.323
Once a destination string is formed as described in the previous section, the H.323 stack treats the string according to the following rules:
- The first section of the string is the destination of the next IP entity (for example, a gateway, terminal, the alias for a remote registered entity, etc.) with which the application attempts to negotiate.
- A non-prefixed section in the string is the Q.931 calledPartyNumber and is the last section that is processed. Any section following the first non-prefixed section is ignored. Only one Q.931 calledPartyNumber is allowed in the destination string.
- One or more prefixed sections (H.225 destinationAddress fields) must appear before the non-prefixed section (Q.931 calledPartyNumber).
- When using free strings (numberstr parameter or Phone List), if the application wants to prefix buffers, valid buffer prefixes for H.225 addresses are:
The following code examples demonstrate the recommended ways of forming the destination string when making an H.323 call. Prerequisite code for setting up the GC_MAKECALL_BLK in all the scenarios described in this section is as follows:
GC_MAKECALL_BLK gcmkbl; GCLIB_MAKECALL_BLK gclib_mkbl = {0}; gcmkbl.cclib = NULL; gcmkbl.gclib = &gclib_mkbl; GC_PARM_BLK *target_datap = NULL; gc_util_insert_parm_val(&target_datap, IPSET_PROTOCOL, IPPARM_PROTOCOL_BITMASK, sizeof(char), IP_PROTOCOL_H323);Scenario 1 - Making a call to a known IP address, and setting the Q.931 calledPartyNumber:
char *pDestAddrBlk = "127.0.0.1"; char *pDestAddrStr = "123456"; /* set GCLIB_ADDRESS_BLK with destination string & type*/ strcpy(gcmkbl.gclib->destination.address,pDestAddrBlk); gcmkbl.gclib->destination.address_type = GCADDRTYPE_IP; gclib_mkbl.ext_datap = target_datap; /* calling the function with the MAKECALL_BLK*/ gc_MakeCall(ldev, &crn, pDestAddrStr, &gcmkbl, MakeCallTimeout,EV_ASYNC);Scenario 2 - Making a call to a known IP address, setting a number of H.225 aliases, and setting the Q.931 calledPartyNumber:
char *pDestAddrBlk = "127.0.0.1"; char *pDestAddrStr = "TEL:111,TEL:222,76543"; /* set GCLIB_ADDRESS_BLK with destination string & type*/ strcpy(gcmkbl.gclib->destination.address,pDestAddrBlk); gcmkbl.gclib->destination.address_type = GCADDRTYPE_IP; gclib_mkbl.ext_datap = target_datap; /* calling the function with the MAKECALL_BLK*/ gc_MakeCall(ldev, &crn, pDestAddrStr, &gcmkbl, MakeCallTimeout,EV_ASYNC);Scenario 3 - Making a call to a known IP address, setting a number of H.225 aliases, and setting the Q.931 calledPartyNumber:
char *pDestAddrBlk = "127.0.0.1"; char *pDestAddrStr = "TEL:111,TEL:222,NAME:myName"; char *IpPhoneList= "003227124311"; /* insert phone list */ gc_util_insert_parm_ref(&target_datap, IPSET_CALLINFO, IPPARM_PHONELIST, (unsigned char)(strlen(IpPhoneList)+1), IpPhoneList); /* set GCLIB_ADDRESS_BLK with destination string & type*/ strcpy(gcmkbl.gclib->destination.address,pDestAddrBlk); gcmkbl.gclib->destination.address_type = GCADDRTYPE_IP; gclib_mkbl.ext_datap = target_datap; /* calling the function with the MAKECALL_BLK*/ gc_MakeCall(ldev, &crn, pDestAddrStr, &gcmkbl, MakeCallTimeout,EV_ASYNC);Scenario 4 - Making a call to a known IP address, setting a number of H.225 aliases, and setting the Q.931 calledPartyNumber:
char *pDestAddrBlk = "127.0.0.1"; char *IpPhoneList= "TEL:003227124311,TEL:444,TEL:222,TEL:1234,171717"; /* insert phone list */ gc_util_insert_parm_ref(&target_datap, IPSET_CALLINFO, IPPARM_PHONELIST, (unsigned char)(strlen(IpPhoneList)+1), IpPhoneList); gclib_mkbl.ext_datap = target_datap; /* set GCLIB_ADDRESS_BLK with destination string & type*/ strcpy(gcmkbl.gclib->destination.address,pDestAddrBlk); gcmkbl.gclib->destination.address_type = GCADDRTYPE_IP; gclib_mkbl.ext_datap = target_datap; /* calling the function with the MAKECALL_BLK, and numberstr parameter = NULL */ gc_MakeCall(ldev, &crn, NULL, &gcmkbl, MakeCallTimeout,EV_ASYNC);Scenario 5 - While registered, making a call, via the gatekeeper, to a registered entity (using a known H.323 ID), setting a number of H.225 aliases, and setting the Q.931 calledPartyNumber:
char *pDestAddrBlk = " RegisteredRemoteGW "; /* The alias of the remote (registered) entity */ char *pDestAddrStr = "TEL:111,TEL:222,987654321"; /* set GCLIB_ADDRESS_BLK with destination string & type (H323-ID) */ strcpy(gcmkbl.gclib->destination.address,pDestAddrBlk); gcmkbl.gclib->destination.address_type = GCADDRTYPE_DOMAIN; gclib_mkbl.ext_datap = target_datap; /* calling the function with the MAKECALL_BLK */ gc_MakeCall(ldev, &crn, pDestAddrStr, &gcmkbl, MakeCallTimeout,EV_ASYNC);Scenario 6 - While registered, making a call, via the gatekeeper, to a registered entity (using a known e-mail address), setting a number of H.225 aliases, and setting the Q.931 calledPartyNumber:
char *pDestAddrBlk = " user@host.com "; /* The alias of the remote (registered) entity */ char *pDestAddrStr = "TEL:111,TEL:222,987654321"; /* set GCLIB_ADDRESS_BLK with destination string & type (EMAIL) */ strcpy(gcmkbl.gclib->destination.address,pDestAddrBlk); gcmkbl.gclib->destination.address_type = GCADDRTYPE_EMAIL; gclib_mkbl.ext_datap = target_datap; /* calling the function with the MAKECALL_BLK */ gc_MakeCall(ldev, &crn, pDestAddrStr, &gcmkbl, MakeCallTimeout,EV_ASYNC);Scenario 7 - While registered, making a call, via the gatekeeper, to a registered entity (using a known URL), setting a number of H.225 aliases, and setting the Q.931 calledPartyNumber:
char *pDestAddrBlk = "www.gw1.intel.com"; /* The alias of the remote (registered) entity */ char *pDestAddrStr = "TEL:111,TEL:222,987654321"; /* set GCLIB_ADDRESS_BLK with destination string & type (URL) */ strcpy(gcmkbl.gclib->destination.address,pDestAddrBlk); gcmkbl.gclib->destination.address_type = GCADDRTYPE_URL; gclib_mkbl.ext_datap = target_datap; /* calling the function with the MAKECALL_BLK */ gc_MakeCall(ldev, &crn, pDestAddrStr, &gcmkbl, MakeCallTimeout,EV_ASYNC);Forming a Destination Address String for a SIP Call
The format of the destination address for a SIP call is:
user@host; param=value
- user - A user name or phone number.
- host - A domain name or an IP address.
- param=value - An optional additional parameter.
When making a SIP call, the destination address is formed according to the following rules in the order of precedence shown:
- If Phone List (as described in Table 2, Configurable Call Parameters and identified by IPSET_CALLINFO, IPPARM_PHONELIST) exists, it is taken to construct the global destination-address-string.
- If the destination address field (of type GCLIB_ADDRESS_BLK in GCLIB_MAKECALL_BLK) exists, it is taken to construct the global destination-address-string. The address_type in GCLIB_ADDRESS_BLK is ignored. If the global destination-address-string is not empty before setting the parameter, an "@" delimiter is used to separate the two parts.
- If the numberstr parameter from the gc_MakeCall( ) function exists, it is taken to destination-address-string. If the global destination-address-string is not empty before setting the parameter, a ";" delimiter is used to separate the two parts.
- Note: To observe the logic described above, the application may use only one of the API's to send a string that is a valid SIP address.
The following code examples demonstrate the recommended ways of forming the destination string when making a SIP call. Prerequisite code for setting up the GC_MAKECALL_BLK in all the scenarios described in this section is as follows:
GC_MAKECALL_BLK gcmkbl; GCLIB_MAKECALL_BLK gclib_mkbl = {0}; gcmkbl.cclib = NULL; gcmkbl.gclib = &gclib_mkbl; GC_PARM_BLK *target_datap = NULL; gc_util_insert_parm_val(&target_datap, IPSET_PROTOCOL, IPPARM_PROTOCOL_BITMASK, sizeof(char), IP_PROTOCOL_SIP);Scenario 1 - Making a SIP call to a known IP address, where the complete address (user@host) is specified in the makecall block:
char *pDestAddrBlk = "11223344@127.0.0.1"; /* where "11223344" is the phone number of the user and "127.0.0.1" is the IP address of the host */ /* set GCLIB_ADDRESS_BLK with destination string & type*/ strcpy(gcmkbl.gclib->destination.address,pDestAddrBlk); gcmkbl.gclib->destination.address_type = GCADDRTYPE_TRANSPARENT; /* calling the function with the MAKECALL_BLK, and numberstr parameter=NULL the INVITE dest address will be: 11223344@127.0.0.1 */ gc_MakeCall(ldev, &crn, NULL, &gcmkbl, MakeCallTimeout, EV_ASYNC);Scenario 2 - Making a SIP call to a known IP address, where the complete address (user@host) is formed by the combination of the destination address in the makecall block and the phone list element:
char *pDestAddrBlk = "127.0.0.1"; /*host*/ char *IpPhoneList = "003227124311"; /*user*/ /* insert phone list */ gc_util_insert_parm_ref(&target_datap, IPSET_CALLINFO, IPPARM_PHONELIST, (unsigned char)(strlen(IpPhoneList)+1), IpPhoneList); /* set GCLIB_ADDRESS_BLK with destination string & type*/ strcpy(gcmkbl.gclib->destination.address,pDestAddrBlk); gcmkbl.gclib->destination.address_type = GCADDRTYPE_TRANSPARENT; gclib_mkbl.ext_datap = target_datap; /* calling the function with the MAKECALL_BLK, and numberstr parameter = NULL the INVITE dest address will be: 003227124311@127.0.0.1 */ gc_MakeCall(ldev, &crn, NULL, &gcmkbl, MakeCallTimeout,EV_ASYNC);Scenario 3 - Making a SIP call to a known IP address, where the complete address (user@host) is formed by the combination of the destination address in the makecall block, a phone list element, and optional parameter (user=phone):
char *pDestAddrBlk = "127.0.0.1"; /*host*/ char *IpPhoneList= "003227124311"; /*user*/ char *pDestAddrStr = "user=phone"; /*extra parameter*/ /* insert phone list */ gc_util_insert_parm_ref(&target_datap, IPSET_CALLINFO, IPPARM_PHONELIST, (unsigned char)(strlen(IpPhoneList)+1), IpPhoneList); /* set GCLIB_ADDRESS_BLK with destination string & type*/ strcpy(gcmkbl.gclib->destination.address,pDestAddrBlk); gcmkbl.gclib->destination.address_type = GCADDRTYPE_TRANSPARENT; gclib_mkbl.ext_datap = target_datap; /* calling the function with the MAKECALL_BLK, and numberstr parameter = NULL the INVITE dest address will be: 003227124311@127.0.0.1;user=phone */ gc_MakeCall(ldev, &crn, pDestAddrStr, &gcmkbl, MakeCallTimeout,EV_ASYNC);Origination Address Information
The origination address can be specified in the origination field of type GCLIB_ADDRESS_BLK in the GCLIB_MAKECALL_BLK structure. The address field in the GCLIB_ADDRESS_BLK contains the actual address and the address_type field in the GCLIB_ADDRESS_BLK structure defines the type (IP address, name, telephone number) in the address field.
- Note: The total length of the address string is limited by the value MAX_ADDRESS_LEN (defined in gclib.h).
The origination address can be set using the gc_SetCallingNum( ) function, which is a deprecated function. The preferred equivalent is gc_SetConfigData( ). See the Global Call API Library Reference for more information.
Specifying a Timeout
The timeout parameter of the gc_MakeCall( ) function specifies the maximum time in seconds to wait for the establishment of a new call, after receiving the first response to the call. This value corresponds to the Q.931\connectTimeOut parameter. If the call is not established during this time, the Disconnect procedure is initiated. The default value is 120 seconds.
When using H.323, two other parameters that affect the timeout behavior, but are not configurable are:
- Q931\responseTimeOut: The maximum time in seconds to wait for the first response to a new call. If no response is received during this time, the Disconnect procedure is initiated. The default value is 4 seconds.
- h245\timeout: The maximum time in seconds to wait for the called party to acknowledge receipt of the capabilities it sent. The default value is 40 seconds.
- Note: When using the H.323 protocol, the application may receive a timeout when trying to make an outbound call if network congestion is encountered and a TCP connection cannot be established. In this case, the SETUP message is not sent on the network.
Code Example for H.323
The following code example shows how to make a call using the H.323 protocol.
/* Make an H323 IP call on line device ldev */ void MakeH323IpCall(LINEDEV ldev) { char *IpDisplay = "This is a Display"; /* display data */ char *IpPhoneList= "003227124311"; /* phone list */ char *IpUUI = "This is a UUI"; /* user to user information string */ char *pDestAddrBlk = "127.0.0.1"; /* destination IP address for MAKECALL_BLK*/ char *pSrcAddrBlk = "987654321"; /* origination address for MAKECALL_BLK*/ char *pDestAddrStr = "123456"; /* destination string for gc_MakeCall() function*/ char *IpNSDataData = "This is an NSData data string"; char *IpNSControlData = "This is an NSControl data string"; char *IpCommonObjId = "1 22 333 4444"; /* unique format */ IP_H221NONSTANDARD appH221NonStd; appH221NonStd.country_code = 181; /* USA */ appH221NonStd.extension = 11; appH221NonStd.manufacturer_code = 11; int ChoiceOfNSData = 1; int ChoiceOfNSControl = 1; int rc = 0; CRN crn; GC_MAKECALL_BLK gcmkbl; int MakeCallTimeout = 120; /* initialize GCLIB_MAKECALL_BLK structure */ GCLIB_MAKECALL_BLK gclib_mkbl = {0}; /* set to NULL to retrieve new parameter block from utility function */ GC_PARM_BLK *target_datap = NULL; gcmkbl.cclib = NULL; /* CCLIB pointer unused */ gcmkbl.gclib = &gclib_mkbl; /* set GCLIB_ADDRESS_BLK with destination string & type*/ strcpy(gcmkbl.gclib->destination.address,pDestAddrBlk); gcmkbl.gclib->destination.address_type = GCADDRTYPE_IP; /* set GCLIB_ADDRESS_BLK with origination string & type*/ strcpy(gcmkbl.gclib->origination.address,pSrcAddrBlk); gcmkbl.gclib->origination.address_type = GCADDRTYPE_NAT; /* set signaling PROTOCOL to H323. default is H323 if device is multi-protocol */ rc = gc_util_insert_parm_val(&target_datap, IPSET_PROTOCOL, IPPARM_PROTOCOL_BITMASK, sizeof(char), IP_PROTOCOL_H323); /* initialize IP_CAPABILITY structure */ IP_CAPABILITY t_Capability = {0}; /* configure a GC_PARM_BLK with four coders, display, phone list and UUI message: */ /* specify and insert first capability parameter data for G.7231 coder */ t_Capability.type = GCCAPTYPE_AUDIO; t_Capability.direction = IP_CAP_DIR_LCLTRANSMIT; t_Capability.extra.audio.VAD = GCPV_DISABLE; t_Capability.extra.audio.frames_per_pkt = 1; t_Capability.capability = GCCAP_AUDIO_g7231_6_3k; rc = gc_util_insert_parm_ref(&target_datap, GCSET_CHAN_CAPABILITY, IPPARM_LOCAL_CAPABILITY, sizeof(IP_CAPABILITY), &t_Capability); t_Capability.type = GCCAPTYPE_AUDIO; t_Capability.direction = IP_CAP_DIR_LCLRECEIVE; t_Capability.extra.audio.VAD = GCPV_DISABLE; t_Capability.extra.audio.frames_per_pkt = 1; t_Capability.capability = GCCAP_AUDIO_g7231_6_3k; rc = gc_util_insert_parm_ref(&target_datap, GCSET_CHAN_CAPABILITY, IPPARM_LOCAL_CAPABILITY, sizeof(IP_CAPABILITY), &t_Capability); /* specify and insert second capability parameter data for G.7229AnnexA coder */ /* changing only frames per pkt and the coder type from first capability: */ t_Capability.extra.audio.frames_per_pkt = 3; t_Capability.capability = GCCAP_AUDIO_g729AnnexA; rc = gc_util_insert_parm_ref(&target_datap, GCSET_CHAN_CAPABILITY, IPPARM_LOCAL_CAPABILITY, sizeof(IP_CAPABILITY), &t_Capability); /* specify and insert 3rd capability parameter data for G.711Alaw 64kbit coder */ /* changing only frames per pkt and the coder type from first capability: */ t_Capability.capability = GCCAP_AUDIO_g711Alaw64k; t_Capability.extra.audio.frames_per_pkt = 10; /* For G.711 use frame size (ms) here, frames per packet fixed at 1 fpp */ rc = gc_util_insert_parm_ref(&target_datap, GCSET_CHAN_CAPABILITY, IPPARM_LOCAL_CAPABILITY, sizeof(IP_CAPABILITY), &t_Capability); /* specify and insert fourth capability parameter data for G.711 Ulaw 64kbit coder */ /* changing only the coder type from previous capability */ t_Capability.capability = GCCAP_AUDIO_g711Ulaw64k; rc = gc_util_insert_parm_ref(&target_datap, GCSET_CHAN_CAPABILITY, IPPARM_LOCAL_CAPABILITY, sizeof(IP_CAPABILITY), &t_Capability); /* insert display string */ rc = gc_util_insert_parm_ref(&target_datap, IPSET_CALLINFO, IPPARM_DISPLAY, (unsigned char)(strlen(IpDisplay)+1), IpDisplay); /* insert phone list */ rc = gc_util_insert_parm_ref(&target_datap, IPSET_CALLINFO, IPPARM_PHONELIST, (unsigned char)(strlen(IpPhoneList)+1), IpPhoneList); /* insert user to user information */ rc = gc_util_insert_parm_ref(&target_datap, IPSET_CALLINFO, IPPARM_USERUSER_INFO, (unsigned char)(strlen(IpUUI)+1), IpUUI); /* setting NS Data elements */ gc_util_insert_parm_ref(&target_datap, IPSET_NONSTANDARDDATA, IPPARM_NONSTANDARDDATA_DATA, (unsigned char)(strlen(IpNSDataData)+1), IpNSDataData); if(ChoiceOfNSData) /* App chooses in advance which type of */ { /* second NS element to use */ gc_util_insert_parm_ref(&target_datap, IPSET_NONSTANDARDDATA, IPPARM_H221NONSTANDARD, sizeof(IP_H221NONSTANDARD), &appH221NonStd); } else { gc_util_insert_parm_ref(&target_datap, IPSET_NONSTANDARDDATA, IPPARM_NONSTANDARDDATA_OBJID, (unsigned char)(strlen(IpCommonObjId)+1), IpCommonObjId); } /* setting NS Control elements */ gc_util_insert_parm_ref(&target_datap, IPSET_NONSTANDARDCONTROL, IPPARM_NONSTANDARDDATA_DATA, (unsigned char)(strlen(IpNSControlData)+1), IpNSControlData); if(ChoiceOfNSControl) /* App chooses in advance which type of */ { /* second NS element to use */ gc_util_insert_parm_ref(&target_datap, IPSET_NONSTANDARDCONTROL, IPPARM_H221NONSTANDARD, sizeof(IP_H221NONSTANDARD), &appH221NonStd); } else { gc_util_insert_parm_ref(&target_datap, IPSET_NONSTANDARDCONTROL, IPPARM_NONSTANDARDDATA_OBJID, (unsigned char)(strlen(IpCommonObjId)+1), IpCommonObjId); } if(rc == 0) { gclib_mkbl.ext_datap = target_datap; rc = gc_MakeCall(ldev, &crn, pDestAddrStr, &gcmkbl, MakeCallTimeout, EV_ASYNC); /* deallocate GC_PARM_BLK pointer */ gc_util_delete_parm_blk(target_datap); } }Code Example for SIP
The following code example shows how to make a call using the SIP protocol.
/* Make a SIP IP call on line device ldev */ void MakeSipIpCall(LINEDEV ldev) { char *IpDisplay = "This is a Display"; /* display data */ char *pDestAddrBlk = "12345@127.0.0.1"; /* destination IP address for MAKECALL_BLK */ char *pSrcAddrBlk = "987654321"; /* origination address for MAKECALL_BLK*/ int rc = 0; CRN crn; GC_MAKECALL_BLK gcmkbl; int MakeCallTimeout = 120; /* initialize GCLIB_MAKECALL_BLK structure */ GCLIB_MAKECALL_BLK gclib_mkbl = {0}; /* set to NULL to retrieve new parameter block from utility function */ GC_PARM_BLK *target_datap = NULL; gcmkbl.cclib = NULL; /* CCLIB pointer unused */ gcmkbl.gclib = &gclib_mkbl; /* set GCLIB_ADDRESS_BLK with destination string & type*/ strcpy(gcmkbl.gclib->destination.address,pDestAddrBlk); gcmkbl.gclib->destination.address_type = GCADDRTYPE_TRANSPARENT; /* set GCLIB_ADDRESS_BLK with origination string & type*/ strcpy(gcmkbl.gclib->origination.address,pSrcAddrBlk); gcmkbl.gclib->origination.address_type = GCADDRTYPE_TRANSPARENT; /* set signaling PROTOCOL to SIP*/ rc = gc_util_insert_parm_val(&target_datap, IPSET_PROTOCOL, IPPARM_PROTOCOL_BITMASK, sizeof(char), IP_PROTOCOL_SIP); /* initialize IP_CAPABILITY structure */ IP_CAPABILITY t_Capability = {0}; /* configure a GC_PARM_BLK with four coders, display, phone list and UUI message: */ /* specify and insert first capability parameter data for G.7231 coder */ t_Capability.type = GCCAPTYPE_AUDIO; t_Capability.direction = IP_CAP_DIR_LCLTRANSMIT; t_Capability.extra.audio.VAD = GCPV_DISABLE; t_Capability.extra.audio.frames_per_pkt = 1; t_Capability.capability = GCCAP_AUDIO_g7231_6_3k; rc = gc_util_insert_parm_ref(&target_datap, GCSET_CHAN_CAPABILITY, IPPARM_LOCAL_CAPABILITY, sizeof(IP_CAPABILITY), &t_Capability); t_Capability.type = GCCAPTYPE_AUDIO; t_Capability.direction = IP_CAP_DIR_LCLRECEIVE; t_Capability.extra.audio.VAD = GCPV_DISABLE; t_Capability.extra.audio.frames_per_pkt = 1; t_Capability.capability = GCCAP_AUDIO_g7231_6_3k; rc = gc_util_insert_parm_ref(&target_datap, GCSET_CHAN_CAPABILITY, IPPARM_LOCAL_CAPABILITY, sizeof(IP_CAPABILITY), &t_Capability); /* specify and insert second capability parameter data for G.7229AnnexA coder */ /* changing only frames per pkt and the coder type from first capability: */ t_Capability.extra.audio.frames_per_pkt = 3; t_Capability.capability = GCCAP_AUDIO_g729AnnexA; rc = gc_util_insert_parm_ref(&target_datap, GCSET_CHAN_CAPABILITY, IPPARM_LOCAL_CAPABILITY, sizeof(IP_CAPABILITY), &t_Capability); /* specify and insert 3rd capability parameter data for G.711Alaw 64kbit coder */ /* changing only frames per pkt and the coder type from first capability: */ t_Capability.capability = GCCAP_AUDIO_g711Alaw64k; t_Capability.extra.audio.frames_per_pkt = 10; /* For G.711 use frame size (ms) here, frames per packet fixed at 1 fpp */ rc = gc_util_insert_parm_ref(&target_datap, GCSET_CHAN_CAPABILITY, IPPARM_LOCAL_CAPABILITY, sizeof(IP_CAPABILITY), &t_Capability); /* specify and insert fourth capability parameter data for G.711 Ulaw 64kbit coder */ /* changing only the coder type from previous capability */ t_Capability.capability = GCCAP_AUDIO_g711Ulaw64k; rc = gc_util_insert_parm_ref(&target_datap, GCSET_CHAN_CAPABILITY, IPPARM_LOCAL_CAPABILITY, sizeof(IP_CAPABILITY), &t_Capability); /* insert display string */ rc = gc_util_insert_parm_ref(&target_datap, IPSET_CALLINFO, IPPARM_DISPLAY, (unsigned char)(strlen(IpDisplay)+1), IpDisplay); if (rc == 0) { gclib_mkbl.ext_datap = target_datap; /* numberstr parameter may be NULL if MAKECALL_BLK is set, as secondary address is ignored in SIP */ rc = gc_MakeCall(ldev, &crn, NULL, &gcmkbl, MakeCallTimeout,EV_ASYNC); /* deallocate GC_PARM_BLK pointer */ gc_util_delete_parm_blk(target_datap); } }
Click here to contact Telecom Support Resources
Copyright 2003, Intel Corporation