Page 1 of 1

IVR code for saving recording to another variable

Posted: Fri Feb 12, 2010 9:58 am
by support
Hi,

Here is some sample IVR code that will allow you to store your recording in another variable:

recordvariable.vxml:

Code: Select all

<?xml version="1.0"?>
<vxml version="2.0">

<property name="sensitivity" value="0.3"/>
<var name="store"/>

<form id="xfer">
  <record name="msg" beep="true" maxtime="10s" finalsilence="4000ms" dtmfterm="true" type="audio/x-wav">
    <prompt timeout="5s">
      Record a message after the beep.
    </prompt>
    <filled>
      <assign name="store" expr="msg"/>
    </filled>
    <noinput>
      I didn't hear anything, please try again.
    </noinput>
  </record>

<field name="confirm">
  <grammar>
    Yes|No
  </grammar>     
  <prompt>
    Your message is <audio expr="store"/>.
  </prompt>
  <prompt>
    To keep it, say yes.  To discard it, say no.
  </prompt>
  <filled>
    <if cond="confirm=='Yes'">
      <submit next="save.php" namelist="store" method="post"/>
    </if>
    <clear/>
  </filled>
</field>
</form>
</vxml>
From this IVR example, note that our original <record> variable, msg, gets stored into another variable, store.

Hope this helps.

Regards,
Plum Support