Ronald Wiplinger
2006-Aug-22 05:02 UTC
[asterisk-users] re-writing the dial plan - some hints please
My dialplan grew over the last months and I want to restructure it. What hints do you have for me? There are some points I want to do, but none of my tests worked. I use realtime, and have there a field called key, which can have several flags. E.g. a flag if the user is allowed to use a conference room, can call long distance, can call overseas, can call local pstn, different tariffs, .... I tried something like: [test-key] exten => _.,1,NoOp(variable key is ${key}) exten => _.,2,Set(flag_int =${CUT(key,,1)}) exten => _.,3,Set(tarif=${CUT(key,,2)}) exten => _.,4,NoOP(flag_int is ${flag_int} and tarif is ${tarif}) and wanted to use this variables in the next context, by using include statments, but it did not work. [caller] include => test-key include => A include => B ... The idea was to set at each entrance point first all flags and variables. Than I can use a common dialplan. If a flag is set, than I could include another context. Unfortunately there is no IF()include. I might be able to set a jump in each context to the end if the flag is not set. Any idea how I can do that? Any ideas of structuring the dialplan more efficiently? bye Ronald
Rushowr
2006-Aug-22 05:19 UTC
[asterisk-users] re-writing the dial plan - some hints please
You can't use that realtime field in an include statement... However, you could use context names like caller-conference and caller-longdistance and then call the context dynamically with Goto(caller-${key}). Otherwise, you're going to have to do it with logic routing. May I suggest at LEAST using Subroutines (end the subroutines with the Return command, and call them with Gosub), or maybe even doing a little logic magic with GotoIf statements? Of course, all of that logic routing can be a pain, but to further alleviate my personal dialplan code pains, I use AEL2 which makes the code a little more like Perl/C/PHP code, and allows for If/Else statements, etc... Just my 0.02. SKM>-----Original Message----- >From: asterisk-users-bounces@lists.digium.com >[mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of >Ronald Wiplinger >Sent: Tuesday, August 22, 2006 8:03 AM >To: Asterisk Users Mailing List - Non-Commercial Discussion >Subject: [asterisk-users] re-writing the dial plan - some hints please > >My dialplan grew over the last months and I want to >restructure it. What hints do you have for me? > >There are some points I want to do, but none of my tests worked. > >I use realtime, and have there a field called key, which can >have several flags. >E.g. a flag if the user is allowed to use a conference room, >can call long distance, can call overseas, can call local >pstn, different tariffs, .... > >I tried something like: >[test-key] >exten => _.,1,NoOp(variable key is ${key}) exten => >_.,2,Set(flag_int =${CUT(key,,1)}) exten => >_.,3,Set(tarif=${CUT(key,,2)}) exten => _.,4,NoOP(flag_int is >${flag_int} and tarif is ${tarif}) > >and wanted to use this variables in the next context, by using >include statments, but it did not work. > >[caller] >include => test-key >include => A >include => B >... > > > >The idea was to set at each entrance point first all flags and >variables. Than I can use a common dialplan. >If a flag is set, than I could include another context. >Unfortunately there is no IF()include. I might be able to set >a jump in each context to the end if the flag is not set. > >Any idea how I can do that? >Any ideas of structuring the dialplan more efficiently? > >bye > >Ronald > > >_______________________________________________ >--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 >