Asterisk “The Future of Telecomm Telecommunications” unications”
Vincente D’Ingianni Director of Professional Services Binary Systems, Inc.
[email protected]
Whatt is Wha is Asterisk?
Asterisk Asteris k is a comp complete lete VoIP So Softsw ftswitch itch,, design designed ed to reproduce the features of standard office PBX system.
Asterisk Asteris k is also a Voice Voice ove overr IP toolk toolkit it whic which h allows allows interaction between these PBX features and IP-based networks (local and remote.)
Asterisk Asteris k is hard hardware ware inde indepen penden dent, t, and and is desi designe gned d to run on numerous operating systems.
Mark Spencer – Creator of Asterisk
Mark Spencer and Vincente D’Ingianni presenting at SIP Sizzles 2003
Asterisk Softswitch System Architecture Asterisk
Proprietary API
PCI Bus
SIP
H.323
Ethernet
IAX
MGCP
Ethernet
Media Gateways / Endpoints
SCCP
Ethernet
Asterisk Capabilities
Telephony gateway (TDM channels - PRI,POTS)
VoIP Gateway (IP channels)
IVR system (Interactive Voice Response)
Voicemail System
Scriptable telephony-to-anything (Perl, C, etc.)
much, much more…
Asterisk is not… A Billing system A CRM system A web server or XML server A configuration tool for VoIP devices A voice recognition system A USENET or email client
…but it is often bundled with these subsystems to form a complete solution.
Asterisk Goals
Provide Open-Source implementations of basic PBX functionality Be vendor neutral (despite last point here) Be as all-encompassing as possible for features Be flexible and provide hooks for advanced features
Move proprietary hardware features into open source software (HMP functionality)
Integrate with 3rd party telephony hardware devices (DSP functionality)
Sell TDM hardware cards for Digium
Who is Digium? Primary supporter of Asterisk development. Owner of the CVS server/bug system/mailing list boxes/etc. Approves all patches and features by community Produces TDM cards (“Wildcard” hardware) which works particularly well with Asterisk Owner of the disclaimers for all contributions to Asterisk, holder of copyright
Asterisk is not quite GPL Asterisk is GPL, but with an important clause Digium can license branches of the source such that those branches are not GPL Digium gets disclaimers from all contributors saying that Digium can license branches of the code.
VoIP Channels
SIP - Session Initiation Protocol (internal stack) H.323 – via OpenH323 Project MGCP - Media Gateway Control Protocol (internal stack) SCCP – Cisco Skinny Protocol (internal stack) IAX – Inter-Asterisk eXcange Protocol
Special open-source protocol developed for communicaiton between Asterisk servers.
VoIP Channel Endpoints
Phones for VoIP (SIP):
Grandstream 102 Cisco ATA 186 Sipura Cisco 7960/7940 Polycom IP-501, IP-601, etc. Snome Many others
Software for VoIP (SIP)
www.xten.com - free SIP client (“Lite”) gnophone.com - Linux SIP client Windows Messenger
TDM and Other Channels TDM POTS cards (Digium, Zapata, Voicetronix, etc.) TDM Digital (AdTran VoFR, Digium E1/T1, etc.) All TDM cards require install of Zaptel driver suite CAPI (ISDN card support for Linux ISDN driver) USB dongle for FXS Modem drivers for certain modems Speaker/headphones
System Requirements
No clear rule of thumb on processor size; at least 500 MHz PIII recommended. Almost any version of Linux is supported. Source & binaries (including sounds) are ~35 MB Using complex codecs (i.e.: G.729, Speex, etc.) will increase processor load dramatically
Remember this is processed on the host processor – HMP
Best to have a > 1.5 GHz machine for multi-channel use. Mac OS X / FreeBSD is becoming stable for non-hardware channels. VMWare and Parallels Virtual Machines
Call Flow (briefly)
Calls come in on channels and are then handed to the “extensions.conf” file, which is the dialplan
Dialplan contains logical sections of matches called ‘Contexts,’ and each channel sends a call into the dialplan with a context name and a dialed number.
The dialplan then matches (with modified regexp’s) the number being dialed, and runs applications accordingly
Each match on the dialed number has an order of steps called ‘Priorities’, and are indicated with an integral incrementing number.
Regular Expressions (briefly) All regular expressions start with “_” character in dial examinations. “X” means any number, “N” is any number other than 0 or 1 “.” means any number of characters Brackets represent groups, with standard “-” and “,” meanings ([1-9] or [0,1,2]) Example: _1410985012X is the same as _1410985012[0-9]
Call Flow (cont’d) [from-my-pri] exten => 14109850123,1,Answer exten => 14109850123,2,Wait(2) exten => 14109850123,3,Playback(monkeys) exten => 14109850123,4,Goto(more-monkeys,123,1) [more-monkeys] exten => _12X,1,Playback(sorry-no-more-monkeys) exten => _12X,2,Hangup
Redirection based on ANI
You can match against calling number instead of called number. This is known as “The ex-girlfriend filter” by the inventor of the routines This pattern matches against called number (1410…) and also against calling numer (301…)
exten => 14109850123/3013659999,1,Busy
Redirection of Call Flow GotoIf - can parse basic Booleans GotoIfTime - handy way to deal with time-based redirection Some applications will add 101 to the existing priority when certain errors occur (notably, Dial does this on busy, and DBget/DBput do this on errors reading from the internal database) Any other type of errors result in channel hangup
Variables
${VARNAME} is how variables are used Variables must be declared before Booleans can be performed Variables can be nested during setting exten => 123,1,SetVar(BAR=blah) exten => 123,2,SetVar(FOO=3) exten => 123,3,SetVar(NEWVAR.${FOO} = $ {BAR}) This results in ${NEWVAR.3} being set to “blah”
Special Variables
${EXTEN} - always the most important variable. This is the number that is being currently evaluated. ${CALLERIDNUM} - the ANI (if available) of the call leg that is creating the call Some others, less used: ${EPOCH}, $ {ENV(var)}, ${CONTEXT}, ${PRIORITY}, several other descriptors of the call leg we’re processing
Some Applications Dial - connects an inbound call with some other channel. The first argument specifies the technology (SIP, Zap, H323, etc.) and the number to be dialed, the Ring-No-Answer delay, and options (if desired) exten => 1234,1,Dial(SIP/1234,25) exten => 1234,2,Voicemail2(u1234)
Some Applications (cont’d)
Playback(filename)
Plays a sound file in .gsm format
Background(filename)
Plays a sound file while listening for DTMF (touch tone) input [test] exten => 123,1,Background(press-a-number) exten => 123,2,Goto(1) exten => _X,1,SayDigits(${EXTEN})
Some Applications (cont’d)
MeetMe(conf#)
Monitor
Adds the caller to a conference room (optionally muted or unmuted) Records channel (in and out) to .wav or .gsm files
PrivacyManager
Forces anonymous calls to enter valid ANI
Some Applications (cont’d)
DISA
SetMusicOnHold
Lets callers from one channel get dialtone on another channel You can specify .mp3 files as music on hold selections (random or sequential)
MP3Player
Fairly useless, but fun. You can specify files or streams of .mp3 to be played to callers.
Some Applications (cont’d) There are over 80 different applications in the system – more created each day. Applications are easily created and added if you’re a decent C coder or scripting coder. Channels are generic, so you don’t have to know about any of the ugly VoIP or TDM stuff.
Voicemail
Voicemail can be sent as email as well as stored on disk
(1 minute = 100KB)
Short pages can be sent to email addresses when VM received Customizable timezones and time readouts per user - supports multiple languages WAV or GSM file format for storage or email Dial by name directory hinges on VM data
Practical Uses Ditch your long distance company! SIP long distance (domestic and int) providers starting to crop up at low rates. Use Asterisk to gateway to them. Prevent phone spam! Callers with no CID get ditched. Filter your phone lines. Allow or forward callers who are on “priority” lists based on ANI.
Practical Uses
Enterprise-quality SIP connection services are now available.
Interconnect office PBXs at zero network cost Get “Unified Messaging” Give ubiquitous access to the PBX for home/traveling employees Disaster recovery scenarios Move phones into your IT department and away from your expensive PBX consulting firm Eliminate adds/moves/changes as physical chores
Advanced Topics
Call queues - you can build a call center with Asterisk, with various call weightings and agent logins/hot seating
Multi-ring, cascading ring with different technologies (inbound calls forward to your desk line and your cell phone - first answer gets it)
Multi-language support with same dialplan
Festival integration for voice synthesis
Really Advanced Topics
Manager interface: TCP socket based interface for controlling and monitoring the system; meant for automated manager tools (see: gastman)
AGI scripts: built-in scriptable hooks to allow passing of data back and forth between Asterisk and external programs.
Asterisk.pm - Perl module that works with AGI to handle grunt work of call handling
Really Advanced Topics (cont)
Sybase and MySQL modules
CDR (call detail record) output can be customized or put into database instead of flat file
Use IAX2 trunk mode to get up to 200% more calls in the same bandwidth as other VoIP systems
Dynamically Route your calls to least-cost providers
Other Asterisk Applications
Can run PPP or HDLC over channels Asterisk can be a RAS server or a router
Can use speaker/microphone as a “phone line”
Video Calls or Conferencing
ENUM e.164 DNS-based call routing
Example: 2.1.2.1.2.5.4.3.0.5.1.e164.arpa.
TDM over ethernet for front-end processing
Asterisk Resources
http://www.asterisk.org/ - Latest Source Code
http://www.digium.com/ - Asterisk TDM hardware
http://www.voip-info.org/ - General VoIP How-To Info
http://www.xten.com/ - Softphone
http://www.asterisk-vonage.com/ - Asterisk to Vonage connectivity
http://www.binary-systems.com/ - Asterisk Consulting & Training Services