Playing Dynamically Created Audio Files with the VAD

Until recently, when creating an application with the 3CX Voice Application Designer, the audio files needed to be known early on in the design stage – it was necessary to specify the names of the files to use and there was no possibility of the application finding them dynamically. It was not possible for applications to be created that needed to play a file by obtaining the name from a database, for example.

One of the new features recently added to the 3CX VAD allows playback of audio files identifying the name at runtime using expressions, giving much more flexibility when writing applications.

This article will describe how to use this new functionality in the 3CX Voice Application Designer.

The New Prompt Type “Dynamic Audio File”

This new functionality is implemented as a new type of prompt: “Dynamic Audio file”. When selecting this type of prompt, the audio file name is defined by an expression. You can use the “Expression Editor” to create the desired expression with ease.

After adding the prompt of this type, focus on the “AudioFileName” field and a button will appear, as highlighted in the following screenshot. Clicking that button will open the expression editor.

Here we can easily create the desired expression. The created expression should return the audio file name as a relative path to the file from the working directory of the application. You don’t have to use absolute paths here. If the audio file is in the audio folder of the project, then you simply need to create an expression that returns the file name, without specifying any path.

For example, if the audio file is “Audio.wav” and the project is deployed to %ProgramData%\3CX\Data\Http\Interface\ivr\MyVadProject, the following table shows the value that must be returned by the expression in order to locate the file in different folders:

File Location Value Returned by the Expression
%ProgramData%\3CX\Data\Http\Interface\ivr\MyVadProject Audio.wav
%ProgramData%\3CX\Data\Http\Interface\ivr\ExternalAudio ..\ExternalAudio\Audio.wav
%ProgramData%\3CX\ExternalAudio ..\..\..\..\..\ExternalAudio\Audio.wav