Page 1 of 1

Can VoiceXML receive replies from it's outbound posts?

Posted: Sun Aug 10, 2008 7:30 pm
by Inno
Hello Plum Support,

I am Developer representing a company that is evaluating your solution. We are anxious to purchase but can't proceed until we are certain our needs can be solved. I'd like to build a proof-of-concept.

I have setup a demo VXML account and learned the very basics of creating a call script to handle inbound calls. The documentation and forums seem to cover most of these needs.

Where I can't find answers is for the following:

1) I happen to be using ASP.NET and wanted to build a handler page (.ASHX) to process a .WAV recording from Plum. I think I saw a .PHP sample and want confirmation that I've understood this feature correctly?

2) I currently store user accounts on a webserver that could be listening for posts from the Plum VXML system. Ideally I wanted Plum to submit account ID and password to my webserver for validation. The problem is I don't see how Plum can RECEIVE back a "true/false" or other form of confirmation. Is communication a two-way street with Plum? If so, are there samples I can review? Even if they were in PHP or any other languages I think I could translate them to C#.

3) Can I collect any number of parameters from users and submit them as querystring values to my webserver? Example: Give the users 4 difference choices to make, then submit all 4 answers to my webserver.

4) If I wanted users to be able to record a series of messages and store them for future deletion/update what would my options be? If I could do what I wanted to in question #2 above I'm confident I could make my webserver record and manage their messages. Otherwise does the Plum system itself have options for local accounts/passwords/recorded messages, etc?

Sorry for the huge list, I just need to know all this. If I had a Developer Guide or something more thorough I wouldn't have to post them here. :wink:

Thanks in advance, Dylan

IVR code examples

Posted: Mon Aug 11, 2008 10:16 am
by support
Hi Dylan,

Here are a couple of IVR code examples that should address your questions:

For question 1, I believe you were referring to this IVR example that uses the IVR tag, <record>:

Record.vxml:

Code: Select all

<?xml version="1.0"?>
<vxml version="2.0">
  <form>
    <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>
      <noinput>
        I didn't hear anything, please try again.
      </noinput>
    </record>

  <field name="confirm">
    <grammar>
      Yes|No
    </grammar>
    <prompt>
      Your message is <audio expr="msg"/>.
    </prompt>
    <prompt>
      To keep it, say yes. To discard it, say no.
    </prompt>
    <filled>
      <if cond="confirm=='Yes'">
        <submit next="http://mightyserver.com/Save.php" namelist="msg"
        method="post" enctype="multipart/form-data"/>
      </if>
      <clear/>
    </filled>
  </field>
  </form>
</vxml>
Save.php:

Code: Select all

<?php
echo "<?xml version=\"1.0\" encoding=\"latin-1\"?>";
?>

<!DOCTYPE vxml SYSTEM "file:/DTD2304.dtd">

<vxml version="2.0">
  <form id="greeting">
    <block>

<?php
  if (isset($_FILES['msg'])) {
    echo "<prompt bargein=\"false\">found the audio attachment</prompt>\n";
  }
  if (isset($_FILES['msg']) && is_uploaded_file($_FILES['msg']['tmp_name'])) {
    move_uploaded_file($_FILES['msg']['tmp_name'],"temp.ul");
    $timestamp = time();
    $cmdline = `/usr/local/bin/sox -t ul -r 8000 temp.ul $timestamp.wav`;
    unlink("temp.ul");
    echo "<prompt bargein=\"false\">Audio saved as <say-as
    type=\"acronym\">$timestamp</say-as> dot wave.</prompt>\n";
  } else {
    echo "<prompt bargein=\"false\">Audio not saved.</prompt>\n";
  }
?>

     </block>
  </form>
</vxml>
Here's another IVR example that demonstrates what you are asking for in questions #2 and #3:

Inno1.vxml:

Code: Select all

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

<form>
  <field name="accountid" type="digits">
      <prompt>
        Please enter your account identification number using your keypad.
      </prompt>
  </field>

  <field name="password" type="digits">
      <prompt>
        Please enter your password using your keypad.
      </prompt>
  </field>

  <block>
    <prompt>
      Please wait while we process your information.
    </prompt>
    <submit namelist="accountid password" next="Inno2.php"/>
  </block>
</form>

</vxml>
Inno2.php:

Code: Select all

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

$accountid = $_GET[accountid];
$password = $_GET[password];

if ($accountid == '1234' && $password == '9999') {
  $verification = 'true';
} else {
  $verification = 'false';
}
?>

<vxml version="2.0">
  <form>
    <var name="verification" expr="'<?php echo($verification)?>'"/>
    <block>
      <prompt>
        Your account identification number is <?php echo($accountid)?>.
      </prompt>
      <prompt>
        Your password is <?php echo($password)?>.
      </prompt>
      <prompt>
        That combination is <value expr="verification"/>.
      </prompt>
    </block>
  </form>
</vxml>
To address question 4, you could accomplish this by combining elements from the previous examples.

For more IVR examples, you can go here:

http://www.plumvoice.com/docs/dev/devel ... taexchange
http://www.plumvoice.com/docs/dev/devel ... nding_Data

Hope this helps.

Regards,
Plum Support

Thanks for the great answers, I've got one more.

Posted: Fri Aug 29, 2008 11:11 am
by Inno
It sounds like I can't do this, but I wanted to have this confirmed before I make decisions based on my presumptions.

If the Plum Voice system records a .WAV file and I store it on my webserver ... is there any way to LATER play it BACK to a user over the phone system?

Example:

User JSmith calls the Plum system and enters their ID/password. The system then asks them if they want to record "Message 1" or "Message 2", etc. He records message 1 and hangs up.

Later JSmith calls back in and wants to hear the message they recorded last call. (Stored on the webserver) They choose the option to play back "Message 1". Can Plum voice submit a request to the webserver and receive BACK the stored WAV to play to JSmith? Or can the webserver only send back text to Plum?

Thanks!

Dylan

Play back recorded .wav file to a user using IVR system

Posted: Fri Aug 29, 2008 2:22 pm
by support
Hi Dylan,

Yes, it is possible to do this, as long as you move the saved recording to somewhere on your webserver that our IVR platform can fetch (similar to viewing an image file on a web browser).

For an IVR example using <record>:


Record.vxml:

Code: Select all

<?xml version="1.0"?>
<vxml version="2.0">
  <form>
    <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>
      <noinput>
        I didn't hear anything, please try again.
      </noinput>
    </record>

  <field name="confirm">
    <grammar>
      Yes|No
    </grammar>
    <prompt>
      Your message is <audio expr="msg"/>.
    </prompt>
    <prompt>
      To keep it, say yes. To discard it, say no.
    </prompt>
    <filled>
      <if cond="confirm=='Yes'">
        <submit next="http://mightyserver.com/Save.php" namelist="msg"
        method="post" enctype="multipart/form-data"/>
      </if>
      <clear/>
    </filled>
  </field>
  </form>
</vxml> 
Save.php:

Code: Select all

<?php
echo "<?xml version=\"1.0\" encoding=\"latin-1\"?>";
?>

<!DOCTYPE vxml SYSTEM "file:/DTD2304.dtd">

<vxml version="2.0">
  <form id="greeting">
    <block>

<?php
if (isset($_FILES['msg']) && Is_uploaded_file($_FILES['msg']['tmp_name'])) {
        move_uploaded_file($_FILES['msg']['tmp_name'],"savedfiles/message.wav");
}  else {
        echo "<prompt bargein=\"false\">Audio not saved.</prompt>";
}
?>

     </block>
  </form>
</vxml> 
Playback.vxml:

Code: Select all

<?xml version="1.0"?>
<vxml version="2.0">
  <form>
    <block>
      <prompt>
        Your message was <audio src="http://mightyserver.com/savedfiles/message.wav"/>.
      </prompt>
    </block>
  </form>
</vxml> 
Hope this helps.

Regards,
Plum Support