login | register
Sun 07 of Sep, 2008 [00:46 UTC]

voip-info.org

Discuss [6] History

Asterisk i extension

Created by: oej,Last modification on Sat 14 of Oct, 2006 [21:40 UTC] by JeroenDE

The Asterisk invalid extension


Each context in extensions.conf may have an 'i' extension that is used
for invalid extensions, i e, non-existing extensions dialled by clients.

Not Automatic

You would think that Asterisk would automatically jump to the 'i' extension if the client dials a number that is not matched by any other extensions. But it doesn't. Take this simple example:
[testing]
exten => 1,1,Dial(Zap/3,20)
exten => 2,1,Dial(Zap/4,20)
exten => i,1,Answer
exten => i,2,Playback(pbx-invalid)
exten => i,3,Hangup
If the client dials '1' or '2', all is well; they are connected to the appropriate extension. But if they dial '3', asterisk does not jump to the 'i' extension and play the "pbx-invalid" sound file.

The 'i' extension only gets fired when there's a prompt or input been made with 'background'. You can set up a 'exten => i,1...' to prompt for wrong keypresses - insult the user and so on. So this wont work if someone just dials somthing wrong.

Where's the original number?

The original number dialled is found in the channel variable ${INVALID_EXTEN}

Alternative to i

Include a separate (!) context like below to catch all other = non-existing extensions:

 [bogons]
 exten => _.,1,what_to_do_for_fat_fingers_always_misdialing

EDIT:
For not trapping into the same extension twice if a user hangs up (when not defined a h extension),
you just could use _X. instead of _. so you only catch the numeric calls (X = 0..9 and not h, i or whatever).

Alternative NOT using 'i'

it works great!
Trapping for incorrectly dialed extentions.

Howto get 'i' working in your dialplan

So after much frustration and poking around I have figured out howto get an 'i' extension to register with your dialplan. The problem is that when a channel enters a context it does not honor 'i' for some reason, but if you're used to using macro's and Goto/GoSub you'll know that the 'i' extension works there. The solution is then to Goto/GoSub from a stub extension to your real extension.
For instance if your SIP users end up in a context-named "sip-users" you could configure something like:
[sip-users]
exten => _.,1,Goto(local-users,BYEXTENSION,1)

[local-users]
exten => 1,1,Dial(Zap/3,20)
exten => 2,1,Dial(Zap/4,20)
exten => i,1,Answer
exten => i,2,Playback(pbx-invalid)
exten => i,3,Hangup



Triggered by Other Commands

The following Asterisk commands can automatically trigger the 'i' extension


Comments

Comments Filter
222

333

by Ikarus, Tuesday 28 of February, 2006 [00:13:10 UTC]
222

333Make something happen at end of every Dial?

by rowitech, Friday 09 of September, 2005 [09:23:37 UTC]
Hi there,

my problem is a bit more than told here. Say I have this dialplan:

exten => 100,1,Dial(SIP/rowi@sip.rowi.net)
exten => 200,1,Dial(SIP/rowi@sip.rowi.net)
exten => _X.,1,Goto(somewhere_else)

I want to got somewhere_else whenever a call has finished. Surely I can add this:

exten => 100,2,Goto(somewhere_else)
exten => 200,2,Goto(somewhere_else)

Doing this for every call makes me crazy. How do I accomplish this?
The h extension is not the right way for me because the user may be busy or I just executed an AGI. I want to go to somewhere_else everytime regardless of what heppened before.

Do I have to put all the stuff into a big AGI?

Rolf

222

333WaitExten() only

by , Tuesday 04 of January, 2005 [01:14:16 UTC]
The extension "i" is only triggered when an invalid extension is entered in response to the "WaitExten()" command.
222

333Goto

by , Thursday 07 of October, 2004 [18:30:20 UTC]
The i extension triggers on a bad goto
222

333related with menu?

by mmenaz, Monday 20 of September, 2004 [00:26:48 UTC]
maybe the "i" triggers when invalid input only waiting for a menu chooice, see:
Asterisk cmd BackGround
But I'm not an expert..
222

333invalid number talkie

by , Saturday 10 of July, 2004 [18:38:02 UTC]
(:confused:)
If you want to set "invalid number talkie", you should use "exten => _.,1,***" insted of "exten => i,1,***".