available on the web.


Published on

  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

available on the web.

  1. 1. Asterisk in Three Beer’s Time Or Less Or: How I Stopped Worrying and Learned to Love The Dialtone © John Todd 2003-08-20 [email_address]
  2. 2. What is Asterisk? (generally) <ul><li>Asterisk is a PBX replacement system, designed to reproduce the features of standard office phone systems. Asterisk is also a Voice over IP toolkit which allows interaction between these PBX features and IP-based networks (local and remote.) Asterisk is hardware independent, and is designed to run on OSS operating systems. </li></ul>
  3. 3. What is Asterisk? (details) <ul><li>Telephony gateway (TDM channels - PRI,POTS) </li></ul><ul><li>VoIP Gateway (IP channels) </li></ul><ul><li>IVR system (Interactive Voice Response) </li></ul><ul><li>Voicemail system </li></ul><ul><li>Scriptable telephony-to-anything (Perl, C, etc.) </li></ul><ul><li>More than will fit on this slide </li></ul>
  4. 4. What Asterisk isn’t <ul><li>A billing system </li></ul><ul><li>A CRM system </li></ul><ul><li>A web server or XML server (re: Cisco 79xx) </li></ul><ul><li>A configuration tool for VoIP devices </li></ul><ul><li>A voice recognition system </li></ul><ul><li>A USENET or email client </li></ul>
  5. 5. Goals of Asterisk <ul><li>Provide Open-Source implementations of basic PBX functionality </li></ul><ul><li>Be vendor neutral (despite last point here) </li></ul><ul><li>Be as all-encompassing as possible for features </li></ul><ul><li>Be flexible and provide hooks for advanced features </li></ul><ul><li>Move proprietary hardware features into open source software </li></ul><ul><li>Sell TDM hardware cards for Digium </li></ul>
  6. 6. Who is Digium? <ul><li>Primary supporter of Asterisk development </li></ul><ul><li>Owner of the CVS server/bug system/mailing list boxes/etc. </li></ul><ul><li>Approves all patches and features by community </li></ul><ul><li>Produces TDM cards (“Wildcard” hardware) which works particularly well with Asterisk </li></ul><ul><li>Owner of the disclaimers for all contributions to Asterisk, holder of copyright </li></ul>
  7. 7. WHAT?!? NON-GPL!?? JIHAD!! <ul><li>Asterisk is GPL, but with an important clause </li></ul><ul><li>Digium can license branches of the source such that those branches are not GPL </li></ul><ul><li>Digium gets disclaimers from all contributors saying that Digium can do so </li></ul><ul><li>Generally everyone is happy with this system </li></ul><ul><li>Hold your flames until after I’m finished. :-) </li></ul>
  8. 8. Channel types: VoIP <ul><li>SIP - Session Initiation Protocol </li></ul><ul><li>H.323 </li></ul><ul><li>MGCP - Media Gateway Control Protocol </li></ul><ul><li>SCCP - Skinny Client Control Protocol (Cisco) </li></ul><ul><li>All of these use UDP for setup/transport except for SCCP, which uses a mix of UDP/TCP </li></ul>
  9. 9. Channel Types: VoIP (cont’d) <ul><li>Phones for VoIP (SIP): </li></ul><ul><ul><li>Grandstream 102 - ~$85 new </li></ul></ul><ul><ul><li>Cisco ATA 186 - 2 lines of analog - ~$140 new </li></ul></ul><ul><ul><li>Cisco 7960/7940 - very nice deskphone - ~$300 used </li></ul></ul><ul><ul><li>Many others - market is starting to flood with new vendors from SE Asia </li></ul></ul><ul><li>Software for VoIP (SIP) </li></ul><ul><ul><li>www.xten.com - free SIP client (“Lite”) </li></ul></ul><ul><ul><li>gnophone.com - Linux SIP client </li></ul></ul><ul><ul><li>Windows Messenger - don’t ask me, I don’t know how. </li></ul></ul>
  10. 10. Channel types - non-VoIP <ul><li>TDM POTS cards (Digium, Zapata, Voicetronix, etc.) </li></ul><ul><li>TDM Digital (AdTran VoFR, Digium E1/T1, etc.) </li></ul><ul><li>All TDM cards require install of Zaptel driver suite </li></ul><ul><li>CAPI (ISDN card support for Linux ISDN driver) </li></ul><ul><li>USB dongle for FXS </li></ul><ul><li>Modem drivers for certain modems (yuck) </li></ul><ul><li>Speaker/headphones (don’t try this at home, kids) </li></ul>
  11. 11. System Requirements <ul><li>No clear rule of thumb on processor size; at least 400mhz PIII recommended </li></ul><ul><li>Almost any version of Linux supported; RH 7.x or 8 is dev platform (9 has tweak issues) </li></ul><ul><li>Source + binaries (including sounds) are ~35m </li></ul><ul><li>Using complex codecs (i.e.: G.729, speex, etc.) will increase processor load dramatically </li></ul><ul><li>Best to have a >1.5ghz machine for multi-channel use </li></ul><ul><li>Linux preferred, though *BSD slowly starting to become stable for non-hardware channels </li></ul>
  12. 12. Gotchas <ul><li>Mpg123 needs to actually be mpg123, and not mpg321 (and located in /usr/bin/) </li></ul><ul><li>You need to have matching kernel source installed correctly to compile Asterisk/Zaptel </li></ul><ul><li>VoIP isn’t simple the first time you do it </li></ul><ul><li>Asterisk documentation is less than adequate - mailing list and Google have better data </li></ul>
  13. 13. Call Flow (briefly) <ul><li>Calls come in on channels and are then handed to the “extensions.conf” file, which is the dialplan </li></ul><ul><li>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 </li></ul><ul><li>The dialplan then matches (with modified regexp’s) the number being dialed , and runs applications accordingly </li></ul><ul><li>Each match on the dialed number has an order of steps called ‘Priorities’, and are indicated with an integral incrementing number (argh! Like a horrible BASIC Frankenstein, without the flexibility! ) </li></ul>
  14. 14. Regular expressions (briefly) <ul><li>All regular expressions start with “_” character in dial examinations. </li></ul><ul><li>“ X” means any number, “N” is any number other than 0 or 1 </li></ul><ul><li>“ .” means any number of characters </li></ul><ul><li>Brackets represent groups, with standard “-” and “,” meanings ([1-9] or [0,1,2]) </li></ul><ul><li>Better regexp in the works </li></ul><ul><li>Example: _1410985012X is the same as _1410985012[0-9] </li></ul>
  15. 15. Call Flow (cont’d) <ul><li>[from-my-pri] </li></ul><ul><li>exten => 14109850123,1,Answer </li></ul><ul><li>exten => 14109850123,2,Wait(2) </li></ul><ul><li>exten => 14109850123,3,Playback(monkeys) </li></ul><ul><li>exten => 14109850123,4,Goto(more-monkeys,123,1) </li></ul><ul><li>[more-monkeys] </li></ul><ul><li>exten => _12X,1,Playback(sorry-no-more-monkeys) </li></ul><ul><li>exten => _12X,2,Hangup </li></ul>
  16. 16. Redirection based on ANI <ul><li>You can match against calling number instead of called number. </li></ul><ul><li>This is a.k.a. “The ex-girlfriend filter” by the inventor of the routines </li></ul><ul><li>This pattern matches against called number (1410…) and also against calling numer (301…) </li></ul><ul><ul><li>exten => 14109850123/3013659999,1,Busy </li></ul></ul>
  17. 17. Redirection of Call Flow <ul><li>GotoIf - can parse basic Booleans </li></ul><ul><li>GotoIfTime - handy way to deal with time-based redirection </li></ul><ul><li>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) </li></ul><ul><li>Any other type of errors result in channel hangup </li></ul>
  18. 18. Variables <ul><li>${VARNAME} is how variables are used </li></ul><ul><li>Variables must be declared before Booleans can be performed (gah - no null value comparitor) </li></ul><ul><li>Variables can be nested during setting </li></ul><ul><ul><li>Exten => 123,1,SetVar(BAR=blah) </li></ul></ul><ul><ul><li>Exten => 123,2,SetVar(FOO=3) </li></ul></ul><ul><ul><li>Exten => 123,3,SetVar(NEWVAR.${FOO} = ${BAR}) </li></ul></ul><ul><ul><li>This results in ${NEWVAR.3} being set to “blah” </li></ul></ul>
  19. 19. Special Variables <ul><li>${EXTEN} - always the most important variable. This is the number that is being currently evaluated. </li></ul><ul><li>${CALLERIDNUM} - the ANI (if available) of the call leg that is creating the call </li></ul><ul><li>Some others, less used: ${EPOCH}, ${ENV(var)}, ${CONTEXT}, ${PRIORITY}, several other descriptors of the call leg we’re processing </li></ul>
  20. 20. Some Applications <ul><li>Dial - connects an inbound call with some other channel. One specifies the technology (SIP, Zap, H323, etc.) the number to be dialed, the Ring-No-Answer delay, and options (if desired) </li></ul><ul><li>exten => 1234,1,Dial(SIP/1234,25) </li></ul><ul><li>exten => 1234,2,Voicemail2(u1234) </li></ul>
  21. 21. Some Applications (cont’d) <ul><li>Playback(filename) </li></ul><ul><ul><li>Plays a sound file in .gsm format </li></ul></ul><ul><li>Background(filename) </li></ul><ul><ul><li>Plays a sound file while listening for DTMF (touch tone) input </li></ul></ul><ul><li>[test] </li></ul><ul><li>exten => 123,1,Background(press-a-number) </li></ul><ul><li>exten => 123,2,Goto(1) </li></ul><ul><li>exten => _X,1,SayDigits(${EXTEN}) </li></ul>
  22. 22. Some Applications (cont’d) <ul><li>MeetMe(conf#) </li></ul><ul><ul><li>Adds the caller to a conference room (optionally muted or unmuted) </li></ul></ul><ul><li>Monitor </li></ul><ul><ul><li>Records channel (in and out) to .wav or .gsm files </li></ul></ul><ul><li>PrivacyManager </li></ul><ul><ul><li>Forces anonymous calls to enter valid ANI </li></ul></ul>
  23. 23. Some Applications (cont’d) <ul><li>DISA </li></ul><ul><ul><li>Lets callers from one channel get dialtone on another channel </li></ul></ul><ul><li>SetMusicOnHold </li></ul><ul><ul><li>You can specify .mp3 files as music on hold selections (random or sequential) </li></ul></ul><ul><li>MP3Player </li></ul><ul><ul><li>Fairly useless, but fun. You can specify files or streams of .mp3 to be played to callers. </li></ul></ul>
  24. 24. Some Applications (cont’d) <ul><li>There are over 80 different applications in the system - no time to talk about them all </li></ul><ul><li>Applications are easily created and added if you’re a decent C coder </li></ul><ul><li>Channels are generic, so you don’t have to know about any of the ugly VoIP or TDM stuff </li></ul>
  25. 25. Voicemail <ul><li>Voicemail can be sent as email as well as stored on disk (1 minute = 100kb) </li></ul><ul><li>Short pages can be sent to email addresses when VM received </li></ul><ul><li>Customizable timezones and time readouts per user - supports multiple languages </li></ul><ul><li>.wav, .gsm file storage or email </li></ul><ul><li>Dial by name directory hinges on VM data </li></ul>
  26. 26. Practical Uses (home) <ul><li>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. </li></ul><ul><li>Prevent phone spam! Callers with no CID get ditched. </li></ul><ul><li>Filter your phone lines. Allow or forward callers who are on “priority” lists based on ANI. </li></ul>
  27. 27. Practical Uses (office) <ul><li>Ditch your LD company (see prior slide) </li></ul><ul><li>Interconnect office PBXs at zero network cost </li></ul><ul><li>Get “Unified Messaging” </li></ul><ul><li>Give ubiquitous access to the PBX for home/travelling employees </li></ul><ul><li>Disaster recovery scenarios </li></ul><ul><li>Move phones into your IT department and away from your expensive PBX consulting firm </li></ul><ul><li>Eliminate adds/moves/changes as physical chores </li></ul>
  28. 28. Advanced Topics <ul><li>Call queues - you can build a call center with Asterisk, with various call weightings and agent logins/hot seating </li></ul><ul><li>Multi-ring, cascading ring with different technologies (inbound calls forward to your desk line and your cell phone - first answer gets it) </li></ul><ul><li>Multi-language support with same dialplan </li></ul><ul><li>Festival integration for voice synthesis </li></ul>
  29. 29. Really Advanced Topics <ul><li>Manager interface: TCP socket based interface for controlling and monitoring the system; meant for automated manager tools (see: gastman) </li></ul><ul><li>AGI scripts: built-in scriptable hooks to allow passing of data back and forth between Asterisk and external programs. </li></ul><ul><li>Asterisk.pm - Perl module that works with AGI to handle gruntwork of call handling </li></ul>
  30. 30. Really Advanced Topics(cont’d) <ul><li>Sybase and MySQL modules </li></ul><ul><li>CDR (call detail record) output can be customized or put into database instead of flat file </li></ul><ul><li>Use IAX2 trunk mode to get up to 200% more calls in the same bandwidth as other VoIP systems </li></ul><ul><li>Route your calls to least-cost providers </li></ul>
  31. 31. Crazy Extra Stuff That Didn’t Fit <ul><li>Can run PPP or HDLC over channels - Asterisk can be a RAS server or a router (masochism) </li></ul><ul><li>Can use speaker/microphone as a “phone line” </li></ul><ul><li>Can do video calls or conferencing </li></ul><ul><li>ENUM e.164 DNS-based call routing </li></ul><ul><ul><li>E.G. </li></ul></ul><ul><li>TDM over ethernet for front-end processing </li></ul>
  32. 32. Resources and Wrap-Up <ul><li>http://www.asterisk.org/ </li></ul><ul><li>http://www.digium.com/ </li></ul><ul><li>http://www.loligo.com/asterisk/ </li></ul><ul><li>http://www.wwworks-inc.com/asterisk/ </li></ul><ul><li>http://www.xten.com/ </li></ul><ul><li>http://www.onlamp.com/pub/a/onlamp/2003/07/03/asterisk.html </li></ul><ul><li>John Todd - jtodd@loligo.com </li></ul><ul><li>Asterisk Gun For Hire </li></ul><ul><li>PLUG Advanced Topics 2003-08-20 </li></ul>
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.