Skip to content

Read()

Synopsis

Read a variable.

Description

Reads a #-terminated string of digits a certain number of times from the user in to the given variable.

This application sets the following channel variable upon completion:

  • READSTATUS - This is the status of the read operation.

    • OK

    • ERROR

    • HANGUP

    • INTERRUPTED

    • SKIPPED

    • TIMEOUT

Syntax

Read(variable,filename&[filename2[&...]],[maxdigits,[options,[attempts,[timeout]]]]])
Arguments
  • variable - The input digits will be stored in the given variable name.

  • filenames - Ampersand separated list of filenames to play before reading digits or tone with option 'i'. If the filename is a relative filename (it does not begin with a slash), it will be searched for in the Asterisk sounds directory. If the filename is able to be parsed as a URL, Asterisk will download the file and then begin playback on it. To include a literal '&' in the URL you can enclosethe URL in single quotes.

    • filename required

    • filename2[,filename2...]

  • maxdigits - Maximum acceptable number of digits. Stops reading after maxdigits have been entered (without requiring the user to press the '#' key).
    Defaults to '0' - no limit - wait for the user press the '#' key. Any value below '0' means the same. Max accepted value is '255'.

  • options

    • s - to return immediately if the line is not up.

    • i - to play filename as an indication tone from your indications.conf.

    • n - to read digits even if the line is not up.

    • t - Terminator digit(s) to use for ending input. Default is '#'. If you need to read the digit '#' literally, you should remove or change the terminator character. Multiple terminator characters may be specified. If no terminator digit is present, input cannot be ended using digits and you will need to rely on duration and max digits for ending input.

    • e - to read the terminator as the digit string if the only digit read is the terminator. This is for cases where the terminator is a valid digit, but only by itself. ie; '1234' and '#' are valid, but '1234#' is not.

  • attempts - If greater than '1', that many attempts will be made in the event no data is entered.

  • timeout - The number of seconds to wait for a digit response. If greater than '0', that value will override the default timeout. Can be floating point.

See Also

Generated Version

This documentation was generated from Asterisk branch 18 using version GIT