
Description | Cautions | Example | Errors | See Also
Name: |
int cc_TermRegisterResponse(linedev, data_blk_ptr) | |
Inputs: |
LINEDEV linedev |
|
TERM_BLK data_blk_ptr |
| |
Returns: |
0 on success | |
Includes: |
isdncmd.h | |
Category: |
System tools | |
Mode: |
asynchronous | |
Technology: |
BRI/SC | |
The cc_TermRegisterResponse( ) function sends a response for CCEV_TERM_REGISTER events. The application, when used as the Network side, receives this event as notification of a TE registration request. On receiving the CCEV_TERM_REGISTER event, the application evaluates the Service Profile Interface ID (SPID) received and either rejects or accepts the registration request. The application then conveys its result to the network using the cc_TermRegisterResponse( ) function to send either the CCEV_RCVTERMREG_ACK event, if the request is accepted, or the CCEV_RCVTERMREG_NACK event, if the request is rejected. If the request is accepted, the terminal is then fully initialized.
Refer to the Call Scenarios in Appendix A for the sequence of events and function calls required for BRI North American terminal initialization. For additional information, refer to the North American BRI Terminal Initialization with Dialogic Products application note; the note can be downloaded from the Application Notes section of the Dialogic FirstCall Info Server website: http://support.dialogic.com
Parameter |
Description |
linedev: |
The line device handle of the D channel Board. |
data_blk_ptr: |
Pointer to the data block TERM_BLK to be sent to the firmware. For a description of the TERM_BLK structure, see Section 6.12. TERM_BLK. |
The data associated with the terminal initialization events can be retrieved using sr_getevtdatap( ) and casting the value to data types associated with the received event. The types of data structures that are used to cast the event-associated data are provided in Table 28 below.
Table 28. Terminal Initialization Events and Data Structures
Event |
Type of Data Structure |
CCEV_TERM_REGISTER |
SPID_BLK |
CCEV_RCVTERMREG_ACK |
USPID_BLK |
CCEV_RCVTERMREG_NACK |
TERM_NACK_BLK |
#include <windows.h> /* For Windows applications only */
#include <stdio.h>
#include <errno.h>
#include "srllib.h"
#include "dtilib.h"
#include "cclib.h"
/* Global variables */
LINEDEV lbuf;
DCHAN_CFG dchan_cfg;
main ()
{
dchan_cfg.layer2_access = FULL_ISDN_STACK; /* full protocol */
dchan_cfg.switch_type = ISDN_BRI_NI1; /* NI1 switch */
dchan_cfg.switch_side = NETWORK_SIDE; /* Network Terminal */
dchan_cfg.number_of_endpoints = 1; /* one terminal */
dchan_cfg.user.tei_assignment = FIXED_TEI_TERMINAL; /* Fixed TEI terminal */
dchan_cfg.user.fixed_tei_value = 23; /* TEI assigned to terminal */
dchan_cfg.tmr.te.T303 = TMR_DEFAULT; /* NOTE: the values chosen are arbitrary. */
dchan_cfg.tmr.te.T304 = TMR_DEFAULT;
dchan_cfg.tmr.te.T305 = TMR_DEFAULT;
dchan_cfg.tmr.te.T308 = TMR_DEFAULT;
dchan_cfg.tmr.te.T310 = TMR_DEFAULT;
dchan_cfg.tmr.te.T313 = TMR_DEFAULT;
dchan_cfg.tmr.te.T318 = TMR_DEFAULT;
dchan_cfg.tmr.te.T319 = TMR_DEFAULT;
if (cc_Open(&lbuf, briS1,0) != SUCCESS)
{
printf("cc_open: error\n");
}
if (cc_SetDChanCfg(lbuf, &dchan_cfg) == SUCCESS)
{
printf("Configuration is set\n");
}
else
printf("Configuration could not be set\n");
.
.
/* Initialize SRL */
.
.
.
/* enable termRegisterHdlr() to handler the CCEV_TERM_REGISTER event */
if ( sr_enbhdlr( devhdl, CCEV_TERM_REGISTER, termRegisterHdlr ) < 0 )
{
printf( "Handler enable for CCEV_TERM_REGISTER event failed: %s\n",
ATDV_ERRMSGP( lbuf ) );
return( 1 );
}
.
.
.
/*
Wait for Link Activation confirmation
After which call processing can be started.
*/
.
.
.
sr_waitevt(-1)
}
/***********************************************/
/* termRegisterHdlr - Term Register Handler */
/***********************************************/
int termRegisterHdlr( )
{
int devindx;
int dev = sr_getevtdev();
int len = sr_getevtlen();
void *datap = sr_getevtdatap();
char *message;
int dchstate;
int x, y;
TERM_BLK termBlk;
SPID_BLK *spidBlk;
/* Extract the event data associated with the CCEV_TERM_RSTER
* Event. Note that the data in the event data pointer is directlast
* to type SPID_BLK in order to extract the SPID number,PI,
* and CES values.
*/
spidBlk = (SPID_BLK *) datap;
printf("SPID: %s", spidBlk->SPID);
termBlk.data_link.sapi = spidBlk->data_link.sapi;
termBlk.data_link.ces = spidBlk->data_link.ces;
/* ......
* at this point, the application reads the SPID value and detnes
* whether or not the value of the SPID is valid for a designated sce.
* If the SPID is valid, then the application will send a PIVE
* acknowledgement (ISDN_OK). Otherwise a negative acknowledgement
* (ISDN_ERROR) is sent. This example shows POSITIVE acknowledgement.
*
*/
/* if sending a positive acknowledgement, the set ack_type = ISDN_OK */
termBlk.ack_type = ISDN_OK;
termBlk.ack_info.uspid.usid = 0xA;
termBlk.ack_info.uspid.tid = 0x0;
termBlk.ack_info.uspid.interpreter = 1;
/* send out the TERMINAL REGISTRATION acknowledgement */
if (cc_TermRegisterResponse(dtidev, &termBlk) != 0)
printf("Term Reg Ack Error\n");
else printf("TermRegisterResponse successful\n");
If the function returns a value < 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_TermRegisterResponse( ) function include the following:
Error Code |
Description |
ERR_ISDN_LIB | E_ISBADIF |
Bad interface number |
ERR_ISDN_LIB | E_ISNOMEM |
Cannot map or allocate memory |
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation