[asterisk-users] Conditional include=> ?
Roderick A. Anderson
raanders at acm.org
Tue Apr 22 10:57:02 CDT 2008
Steve Davies wrote:
> 2008/4/22 Tzafrir Cohen <tzafrir.cohen at xorcom.com>:
>> 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
More information about the asterisk-users
mailing list