(Page 35 of 80 in this chapter)
typedef struct
{
DWORD size ; /* size of this structure */
DWORD connectmask;
/* events that transition to connected */
DWORD disconnectmask;
/* events that transition to disconnected */
ADI_CALLPROG_PARMS callprog;
/* call progress analysis parameters */
} ADI_PLACECALL_PARMS;
Note: When you place a call, the first event you receive is usually ADIEVN_PLACING_CALL. If call placement fails, you receive an ADIEVN_CALL_DISCONNECTED event with a value field of ADI_DIS_NO_DIALTONE or ADI_DIS_NO_WINK. If the port is a bi-directional trunk, ADIEVN_INCOMING_CALL may be received instead of ADIEVN_PLACING_CALL. If you receive an ADIEVN_INCOMING_CALL event, retry placing the outgoing call at a later time.
int myPlaceCall( CTAHD ctahd, char *digits, int accept_incoming )
{
ADI_EVENT event;
adiPlaceCall( ctahd, digits, NULL );
while( 1 )
{
myGetEvent( &event ); /* see adiFetchAndProcess example */
switch( event.id )
{
case ADIEVN_INCOMING_CALL: /* Now in the 'incoming call' state. */
/*
* Glare: The protocol has detected an incoming call when we
* tried to place our call.
*/
if( accept_incoming )
adiAnswerCall( ctahd, 1 );
else
adiRejectCall( ctahd, ADI_REJ_PLAY_REORDER );
break;
case ADIEVN_CALL_CONNECTED: /* Now in the 'connected' state. */
/*
* After PLACING_CALL, this event indicates that a specific
* connection criteria was met. For an INCOMING_CALL, this is
* reached when the specified number of rings have been
* detected/generated and the protocol has answered the call.
* Application is now in the 'connected' (conversation)
* state, and may play, record, collect DTMFs, etc.
* May also release the call to hang up or in response to the
* remote party hanging up.
*/
return SUCCESS;
case ADIEVN_CALL_DISCONNECTED: /* Now in the 'disconnected' state. */
/*
* Before ANSWER_CALL or PLACING_CALL, indicates the network
* is not acknowledging outbound seizure. After PLACING_CALL,
* indicates that a specific disconnect criteria was met.
* After ANSWER_CALL, this is reached when the remote party
* hangs up during either the rejecting or answering states.
*/
return MYDISCONNECT;
case ADIEVN_ANSWERING_CALL: /* Now in the 'answering' state. */
case ADIEVN_REJECTING_CALL: /* Now in the 'rejecting' state. */
default:
break;
}
}
}
(Page 35 of 80 in this chapter)