Asterisk Open-Source PBX System

Use one system to manage voice over IP and conventional phone lines, manage voice mail and run CGI-like applications for phone users.
Setting Up Voice Mail

The next file is voicemail.conf (Listing 3). Again, it has a general section that deals with general or global parameters for voice mail. The first parameter, format, lists the audio format of the messages. The next two parameters are used for e-mail notification: serveremail is the source e-mail address (from field), and attach instructs Asterisk to attach the message to the e-mail. In our example, we do not want the message attached. Again, some parameters have been omitted.

<mbox> is the number used to save and access messages for the user. This is also used in extensions.conf for directing the call flow to the proper voice-mail box. The <passwd> parameter is needed when checking messages. <name> is the name of the user. <email> and <pager> are e-mail addresses that are used to send message notifications. The pager e-mail has a shorter message, because it needs to be read on smaller devices (pagers and cell phones). Many mobile and pager providers have e-mail gateways that can deliver the message to the device.

Defining Extensions

The last file that we examine here is the extensions.conf file (Listing 4). This is one of the most involved files because it contains the dialplan. The dialplan in my example is rather simple compared to its capabilities. This file has a general and global section. The general section is similar to the general section in the previous files; it defines general parameters. I don't define any general parameters in this example. The global section is used to define global variables. These variables can be accessed in the dialplan by using the syntax ${VARIABLE}. I have defined one variable: TIMEOUT is the answer timeout. Built-in variables also can be used within the dialplan, such as, CONTEXT, EXTEN and CALLERID.

All of the other sections are context definitions. A context is simply a grouping of digit patterns. Here I have defined several contexts that define dialing scenarios: voicemail, iax and afterhours. Think of these as individual or mini-dialplans. I then define two contexts that I assign to the users. These inherit the capabilities of the other contexts I already have defined by using the include keyword.

The first context, voicemail, lists the digit patterns that allow users to access their voice-mail messages. Users can dial 6245, and the application VoicemailMain2 prompts them for the mailbox number and password. Users then can manage (listen to, delete and so on) the messages in their mailbox.

The iax context is used for PBX dialing between IAX users. We have defined various extensions for each of the users. An entry with the name of the user (maria) redirects to the extension number entry. For the 111 extension, I also match on callerid. If the callerid matches, I change the callerid name so it has a relative meaning. For example, if the extension dialed is 111, and the callerid is 222, the callerid name is changed to “it's your wife!”. This message shows up on my client whenever my wife calls me (I won't get into how I use this to my advantage).

The last digit pattern context is used for calls that arrive during late hours. Because I don't want to be disturbed at night by external users, I match on any dialed number (_.). It waits for one second and then answers the call. After it answers, it plays a background message so the caller can choose for which person to leave a message (“for brett, press 1”). So, if the caller presses 1, the call proceeds to the 1,1,Voicemail2(111) entry, which sends the user to the 111 mailbox. This is a simple illustration of how you could construct an IVR system.

The [cg1] and [cg2] contexts include functionality I already have defined inside other contexts. This allows me to create different user groups easily. For example, [cg1] has all of the capabilities I have defined, but [cg2] has only the iax capabilities and gets directed to voice mail during late hours. Powerful dialing capabilities can be constructed by utilizing the flexibility of Asterisk's dialplan. My example has shown only a glimpse of the possibilities. You also can simplify the dialplan by using macros, but I leave that as an exercise for the reader.

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

German Book to Asterisk: "Der Weg zu VoIP Asterisk von A bis Z"

Silvio's picture

Buch Bekanntmachung: Der Weg zu VoIP Asterisk von A bis Z

For english see bellow.

Als ich Oktober 2005 angefangen habe mit Asterisk zu arbeiten, gab es nur wenig zusammenhängende Informationen zu Asterisk. Es gab bereits ein Buch zu Asterisk, jedoch wurden dort einige Themen ausgelassen. Auch im neuen Asterisk von Oreilly wird nur Asterisk besprochen, jedoch nicht auf Telefonkarten, VoIP Telefone, Zusatzprogramme eingegangen.

Der Buch Inhalt ist auf die deutschsprachigen Länder, Deutschland, Österreich, Schweiz, bezogen.

Das Buch "Der Weg zu VoIP Asterisk von A bis Z" beschreibt nicht nur Asterisk sondern auch alles Dinge,
welche mit Asterisk verwendet werden können. Hier einige Beispiele aus dem Buchinhalt.

- Einführung in Asterisk
- Benötigte Hardware für Asterisk
- Asterisk installation
-- Das erste Gespräch
-- Echo Call test
-- die sprechende Uhr

- die Konfigurationsdateien
- Sicherheit

- Anrufbeantworter
- Sprachausgabe auf deutsch wechseln
- makeln, weiterleiten
- Music on Hold
- Automatisch weiterleiten

- PSTN(POTS) integration
- ISDN integration

- SIP Telefone
- Sprachcodecs
- Asterisk Konfigurationsprogramme
- Asterisk und Billing
- Rollout in einem Unternehmen
- Alternativen zu Asterisk
- VoIP Protokolle
- ...

Das Buch ist bereits teilweise frei erhältlich im Internet verfügbar.
Die ersten 30 Seiten finden man jetzt schon unter http://www.suvi.org/theory/asterisk.html

Jede Woche, oder beim Verkauf eines Buch Exemplares, wird eine Seite freigegeben. Das Buch wird also Zeit abhängig freigegeben. Zudem unterstützt man mit dem Kauf des Buches die freie Erhältlichkeit des Buches.

Das Buch hat rund 243 Seiten und kann unter https://www.lulu.com/commerce/index.php?fBuyContent=359309 bezogen werden.

Gruss
Silvio

Book announcement: Der Weg zu VoIP Asterisk von A bis Z

First at all: The book is only aviable in the german language. The book does describe Asterisk as well as things that are usefull for Asterisk: VoIP-Telefons, Configuration Software, Billing Software, Telefonycards, ...

The book content is sutiable for the german speaking countries: Germany, Austria and Switzerland.

Parts of the book are allready free avialbe on the internet.
The first 30 pages can be found at http://www.suvi.org/theory/asterisk.html

Everyweek, and if someone buys the book, one page more will be free aviable. With the buy of the book the freedom of the book is supported.

The book has 244 pages and can be bought at https://www.lulu.com/commerce/index.php?fBuyContent=359309

Best Regards
Silvio

Asterisk Connects wtih GoogleTalk

Anonymous's picture

New project is underway to connect GoogleTalk/Jabber with Asterisk. Delivery date and details can be seen here: http://www.networkingpipeline.com/blog/archives/2006/04/asterisk_server....

Faxing with Asterisk using AsterFax

Anonymous's picture

You can also fax with Asterisk using AsterFax which is an email to Fax gateway.

And you plug it in...

Anonymous's picture

...to the Verizon rj11 jack on the wall!
Or you use the magical wireless connectivity available only in the author's town.

Very technical, very specific article. How about a followup that dumbs it down just a bit, such as, you connect the Digium PCI card to your network, this is how much upload speed you'll need per line, you find a voip carrier by looking for this service (sip...) You can/can't have branch offices with the same number and transfer calls across the city/town with call transfer...

I know someone stuck on Vonage's two line SB plan, who is looking for something cheap, where he can migrate his number to something like Broadvoice or some other service, and have one or two (or more) voice lines, plus a fax line like through Vonage. Number portability takes care of the original number, but the technical details on using Asterisk with a carrier to replace Vonage (or Broadvoice which has their own adapters like Vonage, or bring your own adapter) still isn't clear.

What exactly needs to be done to migrate from Vonage Voip to Asterisk, where I can get one voice and one fax (or actually 2 voice lines) which actually has functional call "hunting" for each voice line? Who do I call to order the service, once I have a dedicated box for Asterisk and Digium modems? Unless the cost comes in less than either Vonage for two lines, or Broadvoice or other Voip for multiple single lines, what's the point besides the geek factor? Using call forwarding on busy with multiple single lines, you get all the benefits of all the other services, without worrying about another point of failure in the hardware, a huge UPS for a computer vs. a UPS for a few phone adapters, plus the cost of electricity of running that computer 24/7 every month.

While the technical details are nice, the major part of the story, the connection explanation/possibilities as compared to something like Vonage/Broadvoice so one can fully understand what/why is missing. The technical details would be a nice addition, but I doubt that most post-purchase users are going to use this article for relying on their phone system when the mailing list for Asterisk and the abundant docs online are all available and will be utilized anyway.

Good technical explanation, but the article misses the mark. Thanks for the article anyway.

Asterisk Rapid Installation

Eran's picture

Xorcom has released version 0.9 of Debian and Asterisk auto-installer. It can turn any PC to pre-configured PBX from scratch in a few minutes, and contains lots of extra software and features. It is free and open source.
Asterisk auto-install CD

Eran Gal
Xorcom Ltd
Asterisk Solutions

Re: Asterisk Open-Source PBX System

Anonymous's picture

callerid example is wrong

Should be:

[brett]
type=friend
host=dynamic
secret=brettsecret
context=cg1
callerid="brett"

Re: Asterisk Open-Source PBX System

Anonymous's picture

good catch, although in the context of what I was doing, it wouldn't really have any affect. Technically, I should have had:

callerid="brett"

Re: Asterisk Open-Source PBX System

Anonymous's picture

Or, even more technically correct would be:

callerid="brett"

This sets the CALLERIDNAME variable to brett and the CALLERIDNUM variable to 111 (referencing the whole callerid with CALLERID) if required... (look in Readme.variables for other interesting stuff)

Andy

Re: Asterisk Open-Source PBX System

Anonymous's picture

ok, that didn't work it (it was stripped out...) should be

callerid="brett"

Perhaps you mean...

Anonymous's picture

Do you mean like this?

callerid="brett"<111>

Re: Asterisk Open-Source PBX System

Anonymous's picture

ok, I'm just about to give up on this stupid filtering!

callerid = "brett" less-than-sign 111 greater-than-sign

replace the 'less-than-sign ' with 'shift ,' and greater-than-sign 'shift .'

or look at http://www.automated.it/guidetoasterisk.htm

Andy

Re: Asterisk Open-Source PBX System

Anonymous's picture

right...I think the filtering was messing everyone up...thanks

Re: Asterisk Open-Source PBX System

Anonymous's picture

where is callerid.agi?

cant find it :(

Re: Asterisk Open-Source PBX System

Anonymous's picture

it's on my website: http://www.bschwarz.com/asterisk/

Re: Asterisk Open-Source PBX System

Anonymous's picture

callerid="brett"

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix