[Asterisk-Users] recent 's' and 'n' priorities and lables
Soren Rathje
asterisk at lolle.org
Thu Oct 7 22:59:12 MST 2004
Christopher L. Wade wrote:
> Hi all,
>
> With the recent 's' and 'n' priorities, as well as the advantage of
> labels, dialplan management has become *much* simpler IMHO.
>
Looking at your sample made me think of another Asterisk contributor, the
author of astcl... Sample below...
/Soren
############################################################
##
## astcllib.tcl
## 13 April 2004
##
## Library for Astcl 0.1
## Reed Wade <reed at cadre5.com>
##
## Astcl is free software, distributed under the terms of
## the GNU General Public License
##
############################################################
CONFIGURATION
At startup, astcl does this:
- creates an interpreter instance
- sets a global tcl variable AST_CONFIG_DIR to the value of
the Asterisk config directory (normally /etc/asterisk)
- creates a command named "context"
- evaluates $AST_CONFIG_DIR/astcllib.tcl
- evaluates $AST_CONFIG_DIR/astcl.conf
astcl.conf evaluates as a normal tcl script but has access to the
AST_CONFIG_DIR variable and three new commands: context, user and ext
The context command takes one argument, the name of a new context to
be created. It creates the context, then it creates a new tcl command
with the same name as the context. If you're familiar with TK, this is
similar to the widget creation scheme.
This new command is used in four different ways: to create extensions,
to includes other contexts, add a switch and to set the ignorepat.
Normally, you will not create extensions directly, the "ext" convenience
function provides a sweeter interface.
Example (see samples/astcl.conf for a better one):
set TRUNK Zap/g2
context demo
demo includes othercontext
demo ignorepat 9
demo switch IAX2/blah
ext demo _91NXXNXXXXXX {
SetCallerID 8656904442|a
Dial $TRUNK/${EXTEN:1}
Congestion ""
}
user TYS \
"Reed Wade" reed at cadre5.com \
310 Zap/3&IAX2/reedwade
user TYS \
"Chris Luttrell" cgluttrell at cadre5.com \
303 Zap/2
context staffExtensions
ext staffExtensions TYS {
Dial $line|20|r
ifbusy {
Voicemail b$extension
Goto default|s|1
}
Voicemail u$extension
Goto default|s|1
}
More information about the asterisk-users
mailing list