Enables native play and record mode for an ADI port.
CG
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 Refer to the Details section for field descriptions. |
|
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. |
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: |
|
include2833 |
RFC2833 markers in record buffers: |
|
payloadID |
Payload type used in egress RTP packets as defined in RFC3551. |
|
nsPayload |
Payload format of egress RTP packets: |
|
vadFlag |
Send SID frames: |
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.
adiPlayAsync, adiPlayFromMemory, adiRecordAsync, adiRecordToMemory, adiStartPlaying, adiStartRecording
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;
}