Page 1 of 1

Rule for playing announcements

Posted: Fri Sep 14, 2012 4:37 am
by Polad
Dear support team,

I'm implementing IVR application where customer can call and listen info about debt. I have integration with PHP and according to return value I receive digits (for example: "125"). These digits are the debt. I also have announcement files in following format: "one hundred", "two hundreds", etc - "ten", "twenty", etc - "one", "two", etc. So, my question is: Is it possible to implement some rules which allow to play correct announcement regarding received value? I mean if IVR receive "164" we need to choose and play: "one hundred" "sixty" "four" (3 announcements) consequentially.

Thanks beforehand.

Re: Rule for playing announcements

Posted: Fri Sep 14, 2012 11:11 am
by support
Yes, it's possible. You'll have to implement rules to generate a proper list of audio files to play. Once you have this list, you can loop through to play each audio file like so:

Code: Select all

<?php
header('Content-type: text/xml');
echo "<?xml version=\"1.0\"?>\n";

$debt_prompts = array("one hundred" => "one-hundred.wav", 
		      "sixty" => "sixty.wav", 
		      "four" => "four.wav");
?>

<vxml version="2.0">
  <form>
    <block>
      <prompt>
	Your debt is 
<?php
  foreach ($debt_prompts as $prompt => $audio_file) {
    echo "<audio src=\"$audio_file\">$prompt</audio>\n";
  }
?>
      </prompt>
    </block>
  </form>
</vxml>