[Asterisk-Users] Handling invalid extensions

Craig Guy cguy at bigpond.net.au
Fri Aug 20 09:32:36 MST 2004


Hi, I was wondering how other people might handle this situation.  We have a
10 channel fractional E1 and have so far only allocated about 25 numbers out
of a 100 number block (9500 - 9599).  If an external caller dials an invalid
extension then we would like for them to be put through to our main number.
In order to make for a short and simple extensions.conf we have defined our
incoming context along the lines of:

exten => _123495XX,1,Dial(SIP/${EXTEN:4},16,tr)
exten => _123495XX,2,Voicemail,u${EXTEN:4}
exten => _123495XX,102,Voicemail,b${EXTEN:4}

In order to accomodate invalid extensions we did this:
exten => _123495XX,1,Dial(SIP/${EXTEN:4},16,tr)
exten => _123495XX,2,Voicemail,u${EXTEN:4}
exten => _123495XX,102,GotoIf($[${DIALSTATUS} = CHANUNAVAIL]?104)
exten => _123495XX,103,Voicemail,b${EXTEN:4}
exten => _123495XX,104,Dial(SIP/9500,20,tr)
exten => _123495XX,105,Voicemail,u9500
exten => _123495XX,205,Voicemail,b9500

When I was trying to research this I pretty much found no information apart
from an example using GotoIf in the 's' extension which wouldn't have been
compatible with our pattern matching anyway (exten => s,1,Blah vs exten =>
_123495XX,1,Blah).  The 'i' documentation in the wiki is less than helpful
and if I read it correctly it is really only for the occasion where an
extension cannot be matched.  The way it is defined above we will always get
a match, we will fail when there is no corresponding SIP extension defined
(priority + 101) and that is where the GotoIf($[${DIALSTATUS}..) comes in.
Is there any other way that we should be 'supposed' to do this
functionality?

Craig




More information about the asterisk-users mailing list