Re: [asterisk-users] Conditional include= ?
2008/4/22 Tzafrir Cohen [EMAIL PROTECTED]: [snip] A different approach: [company-base](!) ; common settings [company-A](company-base) ; specific for company A [company-B](company-base) ; specific for company B [company-C](company-base) ; specific for company C Keep in mind you can also use: [sub-template](!,base-template) And: [context](template1,template2) But one limitation is that you can only add: no way to remove line added by a template your context uses. Wow! That took some finding, as it is little more than a footnote (page 115-116 of Asterisk: The Future of Telephony) but is a fantastic feature... Given that I am using include = statements, and the order of the includes is significant, do you know what order lines from templates are included? I will check the code, but can I assume that [template1](!) include = template1-patterns [template2](!) include = template2-patterns [context](template1,template2) include = context-patterns It the same as: [context] include = template1-patterns include = template2-patterns include = context-patterns and always in that order? Is this feature well used and well tested??? Thanks, Steve ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Conditional include= ?
On Wed, 23 Apr 2008, Steve Davies wrote: Wow! That took some finding, as it is little more than a footnote (page 115-116 of Asterisk: The Future of Telephony) but is a fantastic feature... and always in that order? Is this feature well used and well tested??? If you are referring to templates, I have been making heavy use of them for years. I just checked one of my production dialplans -- EVERY context used templates except [general] and [globals]. Here's a snippet: ; templates [digit-timeout](!) exten = t,1,goto(${CONTEXT},s,1) [h](!) exten = h,1,goto(finish-call,h,1) [i](!) exten = i,1,goto(${CONTEXT},s,1) [max-timeout](!) exten = T,1,goto(max-time,s,1) [pound-hangup](!) exten = #,1,hangup() [pound-main](!) exten = #,1,goto(main-menu,s,1) [s](!) exten = s,1, verbose(1,${CONTEXT}:${EXTEN}:${PRIORITY}) [x](!) exten = _x.,1, verbose(1,${CONTEXT}:${EXTEN}:${PRIORITY}) ; the main menu [main-menu](digit-timeout,h,i,max-timeout,pound-main,s) The templates define the common 1 priority steps that get included everywhere. The real templates always use the n priority. The order of processing is as you would expect and is the same between 1.2 and 1.4. Just be careful of using uninitialized n priorities. For example: [foo] exten = x,100, this is foo [t2](!) exten = x,n,this is t2 [t1](!) exten = x,n,this is t1 [t3](t1,t2) exten = x,1,this is t3 exten = x,n,this is also t3 results in: dt*CLI show dialplan t3 [ Context 't3' created by 'pbx_config' ] 'x' =1. this is t3() [pbx_config] 2. this is also t3() [pbx_config] 101. this is t1() [pbx_config] 102. this is t2() [pbx_config] The n priority in [t2] is based on the last seen priority -- the priority in the unrelated context [foo]. Thanks in advance, Steve Edwards [EMAIL PROTECTED] Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000 ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Conditional include= ?
2008/4/23 Steve Edwards [EMAIL PROTECTED]: [big snip] Steve, Fantastic examples. Many thanks for the feedback :) Regards, Steve ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
[asterisk-users] Conditional include= ?
Hi, Does anyone have a clever method of doing a conditional include = line in the dialplan? I want to include a bunch of standard contexts, but in the middle of the bunch have one or more conditionally included, a bit like: [default] include = start-here include = then-here if $[{COMPANY} = A] include = company-A endif if $[{COMPANY} = B] include = company-B endif if $[{COMPANY} = C] include = company-C endif include = end-here The list of conditional variables, and of static includes is potentially large, so I do not want to create several separate sets of contexts with lots of repetition as it is likely to get out-of-control very quickly. Help? Steve ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Conditional include= ?
On Tue, Apr 22, 2008 at 09:55:37AM +0100, Steve Davies wrote: Hi, Does anyone have a clever method of doing a conditional include = line in the dialplan? I want to include a bunch of standard contexts, but in the middle of the bunch have one or more conditionally included, a bit like: [default] include = start-here include = then-here if $[{COMPANY} = A] include = company-A endif if $[{COMPANY} = B] include = company-B endif if $[{COMPANY} = C] include = company-C endif include = end-here The list of conditional variables, and of static includes is potentially large, so I do not want to create several separate sets of contexts with lots of repetition as it is likely to get out-of-control very quickly. A different approach: [company-base](!) ; common settings [company-A](company-base) ; specific for company A [company-B](company-base) ; specific for company B [company-C](company-base) ; specific for company C Keep in mind you can also use: [sub-template](!,base-template) And: [context](template1,template2) But one limitation is that you can only add: no way to remove line added by a template your context uses. -- Tzafrir Cohen icq#16849755 jabber:[EMAIL PROTECTED] +972-50-7952406 mailto:[EMAIL PROTECTED] http://www.xorcom.com iax:[EMAIL PROTECTED]/tzafrir ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Conditional include= ?
Steve Davies schrieb: Does anyone have a clever method of doing a conditional include = line in the dialplan? I want to include a bunch of standard contexts, but in the middle of the bunch have one or more conditionally included, a bit like: [default] include = start-here include = then-here if $[{COMPANY} = A] include = company-A endif if $[{COMPANY} = B] include = company-B endif if $[{COMPANY} = C] include = company-C endif include = end-here The list of conditional variables, and of static includes is potentially large, so I do not want to create several separate sets of contexts with lots of repetition as it is likely to get out-of-control very quickly. I suppose #ifdefs and a preprocessor like cpp is not what you're looking for? You didn't make clear at what stage you want these includes to be replaced / evaluated. I guess you want Asterisk to do it. Regards, Philipp Kempgen -- amooma GmbH - Bachstr. 126 - 56566 Neuwied - http://www.amooma.de Let's use IT to solve problems and not to create new ones. Asterisk? - http://www.das-asterisk-buch.de Geschäftsführer: Stefan Wintermeyer Handelsregister: Neuwied B 14998 ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Conditional include= ?
2008/4/22 Philipp Kempgen [EMAIL PROTECTED]: Steve Davies schrieb: Does anyone have a clever method of doing a conditional include = line in the dialplan? I want to include a bunch of standard contexts, but in the middle of the bunch have one or more conditionally included, a bit like: [default] include = start-here include = then-here if $[{COMPANY} = A] include = company-A endif if $[{COMPANY} = B] include = company-B endif if $[{COMPANY} = C] include = company-C endif include = end-here The list of conditional variables, and of static includes is potentially large, so I do not want to create several separate sets of contexts with lots of repetition as it is likely to get out-of-control very quickly. I suppose #ifdefs and a preprocessor like cpp is not what you're looking for? You didn't make clear at what stage you want these includes to be replaced / evaluated. I guess you want Asterisk to do it. Regards, Philipp Kempgen I would be looking for a runtime evaluation based on a variable. I'll take a look at Tzafrir's suggestion and try to undesrstand it :) Steve ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Conditional include= ?
2008/4/22 Tzafrir Cohen [EMAIL PROTECTED]: On Tue, Apr 22, 2008 at 09:55:37AM +0100, Steve Davies wrote: Hi, Does anyone have a clever method of doing a conditional include = line in the dialplan? I want to include a bunch of standard contexts, but in the middle of the bunch have one or more conditionally included, a bit like: [default] include = start-here include = then-here if $[{COMPANY} = A] include = company-A endif if $[{COMPANY} = B] include = company-B endif if $[{COMPANY} = C] include = company-C endif include = end-here The list of conditional variables, and of static includes is potentially large, so I do not want to create several separate sets of contexts with lots of repetition as it is likely to get out-of-control very quickly. A different approach: [company-base](!) ; common settings [company-A](company-base) ; specific for company A [company-B](company-base) ; specific for company B [company-C](company-base) ; specific for company C Keep in mind you can also use: [sub-template](!,base-template) And: [context](template1,template2) But one limitation is that you can only add: no way to remove line added by a template your context uses. That sounds interesting, though I am not aware of that format - Guess I'll go look it up in the WiKi :) Thanks, Steve ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Conditional include= ?
Steve Davies wrote: 2008/4/22 Tzafrir Cohen [EMAIL PROTECTED]: On Tue, Apr 22, 2008 at 09:55:37AM +0100, Steve Davies wrote: Hi, Does anyone have a clever method of doing a conditional include = line in the dialplan? I want to include a bunch of standard contexts, but in the middle of the bunch have one or more conditionally included, a bit like: [default] include = start-here include = then-here if $[{COMPANY} = A] include = company-A endif if $[{COMPANY} = B] include = company-B endif if $[{COMPANY} = C] include = company-C endif include = end-here The list of conditional variables, and of static includes is potentially large, so I do not want to create several separate sets of contexts with lots of repetition as it is likely to get out-of-control very quickly. A different approach: [company-base](!) ; common settings [company-A](company-base) ; specific for company A [company-B](company-base) ; specific for company B [company-C](company-base) ; specific for company C Keep in mind you can also use: [sub-template](!,base-template) And: [context](template1,template2) But one limitation is that you can only add: no way to remove line added by a template your context uses. That sounds interesting, though I am not aware of that format - Guess I'll go look it up in the WiKi :) It was a nice surprise I got while reading the downloaded version of Asterisk: The Future of Telephony. Not sure if it is in the Wiki as the PDF version works fine until my dead-tree version arrives. I didn't even look. Rod -- Thanks, Steve ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users