Upgrade 3CX to v18 and get it hosted free!

Asterisk Cmd Wait

Author image

Synopsis

Waits for specified time

Description

Wait(seconds)

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.

Note June 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.

How to Accept DTMF Keypresses While Waiting

The 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.

Example

This 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)

See Also


Asterisk | Applications | Functions | Variables | Expressions | Asterisk FAQ


Article Reviews

Write a Review

Your email address will not be published. Required fields are marked *

Required Field. Minimum 5 characters.

Required Field. Minimum 5 characters, maximum 50.

Required field.There is an error with this field.

Required Field.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

There are no reviews for this article. Be the first one to write a review.

Related Posts:

Get 3CX - Absolutely Free!
Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.