We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics

playing audio based on variable

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
magicsoft
Posts: 44
Joined: Wed Aug 25, 2010 8:57 am

playing audio based on variable

Post by magicsoft »

I'm trying to play an audio file based on the filename I get back from a <subdialog>:

Code: Select all

		<block>
			<assign name="varPrompt" expr="'IMPORTANT'"/>
		</block>
		<subdialog name="audiofile" namelist="varPrompt" src="audiofile.ashx"/>
		<audio expr="audiofile.varCompleteFileName">
			Hello, this is Continuing Care calling with an important message.  Please press one.
		</audio>
Apparently my syntax here is not quite correct, as it is treating "audiofile.varCompleteFileName" as a literal string, therefore not finding the file and playing the text using the synthesized voice. I've tried using single quotes, as well as using "src" instead of "expr", but neither works. Is it possible to do this?

Thanks,

Andrew

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

Re: playing audio based on variable

Post by support »

Hi Andrew,

To be able to pull the correct audio file, you would need to dynamically add it into the vxml. We would also recommend submitting to a new IVR script as opposed to using a subdialog.

Code: Select all

<submit next="output.php" namelist="list of necessary variables"/>
output.php:

Code: Select all

<?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>
This builds an audio tag with a file source of 'need_to_choose.wav'.

Hope this helps!

Regards,
Plum Support

Post Reply