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

Global Zero-Out option

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
scholarchip
Posts: 2
Joined: Fri Mar 13, 2009 8:16 am

Global Zero-Out option

Post by scholarchip »

Hello,

I would like to add an option to my application where the user can press the zero key to be transferred. How would I catch this globally without adding it to each form in my application.

Thanks in advance,
Seth

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

IVR code for Global Zero-Out option

Post by support »

Hi,

Here is an example of IVR code that should help you achieve this.

yourapplicationscript.php:

Code: Select all

<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>
<vxml version="2.0" application="yourrootdocument.php">
  <form>
    <field name="myfield">
      <!-- Multiple grammars can be specified either by including -->
      <!-- several grammar blocks within the field item or by -->
      <!-- specifying a built-in grammar with the "field" tag's -->
      <!-- "type" attribute. -->
      <grammar type="application/x-jsgf" mode="dtmf">
        ( 1 | 2 )+
      </grammar>
      <grammar type="application/x-jsgf" mode="voice">
        ( one | two )+
      </grammar>
      <prompt>
        Say or enter any number of the digits one or two.
      </prompt>
      <filled>
        You entered <value expr="myfield"/>.
      </filled>
      <nomatch>
        You did not say or enter any ones or twos.
        <reprompt/>
      </nomatch>
      <noinput>
        You did not enter anything.
        <reprompt/>
      </noinput>
    </field>
  </form>
</vxml>
yourrootdocument.php:

Code: Select all

<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>
<vxml version="2.0">
<link next="transfercall.php" dtmf="0"/>
</vxml> 
transfercall.php:

Code: Select all

<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>
<vxml version="2.0">
  <form>
    <transfer dest="tel:+1xxxxxxxxxx">
      <prompt>
        Transferring your call.
      </prompt>
    </transfer>
  </form>
</vxml>
From this IVR example, a user calls into yourapplicationscript.php and hears a prompt. If a user presses 0 on their phone keypad, they would hear the message, "Transferring your call." and then be transferred to the transfer phone number.

This is possible because yourapplicationscript.php refers to our root document, yourrootdocument.php. In that root document, we have set up a <link> that goes to transfercall.php if the user presses 0 on their phone keypad.

However, please note that if a user enters a <field> in your own IVR script that allows them to enter 0 (for example, if you're collecting digits), they will not be allowed to enter 0 to transfer them (since your IVR field grammar overrides what was set up in your root document). If that is the case, we recommend that you use a different DTMF key such as "*" or "#" for the user to press if they wish to be transferred.

Hope this helps.

Regards,
Plum Support

Post Reply