Now that we’ve gone over some more of the basics, let’s look at a few popular functions that have been incorporated into Asterisk.
Zapateller()
is a simple Asterisk application that plays a special
information tone at the beginning of a call, which causes auto-dialers
(usually used by telemarketers) to think that the line has been
disconnected. Not only will they hang up, but their systems will flag
your number as out of service, which could help you avoid all kinds of
telemarketing calls. To use this functionality within your dialplan,
simply call the Zapateller()
application.
We’ll also use the optional nocallerid
option so that the tone will be
played only when there is no Caller ID information on the incoming call.
For example, you might use Zapateller()
in the s
extension of your [incoming]
context, like this:
[incomimg] exten => s,1,Zapateller(nocallerid) exten => s,n,Playback(enter-ext-of-person)
Another handy feature is called call parking. Call parking
allows you to place a call on hold in a “parking lot,” so that it can be
taken off hold from another extension. Parameters for call parking (such
as the extensions to use, the number of spaces, and so on) are all
controlled within the features.conf configuration
file. The [general]
section
of the features.conf file contains four
settings related to call parking:
parkext
This is the parking lot extension. Transfer a call to this extension,
and the system will tell you which parking position the call is
in. By default, the parking extension is 700
.
parkpos
This option defines the number of parking slots. For example, setting
it to 701-720
creates 20
parking positions, numbered 701 through 720.
context
This is the name of the parking context. To be able to park calls, you must include this context.
parkingtime
If set, this option controls how long (in seconds) a call can stay in the parking lot. If the call isn’t picked up within the specified time, the extension that parked the call will be called back.
You must restart Asterisk after editing
features.conf, as the file is read only on
startup. Running the reload
command
will not cause the features.conf file to be
read.
Also note that because the user needs to be able to transfer the
calls to the parking lot extension, you should make sure you’re using
the t
and/or T
options to the Dial()
application.
So, let’s create a simple dialplan to show off call parking:
[incoming] include => parkedcalls exten => 103,1,Dial(SIP/Bob,,tT) exten => 104,1,Dial(SIP/Charlie,,tT)
To illustrate how call parking works, say that Alice calls into the system and dials extension 103 to reach Bob. After a while, Bob transfers the call to extension 700, which tells him that the call from Alice has been parked in position 701. Bob then dials Charlie at extension 104, and tells him that Alice is at extension 701. Charlie then dials extension 701 and begins to talk to Alice. This is a simple and effective way of allowing callers to be transferred between users.
The t
and T
arguments to
Dial()
are not needed on all
channel types. For example, many SIP phones implement this via a
softkey or hardkey and utilize SIP signaling.
Last but not least, let’s cover setting up an audio conference bridge with the MeetMe()
application.[86] This application allows multiple callers to converse
together, as if they were all in the same physical location. Some of the
main features include:
The ability to create password-protected conferences
Conference administration (mute conference, lock conference, kick participants)
The option of muting all but one participant (useful for company announcements, broadcasts, etc.)
Static or dynamic conference creation
Let’s walk through setting up a basic conference room. The
configuration options for the MeetMe conferencing system are found in
meetme.conf. Inside the configuration file, you define conference rooms and
optional numeric passwords. (If a password is defined here, it will be
required to enter all conferences using that room.) For our example,
let’s set up a conference room at extension 600. First, we’ll set up the
conference room in meetme.conf. We’ll call it
600
, and we won’t assign a password
at this time:
[rooms] conf => 600
Now that the configuration file is complete, we’ll need to restart
Asterisk so that it can reread the meetme.conf
file. Next, we’ll add support for the conference room to our dialplan
with the MeetMe()
application.
MeetMe()
takes three arguments: the
name of the conference room (as defined in
meetme.conf), a set of options, and the password
the user must enter to join this conference. Let’s set up a simple
conference using room 600
, the
i
option (which announces when people
enter and exit the conference), and a password of 54321
:
exten => 600,1,MeetMe(600,i,54321)
That’s all there is to it! When callers enter extension 600, they
will be prompted for the password. If they correctly enter 54321
, they will be added to the conference.
See Appendix B, Application Reference for a list of all the options
supported by the MeetMe()
application.
Another useful application is MeetMeCount()
. As its name suggests, this
application counts the number of users in a particular conference room.
It takes up to two arguments: the
conference room in which to count the number of participants, and
optionally a variable name to assign the count to. If the variable name
is not passed as the second argument, the count is read to the
caller:
exten => 601,1,Playback(conf-thereare) exten => 601,n,MeetMeCount(600) exten => 601,n,Playback(conf-peopleinconf)
If you pass a variable as the second argument to MeetMeCount()
, the count is assigned to the variable, and playback of the
count is skipped. You might use this to limit the number of
participants, like this:
; limit the conference room to 10 participants exten => 600,1,MeetMeCount(600,CONFCOUNT) exten => 600,n,GotoIf($[${CONFCOUNT} <= 10]?meetme:conf_full,1) exten => 600,n(meetme),MeetMe(600,i,54321) exten => conf_full,1,Playback(conf-full)
Isn’t Asterisk fun?
[86] In the world of legacy PBXes, this type of functionality is very expensive. Either you have to pay big bucks for a dial-in service, or you have to add an expensive conferencing bridge to your proprietary PBX.