[Asterisk-Users] Re: What about a higher level configurationlanguage

Steven Critchfield critch at basesys.com
Mon Sep 27 12:14:20 MST 2004


On Mon, 2004-09-27 at 12:33, Kevin Walsh wrote:
> Benjamin on Asterisk Mailing Lists [benjk.on.asterisk.ml at gmail.com] wrote:
> > On Mon, 27 Sep 2004 09:54:46 +0200, Tom Ivar Helbekkmo <tih at eunetnorge.no> wrote:
> > > There is the added complication that one would need a front-end
> > > application to generate the configuration file(s).  You do *not* want
> > > to force people to write that markup-intensive XML by hand.  It tends
> > > to raise the blood pressure to dangerous levels...  :-)
> > >
> > I wasn't suggesting XML as a means to *configure* Asterisk.
> > 
> > Instead, I was suggesting XML as a means to *store* Asterisk's
> > configuration data. 
> > 
> I would suggest that any replacement configuration method should at
> least have support for conditionals such as if/else.  Perhaps "switch"
> too.
> 
> Maybe something like this:
> 
>     exten => 1234, {
>         NoOp(hello world);
>         if (${FOO} == ${BAR}) {
>             FOO = ${BAZ}
>         }
>         switch (Dial(...)) {
>         case BUSY:
>             ...
>         case UNAVAILABLE:
>             ...
>         default:
>             ....
>         }
>     }
> 
> I don't think XML is appropriate here.

I agree that I don't think XML is appropriate. XML seems to always be
pulled out for information storage just like a similar group who thinks
all php apps should store data in mysql. I understand it is nice and
easy to throw the data into a database table or a XML structure as there
is plenty of tools that will handle the parsing and reading of the data
for you. I just don't think either one is up to the expressiveness
needed for the extensions.conf file. 

I like the example provided above. Essentially it is starting to look
like a programming language more evolved than early 80s BASIC. If you
could add labels to the language where we could do something like
goto(context,exten,label), or similarly, if we could get functions built
into it, we would have solved the need for macros.

Then you could have something more like the following

[main-extens]
exten => std_extension, $var1, $var2 {
	NoOp(Std Extension Logic, extension $var1);
	switch(dial($var1)) {
	case BUSY:
		...
	case UNAVAILABLE:
		...
	default:
		...
	}
}

exten => 1234, {
	std_extension(SIP/john at digium.com, 1234 at digium);
}
exten => 1235, {
	std_extension(Zap/3, 1235 at digium);
}

-- 
Steven Critchfield <critch at basesys.com>




More information about the asterisk-users mailing list