It's only software. Mark Spencer
Terminology Channel or Circuit 1 standard voice channel is 64kbit/s Like a TV channel, or IRC channel Line Trunk Extension Private Branch Exchange (PBX) Exchange Direct Inward Dialling (DID US) or Direct Dial-In (DDI everywhere else) Dual-Tone Multi-Frequence (DTMF)
How does the phone network work?
Protocols Analogue (1 pair = 1 call) Single pair of copper wire Digital BRI and PRI (both use ISDN) from 2 to 24 or 30 simultaneous calls VoIP Protocols SIP and IAX (can use Skype, but have to pay for licence)
SIP Debug Message <--- SIP read from UDP://202.180.76.166:5060 ---> INVITE sip:028896222@202.89.80.2 SIP/2.0 Via: SIP/2.0/UDP 202.180.76.166:5060;branch=z9hG4bK7095403d;rport From: "0212742117" <sip:0212742117@202.180.76.166>;tag=as43f544b8 To: <sip:028896222@202.89.80.2> Contact: <sip:0212742117@202.180.76.166> Call-ID: 2d460cf70cf29bc1240be339376aac3f@202.180.76.166 CSeq: 102 INVITE User-Agent: 2talk PBX Max-Forwards: 70 Date: Tue, 19 May 2009 05:42:50 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY Supported: replaces Content-Type: application/sdp Content-Length: 410
Devices Soft Phones Hardware Traditional Telephones (need special hardware) Snom (really expensive phones running linux) Linksys (good phones at decent price) Misc. other manufacturers
What does a PBX look like?
Krone Block
What is Asterisk? PBX Tool kit Allows bridging for all sorts of different technologies Covers different protocols, codecs, and hardware interfaces
APIs Loadable Modules Channel (SIP vs. IAX vs. ISDN etc.) Applications (Voicemail, Dialing, Conferencing etc.) Codec Translation (gsm, µ-law, mp3, etc.) File Format (csv and others). Core PBX Switching Connects callers arriving on various hardware/software interfaces Application Launcher Launches applications for users Codec translator Uses codec modules for different audio compression formats Scheduler and I/O management Low level system management
Asterisk Console Allows dynamic interaction with Asterisk Make sure asterisk is started /etc/init.d/asterisk start Connect to asterisk asterisk -r ctrl-c to exit core show application dial gives information about the dial application
Asterisk s Config files Comments start with ; and not # Located under /etc/asterisk sip.conf Sip account setup iax.conf Iax accounts extensions.conf Dialplan rules features.conf Things such as call parking, call transfer mostly used for analogue phones without those buttons etc., all are well commented
Asterisk Sounds Located in /var/lib/asterisk/sounds Voicemail Digits time (am, pm, oclock) day (today, yesterday, tomorrow) numbers (0 to 9, 10 to 20, thousand, etc.) Testing tt-monkeys, etc.
Asterisk Dialplan Heart of the system. Where call routing is determined.
Simple Dialplan Example [internal] exten => 600,1,Answer() exten => 600,n,Background(demo-echotest) exten => 600,n,Echo() exten => _00X.,1,Answer() exten => _00X.,n,Goto(international,${EXTEN},1) exten => _0[123456789]X.,1,Goto(national,0064${EXTEN:1},1) exten => _4X.,1,Goto(local,00643${EXTEN},1) exten => 100,1,Dial(SIP/paul) exten => 999,1,Dial(IAX2/<provider>/0800000000); If changing the dialplan, don't forget to do a dialplan reload special extensions: i : Invalid s : Start h : Hangup t : Timeout
Dialplan Features Variables [globals], ${EXTEN} Pattern Matching (X,Z,N,.,[15-7]) Matches most specific rule Includes Expressions $[${COUNT} + 1] Normal Operators Conditional Branching Gotoif, Gotoiftime Voicemail Macros AstDB/MySQL/Postgres etc.
Codecs µlaw (64Kbps) alaw (64Kbps) g729 (8Kbps) to terminate need a licence gsm (15Kbps) same codec in cell phones ilbc (15Kbps) speex (24.6Kbps) http://www.hawksoft.com/hawkvoice/codecs.shtml
Codec Translations
QoS Echo Use echo cancelling cards Avoid the PSTN VoIP shares internet connection with Data network can cause quality problem Can seperate data and voice Can prioritise traffic
Other Features Bluetooth DUNDi p2p system for resolving phone numbers Jabber Manager Interface AGI/Dead-AGI Queues/Agents LDAP CDR Call Files --- demo
Security IAX SIP Authentication by plain text, md5, and RSA No media path encryption Challenge response, md5(nonce + password) Problems with NAT Can still get hacks with traditional telephony Wire tapping Blue box Red box Caller ID Spoofing Set(CALLERID(all)=Hello World<1234567>)
Front ends to Asterisk FreePBX Elastix Trixbox
Resources asterisk.org digium.com Asterisk: The Future of Telephony Full text available as a PDF Voip-info wiki mailing lists #asterisk on irc.freenode.net