Summary:ASTERISK-07435: waitexten can not work fine in agi
Reporter:shawn (welles)Labels:
Date Opened:2006-08-01 03:31:21Date Closed:2011-06-07 14:02:41
Versions:Frequency of
Description:1, why waitexten is not in Category list?!
2, waitexten works fine when using it in extension.conf but when using it in AGI it will drop the first digit .
the following is my agi script and extension.conf

execute_agi("exec waitexten 30|m");


exten => 1000,1,NoOP(${EXTEN})
exten => 2000,1,agi(waitexten.php)
when i dial 2000, i hear music and dial further extension 1000. it will hangup after i dial first '0'. if i dial 11000, it will enter the 1000 extension.
Comments:By: Russell Bryant (russell) 2006-08-05 02:50:52

This is not a bug.  It is actually expected behavior.

The way the application WaitExten works is that it waits until a *single* digit is dialed, and then it returns.  When used in the dialplan, the pbx core sees that this digit that was dialed could potentially match an extension once more digits are dialed, so it waits and collects more digit from the channel.

When WaitExten is used in AGI, you will get the response of something like "200 result=42" where "42" is the ASCII code for the digit that was pressed.

There are other ways to collect digits from a caller in AGI, such as simply using the Read application.  Then, to have the call continue at a different extension you would use "SET EXTENSION", "SET PRIORITY", and "SET CONTEXT", and then exit from the AGI script.