[Asterisk-Users] Invalid extension handling

Eric Wieling eric at fnords.org
Thu Apr 14 20:57:22 MST 2005


Adam Robins wrote:

> When an outside callers hits my system, I play them a welcome message
> and ask that they enter an extension.  If the extension is invalid, it
> tells them so, and asks them to try again.  The relevant logic for this
> is:
> 
> [extensions]
> exten => _2XXX,Dial(SIP/${EXTEN})
> ;
> exten => i,1,Playback,invalid
> exten => i,n,Goto(incoming,_NXXNXXXXXX,1)
> ;
> 
> [incoming]
> exten => _NXXNXXXXXX,1,Answer
> exten => _NXXNXXXXXX,n,Background(welcome)        ; play welcome msg &
> ask for extension
> exten => _NXXNXXXXXX,n,WaitExten(5)               ; Wait for extension
> 
> 
> This works fine, however, there is one special case that I would like to
> handle differently.  If the caller inadvertently presses the # key
> following the extension, I would like to discard the # and then send the
> call back onto the stack.  I know how to strip the #, but I can't find
> another command like WaitExten that will reprocess the call as new.

Use Goto.  Since you have a pattern of _2XXX if they dial 2XXX# then 
Asteirsk will process the call as 2XXX and just discard the # since 
it's not listening for DTMF since it's already hit the Dial.

Same for _NXXNXXXXXX.

-- 
Always do right. This will gratify some people and astonish the rest.
Mark Twain



More information about the asterisk-users mailing list