Many developers who are new to VoiceXML often post questions on the Plum support forum about how to dynamically fetch an audio file and use it to play a prompt in their IVR scripts.
To be able to pull the correct audio file, developers can program their applications to dynamically add the file into their vxml code. The following code builds an audio tag with a file source of ‘need_to_choose.wav’.
Code:
<submit next=”output.php” namelist=”list of necessary variables”/>
output.php:
<?php
header(“Content-type: text/xml”);
//Do all necessary actions to determine file name here:
$name = ‘need_to_choose’;
echo “<?xml version=”1.0″?>”;
?>
<vxml version=”2.0″>
<form>
<block>
<audio src=”<?= $name ?>.wav”/>
</block>
</form>
</vxml>
For more information and code samples please visit the Plum Support Forum.
