
Description | Cautions | Example 1 | Example 2 | Errors | See Also
Name: |
int dt_dial(devh,digstr,tmo) | |
Inputs: |
int devh |
|
char *digstr |
| |
unsigned int tmo |
| |
Returns: |
0 on success | |
Includes: |
srllib.h | |
Category: |
Time Slot Signaling | |
Mode: |
synchronous/asynchronous | |
The dt_dial( ) function allows the application to pulse dial an ASCIIZ string of digits on a specified D/240SC-T1, D/240SC-2T1, D/480SC-2T1, D/300SC-E1 D/300SC-2E1 or D/600SC-2E1 time slot. The function can operate in either the synchronous (blocking) or asynchronous (non-blocking) mode.
Parameter |
Description |
devh: |
Specifies the valid time slot device handle returned by a call to dt_open( ). The specified time slot must be in the offhook, idle state when dt_dial( ) is called. |
digstr: |
Pointer to the ASCIIZ string of digits to dial. The maximum length of the string is 32 digits. |
tmo: |
Specifies the maximum number of seconds that the function will block while awaiting a dial status response from the D/xxxSC board. |
Asynchronous Mode
To operate this function in asynchronous (non-blocking) mode, specify 0 for tmo. This allows the application to continue processing while awaiting a completion event. If event handling is set up properly for your application, DTEV_PDDONE will be returned by the sr_getevttype( ) function included in the SRL when the dial is successfully completed. See Appendix A - Standard Runtime Library for information on event handling.
Synchronous Mode
To operate the function in synchronous (blocking) mode, specify a length of time in seconds that the function will block for tmo. This causes the application to wait for a return from the function before performing any other processing. A suggested tmo setting for this function is 60.
#include <windows.h> /* For Windows applications only */
#include <srllib.h>
#include <dtilib.h>
#include <errno.h>
/*
* Basic error handler
*/
do_error( devh, funcname )
int devh;
char *funcname;
{
int errorval = ATDV_LASTERR( devh );
printf( "Error while calling function %s.\n", funcname );
printf( "Error value = %d. Error message = %s.", errorval,
ATDV_ERRMSGP( devh ) );
if ( errorval == EDT_SYSTEM ) {
printf( "errno = %d.\n", errno );
} else {
printf( "\n" );
}
}
main()
{
int tsdev; /* Time Slot device handle */
/*
* Open time slot 1 on board 1
*/
if ( ( tsdev = dt_open( "dtiB1T1", 0 ) ) == -1 ) {
printf( "Failed to open device dtiB1T1. errno = %d\n", errno );
exit( 1 );
}
/*
* Set signaling mode to signaling insertion
*/
if ( dt_setsigmod( tsdev, DTM_SIGINS ) == -1 ) {
do_error( tsdev, "dt_setsigmod()" );
exit( 1 );
}
/*
* Disable silence transmission
*/
if ( dt_setidle( tsdev, DTIS_DISABLE ) == -1 ) {
do_error( tsdev, "dt_setidle()" );
exit( 1 );
}
/*
* Go offhook
*/
if ( dt_settssig( tsdev, DTB_ABIT | DTB_BBIT, DTA_SETMSK ) == -1 ) {
do_error( tsdev, "dt_settssig()" );
exit( 1 );
}
/*
* Dial number with 60 second timeout. Note that this is the blocking
* mode dial.
*/
if ( dt_dial( tsdev, "7223689", 60 ) == -1 ) {
do_error( tsdev, "dt_dial()" );
exit( 1 );
}
/*
* Continue processing
* .
* .
*/
/*
* Done processing - close device.
*/
if ( dt_close( tsdev ) == -1 ) {
do_error( tsdev, "dt_close()" );
}
}
Example 2 -- Setting Flash Hook Using dt_dial( )
/*
* Set flash hook
*/
setflashhook(tsdev)
{
char dial_str[10];
int value;
sprintf(dial_str, "%c", DTV_FLASHCHR);
tmo = 10;
dt_dial(tsdev, string, tmo);
/*
* Change flash time
*/
value = 100; /* 1 sec */
.
.
.
dt_setparm(tsdev, DTG_PDDLFTIM, (void *)&value);
}
If the function returns -1, use the SRL Standard Attribute function ATDV_LASTERR( ) to obtain the error code. See Appendix A - Standard Runtime Library for more information on SRL functions. The error codes returned by ATDV_LASTERR are:
Error defines can be found in the file dtilib.h.
In Voice Software Reference (for Linux or Windows):
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation