开发者

VXML for DTMF entry of letters based on their placement on dialpad

开发者 https://www.devze.com 2023-02-06 02:09 出处:网络
I\'m brand new to VXML (and coding in general) and apparently what I\'m trying to do is... not normal, but hopefully it can be done.

I'm brand new to VXML (and coding in general) and apparently what I'm trying to do is... not normal, but hopefully it can be done.

I understand the principle concept of DTMF input with VXML where I use:

<grammar mode="dtmf"><![CDATA[ (*|0|1|2|3|4|5|6|7|8|9)<2-31> ]]></grammar>

<prompt>something here</prompt>

<noinput-nomatch-filled>conditions</noinput-nomatch-filled>

What I'm trying to do is take multiple actions to allow DTMF entry of letters based on their placement on the开发者_开发百科 dialpad. You'd achieve this by first dialing the number that the letter is on (2-9), and the placement of that letter (1-4).

For example: "E" would be 3 and 2 on the dialpad.

I'm at a complete loss as to how this would work in VXML. What I'd like to do is this:

1) PROMPT: Please input your THREE letter code. Please enter your first letter.

2) Expect two DTMF inputs the first number between 2 and 9, the second number between 1 and 4. Based on this logic (33 = F, 94 = Z) the letter is set.

3) PROMPT: The letter you have entered is (INPUT). Is this correct? Press 1 for yes, 2 to retry.

4) Retry or go onto the next letter. So on and so forth.

If anyone has resources so I can stumble upon the answer to this myself, that'd be great! If anyone would like a bounty... that's an option, too! Thank you for reading!


The typical approach to this problem is just accept twice the number of tones as you expect or use a pound terminated input. Then use ECMAscript or server side code to translate the tone strings into the desired letters.


There are a couple of a ways to approach this problem:

1) You could just accept all 2 digit numbers in the grammar and do all validation/calculation on the server side.

and/or

2) Do some validation in the <filled> section and letter-decoding-from-number on the server-side (and then come back with the result and check with the user if that was the intended letter).

For the two-digit grammar, you could parameterize the built-in digits grammar as follows (please note that the URI scheme is platform-specific, so you may need to refer to the user manual of your voice browser to be sure of the exact scheme to be used)

<field type="digits?length=2">
   <prompt>Please enter the code of the first letter</prompt>
</field>

There are other ways as well, like you could also do letter-decoding on the client-side using a script on the same page, but hopefully the above gives some ideas on what to choose based on your requirement.

(Actually, the OP would probably not be looking for an answer to this question after so long but hopefully it helps others who landed on this page searching for a solution to a similar question)


The best way could be to define a grammar that link each value to the result letter :

  <grammar mode="dtmf" root="letter">
    <rule id="letter">
      <one-of>
        <item>32<tag>E</tag></item>
        ...
      </one-of>
    </rule>
  </grammar>

Another way is to let the user enter the 2 letters and process it with a EcmaScript function, or use the tag .

I am going to plan to add such feature in the Voximal the VoiceXML interpreter for Asterisk. But are you sure that the users can be able to understand and use this method to enter letters ?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号