[asterisk-users] invalid extension

Miguel Molina mmolina at millenium.com.co
Mon Sep 7 14:26:25 CDT 2009


Administrator TOOTAI escribió:
> Hello,
>
> with Asterisk 1.6.1.6 I try to hangup a call if called extension is not 
> existing. For this purpose I would use the internal i extension but 
> seems not to work.
>
> [MyContext]
>
> exten => s,1,NoOp(Call is treated as it should)
> exten => s,n,NoOp(next step)
> exten => s,n,NoOp(aso ...)
>
> exten => _[a-zA-Z].,1,Goto(s,1)		; accept exten LEN >1 alpha
> exten => _X.,1,Goto(s,1)		; accept exten LEN >1 numeric
>
> exten => i,1,NoOP(sorry, extension doesnt exist) ; all 1 digits exten
> exten => i,n,Hangup				 ; refused, end of call
>
> What I have when calling a one digit extension -in this case h- is:
>
>   == Using SIP RTP CoS mark 5 
>
> [Sep  7 18:51:03] NOTICE[6084]: chan_sip.c:18523 handle_request_invite: 
> Call from '' to extension 'h' rejected because extension not found.
>    == Using SIP RTP CoS mark 5
>
> Should it not go to i extension? If I call the i or s extension it's 
> going well. Am I missing something?
>
>   
Hi,

The 'i' extension only works in applications like Background(), 
WaitExten() and everything that uses DTMF to route extensions within a 
context. As you can see in your call, it won't work directly because 
asterisk by default will reject a call that doesn't match in the context 
or included contexts you defined for the user. Because the call is not 
accepted there's no need for a hangup (in a SIP environment).

If you want to explicitly hangup calls using the dialplan, for your case 
add a one-digit catch all and leave your good calls with a 2-digit minimum:

exten => _X,1,NoOP(sorry, extension doesnt exist) ; all 1 digits exten
exten => _X,n,Hangup	

exten => _XX.,1,Goto(s,1)		; accept exten LEN >1 numeric


That will be enough to hangup what you want to, adjusting it to your needs.

Cheers,

-- 
Ing. Miguel Molina
Grupo de Tecnología
Millenium Phone Center




More information about the asterisk-users mailing list