CallXML 3.0 Development Guide Home  |  Frameset Home


<getdigits>  element


The getDigits element reads input touch-tone digits from the call and places them into a variable by the var attribute. This element is typically used for such tasks as gathering PIN codes, pager numbers, and anything else that involves multiple digits coming from the user. Handling any digits gathered requires an associated <onTermDigit> event element within the scope of the <getdigits> element.


usage

<getdigits cleardigits="(true|false)" id="(element id)" includetermdigit="(true|false)" maxdigits="(numeric value)" maxsilence="(m|s|ms)" maxtime="(m|s|ms)" termdigits="(123456789*#|ABCD)" test="CDATA" value-is="STRING" value-is-not="STRING" var="(variable name)">


attributes

cleardigits Data Type: (true|false) Default: false
This attribute's value is a Boolean, indicating whether the queued digits buffer should be cleared when this action starts. "true" clears the digits buffer; "false" leaves the contents of the digit buffer alone.
id Data Type: (element id) Default: none - attribute is optional
The new 'id' attribute in CallXML3.0 is applicable to all container and action elements. Specifying this attribute allows yet another level of control and event handling when events occur and are caught by the <on> element. When an event occurs, the handler will first check the event, and then verify that the handler has a handler specific to the 'id' attribute to execute. This allows the developer to plan a specific course of action for events based on where in the application that they occur.
includetermdigit Data Type: (true|false) Default: none - attribute is optional
This attribute defines whether the terminating digit should be included with the collected digit string. A value of 'true' indicates that the terminating digit will be appended to the string, and 'false' will ensure that the terminating digit pressed by the caller will not be included in the string.
maxdigits Data Type: (numeric value) Default: none - attribute is optional
This attribute denoted the maximum number of digits to collect from the caller. When the maximum amount of digits has been reached, application execution will resume from within the <onmaxdigits> handler, if present.
maxsilence Data Type: (m|s|ms) Default: 5s
This attribute specifies the maximum time to wait between keypresses before a executing any repeat actions, if specified. The time string format is:
<numeric value>[<optional qualifier>] | nolimit

The string begins with a required numeric value. The valid qualifiers are:
  • m: minutes
  • s: seconds (default)
  • ms: milliseconds

Example: "45m 33s 117ms"

Note that if no qualifier is specified, an "s" qualifier is assumed. No combinations of qualifiers are allowed. If there is a need to specify an unlimited amount of time, simply use the key word "nolimit".
maxtime Data Type: (m|s|ms) Default: 30s
The maxtime attribute indicates the maximum time that the CallXML browser should wait for digits before executing any repeat instances, if present.
termdigits Data Type: (123456789*#|ABCD) Default: none - attribute is optional
This attribute holds the list of touch-tone digits which can terminate the current caller action. Note that for each termdigit specified, there should be an <ontermdigit> handler in the code to catch the event. Allowable values are any one of "012356789*#", the ordinary DTMF (Touch-Tone) keypad possibilities, plus the special keypad tones found on some telephones "ABCD".
test Data Type: CDATA Default: Optional
The 'test' attribute is a new supplement to the CallXML markup that permits the developer to execute the contents of a container element, or action element, based on whether or not the specified condition is met. If the defined condition is met, then the code contained within the element is then executed. If the condition is not met, then the application resumes execution with the next sequential container container element in the document.
value-is Data Type: STRING Default: none - attribute is optional
Another new attribute, 'value-is', grants the developer with the ability to perform conditional logic upon container elements, or action elements for the first time within the CallXML markup. The value specified in the 'value-is' attribute specifies a string to compare against any 'value' attributes. If the 'value' and 'value-is' equate to 'true', then the element specified will execute. If the value equates to 'false' then the element will be skipped during document execution.
value-is-not Data Type: STRING Default: none - attribute is optional
Another new attribute, 'value-is-not', grants the developer with the ability to perform conditional logic upon container elements, or action elements, for the first time within the CallXML markup. The value specified in the 'value-is-not' attribute specifies a string to compare against any 'value' attributes. If the 'value' and 'value-is-not' equate to 'false', then the element specified will execute. If the value equates to 'true' then the element will be skipped during document execution.
var Data Type: (variable name) Default: none - attribute is required
This defines the variable name in which to store the digits collected. Not specifying a value for this attribute will cause a fatal application error.



code samples

<3.0 getdigits-termdigits-includetermdigit>
<?xml version="1.0" encoding="UTF-8"?>

<callxml version="3.0">
  <do label="B1">
    <prompt>
      Press any number, followed by the pound key.
    </prompt>
    <getdigits var="Var_1" termdigits="#"
      includetermdigit="true"/>


    <on event="termdigit:#">
      <say>
        You must have pressed $Var_1;
      </say>
    </on>
  </do>
</callxml>



<3.0 getdigits - maxtime - var>
<?xml version="1.0" encoding="UTF-8"?>

<callxml version="3.0">
  <do label="B1">
    <prompt>
      Start pressing digits until max time is reached
    </prompt>
    <getdigits var="Var_1" maxtime="3s"/>

    <on event="maxtime">
      <say>
        You managed to press $Var_1; in the 3 seconds we allowed you
        to input keypresses.
      </say>
    </on>

  </do>
</callxml>



<3.0 getdigits - maxdigits - maxsilence>
<?xml version="1.0" encoding="UTF-8"?>

<callxml version="3.0">
  <do label="B1">
    <prompt>
      Start pressing digits until we hit max digits.
      Or, dont press any digits, and we will hit a max silence event.
    </prompt>
    <getdigits var="Var_1" maxsilence="2s" maxdigits="5"/>

    <on event="maxdigits">
      <say>
        You must have pressed a total of five digits, which were $Var_1;
      </say>
    </on>

    <on event="maxsilence">
      <prompt>
        You must have stopped pressing keys for at least two seconds.
      </prompt>
    </on>

  </do>
</callxml>



<3.0 getdigits-valueis>
<?xml version="1.0" encoding="UTF-8"?>

<callxml version="3.0">
  <do label="B1" value="chocolate">
    <prompt>
    give me a string of 5 digits please.
    </prompt>

<!-- neither of these will execute -->
    <getdigits var="Var_1" maxdigits="5" value-is="vanilla"/>
    <getdigits var="Var_2" maxdigits="1" value-is-not="chocolate"/>


<!-- this however, will execute -->
    <getdigits var="Var_3" maxdigits="1" value-is="chocolate"/>


<!-- as would this, if we were to uncomment it -->
<!--
    <getdigits var="Var_4" maxdigits="1" value-is-not="strawberry"/>
-->

    <on event="maxdigits">
      <say>
        You must have pressed a total of five digits, which were $Var_3;
      </say>
    </on>

  <do>
</callxml>




<3.0 getdigits-test>
<?xml version="1.0" encoding="UTF-8"?>

<callxml version="3.0">
  <do label="B1">
    <prompt>
    give me a string of 5 digits please.
    </prompt>

<!-- neither of these will execute -->
    <getdigits var="Var_1" maxdigits="5" test="1 = 2"/>
    <getdigits var="Var_2" maxdigits="1" test="'foo' != 'foo'"/>


<!-- this however, will execute -->
    <getdigits var="Var_3" maxdigits="1" test="'money' != 'charm'"/>


<!-- as would this, if we were to uncomment it -->
<!--
    <getdigits var="Var_4" maxdigits="1" test="'echo' = 'echo'"/>
-->

    <on event="maxdigits">
      <say>
        You must have pressed a total of five digits, which were $Var_3;
      </say>
    </on>

  <do>
</callxml>




<3.0 getdigits-id>
<?xml version="1.0" encoding="UTF-8" ?>
<callxml version="3.0">

<do label="D1">

<prompt value="enter three digits here for fun and profit"/>

  <getdigits var="V1" termdigits="#" maxdigits="3" id="GD1"/>

  <on event="maxdigits" target="GD652">
  <log>*** maxdigits detected in GD652***</log>
  <say>
    this is never, ever going to occur.
  </say>
  </on>

  <on event="maxdigits" target="GD1">
  <log>*** maxdigits detected in GD1***</log>
  <say>
    you pressed $V1;
  </say>
  </on>

</do>

</callxml>



additional links

none


  ANNOTATIONS: EXISTING POSTS
F9calltrack
10/30/2007 12:21 PM (EDT)
Seems

<prompt>
      Press any number, followed by the pound key.
</prompt>

Should be

<prompt>
      <say>Press any number, followed by the pound key.</say>
</prompt>

OR

<prompt value="Press any number, followed by the pound key.">
</prompt>
voxeojeff
10/30/2007 12:55 PM (EDT)
Hello,

You are correct.  This is something that we will need to edit in our documentation.  I have already alerted our documentation gurus to this fact, and it will be changed during the next documetation update. :-)

Regards,

Jeff Menkel
Voxeo Corporation
SSA_NCH
1/28/2010 2:09 PM (EST)
> the maximum time to wait between keypresses before
> a executing any repeat actions, if specified.

It's not clear to me how repeat actions are specified in this context.  Would the system loop back up to the first container element with a "repeat" attribute?
voxeoblehn
1/28/2010 2:36 PM (EST)
Hello,

In this context, the documentation is referring to the repeat attribute specified at the current scope of the document in which the getdigits is used.

Meaning, if the getdigits w/ maxsilence is located within a prompt of id=foo & the repeat attribute is specified in this prompt - we will repeat the 'foo' prompt again when the maxsilence is reached.

Hope that clarifies things, however, if I just confused you further please let us know :)

Regards,

Brian Lehnen
Voxeo Support

login



© 2012 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site