
Description | Termination Events | Cautions | Example | Errors | See Also
Name: |
int cc_MakeCall(linedev, crnp, numberstr, makecallp, timeout, mode) | |
Inputs: |
LINEDEV linedev |
|
CRN *crnp |
| |
char *numberstr |
| |
MAKECALL_BLK *makecallp |
| |
int timeout |
| |
unsigned long mode |
| |
Returns: |
0 on success | |
Includes: |
cclib.h | |
Category: |
Call control | |
Mode: |
synchronous or asynchronous | |
Technology: |
BRI/2; BRI/SC; PRI (all protocols) | |
The cc_MakeCall( ) function allows the application to request a connection to make an outgoing call on the specified line device or, for the call waiting feature, on the specified board device (BRI and Windows only). When this function is issued asynchronously, a call reference number (CRN) is assigned and returned immediately if the function is successful. If the function is issued synchronously, the CRN will be available at the successful completion of the function. All subsequent communications between the application and the driver regarding the call use the CRN as a reference.
Parameter |
Description |
linedev: |
The line device handle or, for applications using the call waiting feature, the board device handle (BRI and Windows only). |
crnp: |
Pointer to the buffer where the call reference number will be stored. |
numberstr: |
The destination (called party 's) telephone number string. The maximum length is 32 digits. |
makecallp: |
The pointer to the MAKECALL_BLK structure, which is a list of parameters used to specify the outgoing call. See Section 6.8. MAKECALL_BLK for a description of the MAKECALL_BLK structure and for definitions and possible values for the parameters contained in the structure. For information on initializing the MAKECALL_BLK structure, see Section 6.8.1. MAKECALL_BLK Initialization. |
timeout: |
The amount of time (in seconds) during which the call must be established. (Used in synchronous mode only.) If the timeout value expires before the remote end answers the call, then the cc_MakeCall( ) function returns -1. Setting the timeout parameter to 0 causes this parameter to be ignored. |
mode: |
Specifies asynchronous (EV_ASYNC) or synchronous (EV_SYNC) mode. |
#include <windows.h> /* For Windows applications only */
#include <stdio.h>
#include <errno.h>
#include "srllib.h"
#include "dtilib.h"
#include "cclib.h"
void build_makecall_blk( MAKECALL_BLK *makecall_blk )
void main()
{
LINEDEV devhdl = 0;
CRN crn = 0;
char *devname = "dtiB1T1";
MAKECALL_BLK makecall_blk;
if ( cc_Open(&devhdl, devname, 0 ) < 0 )
{
printf("Error opening device: errno = %d\n", errno);
exit(1);
}
/* initialize the MAKECALL Block */
build_makecall_blk(&makecall_blk)
if ( cc_MakeCall(devhdl, &crn, "9933000", &makecall_blk, 30, EV_SYNC) < 0 )
procdevfail(devhdl);
.
.
.
.
.
if ( cc_DropCall(crn, NORMAL_CLEARING, EV_SYNC) < 0 )
callfail(crn);
if ( cc_ReleaseCall(crn) < 0 )
callfail(crn);
if ( cc_Close( devhdl ) < 0 )
printf("Error closing device, errno = %d\n", errno);
}
int callfail(CRN crn)
{
LINEDEV ld;
cc_CRN2LineDev(crn,&ld);
procdevfail(ld);
}
int procdevfail(LINEDEV handle)
{
int reason;
char *msg;
reason = cc_CauseValue(handle);
cc_ResultMsg(handle,reason,&msg);
printf("reason = %x - %s\n",reason,msg);
}
void build_makecall_blk( MAKECALL_BLK *makecall_blk )
{
memset(makecall_blk,0xff,sizeof(MAKECALL_BLK));
makecall_blk->isdn.BC_xfer_cap = BEAR_CAP_SPEECH;
makecall_blk->isdn.BC_xfer_mode = ISDN_ITM_CIRCUIT;
makecall_blk->isdn.BC_xfer_rate = BEAR_RATE_64KBPS;
makecall_blk->isdn.facility_coding_value = ISDN_CPN;
makecall_blk->isdn.destination_number_type = NAT_NUMBER;
makecall_blk->isdn.destination_number_plan = ISDN_NUMB_PLAN;
makecall_blk->isdn.origination_number_type = ISDN_NOTUSED;
makecall_blk->isdn.origination_number_plan = ISDN_NOTUSED;
makecall_blk->isdn.origination_phone_number[0] = '\0';
makecall_blk->isdn.facility_feature_service = ISDN_SERVICE;
makecall_blk->isdn.usrinfo_layer1_protocol = ISDN_UIL1_G711ULAW;
makecall_blk->isdn.usr_rate = ISDN_NOTUSED;
makecall_blk->isdn.usrinfo_bufp = NULL;
makecall_blk->isdn.nsfc_bufp = NULL;
makecall_blk->isdn.destination_sub_number_type = OSI_SUB_ADDR;
makecall_blk->isdn.destination_sub_phone_number[0] = 1;
makecall_blk->isdn.destination_sub_phone_number[1] = 2;
makecall_blk->isdn.destination_sub_phone_number[2] = 3;
makecall_blk->isdn.destination_sub_phone_number[3] = '\0';
makecall_blk->isdn.u.bri.channel_id.channel = NO_BCHAN;
makecall_blk->isdn.u.bri.channel_id.channel_mode = PREFFERED;
}
Call Waiting Example (Windows Only):
#include <windows.h>
#include <stdio.h>
#include <errno.h>
#include "srllib.h"
#include "dtilib.h"
#include "cclib.h"
/** Function prototypes **/
void build_makecall_blk( MAKECALL_BLK *makecall_blk );
int callfail(CRN crn);
int procdevfail(LINEDEV handle);
void main( )
{
CRN crn = 0;
CHAN_ID chanId;
LINEDEV devhdl = 0;
char *devname = "dtiB1";
MAKECALL_BLK makecall_blk;
if ( cc_Open(&devhdl, devname, 0 ) < 0 )
{
printf("Error opening device, errno = %d\n", errno);
exit(1);
}
/* initialize the MAKECALL Block */
build_makecall_blk(&makecall_blk);
if ( cc_MakeCall(devhdl,&crn,"9933000",&makecall_blk,30,EV_SYNC) < 0 )
procdevfail(devhdl);
cc_GetChanId(&crn, &chanId);
printf("The call is conducted on channel %d\n", chanId.channel);
.
.
.
if ( cc_DropCall(crn, NORMAL_CLEARING, EV_SYNC) < 0 )
callfail(crn);
if ( cc_ReleaseCall(crn) < 0 )
callfail(crn);
if ( cc_Close( devhdl ) < 0 )
printf("Error closing device, errno = %d\n", errno);
}
int callfail(CRN crn)
{
LINEDEV ld;
cc_CRN2LineDev(crn,&ld);
procdevfail(ld);
}
int procdevfail(LINEDEV handle)
{
int reason;
char *msg;
reason = cc_CauseValue(handle);
cc_ResultMsg(handle,reason,&msg);
printf("reason = %x - %s\n",reason,msg);
}
void build_makecall_blk( MAKECALL_BLK *makecall_blk )
{
memset(makecall_blk,0xff,sizeof(MAKECALL_BLK));
makecall_blk->isdn.BC_xfer_cap = BEAR_CAP_SPEECH;
makecall_blk->isdn.BC_xfer_mode = ISDN_ITM_CIRCUIT;
makecall_blk->isdn.BC_xfer_rate = BEAR_RATE_64KBPS;
makecall_blk->isdn.facility_coding_value = ISDN_CPN;
makecall_blk->isdn.destination_number_type = NAT_NUMBER;
makecall_blk->isdn.destination_number_plan = ISDN_NUMB_PLAN;
makecall_blk->isdn.origination_number_type = ISDN_NOTUSED;
makecall_blk->isdn.origination_number_plan = ISDN_NOTUSED;
makecall_blk->isdn.origination_phone_number[0] = '\0';
makecall_blk->isdn.facility_feature_service = ISDN_SERVICE;
makecall_blk->isdn.usrinfo_layer1_protocol = ISDN_UIL1_G711ULAW;
makecall_blk->isdn.usr_rate = ISDN_NOTUSED;
makecall_blk->isdn.usrinfo_bufp = NULL;
makecall_blk->isdn.nsfc_bufp = NULL;
makecall_blk->isdn.destination_sub_number_type = OSI_SUB_ADDR;
makecall_blk->isdn.destination_sub_phone_number[0] = 1;
makecall_blk->isdn.destination_sub_phone_number[1] = 2;
makecall_blk->isdn.destination_sub_phone_number[2] = 3;
makecall_blk->isdn.destination_sub_phone_number[3] = '\0';
makecall_blk->isdn.channel_id.channel = NO_BCHAN;
makecall_blk->isdn.channel_id.channel_mode = PREFFERED;
}
If the function returns < 0 to indicate failure, use the cc_CauseValue( ) function to retrieve the reason code for the failure. The cc_ResultMsg( ) function can be used to interpret the reason code. Error codes are defined in the files ccerr.h, isdnerr.h, and isdncmd.h.
Error codes from the cc_MakeCall( ) function include the following:
Error Code |
Description |
ERR_ISDN_LIB | E_ISBADPAR |
Bad input parameter |
ERR_ISDN_LIB | E_ISBADIF |
Bad interface number |
ERR_ISDN_LIB | E_ISBADTS |
Bad time slot |
ERR_ISDN_LIB | E_ISINVNETWORK |
Invalid network type |
ERR_ISDN_LIB | E_ISBADCRN |
Bad call reference number |
ERR_ISDN_LIB | E_ISBADCALLID |
Bad call identifier |
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation