Álvaro Palma
2006-May-10 09:49 UTC
[Asterisk-Users] Is there a way to not propagate a context included inside other context?
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. -- Atly. ?lvaro Palma
Moises Silva
2006-May-10 10:25 UTC
[Asterisk-Users] Is there a way to not propagate a context included inside other context?
Alvaro: I dont think such a thing exists for a simple reason. I you think things "right", you will be able to end with a good combination of contexts. In your case, having: [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 does not seems fine to me for your purposes. "internal" is a concept that does not include the "invalid" concept. So may be it would be better [internal] exten => _XX,1,Dial(SIP/12345${EXTEN}) ; Short alias for internal lines exten => _12345XX,1,Dial(SIP/${EXTEN}) ; Long alias for internal lines and then [full] include => invalid include => internal include => local [full.local] include => invalid include => local [full.internal] include => invalid include => internal besides, including invalid at the beginning, it will cause to match always, you should include it at the end. read docs about pattern matching in voip-info.org Best Regards On 5/10/06, ?lvaro Palma <apalma@opschile.cl> 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. > > -- > Atly. > ?lvaro Palma > _______________________________________________ > --Bandwidth and Colocation provided by Easynews.com -- > > Asterisk-Users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >-- "Su nombre es GNU/Linux, no solamente Linux, mas info en http://www.gnu.org"
Johann
2006-May-10 14:22 UTC
[Asterisk-Users] Is there a way to not propagate a context included inside other context?
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. >