Asterisk cmd WaitExten


Waits for an extension to be entered; gives the caller the opportunity to push a new extension onto the stack



Waits for the user to enter a new extension for the specified number of seconds, then returns 0. Seconds can be passed with fractions of a second. (eg: 1.5 = 1.5 seconds).


m[(x)] - Provide music on hold to the caller while waiting for an extension.
Optionally, specify the class for music on hold within parenthesis.


example in extensions.conf

exten => _X.,n,WaitExten(3)

This command is particularly interesting as it pushes the received extension back on to the stack and then restarts the current context. Consider the followig example, using AEL syntax:

context extensions {
        0 => &dial(main);
        10 => &dial(fax);
        // other "real" extensions 11..99 go here
        _[1-9] => { // this pattern needs to catch all incomplete extensions
                jump s@ext-wait;
        s => {
                // optionally start playing a dial tone here
                jump s@ext-wait;


context ext-wait {
        _X! => {
                // optionally stop any dial tone
                jump ${Pre}${EXTEN}@extensions;
        s => {

This pattern is particularly useful for direct dial in.


  • WaitExten does not work in a Macro!
  • The autofallthrough setting was introduced in Asterisk 1.2 now defaults to 'yes' in Asterisk 1.4; if your dialplan relies on the ability to 'run off the end' of an extension and wait for a new extension without using WaitExten() to accomplish that, you will need set autofallthrough to 'no' in your extensions.conf file. If you want to set autofallthrough to 'no', you must go through your dialplan and add WaitExten() at every place where execute would run off the end of an extension and wait for another one to be dialed.
  • An examination of the source code seems to suggest that TIMEOUT(response) and TIMEOUT(digit) do not have any effect on WaitExten.

A user experience

"autofallthrough=yes" causes the ResponseTimeout() to be ignored (as far as I can tell). After running out of extensions in a context, instead of waiting the amount of time specified in ResponseTimeout() and proceeding to t, the hangup extension (h) is reached. So: In order to obtain the behavior described above, make sure that autofallthrough is not set.

Compared to the old Asterisk 1.0 way...

... there is a new option in Asterisk 1.2 called "autofallthrough" in extensions.conf that is set to yes. Asterisk 1.0 (and earlier) behavior was to wait for an extension to be dialed after there were no more extensions to execute. "autofallthrough" changes this behavior so that the call will immediately be terminated with BUSY, CONGESTION, or HANGUP based on Asterisk's best guess. If you are writing an extension for IVR, you must use the WaitExten application if "autofallthrough" is set to yes.

See also:

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

Created by: oej, Last modification: Thu 04 of Nov, 2010 (02:04) by admin
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+