2

platform : sandbox testing place

I would like to add one more snippet set

The below snippet will get the mobile number from caller, and post the caller entered number into another page, Code working fine,

but i want to check the that number in the table and pull the " Entered phone number details", that is in contact_tbl holds the phone number, firstname, lastname, address, now i want to pull these details for the given phone number.

<?php
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
?>
<vxml version = "2.1">
  <meta name="maintainer" content="your_email_address@wherever.com"/>

  <property name="inputmodes" value="dtmf" />
  <form id="get_mobile_no">
    <field name="mobileno" type="digits?minlength=10;maxlength=10">
      <prompt>
        <prosody rate="slow"> please enter your 10 digit mobile number !</prosody>
      </prompt>
      <!--INVALID-->
      <nomatch count = "1">
        <prompt>
          <prosody rate="slow"> Is that a number? Please try again. </prosody>
        </prompt>
        <reprompt/>
      </nomatch>
      <!--TIMEOUT-->
      <noinput count = "1">
        <prompt>Again, please enter your 10 digit mobile number !</prompt>
        <reprompt/>
      </noinput>
      <catch event="noinput nomatch" count="3">
      <prompt>Please try again later. Good bye.</prompt>
      <exit/> </catch>
      <filled>
        <prompt>
          <prosody rate="slow"> you said
            <value expr="mobileno"/>
            ! Thanks for calling, you may now hang up.</prosody>
        </prompt>
      </filled>
    </field>
    <block name="sendData">
      <prompt>Entering   entering...</prompt>
      <submit next="get_dtmf_ip.php" namelist="mobileno" method="post" />
    </block>
  </form>
</vxml>

sample VXML ivr application which get input from user and play caller entered number.

below code working fine, but when i remove grammer tag, it playing some error code, i am not able to track that error code.

now i want to make little change, that user can enter more than one number.

exactly caller have to enter their their mobile number.

how to change the code to accept multiple number.

<?php
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
?>
<vxml version = "2.1">
      <meta name="maintainer" content="your_email_address@wherever.com"/>
    <form id="guessNumber">
        <field name="guess">
          <grammar type="text/gsl">
            [dtmf-1 dtmf-2 dtmf-3 dtmf-4 dtmf-5 dtmf-6 dtmf-6 dtmf-7 dtmf-8 dtmf-9]
          </grammar>
          <prompt>
            <prosody rate="slow">
Guess what the computer is thinking! Pick a number between 0 and 9.
            </prosody>
          </prompt>
          <nomatch>
            <prompt>
              <prosody rate="slow">
Is that a number? Please try again.
              </prosody>
            </prompt>
            <reprompt/>
          </nomatch>
          <filled>
            <prompt>
              <prosody rate="slow">
you said
                <value expr="guess"/>
                !
              </prosody>
            </prompt>
          </filled>
        </field>
      </form>
      </vxml>
user1102364
  • 21
  • 1
  • 6

1 Answers1

0

This question is a little old, but for future readers...

It is hard to tell what you are asking. To allow more than one digit, change the grammar to:

<grammar version="1.0" xml:lang="en-US" root="keypress" 
         mode="dtmf" scope="document">
    <rule id="keypress" scope = "public">
      <one-of>
          <item> 1 </item>
          <item> 2 </item>
          <item> 3 </item>
          <item> 4 </item>
          <item> 5 </item>
          <item> 6 </item>
          <item> 7 </item>
          <item> 8 </item>
          <item> 9 </item>
          <item> 0 </item>
      </one-of>
    </rule>
</grammar>

Then specify the number of digits using:

<field name="guess" type="digits?length=2" >

If however, you are asking how to get multiple responses from the caller just add a second field element to the form like this:

<form id="guessNumber">
    <field name="guess1" type="digits?length=1" >
        <prompt>
            Guess what the computer is thinking! Pick a number between 0 and 9.
        </prompt>
    </field>

    <field name="guess2" type="digits?length=1" >
        <prompt>
            Guess what the computer is thinking now! Pick a number between 0 and 9.
        </prompt>
        <filled>
            You guessed <value expr="guess1"> and <value expr="guess2">.
        </filled>
    </field>
</form>

nomatch and prosody elements removed them for clarity. They can be added back in.

Alien Technology
  • 1,760
  • 1
  • 20
  • 30