Many doc directory improvements, including:

- Added development section (backtrace.tex)
- Correct filesystem path formating
- Replace all "|" argument separator to ","
- Endless count of spaces at the end of line
- Using astlisting to make listings do not take so much place
- Take back ASTRISKVERSION on first page
- Make localchannel.tex readable by inserting extra end of lines

(closes issue #10962)
Reported by: IgorG
Patches: 
      texdoc-85177-1.patch uploaded by IgorG (license 20)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@85519 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.6.0
Russell Bryant 18 years ago
parent cd929dbd72
commit 8b8a42e61c

@ -1,9 +1,9 @@
\section{Introduction} \section{Introduction}
AEL is a specialized language intended purely for AEL is a specialized language intended purely for
describing Asterisk dial plans. describing Asterisk dial plans.
The current version was written by Steve Murphy, and is a rewrite of The current version was written by Steve Murphy, and is a rewrite of
the original version. the original version.
This new version further extends AEL, and This new version further extends AEL, and
@ -18,7 +18,7 @@ AEL is really the merger of 4 different 'languages', or syntaxes:
\item The second syntax is the Expression Syntax, which is normally \item The second syntax is the Expression Syntax, which is normally
handled by Asterisk extension engine, as expressions enclosed in handled by Asterisk extension engine, as expressions enclosed in
\$[...]. The right hand side of assignments are wrapped in \$[ ... ] \$[...]. The right hand side of assignments are wrapped in \$[ ... ]
by AEL, and so are the if and while expressions, among others. by AEL, and so are the if and while expressions, among others.
\item The third syntax is the Variable Reference Syntax, the stuff \item The third syntax is the Variable Reference Syntax, the stuff
@ -139,16 +139,16 @@ Right at this moment, the following commands are available, but do
nothing: nothing:
Enable AEL contexts debug Enable AEL contexts debug
*CLI> ael debug contexts *CLI> ael debug contexts
Enable AEL macros debug Enable AEL macros debug
*CLI> ael debug macros *CLI> ael debug macros
Enable AEL read debug Enable AEL read debug
*CLI> ael debug read *CLI> ael debug read
Enable AEL tokens debug Enable AEL tokens debug
*CLI> ael debug tokens *CLI> ael debug tokens
Disable AEL debug messages Disable AEL debug messages
*CLI> ael no debug *CLI> ael no debug
@ -201,7 +201,7 @@ be included on a single line. Whatever you think is best!
You can just as easily say, You can just as easily say,
\begin{verbatim} \begin{verbatim}
if(${x}=1) { NoOp(hello!); goto s|3; } else { NoOp(Goodbye!); goto s|12; } if(${x}=1) { NoOp(hello!); goto s,3; } else { NoOp(Goodbye!); goto s,12; }
\end{verbatim} \end{verbatim}
as you can say: as you can say:
@ -210,12 +210,12 @@ as you can say:
if(${x}=1) if(${x}=1)
{ {
NoOp(hello!); NoOp(hello!);
goto s|3; goto s,3;
} }
else else
{ {
NoOp(Goodbye!); NoOp(Goodbye!);
goto s|12; goto s,12;
} }
\end{verbatim} \end{verbatim}
@ -224,10 +224,10 @@ or:
\begin{verbatim} \begin{verbatim}
if(${x}=1) { if(${x}=1) {
NoOp(hello!); NoOp(hello!);
goto s|3; goto s,3;
} else { } else {
NoOp(Goodbye!); NoOp(Goodbye!);
goto s|12; goto s,12;
} }
\end{verbatim} \end{verbatim}
@ -235,9 +235,9 @@ or:
\begin{verbatim} \begin{verbatim}
if (${x}=1) { if (${x}=1) {
NoOp(hello!); goto s|3; NoOp(hello!); goto s,3;
} else { } else {
NoOp(Goodbye!); goto s|12; NoOp(Goodbye!); goto s,12;
} }
\end{verbatim} \end{verbatim}
@ -274,12 +274,12 @@ The following are keywords in the AEL language:
\item while \item while
\item case \item case
\item pattern \item pattern
\item default NOTE: the "default" keyword can be used as a context name, \item default NOTE: the "default" keyword can be used as a context name,
for those who would like to do so. for those who would like to do so.
\item catch \item catch
\item switches \item switches
\item eswitches \item eswitches
\item includes \item includes
\end{itemize} \end{itemize}
@ -288,15 +288,15 @@ The following are keywords in the AEL language:
AEL first parses the extensions.ael file into a memory structure representing the file. AEL first parses the extensions.ael file into a memory structure representing the file.
The entire file is represented by a tree of "pval" structures linked together. The entire file is represented by a tree of "pval" structures linked together.
This tree is then handed to the semantic check routine. This tree is then handed to the semantic check routine.
Then the tree is handed to the compiler. Then the tree is handed to the compiler.
After that, it is freed from memory. After that, it is freed from memory.
A program could be written that could build a tree of pval structures, and A program could be written that could build a tree of pval structures, and
a pretty printing function is provided, that would dump the data to a file, a pretty printing function is provided, that would dump the data to a file,
or the tree could be handed to the compiler to merge the data into the or the tree could be handed to the compiler to merge the data into the
asterisk dialplan. The modularity of the design offers several opportunities asterisk dialplan. The modularity of the design offers several opportunities
for developers to simplify apps to generate dialplan data. for developers to simplify apps to generate dialplan data.
@ -307,6 +307,7 @@ for developers to simplify apps to generate dialplan data.
First, some basic objects First, some basic objects
\begin{astlisting}
\begin{verbatim} \begin{verbatim}
------------------------ ------------------------
<word> a lexical token consisting of characters matching this pattern: [-a-zA-Z0-9"_/.\<\>\*\+!$#\[\]][-a-zA-Z0-9"_/.!\*\+\<\>\{\}$#\[\]]* <word> a lexical token consisting of characters matching this pattern: [-a-zA-Z0-9"_/.\<\>\*\+!$#\[\]][-a-zA-Z0-9"_/.!\*\+\<\>\{\}$#\[\]]*
@ -490,9 +491,8 @@ First, some basic objects
<includes> :== 'includes' '{' <includeslist> '}' <includes> :== 'includes' '{' <includeslist> '}'
| 'includes' '{' '}' | 'includes' '{' '}'
\end{verbatim} \end{verbatim}
\end{astlisting}
\section{AEL Example USAGE} \section{AEL Example USAGE}
@ -582,7 +582,7 @@ CID matching is done as with the extensions.conf file. Follow the extension
name/number with a slash (/) and the number to match against the Caller ID: name/number with a slash (/) and the number to match against the Caller ID:
\begin{verbatim} \begin{verbatim}
context zoombo context zoombo
{ {
819/7079953345 => { NoOp(hello, 3345); } 819/7079953345 => { NoOp(hello, 3345); }
} }
@ -701,14 +701,14 @@ context foo {
} }
\end{verbatim} \end{verbatim}
NOTE: AEL wraps the right hand side of an assignment with \$[ ] to allow NOTE: AEL wraps the right hand side of an assignment with \$[ ] to allow
expressions to be used If this is unwanted, you can protect the right hand expressions to be used If this is unwanted, you can protect the right hand
side from being wrapped by using the Set() application. side from being wrapped by using the Set() application.
Read the README.variables about the requirements and behavior Read the README.variables about the requirements and behavior
of \$[ ] expressions. of \$[ ] expressions.
NOTE: These things are wrapped up in a \$[ ] expression: The while() test; NOTE: These things are wrapped up in a \$[ ] expression: The while() test;
the if() test; the middle expression in the for( x; y; z) statement the if() test; the middle expression in the for( x; y; z) statement
(the y expression); Assignments - the right hand side, so a = b -> Set(a=\$[b]) (the y expression); Assignments - the right hand side, so a = b -> Set(a=\$[b])
Writing to a dialplan function is treated the same as writing to a variable. Writing to a dialplan function is treated the same as writing to a variable.
@ -719,7 +719,7 @@ context blah {
CALLERID(name)=ChickenMan; CALLERID(name)=ChickenMan;
NoOp(My name is ${CALLERID(name)} !); NoOp(My name is ${CALLERID(name)} !);
} }
} }
\end{verbatim} \end{verbatim}
You can declare variables in Macros, as so: You can declare variables in Macros, as so:
@ -739,7 +739,7 @@ arguments and associated ARG1, ARG2, etc variables. Sorry.
In trunk (1.6 and higher), we have made all arguments local variables to In trunk (1.6 and higher), we have made all arguments local variables to
a macro call. They will not affect channel variables of the same name. a macro call. They will not affect channel variables of the same name.
This includes the ARG1, ARG2, etc variables. This includes the ARG1, ARG2, etc variables.
Users can declare their own local variables by using the keyword 'local' Users can declare their own local variables by using the keyword 'local'
before setting them to a value; before setting them to a value;
@ -753,7 +753,7 @@ Macro myroutine(firstarg, secondarg)
\end{verbatim} \end{verbatim}
In the above example, Myvar, firstarg, and secondarg are all local variables, In the above example, Myvar, firstarg, and secondarg are all local variables,
and will not be visible to the calling code, be it an extension, or another Macro. and will not be visible to the calling code, be it an extension, or another Macro.
If you need to make a local variable within the Set() application, you can do it this way: If you need to make a local variable within the Set() application, you can do it this way:
@ -812,7 +812,7 @@ context conditional {
} }
else else
Voicemail(${EXTEN}|u); Voicemail(${EXTEN}|u);
ifTime (14:00-25:00|sat-sun|*|*) ifTime (14:00-25:00|sat-sun|*|*)
Voicemail(${EXTEN}|b); Voicemail(${EXTEN}|b);
else else
{ {
@ -858,7 +858,7 @@ context conditional {
\end{verbatim} \end{verbatim}
NOTE: The conditional expression in if() statements (the NOTE: The conditional expression in if() statements (the
"\${DIALSTATUS}" = "BUSY" above) is wrapped by the compiler in "\${DIALSTATUS}" = "BUSY" above) is wrapped by the compiler in
\$[] for evaluation. \$[] for evaluation.
NOTE: Neither the switch nor case values are wrapped in \$[ ]; they can NOTE: Neither the switch nor case values are wrapped in \$[ ]; they can
@ -926,7 +926,7 @@ begin:
context gotoexample2 { context gotoexample2 {
s => { s => {
end: end:
goto gotoexample|s|begin; // go to label in different context goto gotoexample|s|begin; // go to label in different context
} }
} }
@ -962,7 +962,7 @@ begin:
context gotoexample2 { context gotoexample2 {
s => { s => {
end: end:
jump s@gotoexample; // go to label in different context jump s@gotoexample; // go to label in different context
} }
} }
@ -980,7 +980,7 @@ NOTE: goto labels follow the same requirements as the Goto()
NOTE AEL introduces the special label "1", which is the beginning NOTE AEL introduces the special label "1", which is the beginning
context number for most extensions. context number for most extensions.
NOTE: A NEW addition to AEL: you can now use ',' instead of '|' to NOTE: A NEW addition to AEL: you can now use ',' instead of '|' to
separate the items in the target address. You can't have a mix, separate the items in the target address. You can't have a mix,
though, of '|' and ',' in the target. It's either one, or the other. though, of '|' and ',' in the target. It's either one, or the other.
@ -1099,7 +1099,7 @@ tree, and makes several checks:
o the times have to be in range of 0 to 24 hours. o the times have to be in range of 0 to 24 hours.
o The weekdays have to match the internal list, if they are provided; o The weekdays have to match the internal list, if they are provided;
o the day of the month, if provided, must be in range of 1 to 31; o the day of the month, if provided, must be in range of 1 to 31;
o the month name or names have to match those in the internal list. o the month name or names have to match those in the internal list.
\item (0.5) If an expression is wrapped in \$[ ... ], and the compiler \item (0.5) If an expression is wrapped in \$[ ... ], and the compiler
will wrap it again, a warning is issued. will wrap it again, a warning is issued.
\item (0.5) If an expression had operators (you know, \item (0.5) If an expression had operators (you know,
@ -1107,7 +1107,7 @@ tree, and makes several checks:
issued. Maybe someone forgot to wrap a variable name? issued. Maybe someone forgot to wrap a variable name?
\item (0.12) check for duplicate context names. \item (0.12) check for duplicate context names.
\item (0.12) check for abstract contexts that are not included by any context. \item (0.12) check for abstract contexts that are not included by any context.
\item (0.13) Issue a warning if a label is a numeric value. \item (0.13) Issue a warning if a label is a numeric value.
\end{itemize} \end{itemize}
There are a subset of checks that have been removed until the proposed There are a subset of checks that have been removed until the proposed
@ -1249,18 +1249,18 @@ available through AEL, via:
commands commands
\item Functions: Functions were implemented inside \${ .. } variable \item Functions: Functions were implemented inside \${ .. } variable
references, and supply many useful capabilities. references, and supply many useful capabilities.
\item Expressions: An expression evaluation engine handles items \item Expressions: An expression evaluation engine handles items
wrapped inside \$[...]. This includes some string manipulation wrapped inside \$[...]. This includes some string manipulation
facilities, arithmetic expressions, etc. facilities, arithmetic expressions, etc.
\item Application Gateway Interface: Asterisk can fork external \item Application Gateway Interface: Asterisk can fork external
processes that communicate via pipe. AGI applications can be processes that communicate via pipe. AGI applications can be
written in any language. Very powerful applications can be added written in any language. Very powerful applications can be added
this way. this way.
\item Variables: Channels of communication have variables associated \item Variables: Channels of communication have variables associated
with them, and asterisk provides some global variables. These can be with them, and asterisk provides some global variables. These can be
manipulated and/or consulted by the above mechanisms. manipulated and/or consulted by the above mechanisms.
\end{itemize} \end{itemize}

@ -16,13 +16,13 @@
can be encoded in a text message such as ring tones, and small can be encoded in a text message such as ring tones, and small
graphic, etc. Text messaging is being used for voting and graphic, etc. Text messaging is being used for voting and
competitions, and also SPAM... competitions, and also SPAM...
Sending a message involves the mobile phone contacting a message Sending a message involves the mobile phone contacting a message
centre (SMSC) and passing the message to it. The message centre then centre (SMSC) and passing the message to it. The message centre then
contacts the destination mobile to deliver the message. The SMSC is contacts the destination mobile to deliver the message. The SMSC is
responsible for storing the message and trying to send it until the responsible for storing the message and trying to send it until the
destination mobile is available, or a timeout. destination mobile is available, or a timeout.
Landline SMS works in basically the same way. You would normally have Landline SMS works in basically the same way. You would normally have
a suitable text capable landline phone, or a separate texting box such a suitable text capable landline phone, or a separate texting box such
as a Magic Messenger on your phone line. This sends a message to a as a Magic Messenger on your phone line. This sends a message to a
@ -111,30 +111,33 @@
\section{extensions.conf} \section{extensions.conf}
The following contexts are recommended. The following contexts are recommended.
\begin{astlisting}
\begin{verbatim} \begin{verbatim}
; Mobile Terminated, RX. This is used when an incoming call from the SMS arrive ; Mobile Terminated, RX. This is used when an incoming call from the SMS arrive
s, with the queue (called number and sub address) in ${EXTEN} s, with the queue (called number and sub address) in ${EXTEN}
; Running an app after receipt of the text allows the app to find all messages ; Running an app after receipt of the text allows the app to find all messages
in the queue and handle them, e.g. email them. in the queue and handle them, e.g. email them.
; The app may be something like smsq --process=somecommand --queue=${EXTEN} ; The app may be something like smsq --process=somecommand --queue=${EXTEN}
to run a command for each received message to run a command for each received message
; See below for usage ; See below for usage
[smsmtrx] [smsmtrx]
exten = _X.,1, SMS(${EXTEN}|a) exten = _X.,1, SMS(${EXTEN},a)
exten = _X.,2,System("someapptohandleincomingsms ${EXTEN}") exten = _X.,2,System("someapptohandleincomingsms ${EXTEN}")
exten = _X.,3,Hangup exten = _X.,3,Hangup
; Mobile originated, RX. This is receiving a message from a device, e.g. ; Mobile originated, RX. This is receiving a message from a device, e.g.
; a Magic Messenger on a sip extension ; a Magic Messenger on a sip extension
; Running an app after receipt of the text allows the app to find all messages ; Running an app after receipt of the text allows the app to find all messages
; in the queue and handle then, e.g. sending them to the public SMSC ; in the queue and handle then, e.g. sending them to the public SMSC
; The app may be something like smsq --process=somecommand --queue=${EXTEN} ; The app may be something like smsq --process=somecommand --queue=${EXTEN}
; to run a command for each received message ; to run a command for each received message
; See below for example usage ; See below for example usage
[smsmorx] [smsmorx]
exten = _X.,1, SMS(${EXTEN}|sa) exten = _X.,1, SMS(${EXTEN},sa)
exten = _X.,2,System("someapptohandlelocalsms ${EXTEN}") exten = _X.,2,System("someapptohandlelocalsms ${EXTEN}")
exten = _X.,3,Hangup exten = _X.,3,Hangup
\end{verbatim} \end{verbatim}
\end{astlisting}
smsmtrx is normally accessed by an incoming call from the SMSC. In the smsmtrx is normally accessed by an incoming call from the SMSC. In the
UK this call is from a CLI of 080058752X0 where X is the sub address. UK this call is from a CLI of 080058752X0 where X is the sub address.
@ -318,7 +321,7 @@ exten = _1709400[0-8],1,Goto(smsmorx,${CALLERID(num)}-{EXTEN:7:1},1)
error. Any trailing arguments are processed as follows:- error. Any trailing arguments are processed as follows:-
\begin{itemize} \begin{itemize}
\item If the message is mobile originating and no destination address \item If the message is mobile originating and no destination address
has been specified, then the first argument is assumed to be a has been specified, then the first argument is assumed to be a
destination address destination address
@ -405,7 +408,7 @@ exten = _1709400[0-8],1,Goto(smsmorx,${CALLERID(num)}-{EXTEN:7:1},1)
Within this directory are sub directories mtrx, mttx, morx, motx which Within this directory are sub directories mtrx, mttx, morx, motx which
hold the received messages and the messages ready to send. Also, hold the received messages and the messages ready to send. Also,
/var/log/asterisk/sms is a log file of all messages handled. /var/log/asterisk/sms is a log file of all messages handled.
The file name in each queue directory starts with the queue parameter The file name in each queue directory starts with the queue parameter
to SMS which is normally the CLI used for an outgoing message or the to SMS which is normally the CLI used for an outgoing message or the
called number on an incoming message, and may have -X (X being sub called number on an incoming message, and may have -X (X being sub

@ -32,7 +32,7 @@
\author{Asterisk Development Team \\ Asterisk.org} \author{Asterisk Development Team \\ Asterisk.org}
\title{Asterisk Reference Information \\ Version SVN-trunk-r72921M} \title{Asterisk Reference Information \\ Version ASTERISKVERSION}
\begin{document} \begin{document}
\maketitle \maketitle
@ -132,6 +132,12 @@ reference purposes.
\section{Queue Logs} \section{Queue Logs}
\input{queuelog.tex} \input{queuelog.tex}
\chapter{Development}
\section{Backtrace}
\input{backtrace.tex}
% This is a list of files not yet integrated into this document: % This is a list of files not yet integrated into this document:
% %
%Misc %Misc
@ -143,7 +149,6 @@ reference purposes.
%-------------- %--------------
%See http://www.asterisk.org/developers for more information %See http://www.asterisk.org/developers for more information
% %
%backtrace.txt How to produce a backtrace when Asterisk crashes
%callfiles.txt Asterisk callfiles using instruction %callfiles.txt Asterisk callfiles using instruction
%CODING-GUIDELINES Guidelines for developers %CODING-GUIDELINES Guidelines for developers
%externalivr.txt Documentation of the protocol used in externalivr() %externalivr.txt Documentation of the protocol used in externalivr()

@ -249,26 +249,29 @@ SQLite version 2 is supported in cdr\_sqlite.
\subsection{Steps to follow in order to have RADIUS support} \subsection{Steps to follow in order to have RADIUS support}
\subsubsection{Installation of the Radiusclient library} \subsubsection{Installation of the Radiusclient library}
Installation:
\begin{verbatim} Download the sources from
Download the sources from: \url{http://developer.berlios.de/projects/radiusclient-ng/}
http://developer.berlios.de/projects/radiusclient-ng/
Untar the source tarball. Untar the source tarball:
root@localhost:/usr/local/src# tar xvfz radiusclient-ng-0.5.2.tar.gz
\begin{verbatim}
Compile and install the library. root@localhost:/usr/local/src# tar xvfz radiusclient-ng-0.5.2.tar.gz
root@localhost:/usr/local/src# cd radiusclient-ng-0.5.2 \end{verbatim}
root@localhost:/usr/local/src/radiusclient-ng-0.5.2# ./configure
root@localhost:/usr/local/src/radiusclient-ng-0.5.2# make Compile and install the library:
root@localhost:/usr/local/src/radiusclient-ng-0.5.2# make install
\begin{verbatim}
root@localhost:/usr/local/src# cd radiusclient-ng-0.5.2
root@localhost:/usr/local/src/radiusclient-ng-0.5.2# ./configure
root@localhost:/usr/local/src/radiusclient-ng-0.5.2# make
root@localhost:/usr/local/src/radiusclient-ng-0.5.2# make install
\end{verbatim} \end{verbatim}
\subsubsection{Configuration of the Radiusclient library} \subsubsection{Configuration of the Radiusclient library}
By default all the configuration files of the radiusclient library will By default all the configuration files of the radiusclient library will
be in /usr/local/etc/radiusclient-ng directory. be in \path{/usr/local/etc/radiusclient-ng} directory.
File "radiusclient.conf" File "radiusclient.conf"
Open the file and find lines containing the following: Open the file and find lines containing the following:
@ -280,11 +283,12 @@ SQLite version 2 is supported in cdr\_sqlite.
running on the same host as your Asterisk PBX. running on the same host as your Asterisk PBX.
acctserver localhost acctserver localhost
This is the hostname or IP address of the RADIUS server used for This is the hostname or IP address of the RADIUS server used for
accounting. You will have to change this unless the server is running accounting. You will have to change this unless the server is running
on the same host as your Asterisk PBX. on the same host as your Asterisk PBX.
File "servers" \textbf{File "servers"}
RADIUS protocol uses simple access control mechanism based on shared RADIUS protocol uses simple access control mechanism based on shared
secrets that allows RADIUS servers to limit access from RADIUS clients. secrets that allows RADIUS servers to limit access from RADIUS clients.
@ -294,25 +298,23 @@ SQLite version 2 is supported in cdr\_sqlite.
You need to configure a shared secret for each server you have You need to configure a shared secret for each server you have
configured in radiusclient.conf file in the previous step. The shared configured in radiusclient.conf file in the previous step. The shared
secrets are stored in /usr/local/etc/radiusclient-ng/servers file. secrets are stored in \path{/usr/local/etc/radiusclient-ng/servers} file.
Each line contains hostname of a RADIUS server and shared secret Each line contains hostname of a RADIUS server and shared secret
used in communication with that server. The two values are separated used in communication with that server. The two values are separated
by white spaces. Configure shared secrets for every RADIUS server you by white spaces. Configure shared secrets for every RADIUS server you
are going to use. are going to use.
File "dictionary" \textbf{File "dictionary"}
Asterisk uses some attributes that are not included in the Asterisk uses some attributes that are not included in the
dictionary of radiusclient library, therefore it is necessary to add dictionary of radiusclient library, therefore it is necessary to add
them. A file called dictionary.digium (kept in the contrib dir) them. A file called dictionary.digium (kept in the contrib dir)
was created to list all new attributes used by Asterisk. was created to list all new attributes used by Asterisk.
Add to the end of the main dictionary file Add to the end of the main dictionary file
/usr/local/etc/radiusclient-ng/dictionary \path{/usr/local/etc/radiusclient-ng/dictionary} the line:
the line:
\begin{verbatim}
\$INCLUDE /path/to/dictionary.digium \$INCLUDE /path/to/dictionary.digium
\end{verbatim}
\subsubsection{Install FreeRADIUS Server (Version 1.1.1)} \subsubsection{Install FreeRADIUS Server (Version 1.1.1)}
@ -341,7 +343,7 @@ SQLite version 2 is supported in cdr\_sqlite.
File "clients.conf" File "clients.conf"
File /usr/local/etc/raddb/clients.conf contains description of File \path{/usr/local/etc/raddb/clients.conf} contains description of
RADIUS clients that are allowed to use the server. For each of the RADIUS clients that are allowed to use the server. For each of the
clients you need to specify its hostname or IP address and also a clients you need to specify its hostname or IP address and also a
shared secret. The shared secret must be the same string you configured shared secret. The shared secret must be the same string you configured
@ -363,15 +365,15 @@ SQLite version 2 is supported in cdr\_sqlite.
File "dictionary" File "dictionary"
Note : as of version 1.1.2, the dictionary.digium file ships with FreeRADIUS. Note: as of version 1.1.2, the dictionary.digium file ships with FreeRADIUS.
The following procedure brings the dictionary.digium file to previous versions The following procedure brings the dictionary.digium file to previous versions
of FreeRADIUS. of FreeRADIUS.
File /usr/local/etc/raddb/dictionary contains the dictionary of File \path{/usr/local/etc/raddb/dictionary} contains the dictionary of
FreeRADIUS server. You have to add the same dictionary file FreeRADIUS server. You have to add the same dictionary file
(dictionary.digium), which you added to the dictionary of radiusclient-ng (dictionary.digium), which you added to the dictionary of radiusclient-ng
library. You can include it into the main file, adding the following line at the library. You can include it into the main file, adding the following line at the
end of file '/usr/local/etc/raddb/dictionary': end of file \path{/usr/local/etc/raddb/dictionary}:
\$INCLUDE /path/to/dictionary.digium \$INCLUDE /path/to/dictionary.digium
@ -388,17 +390,16 @@ SQLite version 2 is supported in cdr\_sqlite.
library has been detected on your system. library has been detected on your system.
By default FreeRADIUS server will log all accounting requests into By default FreeRADIUS server will log all accounting requests into
/usr/local/var/log/radius/radacct directory in form of plain text files. \path{/usr/local/var/log/radius/radacct} directory in form of plain text files.
The server will create one file for each hostname in the directory. The The server will create one file for each hostname in the directory. The
following example shows how the log files look like. following example shows how the log files look like.
Asterisk now generates Call Detail Records. See /include/asterisk/cdr.h Asterisk now generates Call Detail Records. See \path{/include/asterisk/cdr.h}
for all the fields which are recorded. By default, records in comma for all the fields which are recorded. By default, records in comma
separated values will be created in /var/log/asterisk/cdr-csv. separated values will be created in \path{/var/log/asterisk/cdr-csv}.
The configuration file for cdr\_radius.so module is :
/etc/asterisk/cdr.conf The configuration file for cdr\_radius.so module is \path{/etc/asterisk/cdr.conf}
This is where you can set CDR related parameters as well as the path to This is where you can set CDR related parameters as well as the path to
the radiusclient-ng library configuration file. the radiusclient-ng library configuration file.
@ -423,7 +424,7 @@ SQLite version 2 is supported in cdr\_sqlite.
"Asterisk-Bill-Sec", The duration that a call was up after other "Asterisk-Bill-Sec", The duration that a call was up after other
end answered which will be <= to duration end answered which will be <= to duration
"end time" minus "answer time" "end time" minus "answer time"
"Asterisk-Disposition", ANSWERED, NO ANSWER, BUSY "Asterisk-Disposition", ANSWERED, NO ANSWER, BUSY
"Asterisk-AMA-Flags", DOCUMENTATION, BILL, IGNORE etc, specified on "Asterisk-AMA-Flags", DOCUMENTATION, BILL, IGNORE etc, specified on
a per channel basis like accountcode. a per channel basis like accountcode.
"Asterisk-Unique-ID", Unique call identifier "Asterisk-Unique-ID", Unique call identifier

@ -4,8 +4,8 @@ There are two levels of parameter evaluation done in the Asterisk
dial plan in extensions.conf. dial plan in extensions.conf.
\begin{enumerate} \begin{enumerate}
\item The first, and most frequently used, is the substitution of variable \item The first, and most frequently used, is the substitution of variable
references with their values. references with their values.
\item Then there are the evaluations of expressions done in \$[ .. ]. \item Then there are the evaluations of expressions done in \$[ .. ].
This will be discussed below. This will be discussed below.
\end{enumerate} \end{enumerate}
Asterisk has user-defined variables and standard variables set Asterisk has user-defined variables and standard variables set
@ -16,69 +16,69 @@ listed at the end of this document.
\begin{verbatim} \begin{verbatim}
exten => s,5,BackGround,blabla exten => s,5,BackGround,blabla
\end{verbatim} \end{verbatim}
The parameter (blabla) can be quoted ("blabla"). In this case, a The parameter (blabla) can be quoted ("blabla"). In this case, a
comma does not terminate the field. However, the double quotes comma does not terminate the field. However, the double quotes
will be passed down to the Background command, in this example. will be passed down to the Background command, in this example.
Also, characters special to variable substitution, expression evaluation, etc Also, characters special to variable substitution, expression evaluation, etc
(see below), can be quoted. For example, to literally use a \$ on the (see below), can be quoted. For example, to literally use a \$ on the
string "\$1231", quote it with a preceding \textbackslash. Special characters that must string "\$1231", quote it with a preceding \textbackslash. Special characters that must
be quoted to be used, are [ ] \$ " \textbackslash. (to write \textbackslash itself, use \textbackslash). be quoted to be used, are [ ] \$ " \textbackslash. (to write \textbackslash itself, use \textbackslash).
These Double quotes and escapes are evaluated at the level of the These Double quotes and escapes are evaluated at the level of the
asterisk config file parser. asterisk config file parser.
Double quotes can also be used inside expressions, as discussed below. Double quotes can also be used inside expressions, as discussed below.
\section{Variables} \section{Variables}
Parameter strings can include variables. Variable names are arbitrary strings. Parameter strings can include variables. Variable names are arbitrary strings.
They are stored in the respective channel structure. They are stored in the respective channel structure.
To set a variable to a particular value, do: To set a variable to a particular value, do:
\begin{verbatim} \begin{verbatim}
exten => 1,2,Set(varname=value) exten => 1,2,Set(varname=value)
\end{verbatim} \end{verbatim}
You can substitute the value of a variable everywhere using \${variablename}. You can substitute the value of a variable everywhere using \${variablename}.
For example, to stringwise append \$lala to \$blabla and store result in \$koko, For example, to stringwise append \$lala to \$blabla and store result in \$koko,
do: do:
\begin{verbatim} \begin{verbatim}
exten => 1,2,Set(koko=${blabla}${lala}) exten => 1,2,Set(koko=${blabla}${lala})
\end{verbatim} \end{verbatim}
There are two reference modes - reference by value and reference by name. There are two reference modes - reference by value and reference by name.
To refer to a variable with its name (as an argument to a function that To refer to a variable with its name (as an argument to a function that
requires a variable), just write the name. To refer to the variable's value, requires a variable), just write the name. To refer to the variable's value,
enclose it inside \${}. For example, Set takes as the first argument enclose it inside \${}. For example, Set takes as the first argument
(before the =) a variable name, so: (before the =) a variable name, so:
\begin{verbatim} \begin{verbatim}
exten => 1,2,Set(koko=lala) exten => 1,2,Set(koko=lala)
exten => 1,3,Set(${koko}=blabla) exten => 1,3,Set(${koko}=blabla)
\end{verbatim} \end{verbatim}
stores to the variable "koko" the value "lala" and to variable "lala" the stores to the variable "koko" the value "lala" and to variable "lala" the
value "blabla". value "blabla".
In fact, everything contained \${here} is just replaced with the value of In fact, everything contained \${here} is just replaced with the value of
the variable "here". the variable "here".
\section{Variable Inheritance} \section{Variable Inheritance}
Variable names which are prefixed by "\_" will be inherited to channels Variable names which are prefixed by "\_" will be inherited to channels
that are created in the process of servicing the original channel in that are created in the process of servicing the original channel in
which the variable was set. When the inheritance takes place, the which the variable was set. When the inheritance takes place, the
prefix will be removed in the channel inheriting the variable. If the prefix will be removed in the channel inheriting the variable. If the
name is prefixed by "\_\_" in the channel, then the variable is name is prefixed by "\_\_" in the channel, then the variable is
inherited and the "\_\_" will remain intact in the new channel. inherited and the "\_\_" will remain intact in the new channel.
In the dialplan, all references to these variables refer to the same In the dialplan, all references to these variables refer to the same
variable, regardless of having a prefix or not. Note that setting any variable, regardless of having a prefix or not. Note that setting any
version of the variable removes any other version of the variable, version of the variable removes any other version of the variable,
regardless of prefix. regardless of prefix.
\subsection{Example} \subsection{Example}
\begin{verbatim} \begin{verbatim}
Set(__FOO=bar) ; Sets an inherited version of "FOO" variable Set(__FOO=bar) ; Sets an inherited version of "FOO" variable
Set(FOO=bar) ; Removes the inherited version and sets a local Set(FOO=bar) ; Removes the inherited version and sets a local
; variable. ; variable.
However, However,
@ -101,11 +101,11 @@ skip from the beginning of the string to the variable name.
exten => _9X.,1,Set(number=${EXTEN:1}) exten => _9X.,1,Set(number=${EXTEN:1})
\end{verbatim} \end{verbatim}
Assuming we've dialed 918005551234, the value saved to the 'number' variable Assuming we've dialed 918005551234, the value saved to the 'number' variable
would be 18005551234. This is useful in situations when we require users to would be 18005551234. This is useful in situations when we require users to
dial a number to access an outside line, but do not wish to pass the first dial a number to access an outside line, but do not wish to pass the first
digit. digit.
If you use a negative offset number, Asterisk starts counting from the end If you use a negative offset number, Asterisk starts counting from the end
of the string and then selects everything after the new position. The following of the string and then selects everything after the new position. The following
example will save the numbers 1234 to the 'number' variable, still assuming example will save the numbers 1234 to the 'number' variable, still assuming
we've dialed 918005551234. we've dialed 918005551234.
@ -137,13 +137,13 @@ from the end of the string.
exten => _XXXX#,1,Set(pin=${EXTEN:0:-1}) exten => _XXXX#,1,Set(pin=${EXTEN:0:-1})
\end{verbatim} \end{verbatim}
\section{Expressions} \section{Expressions}
Everything contained inside a bracket pair prefixed by a \$ (like \$[this]) is Everything contained inside a bracket pair prefixed by a \$ (like \$[this]) is
considered as an expression and it is evaluated. Evaluation works similar to considered as an expression and it is evaluated. Evaluation works similar to
(but is done on a later stage than) variable substitution: the expression (but is done on a later stage than) variable substitution: the expression
(including the square brackets) is replaced by the result of the expression (including the square brackets) is replaced by the result of the expression
evaluation. evaluation.
For example, after the sequence: For example, after the sequence:
\begin{verbatim} \begin{verbatim}
@ -170,7 +170,7 @@ The double quotes will be counted as part of that lexical token.
As an example: As an example:
\begin{verbatim} \begin{verbatim}
exten => s,6,GotoIf($[ "${CALLERID(name)}" : "Privacy Manager" ]?callerid-liar|s|1:s|7) exten => s,6,GotoIf($[ "${CALLERID(name)}" : "Privacy Manager" ]?callerid-liar,s,1:s,7)
\end{verbatim} \end{verbatim}
The variable CALLERID(name) could evaluate to "DELOREAN MOTORS" (with a space) The variable CALLERID(name) could evaluate to "DELOREAN MOTORS" (with a space)
@ -189,7 +189,7 @@ DELOREAN MOTORS : Privacy Manager
\end{verbatim} \end{verbatim}
and will result in syntax errors, because token DELOREAN is immediately and will result in syntax errors, because token DELOREAN is immediately
followed by token MOTORS and the expression parser will not know how to followed by token MOTORS and the expression parser will not know how to
evaluate this expression, because it does not match its grammar. evaluate this expression, because it does not match its grammar.
\subsection{Operators} \subsection{Operators}
@ -246,8 +246,8 @@ with equal precedence are grouped within { } symbols.
regular expression. The regular expression is anchored to the regular expression. The regular expression is anchored to the
beginning of the string with an implicit `\^'. beginning of the string with an implicit `\^'.
If the match succeeds and the pattern contains at least one regular If the match succeeds and the pattern contains at least one regular
expression subexpression `\(...\)', the string corresponing expression subexpression `\(...\)', the string corresponing
to `\textbackslash1' is returned; otherwise the matching operator to `\textbackslash1' is returned; otherwise the matching operator
returns the number of characters matched. If the match fails and returns the number of characters matched. If the match fails and
the pattern contains a regular expression subexpression the null the pattern contains a regular expression subexpression the null
@ -288,13 +288,13 @@ or C derived languages.
In 1.6 and above, we shifted the \$[...] expressions to be calculated In 1.6 and above, we shifted the \$[...] expressions to be calculated
via floating point numbers instead of integers. We use 'long double' numbers via floating point numbers instead of integers. We use 'long double' numbers
when possible, which provide around 16 digits of precision with 12 byte numbers. when possible, which provide around 16 digits of precision with 12 byte numbers.
To specify a floating point constant, the number has to have this format: D.D, where D is To specify a floating point constant, the number has to have this format: D.D, where D is
a string of base 10 digits. So, you can say 0.10, but you can't say .10 or 20.-- we hope a string of base 10 digits. So, you can say 0.10, but you can't say .10 or 20.-- we hope
this is not an excessive restriction! this is not an excessive restriction!
Floating point numbers are turned into strings via the '%g'/'%Lg' format of the printf Floating point numbers are turned into strings via the '\%g'/'\%Lg' format of the printf
function set. This allows numbers to still 'look' like integers to those counting function set. This allows numbers to still 'look' like integers to those counting
on integer behavior. If you were counting on 1/4 evaluating to 0, you need to now say on integer behavior. If you were counting on 1/4 evaluating to 0, you need to now say
TRUNC(1/4). For a list of all the truncation/rounding capabilities, see the next section. TRUNC(1/4). For a list of all the truncation/rounding capabilities, see the next section.
@ -309,7 +309,7 @@ added to the core of the Expr2 parser. Indeed, dialplan functions can be called
\$[..] expressions without the \$\{...\} operators. The only trouble might be in the fact that \$[..] expressions without the \$\{...\} operators. The only trouble might be in the fact that
the arguments to these functions must be specified with a comma. If you try to call the arguments to these functions must be specified with a comma. If you try to call
the MATH function, for example, and try to say 3 + MATH(7*8), the expression parser will the MATH function, for example, and try to say 3 + MATH(7*8), the expression parser will
evaluate 7*8 for you into 56, and the MATH function will most likely complain that its evaluate 7*8 for you into 56, and the MATH function will most likely complain that its
input doesn't make any sense. input doesn't make any sense.
We also provide access to most of the floating point functions in the C library. (but not all of them). We also provide access to most of the floating point functions in the C library. (but not all of them).
@ -323,7 +323,7 @@ surround function calls in \$[...] expressions with \$\{...\}. Don't jump to con
though! -- you still need to wrap variable names in curly braces! though! -- you still need to wrap variable names in curly braces!
\begin{enumerate} \begin{enumerate}
\item COS(x) x is in radians. Results vary from -1 to 1. \item COS(x) x is in radians. Results vary from -1 to 1.
\item SIN(x) x is in radians. Results vary from -1 to 1. \item SIN(x) x is in radians. Results vary from -1 to 1.
\item TAN(x) x is in radians. \item TAN(x) x is in radians.
\item ACOS(x) x should be a value between -1 and 1. \item ACOS(x) x should be a value between -1 and 1.
@ -431,7 +431,6 @@ TRUNC(3.5)
TRUNC(-3.5) TRUNC(-3.5)
returns -3. returns -3.
\end{verbatim} \end{verbatim}
\end{astlisting} \end{astlisting}
@ -450,7 +449,7 @@ case.
\subsection{Conditionals} \subsection{Conditionals}
There is one conditional application - the conditional goto : There is one conditional application - the conditional goto :
\begin{verbatim} \begin{verbatim}
exten => 1,2,GotoIf(condition?label1:label2) exten => 1,2,GotoIf(condition?label1:label2)
@ -460,21 +459,21 @@ If condition is true go to label1, else go to label2. Labels are interpreted
exactly as in the normal goto command. exactly as in the normal goto command.
"condition" is just a string. If the string is empty or "0", the condition "condition" is just a string. If the string is empty or "0", the condition
is considered to be false, if it's anything else, the condition is true. is considered to be false, if it's anything else, the condition is true.
This is designed to be used together with the expression syntax described This is designed to be used together with the expression syntax described
above, eg : above, eg :
\begin{verbatim} \begin{verbatim}
exten => 1,2,GotoIf($[${CALLERID(all)} = 123456]?2|1:3|1) exten => 1,2,GotoIf($[${CALLERID(all)} = 123456]?2,1:3,1)
\end{verbatim} \end{verbatim}
Example of use : Example of use :
\begin{verbatim} \begin{verbatim}
exten => s,2,Set(vara=1) exten => s,2,Set(vara=1)
exten => s,3,Set(varb=$[${vara} + 2]) exten => s,3,Set(varb=$[${vara} + 2])
exten => s,4,Set(varc=$[${varb} * 2]) exten => s,4,Set(varc=$[${varb} * 2])
exten => s,5,GotoIf($[${varc} = 6]?99|1:s|6) exten => s,5,GotoIf($[${varc} = 6]?99,1:s,6)
\end{verbatim} \end{verbatim}
\subsection{Parse Errors} \subsection{Parse Errors}
@ -483,16 +482,20 @@ Syntax errors are now output with 3 lines.
If the extensions.conf file contains a line like: If the extensions.conf file contains a line like:
\begin{astlisting}
\begin{verbatim} \begin{verbatim}
exten => s,6,GotoIf($[ "${CALLERID(num)}" = "3071234567" & & "${CALLERID(name)}" : "Privacy Manager" ]?callerid-liar|s|1:s|7) exten => s,6,GotoIf($[ "${CALLERID(num)}" = "3071234567" & & "${CALLERID(name)}" : "Privacy Manager" ]?callerid-liar,s,1:s,7)
\end{verbatim} \end{verbatim}
\end{astlisting}
You may see an error in /var/log/asterisk/messages like this: You may see an error in /var/log/asterisk/messages like this:
\begin{astlisting}
\begin{verbatim} \begin{verbatim}
Jul 15 21:27:49 WARNING[1251240752]: ast_yyerror(): syntax error: parse error, unexpected TOK_AND, expecting TOK_MINUS or TOK_LP or TOKEN; Input: Jul 15 21:27:49 WARNING[1251240752]: ast_yyerror(): syntax error: parse error, unexpected TOK_AND, expecting TOK_MINUS or TOK_LP or TOKEN; Input:
"3072312154" = "3071234567" & & "Steves Extension" : "Privacy Manager" "3072312154" = "3071234567" & & "Steves Extension" : "Privacy Manager"
^ ^
\end{verbatim} \end{verbatim}
\end{astlisting}
The log line tells you that a syntax error was encountered. It now The log line tells you that a syntax error was encountered. It now
also tells you (in grand standard bison format) that it hit an "AND" also tells you (in grand standard bison format) that it hit an "AND"
@ -506,12 +509,12 @@ marked with the "\^" character.
\subsection{NULL Strings} \subsection{NULL Strings}
Testing to see if a string is null can be done in one of two different ways: Testing to see if a string is null can be done in one of two different ways:
\begin{verbatim} \begin{verbatim}
exten => _XX.,1,GotoIf($["${calledid}" != ""]?3) exten => _XX.,1,GotoIf($["${calledid}" != ""]?3)
exten => _XX.,1,GotoIf($[foo${calledid} != foo]?3) exten => _XX.,1,GotoIf($[foo${calledid} != foo]?3)
\end{verbatim} \end{verbatim}
The second example above is the way suggested by the WIKI. It will The second example above is the way suggested by the WIKI. It will
work as long as there are no spaces in the evaluated value. work as long as there are no spaces in the evaluated value.
The first way should work in all cases, and indeed, might now The first way should work in all cases, and indeed, might now
@ -529,7 +532,7 @@ Pascal, APL, assembler, etc.
\subsection{Incompatabilities} \subsection{Incompatabilities}
The asterisk expression parser has undergone some evolution. It is hoped The asterisk expression parser has undergone some evolution. It is hoped
that the changes will be viewed as positive. that the changes will be viewed as positive.
The "original" expression parser had a simple, hand-written scanner, The "original" expression parser had a simple, hand-written scanner,
and a simple bison grammar. This was upgraded to a more involved bison and a simple bison grammar. This was upgraded to a more involved bison
@ -545,7 +548,7 @@ allow it.
If you have not touched your extensions.conf files in a year or so, the If you have not touched your extensions.conf files in a year or so, the
above upgrades may cause you some heartburn in certain circumstances, as above upgrades may cause you some heartburn in certain circumstances, as
several changes have been made, and these will affect asterisk's behavior on several changes have been made, and these will affect asterisk's behavior on
legacy extension.conf constructs. The changes have been engineered legacy extension.conf constructs. The changes have been engineered
to minimize these conflicts, but there are bound to be problems. to minimize these conflicts, but there are bound to be problems.
@ -558,21 +561,21 @@ of possible concern with "legacy" extension.conf files:
to the value '2', but '1+1' would evaluate to the string '1+1'. If this to the value '2', but '1+1' would evaluate to the string '1+1'. If this
behavior was depended on, then the expression evaluation will break. '1+1' behavior was depended on, then the expression evaluation will break. '1+1'
will now evaluate to '2', and something is not going to work right. will now evaluate to '2', and something is not going to work right.
To keep such strings from being evaluated, simply wrap them in double To keep such strings from being evaluated, simply wrap them in double
quotes: ' "1+1" ' quotes: ' "1+1" '
\item The colon operator. In versions previous to double quoting, the \item The colon operator. In versions previous to double quoting, the
colon operator takes the right hand string, and using it as a colon operator takes the right hand string, and using it as a
regex pattern, looks for it in the left hand string. It is given regex pattern, looks for it in the left hand string. It is given
an implicit \^ operator at the beginning, meaning the pattern an implicit \^ operator at the beginning, meaning the pattern
will match only at the beginning of the left hand string. will match only at the beginning of the left hand string.
If the pattern or the matching string had double quotes around If the pattern or the matching string had double quotes around
them, these could get in the way of the pattern match. Now, them, these could get in the way of the pattern match. Now,
the wrapping double quotes are stripped from both the pattern the wrapping double quotes are stripped from both the pattern
and the left hand string before applying the pattern. This and the left hand string before applying the pattern. This
was done because it recognized that the new way of was done because it recognized that the new way of
scanning the expression doesn't use spaces to separate tokens, scanning the expression doesn't use spaces to separate tokens,
and the average regex expression is full of operators that and the average regex expression is full of operators that
the scanner will recognize as expression operators. Thus, unless the scanner will recognize as expression operators. Thus, unless
the pattern is wrapped in double quotes, there will be trouble. the pattern is wrapped in double quotes, there will be trouble.
For instance, \${VAR1} : (Who|What*)+ For instance, \${VAR1} : (Who|What*)+
@ -601,7 +604,7 @@ of possible concern with "legacy" extension.conf files:
\item Added the conditional operator 'expr1 ? true\_expr :: false\_expr' \item Added the conditional operator 'expr1 ? true\_expr :: false\_expr'
First, all 3 exprs are evaluated, and if expr1 is false, the 'false\_expr' First, all 3 exprs are evaluated, and if expr1 is false, the 'false\_expr'
is returned as the result. See above for details. is returned as the result. See above for details.
\item Unary operators '-' and '!' were made right associative. \item Unary operators '-' and '!' were made right associative.
\end{enumerate} \end{enumerate}
@ -682,7 +685,7 @@ available in each application's help text. All these variables
are in UPPER CASE only. are in UPPER CASE only.
Variables marked with a * are builtin functions and can't be set, Variables marked with a * are builtin functions and can't be set,
only read in the dialplan. Writes to such variables are silently only read in the dialplan. Writes to such variables are silently
ignored. ignored.
\begin{verbatim} \begin{verbatim}
@ -701,7 +704,7 @@ ${CALLINGTNS} * Transit Network Selector (PRI channels)
${CALLINGTON} * Caller Type of Number (PRI channels) ${CALLINGTON} * Caller Type of Number (PRI channels)
${CHANNEL} * Current channel name ${CHANNEL} * Current channel name
${CONTEXT} * Current context ${CONTEXT} * Current context
${DATETIME} * Current date time in the format: DDMMYYYY-HH:MM:SS ${DATETIME} * Current date time in the format: DDMMYYYY-HH:MM:SS
(Deprecated; use ${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)}) (Deprecated; use ${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)})
${DB_RESULT} Result value of DB_EXISTS() dial plan function ${DB_RESULT} Result value of DB_EXISTS() dial plan function
${EPOCH} * Current unix style epoch ${EPOCH} * Current unix style epoch
@ -719,7 +722,7 @@ ${LANGUAGE} * Current language (Deprecated; use ${LANGUAGE()})
${LEN(VAR)} * String length of VAR (integer) ${LEN(VAR)} * String length of VAR (integer)
${PRIORITY} * Current priority in the dialplan ${PRIORITY} * Current priority in the dialplan
${PRIREDIRECTREASON} Reason for redirect on PRI, if a call was directed ${PRIREDIRECTREASON} Reason for redirect on PRI, if a call was directed
${TIMESTAMP} * Current date time in the format: YYYYMMDD-HHMMSS ${TIMESTAMP} * Current date time in the format: YYYYMMDD-HHMMSS
(Deprecated; use ${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}) (Deprecated; use ${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)})
${TRANSFER_CONTEXT} Context for transferred calls ${TRANSFER_CONTEXT} Context for transferred calls
${FORWARD_CONTEXT} Context for forwarded calls ${FORWARD_CONTEXT} Context for forwarded calls
@ -791,7 +794,7 @@ ${VPB_GETDTMF} chan_vpb
\subsection{The MeetMe Conference Bridge} \subsection{The MeetMe Conference Bridge}
\begin{verbatim} \begin{verbatim}
${MEETME_RECORDINGFILE} Name of file for recording a conference with ${MEETME_RECORDINGFILE} Name of file for recording a conference with
the "r" option the "r" option
${MEETME_RECORDINGFORMAT} Format of file to be recorded ${MEETME_RECORDINGFORMAT} Format of file to be recorded
${MEETME_EXIT_CONTEXT} Context for exit out of meetme meeting ${MEETME_EXIT_CONTEXT} Context for exit out of meetme meeting
@ -826,14 +829,14 @@ ${DUNDDEST} * The Destination of the result from a call to DUNDiLookup()
\subsection{chan\_zap} \subsection{chan\_zap}
\begin{verbatim} \begin{verbatim}
${ANI2} * The ANI2 Code provided by the network on the incoming call. ${ANI2} * The ANI2 Code provided by the network on the incoming call.
(ie, Code 29 identifies call as a Prison/Inmate Call) (ie, Code 29 identifies call as a Prison/Inmate Call)
${CALLTYPE} * Type of call (Speech, Digital, etc) ${CALLTYPE} * Type of call (Speech, Digital, etc)
${CALLEDTON} * Type of number for incoming PRI extension ${CALLEDTON} * Type of number for incoming PRI extension
i.e. 0=unknown, 1=international, 2=domestic, 3=net_specific, i.e. 0=unknown, 1=international, 2=domestic, 3=net_specific,
4=subscriber, 6=abbreviated, 7=reserved 4=subscriber, 6=abbreviated, 7=reserved
${CALLINGSUBADDR} * Called PRI Subaddress ${CALLINGSUBADDR} * Called PRI Subaddress
${FAXEXTEN} * The extension called before being redirected to "fax" ${FAXEXTEN} * The extension called before being redirected to "fax"
${PRIREDIRECTREASON} * Reason for redirect, if a call was directed ${PRIREDIRECTREASON} * Reason for redirect, if a call was directed
${SMDI_VM_TYPE} * When an call is received with an SMDI message, the 'type' ${SMDI_VM_TYPE} * When an call is received with an SMDI message, the 'type'
of message 'b' or 'u' of message 'b' or 'u'
@ -845,7 +848,7 @@ ${SIPCALLID} * SIP Call-ID: header verbatim (for logging or CDR matching
${SIPDOMAIN} * SIP destination domain of an inbound call (if appropriate) ${SIPDOMAIN} * SIP destination domain of an inbound call (if appropriate)
${SIPUSERAGENT} * SIP user agent (deprecated) ${SIPUSERAGENT} * SIP user agent (deprecated)
${SIPURI} * SIP uri ${SIPURI} * SIP uri
${SIP_CODEC} Set the SIP codec for a call ${SIP_CODEC} Set the SIP codec for a call
${SIP_URI_OPTIONS} * additional options to add to the URI for an outgoing call ${SIP_URI_OPTIONS} * additional options to add to the URI for an outgoing call
${RTPAUDIOQOS} RTCP QoS report for the audio of this call ${RTPAUDIOQOS} RTCP QoS report for the audio of this call
${RTPVIDEOQOS} RTCP QoS report for the video of this call ${RTPVIDEOQOS} RTCP QoS report for the video of this call
@ -872,7 +875,7 @@ ${DIALEDPEERNUMBER} * Dialed peer number
${DIALEDTIME} * Time for the call (seconds) ${DIALEDTIME} * Time for the call (seconds)
${ANSWEREDTIME} * Time from dial to answer (seconds) ${ANSWEREDTIME} * Time from dial to answer (seconds)
${DIALSTATUS} * Status of the call, one of: ${DIALSTATUS} * Status of the call, one of:
(CHANUNAVAIL | CONGESTION | BUSY | NOANSWER (CHANUNAVAIL | CONGESTION | BUSY | NOANSWER
| ANSWER | CANCEL | DONTCALL | TORTURE) | ANSWER | CANCEL | DONTCALL | TORTURE)
${DYNAMIC_FEATURES} * The list of features (from the [applicationmap] section of ${DYNAMIC_FEATURES} * The list of features (from the [applicationmap] section of
features.conf) to activate during the call, with feature features.conf) to activate during the call, with feature
@ -888,7 +891,7 @@ ${OUTBOUND_GROUP} Default groups for peer channels (as in SetGroup)
\subsection{The chanisavail() application} \subsection{The chanisavail() application}
\begin{verbatim} \begin{verbatim}
${AVAILCHAN} * the name of the available channel if one was found ${AVAILCHAN} * the name of the available channel if one was found
${AVAILORIGCHAN} * the canonical channel name that was used to create the channel ${AVAILORIGCHAN} * the canonical channel name that was used to create the channel
${AVAILSTATUS} * Status of requested channel ${AVAILSTATUS} * Status of requested channel
\end{verbatim} \end{verbatim}
@ -912,7 +915,7 @@ ${SPYGROUP} * A ':' (colon) separated list of group names.
${OSPINHANDLE} OSP handle of in_bound call ${OSPINHANDLE} OSP handle of in_bound call
${OSPINTIMELIMIT} Duration limit for in_bound call ${OSPINTIMELIMIT} Duration limit for in_bound call
${OSPOUTHANDLE} OSP handle of out_bound call ${OSPOUTHANDLE} OSP handle of out_bound call
${OSPTECH} OSP technology ${OSPTECH} OSP technology
${OSPDEST} OSP destination ${OSPDEST} OSP destination
${OSPCALLING} OSP calling number ${OSPCALLING} OSP calling number
${OSPOUTTOKEN} OSP token to use for out_bound call ${OSPOUTTOKEN} OSP token to use for out_bound call

@ -17,7 +17,7 @@ the current value by Asterisk:
%Cn[;n] Change terminal foreground (and optional background) color to specified %Cn[;n] Change terminal foreground (and optional background) color to specified
\end{verbatim} \end{verbatim}
A full list of colors may be found in include/asterisk/term.h A full list of colors may be found in \path{include/asterisk/term.h}
On Linux systems, you may also use: On Linux systems, you may also use:

@ -29,12 +29,12 @@ a DUNDi query from the dialplan, see how many results there are, and access
each one. Here is some example usage: each one. Here is some example usage:
\begin{verbatim} \begin{verbatim}
exten => 1,1,Set(ID=${DUNDIQUERY(1|dundi_test|b)}) exten => 1,1,Set(ID=${DUNDIQUERY(1,dundi_test,b)})
exten => 1,n,Set(NUM=${DUNDIRESULT(${ID}|getnum)}) exten => 1,n,Set(NUM=${DUNDIRESULT(${ID},getnum)})
exten => 1,n,NoOp(There are ${NUM} results) exten => 1,n,NoOp(There are ${NUM} results)
exten => 1,n,Set(X=1) exten => 1,n,Set(X=1)
exten => 1,n,While($[${X} <= ${NUM}]) exten => 1,n,While($[${X} <= ${NUM}])
exten => 1,n,NoOp(Result ${X} is ${DUNDIRESULT(${ID}|${X})}) exten => 1,n,NoOp(Result ${X} is ${DUNDIRESULT(${ID},${X})})
exten => 1,n,Set(X=$[${X} + 1]) exten => 1,n,Set(X=$[${X} + 1])
exten => 1,n,EndWhile exten => 1,n,EndWhile
\end{verbatim} \end{verbatim}

@ -24,7 +24,7 @@ function is then up to the administrator to implement in a way that
best suits their environment. best suits their environment.
\begin{verbatim} \begin{verbatim}
Function: ENUMLOOKUP(number[|Method-type[|options[|record#[|zone-suffix]]]]) Function: ENUMLOOKUP(number[,Method-type[,options[,record#[,zone-suffix]]]])
\end{verbatim} \end{verbatim}
Performs an ENUM tree lookup on the specified number, method type, and Performs an ENUM tree lookup on the specified number, method type, and
@ -34,7 +34,7 @@ Function: ENUMLOOKUP(number[|Method-type[|options[|record#[|zone-suffix]]]])
\item post-parsed NAPTR of one method (URI) type \item post-parsed NAPTR of one method (URI) type
\item count of elements of one method (URI) type \item count of elements of one method (URI) type
\item count of all method types \item count of all method types
\item full URI of method at a particular point in the list of all possible methods \item full URI of method at a particular point in the list of all possible methods
\end{enumerate} \end{enumerate}
\subsection{Arguments} \subsection{Arguments}
@ -48,7 +48,7 @@ Function: ENUMLOOKUP(number[|Method-type[|options[|record#[|zone-suffix]]]])
\end{itemize} \end{itemize}
\item service\_type \item service\_type
\begin{itemize} \begin{itemize}
\item tel, sip, h323, iax2, mailto, ...[any other string], \item tel, sip, h323, iax2, mailto, ...[any other string],
ALL. Default type is "sip". ALL. Default type is "sip".
Special name of "ALL" will create a list of method types across Special name of "ALL" will create a list of method types across
@ -58,7 +58,7 @@ Function: ENUMLOOKUP(number[|Method-type[|options[|record#[|zone-suffix]]]])
record (lowest value) in the list. The service types are not record (lowest value) in the list. The service types are not
hardcoded in Asterisk except for the default (sip) if no other hardcoded in Asterisk except for the default (sip) if no other
service type specified; any method type string (IANA-approved or service type specified; any method type string (IANA-approved or
not) may be used except for the string "ALL". not) may be used except for the string "ALL".
\end{itemize} \end{itemize}
\item options \item options
@ -72,7 +72,7 @@ Function: ENUMLOOKUP(number[|Method-type[|options[|record#[|zone-suffix]]]])
\end{itemize} \end{itemize}
\end{itemize} \end{itemize}
\item record\# \item record\#
\begin{itemize} \begin{itemize}
\item which record to present if multiple answers are returned \item which record to present if multiple answers are returned
<integer> = The record in priority/order sequence based on the <integer> = The record in priority/order sequence based on the
@ -103,17 +103,17 @@ and it is included as a more complex regexp example, though other
simpler NAPTRs will work just as well. simpler NAPTRs will work just as well.
\begin{verbatim} \begin{verbatim}
0.2.0.1.1.6.5.1.0.3.1.loligo.com. 3600 IN NAPTR 10 100 "u" 0.2.0.1.1.6.5.1.0.3.1.loligo.com. 3600 IN NAPTR 10 100 "u"
"E2U+tel" "!^\\+13015611020$!tel:+12125551212!" . "E2U+tel" "!^\\+13015611020$!tel:+12125551212!" .
0.2.0.1.1.6.5.1.0.3.1.loligo.com. 3600 IN NAPTR 21 100 "u" 0.2.0.1.1.6.5.1.0.3.1.loligo.com. 3600 IN NAPTR 21 100 "u"
"E2U+tel" "!^\\+13015611020$!tel:+14155551212!" . "E2U+tel" "!^\\+13015611020$!tel:+14155551212!" .
0.2.0.1.1.6.5.1.0.3.1.loligo.com. 3600 IN NAPTR 25 100 "u" 0.2.0.1.1.6.5.1.0.3.1.loligo.com. 3600 IN NAPTR 25 100 "u"
"E2U+sip" "!^\\+13015611020$!sip:2203@sip.fox-den.com!" . "E2U+sip" "!^\\+13015611020$!sip:2203@sip.fox-den.com!" .
0.2.0.1.1.6.5.1.0.3.1.loligo.com. 3600 IN NAPTR 26 100 "u" 0.2.0.1.1.6.5.1.0.3.1.loligo.com. 3600 IN NAPTR 26 100 "u"
"E2U+sip" "!^\\+13015611020$!sip:1234@sip-2.fox-den.com!" . "E2U+sip" "!^\\+13015611020$!sip:1234@sip-2.fox-den.com!" .
0.2.0.1.1.6.5.1.0.3.1.loligo.com. 3600 IN NAPTR 30 100 "u" 0.2.0.1.1.6.5.1.0.3.1.loligo.com. 3600 IN NAPTR 30 100 "u"
"E2U+sip" "!^\\+*([^\\*]*)!sip:\\1@sip-3.fox-den.com!" . "E2U+sip" "!^\\+*([^\\*]*)!sip:\\1@sip-3.fox-den.com!" .
0.2.0.1.1.6.5.1.0.3.1.loligo.com. 3600 IN NAPTR 55 100 "u" 0.2.0.1.1.6.5.1.0.3.1.loligo.com. 3600 IN NAPTR 55 100 "u"
"E2U+mailto" "!^\\+13015611020$!mailto:jtodd@fox-den.com!" . "E2U+mailto" "!^\\+13015611020$!mailto:jtodd@fox-den.com!" .
\end{verbatim} \end{verbatim}
@ -282,18 +282,18 @@ ENUMLOOKUP function calls.
; Look up the first SIP result and send the call there, otherwise ; Look up the first SIP result and send the call there, otherwise
; send the call out a PRI. This is the most simple possible ; send the call out a PRI. This is the most simple possible
; ENUM example, but only uses the first SIP reply in the list of ; ENUM example, but only uses the first SIP reply in the list of
; NAPTR(s). ; NAPTR(s).
; ;
exten => _011.,1,Set(enumresult=${ENUMLOOKUP(+${EXTEN:3})}) exten => _011.,1,Set(enumresult=${ENUMLOOKUP(+${EXTEN:3})})
exten => _011.,n,Dial(SIP/${enumresult}) exten => _011.,n,Dial(SIP/${enumresult})
exten => _011.,n,Dial(Zap/g1/${EXTEN}) exten => _011.,n,Dial(Zap/g1/${EXTEN})
; ;
; end example 1 ; end example 1
; example 2 ; example 2
; ;
; Assumes North American international dialing (011) prefix. ; Assumes North American international dialing (011) prefix.
; Check to see if there are multiple SIP NAPTRs returned by ; Check to see if there are multiple SIP NAPTRs returned by
; the lookup, and dial each in order. If none work (or none ; the lookup, and dial each in order. If none work (or none
; exist) then send the call out a PRI, group 1. ; exist) then send the call out a PRI, group 1.
; ;

@ -15,10 +15,10 @@ pattern, "N", "X", and "Z" are interpreted as classes of digits.
For each extension, several actions may be listed and must be given a unique For each extension, several actions may be listed and must be given a unique
priority. When each action completes, the call continues at the next priority priority. When each action completes, the call continues at the next priority
(except for some modules which use explicitly GOTO's). (except for some modules which use explicitly GOTO's).
When each action completes, it generally moves to the next priority (except for When each action completes, it generally moves to the next priority (except for
some modules which use explicitly GOTO's. some modules which use explicitly GOTO's.
Extensions frequently have data they pass to the executing application Extensions frequently have data they pass to the executing application
(most frequently a string). You can see the available dialplan applications (most frequently a string). You can see the available dialplan applications
@ -30,7 +30,7 @@ functions in your Asterisk, use the "show functions" command.
\subsubsection{Example dialplan} \subsubsection{Example dialplan}
The example dial plan, in the configs/extensions.conf.sample file The example dial plan, in the \path{configs/extensions.conf.sample} file
is installed as extensions.conf if you run "make samples" after is installed as extensions.conf if you run "make samples" after
installation of Asterisk. This file includes many more instructions installation of Asterisk. This file includes many more instructions
and examples than this file, so it's worthwhile to read it. and examples than this file, so it's worthwhile to read it.
@ -44,7 +44,7 @@ There are some extensions with important meanings:
\begin{itemize} \begin{itemize}
\item What to do when an extension context is entered (unless \item What to do when an extension context is entered (unless
overridden by the low level channel interface) overridden by the low level channel interface)
This is used in macros, and some special cases. This is used in macros, and some special cases.
"s" is not a generic catch-all wildcard extension. "s" is not a generic catch-all wildcard extension.
\end{itemize} \end{itemize}
\item i \item i
@ -76,7 +76,7 @@ There are some extensions with important meanings:
\end{itemize} \end{itemize}
\end{itemize} \end{itemize}
And finally, the extension context "default" is used when either a) an And finally, the extension context "default" is used when either a) an
extension context is deleted while an extension is in use, or b) a specific extension context is deleted while an extension is in use, or b) a specific
starting extension handler has not been defined (unless overridden by the starting extension handler has not been defined (unless overridden by the
low level channel interface). low level channel interface).

@ -3,5 +3,5 @@ a caller stream right into an ice-cast stream as well as using chan\_local
to place things like conferences, music on hold, etc. into the stream. to place things like conferences, music on hold, etc. into the stream.
You'll need to specify a config file for the ices encoder. An example is You'll need to specify a config file for the ices encoder. An example is
included in contrib/asterisk-ices.xml. included in \path{contrib/asterisk-ices.xml}.

@ -1,25 +1,50 @@
\subsection{Introduction} \subsection{Introduction}
chan\_local is a pseudo-channel. Use of this channel simply loops calls back into the dialplan in a different context. Useful for recursive routing. chan\_local is a pseudo-channel. Use of this channel simply loops calls back
into the dialplan in a different context. Useful for recursive routing.
\subsection{Syntax} \subsection{Syntax}
\begin{verbatim} \begin{verbatim}
Local/extension@context[/n] Local/extension@context[/n]
\end{verbatim} \end{verbatim}
Adding "/n" at the end of the string will make the Local channel not do a native transfer (the "n" stands for "n"o release) upon the remote end answering the line. This is an esoteric, but important feature if you expect the Local channel to handle calls exactly like a normal channel. If you do not have the "no release" feature set, then as soon as the destination (inside of the Local channel) answers the line, the variables and dial plan will revert back to that of the original call, and the Local channel will become a zombie and be removed from the active channels list. This is desirable in some circumstances, but can result in unexpected dialplan behavior if you are doing fancy things with variables in your call handling. Adding "/n" at the end of the string will make the Local channel not do a
native transfer (the "n" stands for "n"o release) upon the remote end answering
There is another option that can be used with local channels, which is the "j" option. The "j" option must be used with the "n" option to make sure that the local channel does not get optimized out of the call. This option will enable a jitterbuffer on the local channel. The jitterbuffer will be used to de-jitter audio that it receives from the channel that called the local channel. This is especially in the case of putting chan\_local in between an incoming SIP call and Asterisk applications, so that the incoming audio will be de-jittered. the line. This is an esoteric, but important feature if you expect the Local
channel to handle calls exactly like a normal channel. If you do not have the
"no release" feature set, then as soon as the destination (inside of the Local
channel) answers the line, the variables and dial plan will revert back to that
of the original call, and the Local channel will become a zombie and be removed
from the active channels list. This is desirable in some circumstances, but can
result in unexpected dialplan behavior if you are doing fancy things with
variables in your call handling.
There is another option that can be used with local channels, which is the "j"
option. The "j" option must be used with the "n" option to make sure that the
local channel does not get optimized out of the call. This option will enable
a jitterbuffer on the local channel. The jitterbuffer will be used to de-jitter
audio that it receives from the channel that called the local channel. This is
especially in the case of putting chan\_local in between an incoming SIP call
and Asterisk applications, so that the incoming audio will be de-jittered.
\subsection{Purpose} \subsection{Purpose}
The Local channel construct can be used to establish dialing into any part of the dialplan. The Local channel construct can be used to establish dialing into any part of
the dialplan.
Imagine you have a TE410P in your box. You want to do something for which you must use a Dial statement (for instance when dropping files in /var/spool/outgoing) but you do want to be able to use your dialplans least-cost-routes or other intelligent stuff. What you could do before we had chan\_local was create a cross-link between two ports of the TE410P and then Dial out one port and in the other. This way you could control where the call was going. Imagine you have a TE410P in your box. You want to do something for which you
must use a Dial statement (for instance when dropping files in
\path{/var/spool/outgoing}) but you do want to be able to use your dialplans
least-cost-routes or other intelligent stuff. What you could do before we had
chan\_local was create a cross-link between two ports of the TE410P and then
Dial out one port and in the other. This way you could control where the call
was going.
Of course, this was a nasty hack, and to make it more sensible, chan\_local was built. Of course, this was a nasty hack, and to make it more sensible, chan\_local was
built.
The "Local" channel driver allows you to convert an arbitrary extension into a channel. It is used in a variety of places, including agents, etc. The "Local" channel driver allows you to convert an arbitrary extension into a
channel. It is used in a variety of places, including agents, etc.
This also allows us to hop to contexts like a GoSub routine; See examples below. This also allows us to hop to contexts like a GoSub routine; See examples below.
@ -44,7 +69,10 @@ exten => _0.,1,Dial(Zap/g1/${EXTEN:1}) ; outgoing calls with 0+number
\subsection{Caveats} \subsection{Caveats}
If you use chan\_local from a call-file and you want to pass channel variables into your context, make sure you append the '/n', because otherwise chan\_local will 'optimize' itself out of the call-path, and the variables will get lost. i.e. If you use chan\_local from a call-file and you want to pass channel variables
into your context, make sure you append the '/n', because otherwise
chan\_local will 'optimize' itself out of the call-path, and the variables will
get lost. i.e.
\begin{verbatim} \begin{verbatim}
Local/00531234567@pbx becomes Local/00531234567@pbx/n Local/00531234567@pbx becomes Local/00531234567@pbx/n

@ -61,43 +61,50 @@ You can get more information about a manager command
with the "manager show command $<$command$>$" CLI command in Asterisk. with the "manager show command $<$command$>$" CLI command in Asterisk.
\section{Examples} \section{Examples}
\begin{verbatim}
Login - Log a user into the manager interface. Login - Log a user into the manager interface.
\begin{verbatim}
Action: Login Action: Login
Username: testuser Username: testuser
Secret: testsecret Secret: testsecret
\end{verbatim}
Originate - Originate a call from a channel to an extension. Originate - Originate a call from a channel to an extension.
\begin{verbatim}
Action: Originate Action: Originate
Channel: sip/12345 Channel: sip/12345
Exten: 1234 Exten: 1234
Context: default Context: default
\end{verbatim}
Originate - Originate a call from a channel to an extension without waiting Originate - Originate a call from a channel to an extension without waiting
for call to complete. for call to complete.
\begin{verbatim}
Action: Originate Action: Originate
Channel: sip/12345 Channel: sip/12345
Exten: 1234 Exten: 1234
Context: default Context: default
Async: yes Async: yes
\end{verbatim}
Redirect with ExtraChannel: Redirect with ExtraChannel:
Attempted goal: Attempted goal:
Have a 'robot' program Redirect both ends of an already-connected call Have a 'robot' program Redirect both ends of an already-connected call
to a meetme room using the ExtraChannel feature through the management interface. to a meetme room using the ExtraChannel feature through the management interface.
\begin{verbatim}
Action: Redirect Action: Redirect
Channel: Zap/1-1 Channel: Zap/1-1
ExtraChannel: SIP/3064-7e00 (varies) ExtraChannel: SIP/3064-7e00 (varies)
Exten: 680 Exten: 680
Priority: 1 Priority: 1
\end{verbatim}
Where 680 is an extension that sends you to a MeetMe room. Where 680 is an extension that sends you to a MeetMe room.
\end{verbatim}
There are a number of GUI tools that use the manager interface, please search There are a number of GUI tools that use the manager interface, please search
the mailing list archives and the documentation page on the the mailing list archives and the documentation page on the

@ -22,7 +22,7 @@ table is as follows:
+----------------+-------------+------+-----+---------+-------+ +----------------+-------------+------+-----+---------+-------+
\end{verbatim} \end{verbatim}
The database name (from /etc/asterisk/res\_odbc.conf) is in the The database name (from \path{/etc/asterisk/res_odbc.conf}) is in the
"odbcstorage" variable in the general section of voicemail.conf. "odbcstorage" variable in the general section of voicemail.conf.
You may modify the voicemessages table name by using You may modify the voicemessages table name by using

@ -29,7 +29,7 @@ I highly advise Zapateller for those seeking the nirvana of "privacy".
\subsection{Next, Fight against the empty CALLERID!} \subsection{Next, Fight against the empty CALLERID!}
A considerable percentage of the calls you don't want, come from A considerable percentage of the calls you don't want, come from
sites that do not provide CallerID. sites that do not provide CallerID.
Null callerid's are a fact of life, and could be a friend with an Null callerid's are a fact of life, and could be a friend with an
unlisted number, or some charity looking for a handout. The unlisted number, or some charity looking for a handout. The
@ -65,6 +65,8 @@ This will also immediately foil all autodialers that simply belch a
message in your ear and hang up. message in your ear and hang up.
\subsubsection{Example usage of Zapateller and PrivacyManager} \subsubsection{Example usage of Zapateller and PrivacyManager}
\begin{astlisting}
\begin{verbatim} \begin{verbatim}
[homeline] [homeline]
exten => s,1,Answer exten => s,1,Answer
@ -72,14 +74,15 @@ exten => s,2,SetVar,repeatcount=0
exten => s,3,Zapateller,nocallerid exten => s,3,Zapateller,nocallerid
exten => s,4,PrivacyManager exten => s,4,PrivacyManager
;; do this if they don't enter a number to Privacy Manager ;; do this if they don't enter a number to Privacy Manager
exten => s,105,Background(tt-allbusy) exten => s,105,Background(tt-allbusy)
exten => s,106,Background(tt-somethingwrong) exten => s,106,Background(tt-somethingwrong)
exten => s,107,Background(tt-monkeysintro) exten => s,107,Background(tt-monkeysintro)
exten => s,108,Background(tt-monkeys) exten => s,108,Background(tt-monkeys)
exten => s,109,Background(tt-weasels) exten => s,109,Background(tt-weasels)
exten => s,110,Hangup exten => s,110,Hangup
exten => s,5,GotoIf($[ "${CALLERID(num)}" = "7773334444" & "${CALLERID(name)}" : "Privacy Manager" ]?callerid-liar|s|1:s|7) exten => s,5,GotoIf($[ "${CALLERID(num)}" = "7773334444" & "${CALLERID(name)}" : "Privacy Manager" ]?callerid-liar,s,1:s,7)
\end{verbatim} \end{verbatim}
\end{astlisting}
I suggest using Zapateller at the beginning of the context, before I suggest using Zapateller at the beginning of the context, before
anything else, on incoming calls.This can be followed by the anything else, on incoming calls.This can be followed by the
@ -97,7 +100,7 @@ other paths to my torture scripts, I wanted to have some fun.
In nearly all cases now, the telemarketers/charity-seekers that In nearly all cases now, the telemarketers/charity-seekers that
usually get thru to my main intro, hang up. I guess they can see it's usually get thru to my main intro, hang up. I guess they can see it's
pointless, or the average telemarketer/charity-seeker is instructed pointless, or the average telemarketer/charity-seeker is instructed
not to enter options when encountering such systems. Don't know. not to enter options when encountering such systems. Don't know.
\subsection{Next: Torture Them!} \subsection{Next: Torture Them!}
@ -163,15 +166,11 @@ There are some variations, and these will be explained in due course.
To use these options, set your Dial to something like: To use these options, set your Dial to something like:
\begin{verbatim} \begin{verbatim}
exten => 3,3,Dial(Zap/5r3&Zap/6r3|35|tmPA(beep)) exten => 3,3,Dial(Zap/5r3&Zap/6r3,35,tmPA(beep))
or
or exten => 3,3,Dial(Zap/5r3&Zap/6r3,35,tmP(something)A(beep))
or
exten => 3,3,Dial(Zap/5r3&Zap/6r3|35|tmP(something)A(beep)) exten => 3,3,Dial(Zap/5r3&Zap/6r3,35,tmpA(beep))
or
exten => 3,3,Dial(Zap/5r3&Zap/6r3|35|tmpA(beep))
\end{verbatim} \end{verbatim}
The 't' allows the dialed party to transfer the call using '\#'. It's The 't' allows the dialed party to transfer the call using '\#'. It's
@ -188,7 +187,7 @@ P(some-shared-key). Also, if the same person has multiple extensions,
use P(unique-id) on all their dial commands. use P(unique-id) on all their dial commands.
Use little 'p' for screening. Every incoming call will include a Use little 'p' for screening. Every incoming call will include a
prompt for the callee's choice. prompt for the callee's choice.
the A(beep), will generate a 'beep' that the callee will hear if they the A(beep), will generate a 'beep' that the callee will hear if they
choose to talk to the caller. It's kind of a prompt to let the callee choose to talk to the caller. It's kind of a prompt to let the callee
@ -197,7 +196,7 @@ helpful.
When there is no CallerID, P and p options will always record an intro When there is no CallerID, P and p options will always record an intro
for the incoming caller. This intro will be stored temporarily in the for the incoming caller. This intro will be stored temporarily in the
/var/lib/asterisk/sounds/priv-callerintros dir, under the name \path{/var/lib/asterisk/sounds/priv-callerintros} dir, under the name
NOCALLERID\_$<$extension$>$ $<$channelname$>$ and will be erased after the NOCALLERID\_$<$extension$>$ $<$channelname$>$ and will be erased after the
callee decides what to do with the call. callee decides what to do with the call.
@ -232,7 +231,7 @@ introductions are stored and re-used for the convenience of the CALLER.
\subsubsection{Introductions} \subsubsection{Introductions}
Unless instructed to not save introductions (see the 'n' option above), Unless instructed to not save introductions (see the 'n' option above),
the screening modes will save the recordings of the caller's names in the screening modes will save the recordings of the caller's names in
the directory /var/lib/asterisk/sounds/priv-callerintros, if they have the directory \path{/var/lib/asterisk/sounds/priv-callerintros}, if they have
a CallerID. Just the 10-digit callerid numbers are used as filenames, a CallerID. Just the 10-digit callerid numbers are used as filenames,
with a ".gsm" at the end. with a ".gsm" at the end.
@ -246,14 +245,15 @@ Next of all, these intros can be used in voicemail, played over
loudspeakers, and perhaps other nifty things. For instance: loudspeakers, and perhaps other nifty things. For instance:
\begin{verbatim} \begin{verbatim}
exten => s,7,System(/usr/bin/play /var/lib/asterisk/sounds/priv-callerintros/${CALLERID(num)}.gsm&|0) exten => s,6,Set(PATH=/var/lib/asterisk/sounds/priv-callerintros)
exten => s,7,System(/usr/bin/play ${PATH}/${CALLERID(num)}.gsm&,0)
\end{verbatim} \end{verbatim}
When a call comes in at the house, the above priority gets executed, When a call comes in at the house, the above priority gets executed,
and the callers intro is played over the phone systems speakers. This and the callers intro is played over the phone systems speakers. This
gives us a hint who is calling. gives us a hint who is calling.
(Note: the |0 option at the end of the System command above, is a (Note: the ,0 option at the end of the System command above, is a
local mod I made to the System command. It forces a 0 result code to local mod I made to the System command. It forces a 0 result code to
be returned, whether the play command successfully completed or be returned, whether the play command successfully completed or
not. Therefore, I don't have to ensure that the file exists or not. Therefore, I don't have to ensure that the file exists or
@ -264,12 +264,13 @@ handle it a little more intelligently)
And one other thing. You can easily supply your callers with an option And one other thing. You can easily supply your callers with an option
to listen to, and re-record their introductions. Here's what I did in to listen to, and re-record their introductions. Here's what I did in
the home system's extensions.conf. (assume that a the home system's extensions.conf. (assume that a
Goto(home-introduction|s|1) exists somewhere in your main menu as an Goto(home-introduction,s,1) exists somewhere in your main menu as an
option): option):
\begin{astlisting}
\begin{verbatim} \begin{verbatim}
[home-introduction] [home-introduction]
exten => s,1,Background,intro-options ;; Script: exten => s,1,Background(intro-options) ;; Script:
;; To hear your Introduction, dial 1. ;; To hear your Introduction, dial 1.
;; to record a new introduction, dial 2. ;; to record a new introduction, dial 2.
;; to return to the main menu, dial 3. ;; to return to the main menu, dial 3.
@ -278,7 +279,7 @@ exten => 1,1,Playback,priv-callerintros/${CALLERID(num)}
exten => 1,2,Goto(s,1) exten => 1,2,Goto(s,1)
exten => 2,1,Goto(home-introduction-record,s,1) exten => 2,1,Goto(home-introduction-record,s,1)
exten => 3,1,Goto(homeline,s,7) exten => 3,1,Goto(homeline,s,7)
exten => 4,1,Playback,intro-intro exten => 4,1,Playback(intro-intro)
;; Script: ;; Script:
;; This may seem a little strange, but it really is a neat ;; This may seem a little strange, but it really is a neat
;; thing, both for you and for us. I've taped a short introduction ;; thing, both for you and for us. I've taped a short introduction
@ -292,26 +293,26 @@ exten => 4,1,Playback,intro-intro
;; using this menu. ;; using this menu.
exten => 4,2,Goto(s,1) exten => 4,2,Goto(s,1)
exten => t,1,Goto(s,1) exten => t,1,Goto(s,1)
exten => i,1,Background,invalid exten => i,1,Background(invalid)
exten => i,2,Goto(s,1) exten => i,2,Goto(s,1)
exten => o,1,Goto(s,1) exten => o,1,Goto(s,1)
[home-introduction-record] [home-introduction-record]
exten => s,1,Background,intro-record-choices ;; Script: exten => s,1,Background(intro-record-choices) ;; Script:
;; If you want some advice about recording your ;; If you want some advice about recording your
;; introduction, dial 1. ;; introduction, dial 1.
;; otherwise, dial 2, and introduce yourself after ;; otherwise, dial 2, and introduce yourself after
;; the beep. ;; the beep.
exten => 1,1,Playback,intro-record exten => 1,1,Playback(intro-record)
;; Your introduction should be short and sweet and crisp. ;; Your introduction should be short and sweet and crisp.
;; Your introduction will be limited to 4 seconds. ;; Your introduction will be limited to 4 seconds.
;; This is NOT meant to be a voice mail message, so ;; This is NOT meant to be a voice mail message, so
;; please, don't say anything about why you are calling. ;; please, don't say anything about why you are calling.
;; After we are done making the recording, your introduction ;; After we are done making the recording, your introduction
;; will be saved for playback. ;; will be saved for playback.
;; If you are the only person that would call from this number, ;; If you are the only person that would call from this number,
;; please state your name. Otherwise, state your business ;; please state your name. Otherwise, state your business
;; or residence name instead. For instance, if you are ;; or residence name instead. For instance, if you are
;; friend of the family, say, Olie McPherson, and both ;; friend of the family, say, Olie McPherson, and both
;; you and your kids might call here a lot, you might ;; you and your kids might call here a lot, you might
;; say: "This is the distinguished Olie McPherson Residence!" ;; say: "This is the distinguished Olie McPherson Residence!"
@ -322,22 +323,23 @@ exten => 1,1,Playback,intro-record
;; "John, from the Park County Morgue. You stab 'em, we slab 'em!". ;; "John, from the Park County Morgue. You stab 'em, we slab 'em!".
;; Just one caution: the kids will hear what you record every time ;; Just one caution: the kids will hear what you record every time
;; you call. So watch your language! ;; you call. So watch your language!
;; I will begin recording after the tone. ;; I will begin recording after the tone.
;; When you are done, hit the # key. Gather your thoughts and get ;; When you are done, hit the # key. Gather your thoughts and get
;; ready. Remember, the # key will end the recording, and play back ;; ready. Remember, the # key will end the recording, and play back
;; your intro. Good Luck, and Thank you!" ;; your intro. Good Luck, and Thank you!"
exten => 1,2,Goto(2,1) exten => 1,2,Goto(2,1)
exten => 2,1,Background,intro-start exten => 2,1,Background(intro-start)
;; OK, here we go! After the beep, please give your introduction. ;; OK, here we go! After the beep, please give your introduction.
exten => 2,2,Background,beep exten => 2,2,Background(beep)
exten => 2,3,Record,priv-callerintros/${CALLERID(num)}:gsm|4 exten => 2,3,Record(priv-callerintros/${CALLERID(num)}:gsm,4)
exten => 2,4,Background,priv-callerintros/${CALLERID(num)} exten => 2,4,Background(priv-callerintros/${CALLERID(num)})
exten => 2,5,Goto(home-introduction,s,1) exten => 2,5,Goto(home-introduction,s,1)
exten => t,1,Goto(s,1) exten => t,1,Goto(s,1)
exten => i,1,Background,invalid exten => i,1,Background(invalid)
exten => i,2,Goto(s,1) exten => i,2,Goto(s,1)
exten => o,1,Goto(s,1) exten => o,1,Goto(s,1)
\end{verbatim} \end{verbatim}
\end{astlisting}
In the above, you'd most likely reword the messages to your liking, In the above, you'd most likely reword the messages to your liking,
and maybe do more advanced things with the 'error' conditions (i,o,t priorities), and maybe do more advanced things with the 'error' conditions (i,o,t priorities),

@ -2,7 +2,7 @@
\section{Introduction} \section{Introduction}
Pardon, but the dialplan in this tutorial will be expressed Pardon, but the dialplan in this tutorial will be expressed
in AEL, the new Asterisk Extension Language. If you are in AEL, the new Asterisk Extension Language. If you are
not used to its syntax, we hope you will find it to some not used to its syntax, we hope you will find it to some
degree intuitive. If not, there are documents explaining degree intuitive. If not, there are documents explaining
its syntax and constructs. its syntax and constructs.
@ -15,6 +15,7 @@ First of all, set up call queues in queue.conf
Here is an example: Here is an example:
\begin{astlisting}
\begin{verbatim} \begin{verbatim}
=========== queues.conf =========== =========== queues.conf ===========
| ; Cool Digium Queues | | ; Cool Digium Queues |
@ -46,8 +47,9 @@ Here is an example:
| leavewhenempty=strict | | leavewhenempty=strict |
=================================== ===================================
\end{verbatim} \end{verbatim}
\end{astlisting}
In the above, we have defined 3 separate calling queues: In the above, we have defined 3 separate calling queues:
sales-general, customerservice, and dispatch. sales-general, customerservice, and dispatch.
Please note that the sales-general queue specifies a Please note that the sales-general queue specifies a
@ -58,16 +60,16 @@ contexts must be defined somewhere in your dialplan.
We will show them after the main menu below. We will show them after the main menu below.
In the [general] section, specifying the persistentmembers=yes, In the [general] section, specifying the persistentmembers=yes,
will cause the agent lists to be stored in astdb, and will cause the agent lists to be stored in astdb, and
recalled on startup. recalled on startup.
The strategy=ringall will cause all agents to be dialed The strategy=ringall will cause all agents to be dialed
together, the first to answer is then assigned the incoming together, the first to answer is then assigned the incoming
call. call.
"joinempty" set to "strict" will keep incoming callers from "joinempty" set to "strict" will keep incoming callers from
being placed in queues where there are no agents to take calls. being placed in queues where there are no agents to take calls.
The Queue() application will return, and the dial plan can The Queue() application will return, and the dial plan can
determine what to do next. determine what to do next.
If there are calls queued, and the last agent logs out, the If there are calls queued, and the last agent logs out, the
@ -80,11 +82,12 @@ set to "strict".
Then in extensions.ael, you can do these things: Then in extensions.ael, you can do these things:
\subsubsection{The Main Menu} \subsubsection{The Main Menu}
At Digium, incoming callers are sent to the "mainmenu" context, where they At Digium, incoming callers are sent to the "mainmenu" context, where they
are greeted, and directed to the numbers they choose... are greeted, and directed to the numbers they choose...
\begin{astlisting}
\begin{verbatim} \begin{verbatim}
context mainmenu { context mainmenu {
@ -93,10 +96,10 @@ context mainmenu {
queues-loginout; queues-loginout;
} }
0 => goto dispatch|s|1; 0 => goto dispatch,s,1;
2 => goto sales|s|1; 2 => goto sales,s,1;
3 => goto customerservice|s|1; 3 => goto customerservice,s,1;
4 => goto dispatch|s|1; 4 => goto dispatch,s,1;
s => { s => {
Ringing(); Ringing();
@ -133,13 +136,15 @@ context mainmenu {
} }
} }
\end{verbatim} \end{verbatim}
\end{astlisting}
\subsubsection{The Contexts referenced from the queues.conf file} \subsubsection{The Contexts referenced from the queues.conf file}
\begin{astlisting}
\begin{verbatim} \begin{verbatim}
context sales { context sales {
0 => goto dispatch|s|1; 0 => goto dispatch,s,1;
8 => Voicemail(${SALESVM}); 8 => Voicemail(${SALESVM});
s => { s => {
@ -151,18 +156,20 @@ context sales {
WaitExten(0.3); WaitExten(0.3);
Background(digium/AtAnyTimeYouMayPress0ToSpeakWithAnOperatorOr8ToLeaveAMessage); Background(digium/AtAnyTimeYouMayPress0ToSpeakWithAnOperatorOr8ToLeaveAMessage);
Set(CALLERID(name)=Sales); Set(CALLERID(name)=Sales);
Queue(sales-general|t); Queue(sales-general,t);
Set(CALLERID(name)=EmptySalQ); Set(CALLERID(name)=EmptySalQ);
goto dispatch|s|1; goto dispatch,s,1;
Playback(goodbye); Playback(goodbye);
Hangup(); Hangup();
} }
} }
\end{verbatim} \end{verbatim}
\end{astlisting}
Please note that there is only one attempt to queue a call in the sales queue. All sales agents that Please note that there is only one attempt to queue a call in the sales queue. All sales agents that
are logged in will be rung. are logged in will be rung.
\begin{astlisting}
\begin{verbatim} \begin{verbatim}
context customerservice { context customerservice {
@ -183,11 +190,11 @@ context customerservice {
Background(digium/AtAnyTimeYouMayPress0ToSpeakWithAnOperatorOr8ToLeaveAMessage); Background(digium/AtAnyTimeYouMayPress0ToSpeakWithAnOperatorOr8ToLeaveAMessage);
Set(CALLERID(name)=Cust Svc); Set(CALLERID(name)=Cust Svc);
Set(QUEUE_MAX_PENALTY=10); Set(QUEUE_MAX_PENALTY=10);
Queue(customerservice|t); Queue(customerservice,t);
Set(QUEUE_MAX_PENALTY=0); Set(QUEUE_MAX_PENALTY=0);
Queue(customerservice|t); Queue(customerservice,t);
Set(CALLERID(name)=EmptyCSVQ); Set(CALLERID(name)=EmptyCSVQ);
goto dispatch|s|1; goto dispatch,s,1;
Background(digium/NoCustomerServiceRepresentativesAreAvailableAtThisTime); Background(digium/NoCustomerServiceRepresentativesAreAvailableAtThisTime);
Background(digium/PleaseLeaveAMessageInTheCustomerServiceVoiceMailBox); Background(digium/PleaseLeaveAMessageInTheCustomerServiceVoiceMailBox);
Voicemail(${CUSTSERVVM}); Voicemail(${CUSTSERVVM});
@ -196,11 +203,13 @@ context customerservice {
} }
} }
\end{verbatim} \end{verbatim}
\end{astlisting}
Note that calls coming into customerservice will first be try to queue Note that calls coming into customerservice will first be try to queue
calls to those agents with a QUEUE\_MAX\_PENALTY of 10, and if none are available, calls to those agents with a QUEUE\_MAX\_PENALTY of 10, and if none are available,
then all agents are rung. then all agents are rung.
\begin{astlisting}
\begin{verbatim} \begin{verbatim}
context dispatch context dispatch
{ {
@ -226,21 +235,22 @@ context dispatch
} }
} }
\end{verbatim} \end{verbatim}
\end{astlisting}
And in the dispatch context, first agents of priority 10 are tried, then And in the dispatch context, first agents of priority 10 are tried, then
20, and if none are available, all agents are tried. 20, and if none are available, all agents are tried.
Notice that a common pattern is followed in each of the three queue contexts: Notice that a common pattern is followed in each of the three queue contexts:
First, you set QUEUE\_MAX\_PENALTY to a value, then you call First, you set QUEUE\_MAX\_PENALTY to a value, then you call
Queue($<$queue-name$>$,option,...) (see the Queue application documetation for details) Queue($<$queue-name$>$,option,...) (see the Queue application documetation for details)
In the above, note that the "t" option is specified, and this allows the In the above, note that the "t" option is specified, and this allows the
agent picking up the incoming call the luxury of transferring the call to agent picking up the incoming call the luxury of transferring the call to
other parties. other parties.
The purpose of specifying the QUEUE\_MAX\_PENALTY is to develop a set of priorities The purpose of specifying the QUEUE\_MAX\_PENALTY is to develop a set of priorities
amongst agents. By the above usage, agents with lower number priorities will amongst agents. By the above usage, agents with lower number priorities will
be given the calls first, and then, if no-one picks up the call, the QUEUE\_MAX\_PENALTY be given the calls first, and then, if no-one picks up the call, the QUEUE\_MAX\_PENALTY
will be incremented, and the queue tried again. Hopefully, along the line, someone will be incremented, and the queue tried again. Hopefully, along the line, someone
will pick up the call, and the Queue application will end with a hangup. will pick up the call, and the Queue application will end with a hangup.
@ -251,12 +261,12 @@ to zero, which means to try all available agents.
\subsection{Assigning agents to Queues} \subsection{Assigning agents to Queues}
In this example dialplan, we want to be able to add and remove agents to In this example dialplan, we want to be able to add and remove agents to
handle incoming calls, as they feel they are available. As they log in, handle incoming calls, as they feel they are available. As they log in,
they are added to the queue's agent list, and as they log out, they are they are added to the queue's agent list, and as they log out, they are
removed. If no agents are available, the queue command will terminate, and removed. If no agents are available, the queue command will terminate, and
it is the duty of the dialplan to do something appropriate, be it sending it is the duty of the dialplan to do something appropriate, be it sending
the incoming caller to voicemail, or trying the queue again with a higher the incoming caller to voicemail, or trying the queue again with a higher
QUEUE\_MAX\_PENALTY. QUEUE\_MAX\_PENALTY.
Because a single agent can make themselves available to more than one queue, Because a single agent can make themselves available to more than one queue,
@ -265,6 +275,7 @@ dialplan.
\subsubsection{Agents Log In and Out} \subsubsection{Agents Log In and Out}
\begin{astlisting}
\begin{verbatim} \begin{verbatim}
context queues-loginout context queues-loginout
{ {
@ -284,14 +295,16 @@ context queues-loginout
} }
} }
\end{verbatim} \end{verbatim}
\end{astlisting}
In the above contexts, the agents dial 6092 to log into their queues, In the above contexts, the agents dial 6092 to log into their queues,
and they dial 6093 to log out of their queues. The agent is prompted and they dial 6093 to log out of their queues. The agent is prompted
for their agent number, and if they are logging in, their passcode, for their agent number, and if they are logging in, their passcode,
and then they are transferred to the proper extension in the and then they are transferred to the proper extension in the
queues-manip context. The queues-manip context does all the queues-manip context. The queues-manip context does all the
actual work: actual work:
\begin{astlisting}
\begin{verbatim} \begin{verbatim}
context queues-manip { context queues-manip {
@ -324,27 +337,29 @@ context queues-manip {
} }
} }
\end{verbatim} \end{verbatim}
\end{astlisting}
In the above extensions, note that the queue-addremove macro is used In the above extensions, note that the queue-addremove macro is used
to actually add or remove the agent from the applicable queue, to actually add or remove the agent from the applicable queue,
with the applicable priority level. Note that agents with a with the applicable priority level. Note that agents with a
priority level of 10 will be called before agents with levels priority level of 10 will be called before agents with levels
of 20 or 30. of 20 or 30.
In the above example, Raquel will be dialed first in the dispatch In the above example, Raquel will be dialed first in the dispatch
queue, if she has logged in. If she is not, then the second call of queue, if she has logged in. If she is not, then the second call of
Queue() with priority of 20 will dial Brittanica if she is present, Queue() with priority of 20 will dial Brittanica if she is present,
otherwise the third call of Queue() with MAX\_PENALTY of 0 will otherwise the third call of Queue() with MAX\_PENALTY of 0 will
dial Rock and Saline simultaneously. dial Rock and Saline simultaneously.
Also note that Rock will be among the first to be called in the sales-general Also note that Rock will be among the first to be called in the sales-general
queue, and among the last in the dispatch queue. As you can see in queue, and among the last in the dispatch queue. As you can see in
main menu, the callerID is set in the main menu so they can tell main menu, the callerID is set in the main menu so they can tell
which queue incoming calls are coming from. which queue incoming calls are coming from.
The call to queue-success() gives some feedback to the agent The call to queue-success() gives some feedback to the agent
as they log in and out, that the process has completed. as they log in and out, that the process has completed.
\begin{astlisting}
\begin{verbatim} \begin{verbatim}
macro queue-success(exten) macro queue-success(exten)
{ {
@ -362,9 +377,11 @@ macro queue-success(exten)
} }
} }
\end{verbatim} \end{verbatim}
\end{astlisting}
The queue-addremove macro is defined in this manner: The queue-addremove macro is defined in this manner:
\begin{astlisting}
\begin{verbatim} \begin{verbatim}
macro queue-addremove(queuename,penalty,exten) macro queue-addremove(queuename,penalty,exten)
{ {
@ -397,6 +414,7 @@ macro queue-addremove(queuename,penalty,exten)
} }
} }
\end{verbatim} \end{verbatim}
\end{astlisting}
Basically, it uses the first character of the exten variable, to determine the Basically, it uses the first character of the exten variable, to determine the
proper actions to take. In the above dial plan code, only the cases I or O are used, proper actions to take. In the above dial plan code, only the cases I or O are used,
@ -408,6 +426,7 @@ which correspond to the Login and Logout actions.
Notice in the above, that the commands to manipulate agents in queues have Notice in the above, that the commands to manipulate agents in queues have
"@agents" in their arguments. This is a reference to the agents context: "@agents" in their arguments. This is a reference to the agents context:
\begin{astlisting}
\begin{verbatim} \begin{verbatim}
context agents context agents
{ {
@ -415,21 +434,21 @@ context agents
8010 => 8010 =>
{ {
Set(QUEUE_MAX_PENALTY=10); Set(QUEUE_MAX_PENALTY=10);
Queue(sales-general|t); Queue(sales-general,t);
Set(QUEUE_MAX_PENALTY=0); Set(QUEUE_MAX_PENALTY=0);
Queue(sales-general|t); Queue(sales-general,t);
Set(CALLERID(name)=EmptySalQ); Set(CALLERID(name)=EmptySalQ);
goto dispatch|s|1; goto dispatch,s,1;
} }
// Customer Service queue // Customer Service queue
8011 => 8011 =>
{ {
Set(QUEUE_MAX_PENALTY=10); Set(QUEUE_MAX_PENALTY=10);
Queue(customerservice|t); Queue(customerservice,t);
Set(QUEUE_MAX_PENALTY=0); Set(QUEUE_MAX_PENALTY=0);
Queue(customerservice|t); Queue(customerservice,t);
Set(CALLERID(name)=EMptyCSVQ); Set(CALLERID(name)=EMptyCSVQ);
goto dispatch|s|1; goto dispatch,s,1;
} }
8013 => 8013 =>
{ {
@ -442,7 +461,7 @@ context agents
Queue(support-dispatch,t); Queue(support-dispatch,t);
Set(QUEUE_MAX_PENALTY=0); // means no max Set(QUEUE_MAX_PENALTY=0); // means no max
Queue(support-dispatch,t); Queue(support-dispatch,t);
goto dispatch|s|1; goto dispatch,s,1;
} }
6121 => &callagent(${RAQUEL},${EXTEN}); 6121 => &callagent(${RAQUEL},${EXTEN});
6165 => &callagent(${SPEARS},${EXTEN}); 6165 => &callagent(${SPEARS},${EXTEN});
@ -450,27 +469,29 @@ context agents
6070 => &callagent(${SALINE},${EXTEN}); 6070 => &callagent(${SALINE},${EXTEN});
} }
\end{verbatim} \end{verbatim}
\end{astlisting}
In the above, the variables \${RAQUEL}, etc stand for In the above, the variables \${RAQUEL}, etc stand for
actual devices to ring that person's actual devices to ring that person's
phone (like Zap/37). phone (like Zap/37).
The 8010, 8011, and 8013 extensions are purely for transferring The 8010, 8011, and 8013 extensions are purely for transferring
incoming callers to queues. For instance, a customer service incoming callers to queues. For instance, a customer service
agent might want to transfer the caller to talk to sales. The agent might want to transfer the caller to talk to sales. The
agent only has to transfer to extension 8010, in this case. agent only has to transfer to extension 8010, in this case.
Here is the callagent macro, note that if a person in the Here is the callagent macro, note that if a person in the
queue is called, but does not answer, then they are automatically queue is called, but does not answer, then they are automatically
removed from the queue. removed from the queue.
\begin{astlisting}
\begin{verbatim} \begin{verbatim}
macro callagent(device,exten) macro callagent(device,exten)
{ {
if( ${GROUP_COUNT(${exten}@agents)}=0 ) if( ${GROUP_COUNT(${exten}@agents)}=0 )
{ {
Set(OUTBOUND_GROUP=${exten}@agents); Set(OUTBOUND_GROUP=${exten}@agents);
Dial(${device}|300|t); Dial(${device},300,t);
switch(${DIALSTATUS}) switch(${DIALSTATUS})
{ {
case BUSY: case BUSY:
@ -478,7 +499,7 @@ macro callagent(device,exten)
break; break;
case NOANSWER: case NOANSWER:
Set(queue-announce-success=0); Set(queue-announce-success=0);
goto queues-manip|O${exten}|1; goto queues-manip,O${exten},1;
default: default:
Hangup(); Hangup();
break; break;
@ -490,6 +511,7 @@ macro callagent(device,exten)
} }
} }
\end{verbatim} \end{verbatim}
\end{astlisting}
In the callagent macro above, the \${exten} will In the callagent macro above, the \${exten} will
be 6121, or 6165, etc, which is the extension of the agent. be 6121, or 6165, etc, which is the extension of the agent.
@ -498,10 +520,10 @@ The use of the GROUP\_COUNT, and OUTBOUND\_GROUP follow this line
of thinking. Incoming calls can be queued to ring all agents in the of thinking. Incoming calls can be queued to ring all agents in the
current priority. If some of those agents are already talking, they current priority. If some of those agents are already talking, they
would get bothersome call-waiting tones. To avoid this inconvenience, would get bothersome call-waiting tones. To avoid this inconvenience,
when an agent gets a call, the OUTBOUND\_GROUP assigns that when an agent gets a call, the OUTBOUND\_GROUP assigns that
conversation to the group specified, for instance 6171@agents. conversation to the group specified, for instance 6171@agents.
The \${GROUP\_COUNT()} variable on a subsequent call should return The \${GROUP\_COUNT()} variable on a subsequent call should return
"1" for that group. If GROUP\_COUNT returns 1, then the busy() "1" for that group. If GROUP\_COUNT returns 1, then the busy()
is returned without actually trying to dial the agent. is returned without actually trying to dial the agent.
\subsection{Pre Acknowledgement Message} \subsection{Pre Acknowledgement Message}
@ -509,16 +531,17 @@ is returned without actually trying to dial the agent.
If you would like to have a pre acknowledge message with option to reject the message If you would like to have a pre acknowledge message with option to reject the message
you can use the following dialplan Macro as a base with the 'M' dial argument. you can use the following dialplan Macro as a base with the 'M' dial argument.
\begin{astlisting}
\begin{verbatim} \begin{verbatim}
[macro-screen] [macro-screen]
exten=>s,1,Wait(.25) exten=>s,1,Wait(.25)
exten=>s,2,Read(ACCEPT|screen-callee-options|1) exten=>s,2,Read(ACCEPT,screen-callee-options,1)
exten=>s,3,Gotoif($[${ACCEPT} = 1] ?50) exten=>s,3,Gotoif($[${ACCEPT} = 1] ?50)
exten=>s,4,Gotoif($[${ACCEPT} = 2] ?30) exten=>s,4,Gotoif($[${ACCEPT} = 2] ?30)
exten=>s,5,Gotoif($[${ACCEPT} = 3] ?40) exten=>s,5,Gotoif($[${ACCEPT} = 3] ?40)
exten=>s,6,Gotoif($[${ACCEPT} = 4] ?30:30) exten=>s,6,Gotoif($[${ACCEPT} = 4] ?30:30)
exten=>s,30,Set(MACRO_RESULT=CONTINUE) exten=>s,30,Set(MACRO_RESULT=CONTINUE)
exten=>s,40,Read(TEXTEN|custom/screen-exten|) exten=>s,40,Read(TEXTEN,custom/screen-exten,)
exten=>s,41,Gotoif($[${LEN(${TEXTEN})} = 3]?42:45) exten=>s,41,Gotoif($[${LEN(${TEXTEN})} = 3]?42:45)
exten=>s,42,Set(MACRO_RESULT=GOTO:from-internal^${TEXTEN}^1) exten=>s,42,Set(MACRO_RESULT=GOTO:from-internal^${TEXTEN}^1)
exten=>s,45,Gotoif($[${TEXTEN} = 0] ?46:4) exten=>s,45,Gotoif($[${TEXTEN} = 0] ?46:4)
@ -527,6 +550,7 @@ exten=>s,50,Playback(after-the-tone)
exten=>s,51,Playback(connected) exten=>s,51,Playback(connected)
exten=>s,52,Playback(beep) exten=>s,52,Playback(beep)
\end{verbatim} \end{verbatim}
\end{astlisting}
\subsection{Caveats} \subsection{Caveats}

@ -100,7 +100,7 @@ device=Local/disa@line4_outbound
exten => 12564286000,1,SLATrunk(line4) exten => 12564286000,1,SLATrunk(line4)
[line4_outbound] [line4_outbound]
exten => disa,1,Disa(no-password|line4_outbound) exten => disa,1,Disa(no-password,line4_outbound)
exten => _1NXXNXXXXXX,1,Dial(SIP/\${EXTEN}@mytrunk) exten => _1NXXNXXXXXX,1,Dial(SIP/\${EXTEN}@mytrunk)
\end{verbatim} \end{verbatim}
@ -277,18 +277,18 @@ extensions.conf:
\begin{verbatim} \begin{verbatim}
[macro-slaline] [macro-slaline]
exten => s,1,SLATrunk(${ARG1}) exten => s,1,SLATrunk(${ARG1})
exten => s,n,Goto(s-${SLATRUNK_STATUS}|1) exten => s,n,Goto(s-${SLATRUNK_STATUS},1)
exten => s-FAILURE,1,Voicemail(1234|u) exten => s-FAILURE,1,Voicemail(1234,u)
exten => s-UNANSWERED,1,Voicemail(1234|u) exten => s-UNANSWERED,1,Voicemail(1234,u)
[line1] [line1]
exten => s,1,Macro(slaline|line1) exten => s,1,Macro(slaline,line1)
[line2] [line2]
exten => s,2,Macro(slaline|line2) exten => s,2,Macro(slaline,line2)
[line1_outbound] [line1_outbound]
exten => disa,1,Disa(no-password|line1_outbound) exten => disa,1,Disa(no-password,line1_outbound)
exten => _1NXXNXXXXXX,1,Dial(Zap/1/${EXTEN}) exten => _1NXXNXXXXXX,1,Dial(Zap/1/${EXTEN})
exten => 8500,1,VoicemailMain(1234) exten => 8500,1,VoicemailMain(1234)

Loading…
Cancel
Save