590 likes | 849 Views
Asterisk PBX. PSTN to VoIP and never back again Tomas Florian. Intro. IT Consulting: florien.ca Linux / Windows interoperation Application development High availability hosting Working with Asterisk for the last year in small office environments
E N D
Asterisk PBX PSTN to VoIP and never back again Tomas Florian
Intro • IT Consulting: florien.ca • Linux / Windows interoperation • Application development • High availability hosting • Working with Asterisk for the last year in small office environments • Beta stage of Asterisk based solution for communication company launching service between Canada and India.
Summary • VoIP (the big picture) • Asterisk • Architecture • Channels • Example • Dialplans • Getting Started • Questions
The Big Picture Some Telco stuff ?? Good old internet
PSTN and the Internet Asterisk
“Hard wired” Expensive Proprietary Local Plain Old Reliability Cell phone service 911 compatibility Flexible Cost effective Open World wide Bleeding edge Not yet “Hello Calgary … I’m in Tokyo and I need help” PSTN vs. VoIP
Flexibility • Branch offices / Virtual Offices • Telecommuting • Automated agents • Custom applications • Press 1 to have your new emails read to you • Today’s weather forecast • Games • … “just” another interface to the web (audio)
Summary • VoIP (the big picture) • Asterisk • Architecture
Asterisk • Open Source • Created by Mark Spencer (1.0 in 2004) • Sponsored by Digium (Hardware) • Minimum requirements • Linux / FreeBSD • Pentium 300 MHz • 128 MB RAM • 600 MB Disk
Asterisk • * … good name choice • Connector between all kinds of audio protocols and technologies • PSTN • SIP/RTP • IAX • H323 (Netmeeting) • …
Applications File formats Codecs Channels Architecture *
Paging VM … … G.723.1 WAV GSM MP3 PSTN … SIP Architecture *
Summary • VoIP (the big picture) • Asterisk • Architecture • Channels
Channels ZAP Asterisk SIP, IAX, H323
SIP: Session Initiation Protocol • VoIP favorite • Wide hardware and software phone support • Hardware phones • Example: BT100 • Hardware adapters • PAP2 • Software phones • X-Lite
Invite OK ACK BYE OK SIP : Introduction UA - Caller UA - Callee • Port 5060 UDP • Human Readable Text (similar to HTTP)
Invite OK ACK RTP • RTP (Real-time Transport Protocol) • Separate UDP stream (media path) • Sends voice data SIP : Introduction Caller Callee
Register Register SIP Proxy and Registrar
Invite Invite SIP Proxy and Registrar
Other VoIP Channels • IAX (Inter Asterisk eXchange) • H323 (Netmeeting)
Channels ZAP Asterisk SIP, IAX, H323
ZAP: Interface to the PSTN • Reuse existing PSTN infrastructure • Downstream from Telco • lines from Telco terminating at Asterisk • FXO • Be the Telco • lines from Asterisk going to existing phone sets • FXS • Digium TDM400, X100P (fancy voice modem)
Summary • VoIP (the big picture) • Asterisk • Architecture • Channels • Example
The Office • SIP interface • Ethernet (LAN): IP 192.168.0.10 • VoIP phones on a switch • Each phone needs IP (assigned by DHCP)
PSTN • ZAP interface • 1 Line: 222-1234 • FXO interface card X100P • Plug in the physical line • One conversation per line • More lines needed for real-life scenario
The Internet • WAN interface instead of LAN • Server - Routable IP 139.142.2.2 • The phones (clients) may be behind their own firewall or NAT but as longas they can contact the server
Summary • VoIP (the big picture) • Asterisk • Architecture • Channels • Example • Dialplans
Dialplans • The glue that holds everything together • Scripting language • Matches extension and launches a certain application • Example 1234,1,Dial(SIP/1234) Application Arguments Extension Priority
Dialplans • Priorities 1234,1,Dial(ZAP/2|15) 1234,2,Voicemail(u1234) • Patterns _9XXXXXXX,1,Dial(Zap/2) • Variables _123XXXX,1,Dial(SIP/{$EXTEN})
Dialplans • Contexts • Security mechanism • Channel • Time of day • Example [from-local] _9XXXXXXX,1,Dial(Zap/1) [from-untrusted] _91234444,1,Dial(Zap/2) • Logical code blocks … include, etc.
Dialplans • Arithmetic • If,Else,Goto • Time of day • Macros
Applications • Answer • DBget / DBput • Festival • MP3Player • Queue • Record • Meetme • System
Digging Deeper • /etc/asterisk • sip.conf • extensions.conf • zapata.conf • … • Asterisk CLI • ethereal • ngrep
Summary • VoIP (the big picture) • Asterisk • Architecture • Channels • Example • Dialplans • Getting Started
Getting startedAsterisk@Home • Asterisk • AMP • Meetme • Music on hold • Flash panel • Call logs • Sugar CRM • Home automation • Wipes your HD!
Resources • asterisk.org (home) • voip-info.org (wiki) • asterisk-users@lists.digium.com (mailing list) • digium.com (asterisk creators – hardware) • E-bay (hardware) • Books • VoIP Telephony with Asterisk (Paul Mahler) • Asterisk: The Future of Telephony (online) • florien.ca (paid support)
NAT : SIP/RTP • Opening ports (ugly) • 5060 UDP • 10000 – 20000 UDP • Hard code external IP • STUN (elegant but not 100% reliable) • Detects external IP • Detects external port • Keep alive • Media Proxy • Send all voice through Asterisk
NAT: IAX2 • NAT problems? What NAT problems? • Single UDP port • High performance, low overhead • … • Lack of hardware support • DIAX • Digium Iaxy
Codecs • G.711 (ulaw/alaw) • 64 Kbps • G.726 (half rate G.711) • 32 Kbps • GSM (Cell phone codec) • 12 Kbps • G.723.1 (also in Netmeeting) • 6.3 or 5.3 Kbps • Many others …
Other Platforms • SipXpbx • SER (SIP Express Router) • Vocal