Asterisk i extension
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.
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
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
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

Comments
333
333Make something happen at end of every Dial?
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
333WaitExten() only
333Goto
333related with menu?
Asterisk cmd BackGround
But I'm not an expert..
333invalid number talkie
If you want to set "invalid number talkie", you should use "exten => _.,1,***" insted of "exten => i,1,***".