text
stringlengths
0
152
K, k
X, x
The [applicationmap] Section
The [applicationmap] section of features.conf is arguably the most nifty, as it allows
you to map DTMF codes to dialplan applications. The caller will be placed on hold
until the application has completed execution.
The syntax for defining an application map is as follows (it must appear on a single
line; line breaks are not allowed):2
Name => DTMF_sequence,ActivateOn[/ActivatedBy],App([Args])[,MOH_Class]
What you are doing is the following:
1. Giving your map a name so that it can be enabled in the dialplan through the use
of the DYNAMIC_FEATURES channel variable (more on this in a moment).
2. Defining the DTMF sequence that activates this feature (we recommend using at
least two digits for this).
3. Defining which channel the feature will be activated on, and (optionally) which
participant is allowed to activate the feature (the default is to allow both channels
to use/activate this feature).
4. Giving the name of the application that this map will trigger, and its arguments.
5. Providing an optional music on hold (MOH) class to assign to this feature
(which the opposite channel will hear when the application is executing). If you
do not define any MOH class, the caller will hear only silence.
2 There is some flexibility in the syntax (you can look at the sample file for details), but our example uses the
style we recommend, since it’s the most consistent with typical dialplan syntax.
features.conf
|
191
Here is an example of an application map that will trigger an AGI script:3
agi_test => *6,self/callee,AGI(agi-test.agi),default
You may add this to your /etc/asterisk/features.conf file if you wish.
Since applications spawned from the application map are run out‐
side the PBX core, you cannot execute any applications that trigger
the dialplan (such as Goto(), Macro(), Background(), etc.). If you
wish to use the application map to spawn external processes
(including executing dialplan code), you will need to trigger an
external application through an AGI() call or the System() applica‐
tion. The point is, if you want anything complex to happen through
the use of an application map, you will need to test very carefully,
as not all things will work as you might expect.
To use an application map, you must declare it in the dialplan by setting the
DYNAMIC_FEATURES variable somewhere before the Dial() command that connects
the channels. Use the double underscore modifier on the variable name to ensure that
the application map is available to both channels throughout the life of the call. Let’s
toss this one in our subDialUser subroutine, so that it’ll be available whenever any of
our extensions call each other:
[subDialUser]
exten => _[0-9].,1,Noop(Dial extension ${EXTEN},channel: ${ARG1}, mailbox: ${ARG2})
same => n,Noop(mboxcontext: ${ARG3}, timeout ${ARG4})
same => n,Set(__DYNAMIC_FEATURES=agi_test)
same => n,Dial(${ARG1},${ARG4})
same => n,GotoIf($["${DIALSTATUS}" = "BUSY"]?busy:unavail)
If you want to allow more than one application map to be available
on a call, you will need to use the # symbol as a delimiter between
multiple map names:
Set(__DYNAMIC_FEATURES=agi_test#my_other_map)
The reason why the # character was chosen instead of a simple
comma is that older versions of the Set() application interpreted
the comma differently than more recent versions, and the syntax
for application maps has never been updated.
Don’t forget to reload the features module after making changes to the features.conf
file:
3 We’ll cover AGI in Chapter 18, but briefly, AGI scripts are external programs you can trigger from the dia‐
lplan. Handy? Very!
192
|
Chapter 11: PBX Features, Including Parking, Paging, and Conferencing
*CLI> module reload features