(Page 15 of 80 in this chapter)


adiGetCallStatus

Description

Retrieves a snapshot of the call control status and stores it in an ADI_CALL_STATUS structure.

Prototype

DWORD adiGetCallStatus( CTAHD ctahd,
ADI_CALL_STATUS *status,
unsigned size )

ctahd Context handle returned by adiOpenPort.

status Pointer to the ADI_CALL_STATUS structure, as shown:

typedef struct
{     /* used by adiGetCallStatus           */
 DWORD size ;    /* size returned by adiGetCallStatus           */
 DWORD state;    /* call states           */
 INT32 reason;    /* reason for going back to IDLE state           */
 char calledaddr [ADI_MAX_DIGITS+1]; 
/* DNIS info (null term string) */
char callingaddr[ADI_MAX_DIGITS+1];
/* ANI info (null term string) */
char callingname[ADI_MAX_CNAME+1];
/* Calling party name */
DWORD pendingcommand;
/* current unack'ed command */
char usercategory; /* the type of the calling party */ char tollcategory; /* (generally same as usercategory) */ WORD reserved; } ADI_CALL_STATUS;
size Size (in bytes) of the user-supplied status information space.

Return Values

Events

None.

Details

This function retrieves the call control status of the current or most recent call. Upon returning from the function, the ADI_CALL_STATUS size field contains the actual number of bytes written. For incoming calls, invoke adiGetCallStatus after receiving the ADIEVN_INCOMING_CALL event.

Caller ID data is written to the ADI_CALL_STATUS structure. Specific details about caller ID data is protocol-dependent, but in general, an application needs to analyze the call status for every incoming call. Make sure that an application that needs caller ID data responds to an ADIEVN_INCOMING_CALL event by invoking adiGetCallStatus.

The ADI_CALL_STATUS structure contains the following fields:

:
Field

Description

size

Number of bytes written at the address pointed to by *status.

state

Current call control state (refer to the AG Access Developer's Manual for more details about call control).

reason

Reason for the last disconnect (This will be zero if the application initiated the disconnect. Otherwise, it is the value received in the event ADIEVN_DISCONNECTED.)

calledaddr

For inbound calls, the address of the requested number if provided (e.g., DNIS, DID).

callingaddr

For inbound calls, the address of the caller if provided (e.g., caller ID, ANI).

callingname

For inbound calls supporting caller ID, the text representation of the caller.

pendingcommand

The last call control command issued that has not yet been acknowledged by the AG board. This field is set when a call control command is sent to the board, and cleared on the next event that causes a transition to a new call state.

Possible values are:

usercategory

The type of the calling party.

tollcategory

Generally the same as usercategory.

See Also

adiPlaceCall, adiAnswerCall, adiReleaseCall, adiTransferCall, adiPlaceSecondCall, adiReleaseSecondCall, adiRejectCall, adiBlockCalls, adiUnBlockCalls

Example


void myShowCallState( CTAHD ctahd )
{
    ADI_CALL_STATUS call_status;

    adiGetCallStatus( ctahd, &call_status, sizeof call_status );
    switch( call_status.state )
    {
        case ADI_CC_STATE_STOPPED:        puts("Stopped/not active");      break;
        case ADI_CC_STATE_IDLE:           puts("Idle/active/waiting");     break;
        case ADI_CC_STATE_INCOMING_CALL:  puts("Incoming call avail");     break;
        case ADI_CC_STATE_ANSWERING_CALL: puts("Answering call");          break;
        case ADI_CC_STATE_PLACING_CALL:   puts("Placing call");            break;
        case ADI_CC_STATE_DISCONNECTED:   puts("Remote disconnected");     break;
        case ADI_CC_STATE_BLOCKING:       puts("App blocking calls");      break;
        case ADI_CC_STATE_CONNECTED:      puts("Connected/conversation");  break;
        case ADI_CC_STATE_REJECTING_CALL: puts("Rejecting incoming call"); break;
        case ADI_CC_STATE_OUT_OF_SERVICE: puts("Line out-of-service");     break;
        case ADI_CC_STATE_PLACING_CALL2:  puts("Placing 2nd call/xfer");   break;
        case ADI_CC_STATE_CONNECTED2:     puts("Connected to 2nd call");   break;
    }
}



(Page 15 of 80 in this chapter)


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