Module get_digits

Collect user input from the channel.

This module provides actions for collecting user input from a channel, in the form of DTMF key presses.

Info:

  • Copyright: 2011-2015 Chad Phillips
  • Author: Chad Phillips

Actions

flush_digits Flush DTMF in the session.
get_digits Collect user input from the channel.


Actions

flush_digits
Flush DTMF in the session.

This action flushes any pending DTMF in the session.

Usage:

    {
      action = "flush_digits",
    }
get_digits
Collect user input from the channel.

This action collects user input from a channel, in the form of DTMF key presses, and stores the collected digits in the 'get_digits' storage area. Note that if no user input is collected, or validation fails, an empty string is saved to the storage area instead.

  • action string get_digits
  • audio_files tab A file or files to play to the user during collection. Playback is terminated when the user enters the first key. Usually used to give the user instructions on what to enter. Provide either a single file as a string, or multiple files in a table. The default is to play nothing.
  • bad_input string (Optional) An audio file to play to the user when input validation fails. Default is 'ivr/ivr-that_was_an_invalid_entry.wav'.
  • digits_regex string (Optional) A regular expression to use for validating the user input. If the user input does not match the expression, then validation fails. The regex is in the same form as the regular expressions used in the FreeSWITCH dialplan. Default is '\d+', which matches one or more digits. Note: If you need to match the * key in the regex, you will have to escape it twice, as in '\d+|\*'.
  • max_digits int (Optional) The maximum number of digits to collect. Default is 10. Alternatively, a string prefixed with a colon can be passed, and the length of the string will be used to set the value.
  • max_tries int (Optional) The maximum amount of times that validation will fail before giving up. Default is 3.
  • min_digits int (Optional) The minimum number of digits to collect. Default is 1. Alternatively, a string prefixed with a colon can be passed, and the length of the string will be used to set the value.
  • storage_key string (Optional) The key to store the collected digits under in the 'get_digits' storage area. Default is 'digits'.
  • terminators string (Optional) A string of keys that the user can use to end the collection before the timeout. Multiple values keys can be used, eg. '*' or '*#'. To accept no terminators, pass an empty string. Default is '#'.
  • timeout int (Optional) Number of seconds to wait for max_digits before trying to validate. Default is 3.

Usage:

    {
      action = "get_digits",
      audio_files = {
        "phrase:extension",
        "/path/to/another/file.wav",
      },
      bad_input = "ivr/ivr-that_was_an_invalid_entry.wav",
      digits_regex = "\\d+'",
      max_digits = 8,
      max_tries = 3,
      min_digits = 3,
      storage_key = "extension",
      terminators = "#*",
      timeout = 3,
    },
generated by LDoc 1.4.6 Last updated 2021-04-08 08:59:59