adiSetNativeInfo

Enables native play and record mode for an ADI port.

Supported board types

Prototype

DWORD adiSetNativeInfo ( CTAHD ctahd, DWORD ingresshd, DWORD egresshd, ADI_NATIVE_CONTROL *control)

Argument

Description

ctahd

Context handle returned by ctaCreateContext or ctaAttachContext.

ingresshd

MSPP filter handle that connects the ADI native record channel on the board to the MSP jitter buffer.

egresshd

MSPP endpoint handle that connects the ADI native play channel on the board to the RTP endpoint.

control

Pointer to the ADI_NATIVE_CONTROL structure, as shown:

typedef struct
{
DWORD size;            /* Size of this structure                          */
DWORD mode;            /* Enables and disables native                     */
                       /* play/record mode for the adi port.              */
                       /* (ADI_NATIVE, ADI_IVR_ONLY)                      */
DWORD play_encoding;   /* Encoding type for native play (refer to adidef.h*/
                       /* for a complete list of ADI_ENCODING_xxx values).*/
                       /* If the mode is ADI_NATIVE and this encoding type*/
                       /* matches the one specified in a subsequent play  */
                       /* command, the native path will be used, otherwise*/
                       /* the PSTN play or record path will be used.      */
DWORD rec_encoding;    /* Encoding type for native record (refer to       */
                       /* adidef.h for a complete list of ADI_ENCODING_xxx*/
                       /* values). If the mode is ADI_NATIVE and this     */
                       /* encoding type matches the one specified in a    */
                       /* subsequent record command, the native path will */
                       /* be used, otherwise the PSTN play or record path */
                       /* will be used.                                   */
DWORD frameformat;     /* specifies record frame format                   */
DWORD include2833;     /* include RFC2833 markers in record buffers       */
WORD payloadID;        /* RTP payload type for egress                     */
WORD nsPayload;        /* nonstandard payload indicator for Egress RTP,   */
                       /* 0 (default)=RFC3267 AMR payload is used,        */
                       /* 1=AMR IF2 frames are packed as payload)         */
WORD vadFlag;          /* VAD enable (1)/disable (0) sending of SID frames*/
} ADI_NATIVE_CONTROL;

Refer to the Details section for field descriptions.

Return values

Return value

Description

SUCCESS

 

ADIERR_INVALID_CALL_STATE

Function not valid in the current call state.

CTAERR_FUNCTION_ACTIVE

Function already started.

CTAERR_INVALID_CTAHD

Context handle is invalid.

CTAERR_INVALID_STATE

Function not valid in the current port state.

CTAERR_SVR_COMM

Server communication error.

Details

Use adiSetNativeInfo to set the native play and record parameters. The native play and record feature enables applications to use the ADI service to play and record voice data directly to and from RTP endpoints associated with MSPP service connections. For information about the native play and record feature, refer to Performing NMS native play and record.

To enable the native play and record feature in the ADI_NATIVE_CONTROL structure, set the mode to ADI_NATIVE. Also set the encoding type so that it matches the encoding type specified in the associated ADI play or record function calls. The specified encoding type must be one of the ADI_ENCODE_EDTX formats. For information about encoding formats, refer to Recording and playing.

Subsequent play calls specifying an encoding type with the same base codec type use the native path to play directly to the MSPP filter. The egress handle in this function specifies the MSPP filter. For example, if the ADI_ENCODE_EDTX_G723 is specified in the call, subsequent play or record calls specifying ADI_ENCODE_G723_6, ADI_ENCODE_G723_5, ADI_ENCODE_EDTX_G723, ADI_ENCODE_EDTX_G723_6, or ADI_ENCODE_EDTX_G723_5 use the native play path.

Subsequent record calls specifying an ADI_ENCODE_EDTX encoding type with the same base codec type use the native path to record from the MSPP filters. The ingress handle in this function specifies the MSPP filters. For example, if the ADI_ENCODE_EDTX_G723 is specified in the call, subsequent play or record calls specifying ADI_ENCODE_EDTX_G723, ADI_ENCODE_EDTX_G723_6, or ADI_ENCODE_EDTX_G723_5 use the native record path.

To disable the native feature in the ADI_NATIVE_CONTROL structure, set the mode to ADI_IVR_ONLY.

Because the native record mode responds to silence as well as to audio data, the ADI port requires DSP resources for silence detection.

The ADI_NATIVE_CONTROL structure contains the following fields:

Field

Description

size

Size of the structure in bytes.

mode

ADI_NATIVE = use the ADI service to play and record voice data directly to and from RTP endpoints associated with MSPP service connections.

ADI_IVR_ONLY = use the PSTN play or record path.

play_encoding

Native play data encoding format. See Recording and playing for a complete list.

rec_encoding

Native record data encoding format. See Recording and playing for a complete list.

frameformat

Frame format in record buffers:
0 = Variable frame size with compressed silence
1 = Variable frame size with expanded silence
2 = Fixed frame size with compressed silence
3 = Fixed frame size with expanded silence

include2833

RFC2833 markers in record buffers:
0 = Disable
1 = Enable

payloadID

Payload type used in egress RTP packets as defined in RFC3551.

nsPayload

Payload format of egress RTP packets:
0 = Standard payload format
1 = Nonstandard payload format

vadFlag

Send SID frames:
0 = Enable (default)
1 = VAD disable

EVRC native playback is supported for both EDTX and raw EVRC file formats. To support EDTX EVRC file playback, set the encoding to ADI_ENCODE_EDTX_EVRC_FR_HDR_FREE for both the adiSetNativeInfo and the adi play function.

To support raw EVRC file playback, set play_encoding= ADI_ENCODE_EDTX_EVRC_FR_HDR_FREE for the adiSetNativeInfo function. Then, set the encoding type to ADI_ENCODE_EVRC_FR for the adi play function.

See also

adiPlayAsync, adiPlayFromMemory, adiRecordAsync, adiRecordToMemory, adiStartPlaying, adiStartRecording

Example

void mySetNativeInfo( CTAHD ctahd, DWORD ingresshd, DWORD egresshd, int encoding, int payloadID)
{
ADI_NATIVE_CONTROL np;
np.rec_encoding = encoding;
np.play_encoding = encoding;
np.frameformat = 0;
np.include2833 = 0;
np.mode = ADI_NATIVE;
np.nsPayload = 0;
np.payloadID = payloadID;
np.vadFlag = 1
if((ret =adiSetNativeInfo( ctahd, ingresshd, egresshd, &np)) == SUCCESS )
printf( "Set Native Control Successful  for handle %x\n", ctahd );
else
printf( "Set Native Control Failed (%x)  for handle %x\n",ret, ctahd );
return;
}