[Asterisk-Users] Is there a way to not propagate a context included inside other context?

Johann johann.hoehn at ecommerce.com
Wed May 10 14:22:28 MST 2006


Split the contexts up even more.  Keep in mind the SIP users you setup can all 
start in a different context and you can have your incoming zap calls start in a 
different context.

Ie, make a context that includes ability to dial internally and outside.  Then 
make another context that just includes the ability to dial internally.  Setup 
the phones to use those contexts and you have obtained your goal.

I wouldn't even bother with the invalid context.  If asterisk can't find the 
extension it will send the status back to the phone that will show the user that 
the dial was invalid anyway.

Keep in mind that asterisk parses the contexts and extensions in a way you might 
not expect.  Use the CLI "show dialplan <context>" to see how the ordering ends 
up.  See 
http://www.voip-info.org/wiki/index.php?page=Asterisk+config+extensions.conf+sorting 
for more info on it.


--johann

Álvaro Palma wrote:
> I've defined my dialplan as showed below. My internal lines are numbered 
> as 12345XX, and internal users can call another by the entire 7-digits 
> extension, or by just last 2 digits.
> 
> [invalid]
> exten => _X.,1,Playback(pbx-invalid)
> exten => _X.,2,Hangup()
> 
> [internal]
> include => invalid
> exten => _XX,1,Dial(SIP/12345${EXTEN}) ; Short alias for internal lines
> exten => _12345XX,1,Dial(SIP/${EXTEN}) ; Long alias for internal lines
> 
> [local]
> exten => _XXXXXXX,1,Dial(Zap/g1/${EXTEN}) ; Local area calls
> 
> [full]
> include => internal
> include => local
> 
> (As it's defined, local also include invalid context)
> 
> My idea is that, if any user authorized to make only internal calls dial 
> any number different than 12345XX, he/she'll receive the invalid 
> message. Besides if any user authorized to make local calls dial any 
> internal number, the call is routed internally (not via a NOT toll free 
> call through the Zap channel).
> 
> My question is: Is there a way to NOT propagate the "invalid" context 
> when the "internal" context is included by other? The problem I see is 
> that, if any user authorized to make local and internal calls (e.g., in 
> the full context), dial a number different than 12345XX, it receives the 
> PBX-INVALID message, instead of dialing the external number through the 
> Zap channel. Or if I switch the include order in the "full" context, 
> even internal calls are routed through the Zap channel!!!
> 
> I know that maybe this dialplan is not the best in this case, but my 
> final question is how to avoid the propagation of "preincluded" context 
> beyond the scope of the context that explicitaly include it.
> 
> Thanks a lot for your answer.
> 



More information about the asterisk-users mailing list