login | register
Tue 02 of Dec, 2008 [12:11 UTC]

voip-info.org

Discuss [2] History

Asterisk cmd Wait

Created by: oej,Last modification on Fri 12 of Oct, 2007 [06:39 UTC] by chandave

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.

If the argument is zero or a negative number, Wait does nothing.

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

Return Code

Wait normally returns 0, or -1 if interrupted.

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

See also



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


Comments

Comments Filter
222

333Re: Wait() not waiting?

by jnfuller, Sunday 20 of May, 2007 [15:51:33 UTC]
Your include reuses priorities. Check your debug to make sure that you don't have issues with parsing. s,1,Set(LANGUAGE()=fr) already used the priority that s,1,Wait(30) attempts to set. You more than likely never call the wait as asterisk is ignoring the code due to priority collision.
222

333Wait() not waiting?

by quad, Tuesday 15 of August, 2006 [03:13:14 UTC]
I have a dial plan that looks like the following:

[default]
exten => s,1,Set(LANGUAGE()=fr)
include => zone1
exten => s,n,Noop

[zone1]
;exten => s,1,Set(TIMEOUT(digit)=2)
exten => s,1,Wait(30)
exten => s,n,Answer
exten => s,n,BackgroundDetect(custom/welcome)
; continuing ...

I want the phone to ring around 4 times before Asterisk Answer()s, but the Wait() command doesn't seem to wait 30 seconds at all. No matter how many seconds I specify, Asterisk answers during the second ring, always. Is there something I overlook? Thanks!