B.91. Read()

Reads DTMF input from a caller and assigns the result to a variable.
Read(variable[,filename[,maxDigits[,option[,attempts[,timeout]]]]])
Reads a DTMF sequence ending in "#" from the caller and places it in the specified variable.
If filename is specified (without file extension!), this audio file is played back to the caller before input is read.
The argument maxDigits defines the maximum number of digits allowed. If provided, the application stops reading when this number of digits has been entered, without the caller having to enter "#" to end the call. The default setting is 0 and means there is no preset limit and "#" is expected; the absolute maximum number of digits allowed is 255.
The option skip causes the application to end immediately if the channel is inactive. The option noanswer enables reading even if the channel is inactive.
The caller has up to attempts attempts within timeout seconds to enter a sequence. A timeout of zero means there is no time limit.
Returns -1 if the channel is hung up, otherwise returns 0.
; Read a 4 digit number, allowing up to 3 attempts, and say this number back to the caller:
exten => 123,1,Read(NUMBER,,4,3)
exten => 123,n,SayNumber(${NUMBER})
exten => 123,n,Goto(1)

Note

Internal help for this application in Asterisk 1.4:
  -= Info about application 'Read' =- 

[Synopsis]
Read a variable

[Description]
  Read(variable[|filename][|maxdigits][|option][|attempts][|timeout])

Reads a #-terminated string of digits a certain number of times from the
user in to the given variable.
  filename   -- file to play before reading digits or tone with option i
  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.
  option     -- options are 's' , 'i', 'n'
                '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.
  attempts   -- if greater than 1, that many attempts will be made in the 
                event no data is entered.
  timeout    -- An integer number of seconds to wait for a digit response. If greater
                than 0, that value will override the default timeout.

Read should disconnect if the function fails or errors out.
diff output to internal help in Asterisk 1.2:
12c12
<   filename   -- file to play before reading digits or tone with option i
---
>   filename   -- file to play before reading digits.
18,21c18,19
<   option     -- options are 's' , 'i', 'n'
<                 '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.
---
>   option     -- may be 'skip' to return immediately if the line is not up,
>                 or 'noanswer' to read digits even if the line is not up.
24,25c22
<   timeout    -- An integer number of seconds to wait for a digit response. If greater
<                 than 0, that value will override the default timeout.
---
>   timeout    -- if greater than 0, that value will override the default timeout.