Christopher L. Wade
2004-Oct-07  16:03 UTC
[Asterisk-Users] recent 's' and 'n' priorities and lables
Hi all,
With the recent 's' and 'n' priorities, as well as the advantage
of
labels, dialplan management has become *much* simpler IMHO.
However, I have one suggestion for possible improvement.  In any of the 
Goto[If|IfTime] statements, the ability to do 's' + a number or label + 
a number would be _nice_.
Example extensions.conf:
exten => 1,1,NoOp(Start)
exten => 1,n,GotoIf($[${SOMETEST}]?:s+2)
exten => 1,n,NoOp(Do something)         ; target if SOMETEST = 1
exten => 1,n,NoOp(Do some other stuff)  ; target if SOMETEST = 0
exten => 1,n,NoOp(Finish)
turns into (pseudo-code):
print 'Start'
if (sometest)
{
	print 'Do something if sometest evaluates to true'
}
print 'Do some other stuff'
print 'Finish'
I realize that this could be implemented other ways, and might not even 
have much use, but it would nice regardless.  The basic idea boils down 
to this, be able to use the recent aliases and convenience features 
everywhere they might be needed/wanted (namely, all the different goto's).
If this already exists, please hit me with the clue stick ;)
Thanks,
Chris
-- 
Christopher L. Wade                     Unistar-Sparco Computers, Inc.
Senior Systems Administrator                            dba Sparco.com
Email: clwade@sparco.com                             7089 Ryburn Drive
Phone: (901) 872 2272 / (800) 840 8400            Millington, TN 38053
Fax:   (901) 872 8482                                              USA
Andrew Kohlsmith
2004-Oct-07  16:06 UTC
[Asterisk-Users] recent 's' and 'n' priorities and lables
On Thursday 07 October 2004 19:03, Christopher L. Wade wrote:> However, I have one suggestion for possible improvement. In any of the > Goto[If|IfTime] statements, the ability to do 's' + a number or label + > a number would be _nice_.oh baby yes please! That would just rock the house...> exten => 1,n,GotoIf($[${SOMETEST}]?:s+2)does :somelabel work? (i.e. no s)? gotoif help seems to indicate this is so. -A.
Soren Rathje
2004-Oct-07  22:59 UTC
[Asterisk-Users] recent 's' and 'n' priorities and lables
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@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@cadre5.com \ 310 Zap/3&IAX2/reedwade user TYS \ "Chris Luttrell" cgluttrell@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 }