Component Playback

Table of Contents

Description

Performs playback of the audio file to the subscriber.
Can initiate both synchronous playback, where control to the next component is not transferred until after playback ends, and background playback, where control to the next component is transferred immediately after playback starts. Background playback control allows pausing and stopping. Playback can be resumed from the specified millisecond of a particular file.
Supports sequential and looping playback of random files in a specified directory.

Table 1. System Characteristics

Index

204

Short title

play

Types of scenarios

IVR

Starter module

r_sip_ivr_script_component_play

Mode

Asynchronous

Icon

204

Branching pattern

Branching, closing

Properties

Table 2. Properties
Specification Description

Title: Layer
Code: playerId
Visibility: no
Default: `"default"`", "Selects the playback layer.
A layer is a separate term in the IVR media context that plays no more than one file at a time.
Thus, an IVR script in different playback modes, which include background playback, can play multiple files simultaneously - all of which are mixed.

Title: Mode
Code: mode
Visibility: no
Default: `File completely'

Selects the component’s operating mode.
Possible options:

  • File completely (syncPlayFile, 0) - Plays audio file with waiting for its completion. If a directory is specified as parameters, a random file from the directory is played.

  • Pre-listen (syncPlayFileLimit, 1) - Performs playback with a wait for its completion and a playback time limit.

  • File + extra time (syncPlayFileExtra, 2) - Performs playback with waiting for its completion and waiting for an extra pause applied for DTMF character input.

  • File List (syncPlayFiles, 7) - Plays a sequential list of files. Optionally can expect an additional pause applied for DTMF character input.

  • Background Playback (asyncPlayStart, 3) - Adds a layer and initiates background playback in it, immediately passing control to the next component. If playback is already in progress in the specified layer, it is automatically interrupted.

  • Background Stop (asyncPlayStop, 4) - Stops playback in the specified layer.

  • Change background volume (asyncModifyVolume, 6) - Changes the volume of the file playing in the background on the specified layer.

Title: Time, s
Code: playTimeSec
Visibility: yes
Default: — 

Limit playback time, in seconds.
Applies in Pre-listen mode.

Title: Additional time, s
Code: extraTimeSec
Visibility: yes
Default: 0

Additional pause timeout after playback ends, in seconds.
Applies in File + additional time and File list modes`.

Title: Catalog
Code: folder
Visibility: yes
Default: — 

Argument containing the directory path.
Must include one of filecategories.

Title: Randomly
Code: randomize
Visibility: yes
Default: Yes

Mode of randomly selecting the next file from the directory.
Applies when specifying a directory with audio files as the source.

  • Yes - at the beginning and at the end of playback of each audio file, the next file is selected randomly.

  • No - files are played back in lexical-graphic sorting order by name.

Title: File
Code: file
Visibility: yes
Default: — 

File to play.
Can be selected in one of the modes:

  • a static file attached to the script (loaded from the Script Editor application or via the API);

  • argument-formed path, which must include one of the filecategories.

Title: Flow file
Code: fileCanGrow
Visibility: yes
Default: `None'

Growing file streaming mode.
Applies only in File Complete, Preview, File + Extra Time, and Background Playback playback modes when playing one specific file.
This mode is useful for streaming needs, for example, when data is generated by an external service gradually and it is necessary to send it to the voice channel at once.

In this mode, only a WAV file that has a header size known to be larger than the amount of samples placed in the file can be played back.
If playback reaches the current end of the file and the file size specified in the WAV header is not reached, the player generates silence.
As samples are added to the end of the file, playback continues.
Playback ends when the number of samples played from the file matches the specified number of samples in the Wav header.
The Wav header is allowed to overwrite the size when the data runs out.

Possible options:
* No - normal playback mode.
* Yes - playback from a growing WAV file is allowed.

Title: Files (JSON list)
Code: filesArg
Visibility: yes
Default: — 

An argument containing a JSON structure in the form of an array of strings, each representing a file path.
Each path must include one of filecategories.
Files are played back in the order they are listed.

Title: Looping
Code: loop
Visibility: yes
Default: `No'

Turns off continuous loop playback.
When playing through directory selection, a new file is randomly selected each time.

Title: Beginning, ms
Code: startAt
Visibility: yes
Default: — 

Argument containing the offset to start playback, in milliseconds.
Makes sense when the file is not looped.

Title: The End, ms
Code: stopAt
Visibility: yes
Default: — 

An argument containing the final position in the file, in milliseconds.
Makes sense when the file is not looped.

Title: Volume (divider)
Code: volumeDiv
Visibility: yes
Default: — 

Argument containing the playback volume divider in the layer

Title: Buffer for DTMF
Code: dtmfBuffer
Visibility: yes
Default: — 

Variable to store received DTMF characters.

Title: Clear buffer DTMF
Code: clearDtmfBuffer
Visibility: yes
Default: `Yes'

Buffer pre-clearance switch DTMF.

Title: Number of characters
Code: maxSymbolCount
Visibility: yes
Default: — 

An argument containing a limit on the number of characters that can be entered.
When the specified number of DTMF characters is received during the component execution, the recording is automatically terminated and the last portion of voice data is sent to the recognition service.

Title: Interrupt Symbols
Code: interruptSymbols
Visibility: yes
Default: — 

A string containing sequences of interrupt characters separated by commas.
When a character sequence matching one of the specified interrupt sequences is detected at the end of the DTMF buffer, the recording is automatically terminated and the last portion of data is sent to the recognition service.
For example, *, 7, 123, 9395.

Title: Cut interrupt characters
Code: clearInterrupt
Visibility: yes
Default: Yes

Disable the operation of removing interrupt characters from the DTMF buffer after an interrupt sequence is detected.

Title: Transition
Code: transfer
Visibility: no
Default: — 

The component to which control is passed on successful completion of the operation.

Title: Transition, Error
Code: transferError
Visibility: no
Default: — 

See also