[Asterisk-Users] Handling invalid extensions

Craig Guy cguy at bigpond.net.au
Fri Aug 20 17:46:28 MST 2004


Hi Will,

That won't work (I tried it originally).  What happens is that an invalid
extension will match the _123495XX pattern and asterisk will try to dial it.
My understanding is that the i extension will only activate if no pattern
match can be found, eg if somehow 9[0-4,6-9]XX gets into the context which
is impossible because our indial range is 9500 to 9599.  If the channel
cannot be created then asterisk jumps to n+101 which typically calls
voicemail with a busy parameter.

Asterisk attempts to create the SIP channel and fails because there is no
corresponding entry in sip.conf.  At this point we know that the call
couldn't be connected but it could either have been because it was genuinely
busy or some other reason like the SIP channel could not be created through
lack of a SIP.conf definition.  The GotoIf statement checks the DIALSTATUS
and branches if the dial attempt failed through not being able to create the
channel rather than busy.  If the GotoIf statement wasn't there it would try
and send the call to the invalid extensions voicemail with a busy flag which
will also fail as no voicemail is configured for undefined SIP extensions.

That is the reason why the GotoIf is at n+101 and also why trying to use the
'i' extension won't work.

The other benefit of this approach is that if a phone is physically
unavailable because it has been unplugged or whatever then the call gets
redirected to the main switch rather than going to voicemail.  This
behaviour could be modified by placing the GotoIf after the
Voicemail,b$(EXTEN:4) rather than before it.

Anyway, I was just curious because I couldn't find any reference to doing
this type of thing in the wiki.

Craig

----- Original Message ----- 
From: "William Glynn" <wglynn at freedomhealthcare.org>
To: <asterisk-users at lists.digium.com>
Sent: Saturday, August 21, 2004 12:57 AM
Subject: RE: [Asterisk-Users] Handling invalid extensions


Hrm:

> [extensions]
> exten => 950X,Macro(siphandset,${EXTEN})
> exten => 951X,Macro(siphandset,${EXTEN})
> exten => 9521,Macro(siphandset,${EXTEN})
> exten => 9537,Macro(siphandset,${EXTEN})
> exten => 9543,Macro(siphandset,${EXTEN})
> ; ...
> ; define patterns matching all assigned extensions
>
> [inbound]
> ; Attempt to connect to extensions/xxxx
> exten => _123495XX,1,Dial(Local/${EXTEN:4}@extensions)
>
> ; Didn't work? Connect to 9500
> exten => _123495XX,2,Goto(extensions,9500,1)

I guess that's a bit silly, now isn't it? :-)
Let's try that again:

[extensions]
exten => 9500,...
; ...
; all phones here

; No patterns matched?
exten => i,Goto(9500,1)

[inbound]
; Unconditionally hand off to [extensions] context
exten => _123495XX,Goto(extensions,${EXTEN:4},1)

--Will Glynn
Freedom Healthcare Group
_______________________________________________
Asterisk-Users mailing list
Asterisk-Users at lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users




More information about the asterisk-users mailing list