Starts the NOCC protocol on a specified context.
AG
CG
DWORD adiStartProtocol ( CTAHD ctahd, char *protoname, WORD *protoparms, ADI_START_PARMS *parms)
Argument |
Description |
ctahd |
Context handle returned by ctaCreateContext or ctaAttachContext. |
protoname |
Name of the protocol trunk control program (TCP). The valid value is NOCC. |
protoparms |
Valid value is NULL. |
parms |
Pointer to an ADI_START_PARMS structure, as shown (NULL uses default parameter values): typedef struct Refer to ADI_START_PARMS for field descriptions. |
Return value |
Description |
SUCCESS |
|
CTAERR_BAD_ARGUMENT |
protoname is invalid or NULL or parms contains an invalid size field. |
CTAERR_INVALID_CTAHD |
Context handle is invalid. |
CTAERR_INVALID_STATE |
Function not valid in the current port state. |
CTAERR_SVR_COMM |
Server communication error. |
Event |
Description |
ADIEVN_STARTPROTOCOL_DONE |
If successful, the value field contains CTA_REASON_FINISHED; otherwise, the value contains an error code, such as: CTAERR_BAD_ARGUMENT Invalid protocol name; the protocol associated with protoname was not specified in the configuration file. |
Use adiStartProtocol to specify the NOCC protocol. The function initializes the ADI service and by default starts the DTMF detector.
The ADI_START_PARMS data structure consists of the following substructures:
Substructure |
Description |
ADI_CALLCTL_PARMS |
Controls which functions are started automatically by adiStartProtocol. The ADI_CALLCTL_PARMS structure is defined as: typedef struct |
Specifies how to perform dialing. Refer to adiStartDial for the structure definition. |
|
Controls DTMF detection if required by the protocol, as well as initial DTMF detection in the conversation (connected) state if started automatically by the protocol. Refer to adiStartDTMFDetector for the structure definition. |
|
ADI_ECHOCANCEL_PARMS |
Controls the application of an echo cancellation algorithm to the context in the connected state and is defined as: typedef struct |
Refer to the Parameters section for default values and a more detailed explanation of the fields in these structures.
When the protocol is NOCC, adiStartProtocol must be called before any ADI functions are invoked. The application can execute any function once ADIEVN_STARTPROTOCOL_DONE is received.
For details about using telephony protocols in the application, refer to the Dialogic® NaturalAccess™ CAS API Developer's Manual.
int myStartProtocol( CTAHD ctahd )
{
CTA_EVENT event;
/* start "no call control" protocol with all default parameters */
if( adiStartProtocol( ctahd, "NOCC", NULL, NULL ) != SUCCESS )
return MYFAILURE;
do
{
myGetEvent( &event ); /* see ctaWaitEvent example */
} while( event.id != ADIEVN_STARTPROTOCOL_DONE );
if( CTA_IS_ERROR( event.value ) )
return MYFAILURE; /* API error */
else
return SUCCESS; /* started successfully */
}