Asterisk cmd Wait
SynopsisWaits for specified time
The Wait command takes one argument, the number of seconds to wait. During the time waited, all sound input received on the channel, including DTMF tones, are silently ignored. The Wait command is typically used before answering a channel, although in newer Asterisk version (1.4 and later) Answer() itself can take an argument in milliseconds to wait for the desired number of seconds.
If the argument is zero or a negative number, Wait does nothing. The argument can be a fractional number like 0.3 or 1.5 .
If Wait() is run on a channel which has been hung up (i.e. from the 'h' extension), the Wait() application returns 0 immediately and no further processing of the 'h' extension priorities takes place. You can get around this with 'System(path/to/sleep Xs)', where 'X' is the number of seconds to wait. Nasty, but it works.
How to Accept DTMF Keypresses While WaitingThe Wait command will ignore any DTMF input from buttons pressed by callers on the line. If you want to accept DTMF input while waiting, set the wait time by calling ResponseTimeout and do not define a step at the next highest priority. Asterisk will silently wait up to ResponseTimeout seconds for the user to dial an extension number valid in the current context.
NotesJune 2010: Wait could be modified to work on a dead channel in extension h, but as it stands right now the code assumes the channel is alive, and to ensure that things work properly, it has to read incoming media from the channel so it can be discarded... and if at any time waiting for or reading media from the channel fails, it exits, because there's no point in continuing to wait since the call is gone.
ExampleThis example will wait 30 seconds (typically about 6-7 rings) before answering the channel.
exten => s,1,Wait(30)
exten => s,2,Answer
On Asterisk 1.4 and later this can be done more elegantly:
exten => s,1,Answer(30000)
Asterisk | Applications | Functions | Variables | Expressions | Asterisk FAQ
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+