Presentation is loading. Please wait.

Presentation is loading. Please wait.

Asterisk in Three Beer’s Time Or Less Or: How I Stopped Worrying and Learned to Love The Dialtone © John Todd 2003-08-20

Similar presentations

Presentation on theme: "Asterisk in Three Beer’s Time Or Less Or: How I Stopped Worrying and Learned to Love The Dialtone © John Todd 2003-08-20"— Presentation transcript:

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

2 © 2003 John Todd ( What is Asterisk? (generally) 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.

3 © 2003 John Todd ( What is Asterisk? (details) Telephony gateway (TDM channels - PRI,POTS) VoIP Gateway (IP channels) IVR system (Interactive Voice Response) Voicemail system Scriptable telephony-to-anything (Perl, C, etc.) More than will fit on this slide

4 © 2003 John Todd ( What Asterisk isn’t A billing system A CRM system A web server or XML server (re: Cisco 79xx) A configuration tool for VoIP devices A voice recognition system A USENET or email client

5 © 2003 John Todd ( Goals of Asterisk 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 Sell TDM hardware cards for Digium

6 © 2003 John Todd ( 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

7 © 2003 John Todd ( WHAT?!? NON-GPL!?? JIHAD!! 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 do so Generally everyone is happy with this system Hold your flames until after I’m finished. :-)

8 © 2003 John Todd ( Channel types: VoIP SIP - Session Initiation Protocol H.323 MGCP - Media Gateway Control Protocol SCCP - Skinny Client Control Protocol (Cisco) All of these use UDP for setup/transport except for SCCP, which uses a mix of UDP/TCP

9 © 2003 John Todd ( Channel Types: VoIP (cont’d) Phones for VoIP (SIP):  Grandstream 102 - ~$85 new  Cisco ATA 186 - 2 lines of analog - ~$140 new  Cisco 7960/7940 - very nice deskphone - ~$300 used  Many others - market is starting to flood with new vendors from SE Asia Software for VoIP (SIP)  - free SIP client (“Lite”)  - Linux SIP client  Windows Messenger - don’t ask me, I don’t know how.

10 © 2003 John Todd ( Channel types - non-VoIP 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 (yuck) Speaker/headphones (don’t try this at home, kids)

11 © 2003 John Todd ( System Requirements No clear rule of thumb on processor size; at least 400mhz PIII recommended Almost any version of Linux supported; RH 7.x or 8 is dev platform (9 has tweak issues) Source + binaries (including sounds) are ~35m Using complex codecs (i.e.: G.729, speex, etc.) will increase processor load dramatically Best to have a >1.5ghz machine for multi-channel use Linux preferred, though *BSD slowly starting to become stable for non-hardware channels

12 © 2003 John Todd ( Gotchas Mpg123 needs to actually be mpg123, and not mpg321 (and located in /usr/bin/) You need to have matching kernel source installed correctly to compile Asterisk/Zaptel VoIP isn’t simple the first time you do it Asterisk documentation is less than adequate - mailing list and Google have better data

13 © 2003 John Todd ( 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 (argh! Like a horrible BASIC Frankenstein, without the flexibility! )

14 © 2003 John Todd ( 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]) Better regexp in the works Example: _1410985012X is the same as _1410985012[0-9]

15 © 2003 John Todd ( 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

16 © 2003 John Todd ( Redirection based on ANI You can match against calling number instead of called number. This is a.k.a. “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

17 © 2003 John Todd ( 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

18 © 2003 John Todd ( Variables ${VARNAME} is how variables are used Variables must be declared before Booleans can be performed (gah - no null value comparitor) 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”

19 © 2003 John Todd ( 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

20 © 2003 John Todd ( Some Applications 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) exten => 1234,1,Dial(SIP/1234,25) exten => 1234,2,Voicemail2(u1234)

21 © 2003 John Todd ( 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})

22 © 2003 John Todd ( Some Applications (cont’d) MeetMe(conf#)  Adds the caller to a conference room (optionally muted or unmuted) Monitor  Records channel (in and out) to.wav or.gsm files PrivacyManager  Forces anonymous calls to enter valid ANI

23 © 2003 John Todd ( Some Applications (cont’d) DISA  Lets callers from one channel get dialtone on another channel SetMusicOnHold  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.

24 © 2003 John Todd ( Some Applications (cont’d) There are over 80 different applications in the system - no time to talk about them all Applications are easily created and added if you’re a decent C coder Channels are generic, so you don’t have to know about any of the ugly VoIP or TDM stuff

25 © 2003 John Todd ( 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,.gsm file storage or email Dial by name directory hinges on VM data

26 © 2003 John Todd ( Practical Uses (home) 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.

27 © 2003 John Todd ( Practical Uses (office) Ditch your LD company (see prior slide) Interconnect office PBXs at zero network cost Get “Unified Messaging” Give ubiquitous access to the PBX for home/travelling 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

28 © 2003 John Todd ( 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

29 © 2003 John Todd ( 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. - Perl module that works with AGI to handle gruntwork of call handling

30 © 2003 John Todd ( Really Advanced Topics(cont’d) 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 Route your calls to least-cost providers

31 © 2003 John Todd ( Crazy Extra Stuff That Didn’t Fit Can run PPP or HDLC over channels - Asterisk can be a RAS server or a router (masochism) Can use speaker/microphone as a “phone line” Can do video calls or conferencing ENUM e.164 DNS-based call routing  E.G. TDM over ethernet for front-end processing

32 © 2003 John Todd ( Resources and Wrap-Up John Todd - Asterisk Gun For Hire PLUG Advanced Topics 2003-08-20

Download ppt "Asterisk in Three Beer’s Time Or Less Or: How I Stopped Worrying and Learned to Love The Dialtone © John Todd 2003-08-20"

Similar presentations

Ads by Google