Synopsis
Read a variable in the form for DTMF tones as pressed by the callerDescription
As of Asterisk 1.0:Read(variable[|filename][|maxdigits][|option])
As of Asterisk 1.2:
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.
- variable: variable where the user's response will be stored.
- filename: file to play before reading digits.
- maxdigits: maximum acceptable number of digits. Stops reading after maxdigits have been entered (without requiring the user 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: may be 'skip' to return immediately if the line is not up, or 'noanswer' 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: Timeout in seconds. If greater than 0, that value will override the default timeout.
Read should disconnect if the function fails or errors out.
; The Following Example uses Read and Say digits to read 3 digits from user, saying each one as user types.
exten => s,1,Gotoif($[ "${LEN(${extensao})}" < "3"]?3:100)
exten => s,n,NoOp(executando - ${extensao} - )
exten => s,n,Read(digito||1)
exten => s,n,SayDigits(${digito})
exten => s,n,Set(extensao=${extensao}${digito})
exten => s,n,GoTo(s,1)
exten => s,100,GoTo(from-pstn,s,1)
exten => h,1,hangup()
Asterisk | Applications | Functions | Variables | Expressions | Asterisk FAQ
Comments
333Multiple sound files issue
For a dialplan with static sound file names you can use - sox file1 file2 file3 file4 file1234 - to combine sound files 1,2,3&4 into file1234. it doesn't work when the sound filename is dynamically determined.
I use Read() way more frequently than Playback or Background.
3331.6 Change
333Cannot combine multiple sound files
333No Timeout