PlayFile
From SoftIVR
playFile
playFile(filename[, options]) plays a prompt to the caller. The file can either be one that's been uploaded, or can be one of the standard prompts if its name starts with std.
Parameters
- filename - the name of the file to play
- options - an optional string containing options
The options are:
- background - return immediately, so that the script can carry on processing while the prompt is playing;
- stop_on_dtmf - stop playing and return if the IVR received a tone during playback.
Return values
The playFile function returns 0 on success, or a string containing one of
- ERROR_FILE_NOT_FOUND - file not found
Examples
This snippet starts a prompt playing, and stops if the user presses 1:
playFile("prompt.wav", "background"); while (getStatus().indexOf("playing") >= 0) { dtmf = getDTMF(1); if (dtmf == 1) { stopIVR(); break; } }
Return to Javascript functions.