Skip to main content

Session getDigits

About

Gets DTMF from the specified channel. Digits will queue up until you run this method. If you want to make sure that no digits are in queue when you call this method, call flushDigits.

Click here to expand Table of Contents

Synopsis

getDigits(length, terminators, timeout, digit_timeout, abs_timeout)
  • length - number of digits to read
  • terminators - string of digits that terminate the input (*#)
  • timeout - first digit timeout in milliseconds
  • digit_timeout - inter-digit timeout in milliseconds
  • abs_timeout - absolute timeout in milliseconds

If only the first timeout is specified, it will be considered the first digit timeout and the digit_timeout. Alternatively, the digit_timeout can be explicitly specified. The abs_timeout overrules the other timeouts, regardless of keypresses.

All timeouts are specified in milliseconds.

Example

var dtmf;
dtmf = session.getDigits(5, "#", 40000, 20000, 20000);
var dtmf = '12';
dtmf += session.getDigits(3, "", 5000, 10000, 20000);
var dtmf;
dtmf = session.getDigits(1, "", 10000);

See Also