mod_dptools: file_string is a useful way of specifying multiple sound files to be played or written sequentially. It is a convenience feature.
The idea behind
file_string is simple: when you have multiple sound files to play sequentially, especially when there are many of them, it is convenient to be able to specify all of those files before initiating the playback.
When access to a file fails (either by trying to read it, or write into it), that file is skipped, and the next filename in the list is processed.
There are two methods of using
- high level, core most functions that use switch_ivr_playback()
mod_dptools: playback(because all the examples below are using that), but it is just referring to the C function
switch_ivr_play_fileis mentioned. I assume it's referring to the same function as
switch_ivr_playback. Figure out from source.
- low level, code that uses direct file handles
You can set up to 128 files in the list.
2.1 High level method
mod_dptools: playback uses
file_string internally, and the example below shows how:
TODO What other modules are using
See Channel Variables Catalog to learn more about the channel variables
2.2 Low level method
The low level method defines its own
file_string:// URI scheme, and the examples below show how to use it exactly.
When using the
file_string:// URI scheme, the delimiter is always the
mod_dptools: playback without the
playback_delimiter channel variable
2.2.2. Music-on-hold (MOH)
2.2.3. Used with
2.2.4 Record a session
If writing to a file fails, the next filename in the list is tried:
Note that you have to specify the full path, as sound path expansion is done in switch_ivr_play_file, which is above the level that the file_string:// protocol operates at.
TODO See TODOs in 2. Usage above.
3. Execution Parameters
There is a
timeout parameter expressed in milliseconds that limits the duration of the file played.
- Useful for testing new music-on-hold (MOH), prompts, audio levels, etc.
- Allows for more flexible concatenated audio files.
In this example, an extension is made that plays all listed files as follows:
- Announce a number to easily identify the file in the list.
- Play the file for 15 seconds. This is long enough to hear the song and take notes if needed.
An answer is required to prevent the call from timing out so any number of files can be played in a single call.
Without the timeout, you would have to listen to entire files.