ADP
I love Asterisk. It is a superb piece of software
and a fine example of open source success. However, the extensions.conf
syntax is painful at best. I haven't had to worry about linenumbers since my
GW-BASIC days, and even then it wasn't necessary that line be numbered
sequentially. So I did some thinking about how to solve this problem, and
decided the best approach would be to write a translator that takes something
sane, which I will call ADP, and translate it to standard extensions.conf
format. Let's look at an example. Instead of this:
[incoming]
exten => s,1,Wait(1)
exten => s,2,Answer
exten => s,3,Playback(greeting)
exten => s,4,VoiceMail(77&80)
exten => s,5,Hangup
we write this:
[incoming]
ext s {
Wait(1)
Answer
Playback(greeting)
VoiceMail(77&80)
Hangup
}
Now, adding Zapateller between Answer and Playback does not require
manually reordering priority numbers.
I decided on the language and wrote a grammar for it, then dusted off my
lex/yacc skills (and book) and wrote me a C implementation of ADP. You can find
the current version and darcs repository at http://hans.fugal.net/src/adp. It
works, but there are probably bugs and certainly memory leaks (but unless you
have a gargantuan extensions.conf, who cares?)
I hope you find it useful. Suggestions and patches welcome.


