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

Newbie - scratchpad

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

peterj@skipzone.co.uk
Posts: 10
Joined: Sat Dec 30, 2006 8:55 am
Location: windsor uk

Newbie - scratchpad

Post by peterj@skipzone.co.uk »

Hi Plum 'Tree',

I am just getting started. I have made a scratchpad with a voiceXML script in it. But when I dial my number it says there are no scripts enabled on this number.

Can you nudge me in the right direction.

Thanks - Pete

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

<form>
<block>
<prompt>
Welcome to our new SKIPZONE TEST SYSTEM.
</prompt>
</block>
</form>
</vxml>[/code]

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

After call is in, IVR app for that phone number is executed

Post by support »

Hello,

After creating your Scratchpad you must then assign it to a DNIS. This can be done by going to the "Application Setup" page, and clicking "E" to edit one of your DNISs. You should then select the scratchpad you have created for that DNIS and click "Commit".

Plum IVR Hosting allows you to assign either a URL or a simple scratchpad to your DNIS(s). When an IVR call comes in on your phone number, the IVR application for that phone number (DNIS) is executed.

Regards,
Plum Support
Last edited by support on Wed Feb 24, 2010 6:02 pm, edited 3 times in total.

peterj@skipzone.co.uk
Posts: 10
Joined: Sat Dec 30, 2006 8:55 am
Location: windsor uk

Started

Post by peterj@skipzone.co.uk »

Great! Thanks! Now it works.

Now I need it to send me an email eveytime i call the test number.
Can you give me an example script.

I am sure this test will lead to something usfeful for my clients.

Regards

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

no way to send email using IVR scripts written on scratchpad

Post by support »

Hi,

Unfortunately, there is no way to send emails using IVR scripts written in the scratchpad.

Instead, you will need to run/host your VoiceXML script on an IVR server with a scripting language (e.g. PHP, ASP) that has some sort of built-in mail commands.


Regards,

Plum Support
Last edited by support on Sat Feb 20, 2010 3:40 pm, edited 2 times in total.

peterj@skipzone.co.uk
Posts: 10
Joined: Sat Dec 30, 2006 8:55 am
Location: windsor uk

Started + email

Post by peterj@skipzone.co.uk »

Would it be possble to give an example of some .php ?

Then I could modify it and put it on my website.

just needs to send me an email when for example the IVR returns caller to 'sales' dept.

Many thanks

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

IVR script using PHP mail function

Post by support »

Hi,

For further info on the PHP mail function to use with your IVR script, we recommend looking here: http://us3.php.net/manual/en/ref.mail.php.

Regards,

Plum Support
Last edited by support on Fri Jan 01, 2010 1:13 pm, edited 1 time in total.

peterj@skipzone.co.uk
Posts: 10
Joined: Sat Dec 30, 2006 8:55 am
Location: windsor uk

from scratchpad to URL

Post by peterj@skipzone.co.uk »

When I moved my demo script from scratchpad to my web site. It locates the file on the URL but then it says

VoiceXML Validator:

File: http://www.skipzone.co.uk/skipzoneIVRtest.php

Validation Results:

Fatal Error at line 1, char 1
Message: Expected comment or processing instruction

I have searched the forum for clues and example codes but have found none.

Many thanks for your help.... I know it probably is a bit remedial! But I like to have a go at these things before I have to pay an experienced programmer to sort it all out.

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>skipzoneIVRtest</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
</html>
<?xml version="1.0"?>
<vxml version="2.0">

  <form>
    <block>
      <prompt>
         Welcome to Skipzone Test Portals.
      </prompt>
      <goto next="#mainmenu"/>
    </block>
  </form>

  <menu id="mainmenu">
    <prompt>
      Please choose a department:
      <enumerate/>
    </prompt>
    <choice dtmf="1" next="#sales">
       Sales</choice>
    <choice dtmf="2" next="#support">
       Tech Support</choice>
    <choice dtmf="3" next="#directory">
       Company Directory</choice> 
  </menu>

  <form id="sales">
    <block>
      Please hold for the next available sales
      representative.
      <!-- transfer to sales -->
    </block>
  </form>

  <form id="support">
    <block>
	<?php
$headers  = "From: \"Me\"<pete@lt-holdings.co.uk>k>\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"";
mail('first@lt-holdings.co.uk', "hello", $headers);
?>
      <!-- transfer to tech support -->
    </block> 
  </form>

  <form id="directory">
    <block>
      <!-- transfer to company directory -->
    </block>
  </form>

</vxml>


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

IVR script change

Post by support »

Hi,

You can't mix html code/tags with your VoiceXML. If you remove everything up to and including the "</html>" from your IVR script, you should be OK. Also, make sure there is no whitespace before the "<?xml version="1.0"?>".


Regards,

Plum Support
Last edited by support on Fri Jan 01, 2010 1:15 pm, edited 1 time in total.

peterj@skipzone.co.uk
Posts: 10
Joined: Sat Dec 30, 2006 8:55 am
Location: windsor uk

Post by peterj@skipzone.co.uk »

Removed html and spaces.

File: http://www.skipzone.co.uk/skipzoneIVRtest.php

Validation Results:

Fatal Error at line 1, char 1
Message: Expected comment or processing instruction

Is it because I have called the file .php which is what Dreamweaver saves?

Does my server have to support any special protocols?

Thanks Pete

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

IVR code change due to PHP confusion

Post by support »

Hi,

Because the PHP processing instructions and the xml prolog (<?xml version="1.0"?>) use the same escape characters, PHP is getting confused. So you need to change your first line of IVR code to look like this:

<?php echo "<?xml version=\"1.0\"?>" ?>


Regards,

Plum Support
Last edited by support on Fri Jan 01, 2010 1:16 pm, edited 1 time in total.

peterj@skipzone.co.uk
Posts: 10
Joined: Sat Dec 30, 2006 8:55 am
Location: windsor uk

Post by peterj@skipzone.co.uk »

Great! works! That was the easy bit! I'll be back in a few weeks with some more questions!

peterj@skipzone.co.uk
Posts: 10
Joined: Sat Dec 30, 2006 8:55 am
Location: windsor uk

choose the language

Post by peterj@skipzone.co.uk »

I have been experimenting.... In this example the caller chooses French, German or English. I then want the subject of the email to be the relevant language.

How do I make $language = the choice?

I can't seem to write any values within the vxml portion of the script.

Many thanks for your help.

Code: Select all

<?php echo "<?xml version=\"1.0\"?>" ?>
<vxml version="2.0">

  <form>
    <block>
      <prompt>
         Welcome to Skipzone Test Portals.
      </prompt>
      <goto next="#mainmenu"/>
    </block>
  </form>
  
  <menu id="mainmenu">
    <prompt>
      Please choose a language:
      <enumerate/>
    </prompt>
    <choice dtmf="1" next="#sales">
        french</choice>
    <choice dtmf="2" next="#support">
         german</choice>
    <choice dtmf="3" next="#directory">
       english</choice> 
  </menu>
  

  <form id="sales">
    <block> 
	      Please hold for the next available french sales
      representative.
<!-- transfer to sales -->
    </block>
  </form>

  <form id="support">
    <block>
	 Please hold for the next available german sales
      representative.
		       <!-- transfer to tech support -->
    </block> 
  </form>

  <form id="directory">
    <block>
	 Please hold for the next available english sales
      representative.
	      <!-- transfer to company directory -->
    </block>
  </form>

<?php
mail('first@lt-holdings.co.uk', "sales language", $choice);
?>

</vxml>


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

IVR example that collects language and submits to PHP script

Post by support »

Hello,

If you want your PHP script to get access to the selections users make in the VoiceXML dialog you will have to collect the information and then submit it to your PHP.

When data is collected in VXML it is stored in a Javscript variable, that variable can then be submitted to an IVR application server and processed using a scripting language. In your case this would be your Apache/PHP server. A simple IVR example that collects the language and then submits it to your PHP script would be:

page1.php

Code: Select all

<?php echo "<?xml version=\"1.0\"?>" ?>
<vxml version="2.0">
  <form>
    <block>
      <prompt>
         Welcome to Skipzone Test Portals.
      </prompt>
    </block>
    <field name="language">
      <prompt>
        Please choose a language: French, German, English.
      </prompt>
      <grammar type="application/srgs+xml" version="1.0" root="language" mode="voice">
        <rule id="language">
          <one-of>
            <item>french</item>
            <item>german</item>
            <item>english</item>
          </one-of>
        </rule>
      </grammar>
      <filled>
        <submit next="page2.php" method="post" namelist="language"/>
      </filled>
    </field>
 </form>
</vxml>
page2.php

Code: Select all

<?php 
mail('first@lt-holdings.co.uk', "sales language", $language);
echo "<?xml version=\"1.0\"?>"
?>
<vxml version="2.0">
  <form>
    <block>
      <prompt>
        Please hold for the next available <?php echo($language);?> sales representative.
        <!-- transfer to sales -->
      </prompt>
    </block>
  </form>
</vxml>
Passing the collected variable to your PHP page allows you to send the email with dynamic information as well as providing a dynamic prompt.

Regards,
Plum Support
Last edited by support on Sat Feb 20, 2010 3:41 pm, edited 4 times in total.

peterj@skipzone.co.uk
Posts: 10
Joined: Sat Dec 30, 2006 8:55 am
Location: windsor uk

Post by peterj@skipzone.co.uk »

Great. Thanks. I understand the principle now.

peterj@skipzone.co.uk
Posts: 10
Joined: Sat Dec 30, 2006 8:55 am
Location: windsor uk

Post by peterj@skipzone.co.uk »

I am trying to submit the callers phone number. Is it possible like this? There must be more to it?!

Code: Select all

<?php echo "<?xml version=\"1.0\"?>" ?>
<vxml version="2.0">
  <form>
    <block>
      <prompt>
         Welcome to Skipzone Test Portals.
      </prompt>
    </block>
    <field name="language">
      <prompt>
        Please choose a language: French, German, English.
      </prompt>
      <grammar type="application/srgs+xml" version="1.0" root="language" mode="voice">
        <rule id="language">
          <one-of>
            <item>french</item>
            <item>german</item>
            <item>english</item>
          </one-of>
        </rule>
      </grammar>
      <filled>
        <submit next="page2.php" method="post" namelist="language"/>
<submit next="page2.php" method="post" session.telephone.ani ="caller"/>

      </filled>
    </field>
 </form>
</vxml> 

Code: Select all

<?php
mail('first@lt-holdings.co.uk', $caller, $language);
echo "<?xml version=\"1.0\"?>"
?>
<vxml version="2.0">
  <form>
    <block>
      <prompt>
        Please hold for the next available <?php echo($language);?> sales representative.
        <!-- transfer to sales -->
      </prompt>
    </block>
  </form>
</vxml> 
Many thanks for your help.

Post Reply