play_and_get_digits

The play_and_get_digits application will play a sound file to the caller, while at the same time listening for DTMFs dialed by the caller, and act on them.

This is especially useful when scripting FreeSWITCH, allowing for full application logic and control flow.

In dialplan, you can use it for simple interactions without invoking the ivr application and its XML IVR language.

Argument syntax:

<min> <max> <tries> <timeout> <terminators> <file> <invalid_file> <var_name> <regex> [<digit_timeout>] ['<failure_ext> [failure_dp [failure_context]]'] 

Arguments:

  • min: Minimum number of digits to collect
  • max: Maximum number of digits to collect
  • tries: Number of attempts to play the file and collect digits
  • timeout: Number of milliseconds to wait before assuming the caller is done entering digits
  • terminators: Digits used to end input if less than min digits have been pressed (typically #)
  • file: Sound file to play while digits are fetched
  • invalid_file: Sound file to play when digits don't match the regex argument
  • var_name: Channel variable that digits should be placed in
  • regex: Regular expression to match valid digits
  • digit_timeout (optional): Number of milliseconds to wait in between digits (defaults to timeout value)
  • failure_ext (optional): Destination extension to which the call should be transferred if the caller does not enter a valid input value
  • * failure_dp (optional with failure_ext): Destination Dialplan type when using failure_ext (almost always "XML")
  • failure_context (optional with failure_dp): Destination Dialplan context when using failure_dp

Example:

<action application="play_and_get_digits" data="2 5 3 8000 # /path/to/sound_file.wav /path/to/invalid_sound.wav my_digits d+ "/> 
<action application="log" data="User entered these digits: ${my_digits}"/> 
 

This example executes play_and_get_digits with the following parameters:

  • Looks for a minimum of two digits
  • Looks for a maximum of five digits
  • Tries three times
  • Waits 8 seconds before assuming the caller is done entering digits
  • Uses the # key as the terminator
  • Plays the sound file /path/to/sound_file.wav while collecting digits
  • Plays the sound file /path/to/invalid_sound.wav if invalid digits are dialed
  • Stores the dialed digits in the channel variable my_digits
  • Matches against the pattern d+
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.54.7