(Page 35 of 80 in this chapter)


adiPlaceCall

Description

Places an outbound call.

Prototype

DWORD adiPlaceCall( CTAHD ctahd,
char *digitstr,
ADI_PLACECALL_PARMS *parms )

ctahd Context handle returned by adiOpenPort.

digitstr Pointer to a NULL-terminated string containing the phone number to dial.

parms Pointer to an ADI_PLACECALL_PARMS structure, shown below (NULL uses default parameter values):

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;
For the ADI_CALLPROG_PARMS structure, see the function adiStartCallProgress. See Appendix D for more details and default values.

Return Values

Events

Details

digitstr may contain the following embedded escape characters which control the dialing sequence, as listed below:

Character

Description

;

(semicolon) Wait for precise dial tone.

.

(period) Insert long pause in dialing.

,

(comma) Insert short pause in dialing.

!

Flash-hook.

P

Switch to pulse dialing.

T

Switch to DTMF dialing.

M

Switch to MF dialing.


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.

If an incoming call is detected during call placement, the application should proceed to process it.

Call placement and call control are discussed in detail in the AG Access Developer's Manual.

Note: This function is not available when using the NOCC protocol.

See Also

adiStartProtocol, adiReleaseCall, adiStartMFDetector (for MF table)

Example


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)


Tech_Support@nmss.com
Copyright © 1996, Natural MicroSystems, Inc. All rights reserved.