# Defining an audio pass-through with silence detection configuration

The audio pass-through with silence detection configuration is similar to the audio pass-through configuration for the media paths in that no media transformation is applied and no DSP resources are used for media transformation.

The difference is that a silence detector is inserted, for example, to avoid recording the initial silence of a voice message. This silence detection requires a DSP port and an MSPP connection between the DSP port and the audio RTP endpoint.

The following illustration shows an audio pass-through with silence detection configuration:

When silence detection is required for controlling the record function, the application must:

- Set up the audio pass-though path.

- Connect the audio RTP endpoint to an MSPP channel that is attached to an IVR silence detection resource. For more information, see the ADI Service Developer's Reference Manual and the Fusion Developer's Manual.

- Associate each endpoint to an ADI port.

- Call adiPlayMMFromMemory, adiPlayMMAsync, adiRecordMMToMemory, or adiRecordMMAsync to create the filters and initiate pass-through play or record.

See Video enhancements to the ADI service and Video enhancements to the MSPP service for more information.

## Function sequence

The following tables present a typical function sequence for an audio-pass through with silence detection configuration. This sequence shows:

- Initialization

- Play operation

- Record operation

This function sequence contains both video-specific and non-video-specific calls.

### Initialization

Step | Call | Description
1 | ctaCreateQueue ( &queuehd) | Creates a CTA queue.
2 | ctaCreateContext ( &video_ctahd, queuehd) | Creates a CTA context for the video channel.
3 | ctaCreateContext ( &audio_ctahd, queuehd) | Creates a CTA context for the audio channel. A single context can be used for the ADI port and the Fusion channel.
4 | ctaOpenServices ( video_ctahd, svclist, nsvcs) | Creates an ADI port for the pass-through video. The pass-through video channel consumes no DSP resources on the CG board. Therefore, the svclist parameter of ctaOpenServices must contain the following settings: Set the svclist.mvipaddr.mode parameter to 0 to prevent allocation of DSP resources for this channel on the CG board. The svclist.mvipaddr.stream and svclist.mvipaddr.timeslot parameters are not applicable when the mvipaddr.mode parameter is set to 0. Set these parameters to 0 for the pass-through video channel. The ADI service and the MSPP service are in the list of services.
5 | ctaOpenServices ( audio_ctahd, svclist, nsvcs) | Creates an ADI port and opens the MSPP service for audio. The audio channel requires an ADI DSP port for silence detection. Therefore, the svclist parameter for the ADI service in ctaOpenServices must contain the following settings: Set the svclist.mvipaddr.mode parameter to ADI_VOICE_DUPLEX to allocate DSP resources for this channel on the CG board. Set the svclist.mvipaddr.stream parameter to 16 or 0. NMS recommends 0. Set the svclist.mvipaddr.timeslot parameter to the desired DSP port. Valid range is 0 - 127. See the ADI Service Developers Reference Manual. To open the MSPP service, and support a DS0 endpoint in the Fusion channel, the svclist parameter for the MSPP service in ctaOpenServices must contain the following settings: Set the svclist.mvipaddr.mode parameter to ADI_VOICE_DUPLEX to allocate DSP resources for this channel on the CG board. Set the svclist.mvipaddr.stream parameter to 16 or 0. NMS recommends 0. Set the svclist.mvipaddr.timeslot parameter to the desired DSP port. Valid range is 0 - 127. See the MSPP Service Developers Reference Manual. Both the ADI service and the MSPP service must be in the list of services.
6 | nccStartProtocol ( audio_ctahd, nocc) | Starts the NOCC protocol on the audio channel to enable silence detection, transcoding, and play/record operation on the audio channel.
7 | mspCreateEndpoint ( video_ctahd, &video_ephd) | Creates a video RTP endpoint.
8 | mspCreateEndpoint ( audio_ctahd, &audio_ephd) | Creates an audio RTP endpoint.
9 | mspGetFilterHandle ( video_ctahd, video_ephd, &cg_video_ephd) | Translates the video MSPP ephd to a CG board ephd.
10 | mspGetFilterHandle ( audio_ctahd, audio_ephd, &cg_audio_ephd) | Translates the audio MSPP ephd to a CG board ephd.
11 | mspCreateEndpoint ( audio_ctahd, &sd_ephd) | Creates a DS0 endpoint for the silence detection path.
12 | mspCreateChannel ( audio_ctahd, &sd_chhd) | Creates an AMR MSPP channel for the silence detection path.
13 | mspConnect ( audio_ephd, sd_chhd, sd_ephd) | Connects the audio RTP endpoint, the AMR channel, and the DS0 endpoint together for the silence detection path.
14 | swiMakeConnection ( &inp, &out) | Connects the DS0 endpoint to the audio DSP port declared in svclist.mvipaddr of ctaOpenServices. Note: The connection can be simplex.

### Play operation

Step | Call | Description
1 | adiPlayMMFromMemory ( pvideo_ctahd, cg_video_ephd,,,,) or adiPlayMMAsync ( pvideo_ctahd, cg_video_ephd,,,,) | Begins playing video portion of message.
2 | adiPlayMMFromMemory ( paudio_ctahd, cg_audio_ephd,,,,) or adiPlayMMAsync ( pvideo_ctahd, cg_audio_ephd,,,,) | Begins playing of audio portion of message.
3 | adiStopPlaying ( pvideo_ctahd) | Stops playing video portion of message.
4 | adiStopPlaying ( paudio_ctahd) | Stops playing audio portion of message.

### Record operation

Step | Call | Description
1 | mspEnableChannel ( sd_chhd) | Enables the AMR MSPP channel so that the incoming flow can reach the silence detector.
2 | adiRecordMMToMemory ( video_ctahd, cg_video_ephd, cg_audio_ephd) or adiRecordMMAsync ( video_ctahd, cg_video_ephd, cg_audio_ephd) | Begins recording video portion of message. The application passes both the audio board handle and the video board handle to the video record function, reflecting the inter-dependence between the audio and video streams (for example, for I-frame detection).
3 | adiRecordMMToMemory ( audio_ctahd, cg_video_ephd, cg_audio_ephd) or adiRecordMMAsync ( audio_ctahd, cg_video_ephd, cg_audio_ephd) | Begins recording of audio portion of message. Initial silence can be skipped and audio record can be aborted if a long silence is detected during the record operation. The application passes both the audio board handle and the video board handle to the audio record function, allowing the inter-dependence between the audio and video streams (for example, for I-frame detection).
4 | adiStopRecording ( video_ctahd) | Stops recording video portion of message.
5 | adiStopRecording ( audio_ctahd) | Stops recording audio portion of message.
6 | mspDisableChannel ( sd_chhd) | Disables the AMR MSPP channel.