Real-time multimedia and communication in packet networks Asterisk The open source IP PBX Some House Rules • • • • Practical component of the course Workings and power of asterisk, an IP Private Branch eXchange (PBX) Small tutorials will be given on a daily basis before each lecture Large practical – write your own application that adds value to an Asterisk PBX • This will be demonstrated to the class at the end of the course. • Practical to be done on a Linux machine you can ssh into cc Some Admin You should have by now: - found your extension on pbx.ict.ru.ac.za - registered on iLanga your two phones (sj and hardphone) - explored the messaging between the two phones and the SIP proxy server in iLanga at least in these situations: 1. Registration 2. Call establishment with callee answering and without answer (voicemail) - checked the media stream in iLanga and discovered possible difference with respect to the case of calling directly an end point. What happens if you call a telephone registered with iLanga directly via its IP number? Some House Rules • • • • Practical component of the course Workings and power of asterisk, an IP Private Branch eXchange (PBX) Small tutorials will be given on a daily basis before each lecture Large practical – write your own application that adds value to an Asterisk PBX • This will be demonstrated to the class at the end of the course. • Practical to be done on a Linux machine you can ssh into cc What is Asterisk (*)? • A private or enterprise grade exchange generally referred to as a private branch exchange (PBX) • Designed to interface telephony hardware or software with any telephony application seamlessly and consistently • i.e. Asterisk can be moulded to fit any telephony application • Asterisk can be used in any of these applications • Heterogeneous Voice over IP gateway (MGCP, SIP, IAX, H.323) • Private Branch eXchange (PBX) • Custom Interactive Voice Response (IVR) server • Conferencing server • Softswitch? What is Asterisk (*)? • A private or enterprise grade exchange generally referred to as a private branch exchange (PBX) • Designed to interface telephony hardware or software with any telephony application seamlessly and consistently • i.e. Asterisk can be moulded to fit any telephony application • Asterisk can be used in any of these applications • Heterogeneous Voice over IP gateway (MGCP, SIP, IAX, H.323) • Private Branch eXchange (PBX) • Custom Interactive Voice Response (IVR) server • Conferencing server • Softswitch? What is Asterisk (*)? • A private or enterprise grade exchange generally referred to as a private branch exchange (PBX) • Designed to interface telephony hardware or software with any telephony application seamlessly and consistently • i.e. Asterisk can be moulded to fit any telephony application • Asterisk can be used in any of these applications • Heterogeneous Voice over IP gateway (MGCP, SIP, IAX, H.323) • Private Branch eXchange (PBX) • Custom Interactive Voice Response (IVR) server • Conferencing server • Softswitch? Asterisk – Supported Communication Technologies • Asterisk is designed to allow new interfaces and technologies to be added easily • Asterisk’s goal is to support every kind of telephony technology possible • Asterisk interfaces divided into 3: • Zaptel hardware • Non-Zaptel hardware • Packet voice Zaptel Hardware • Check out http://www.zapatatelephony.org/ • Provide integration with traditional and legacy analogue and digital telephone interfaces • Zaptel interfaces available from Digium (www.digiumcards.com) • Zaptel interfaces available for a number of telephony interfaces • ISDN Basic Rate Interface (BRI) • ISDN Primary Rate Interface (PRI) • Analog FXS interface – connect to a station i.e. analogue phone • Analog FXO interface – connect to an office i.e. PBX Zaptel Hardware Digium 4 x FXS card $342 USD Digium 2 x FXS, 2 x FXO card $360 USD Digium BRI card $469 USD Digium BRI card $1345 USD Packet Voice Protocols • Standard protocols for communication over packet networks • Only interfaces that do not require specialised hardware • E.g. • SIP • IAX • H.323 • IAX • MGCP Asterisk’s Architecture Modules and Applications • Asterisk’s core contains several engines that play a critical role in the software’s operation • At startup, Dynamic module loader loads various modules for: • Channel drivers • File formats • Codecs • Applications • Custom applications launcher i.e. the iLanga Prepaid Application • Asterisk’s switching core accepts calls from any of the various interfaces and routes them according to the dialplan • Codec translator permits channels which are compressed with different codecs to talk to each other • Scheduler and IO Manager which can be used by applications and drivers Asterisk’s Architecture • Modular API for Asterisk responsible for Asterisk’s success • Channel API, File Format API, Codec API, Application API Some Asterisk configurations (basic) • Asterisk box contains • 1 analog interface for telephone (FXS interface) • 1 analog interface to PSTN (FXO interface) • Ethernet interface for VoIP Some Asterisk configurations • Asterisk box contains • One E1 or (PRI) interface connected to a digital to analog converter or channel bank • 15 phones connected channel bank • 15 lines to PSTN (i.e. Telkom) Some Asterisk configurations • In this example we illustrate the possibility of distributing a number of Asterisk boxes • Each Asterisk box can be interconnected using • TDM technology e.g. BRI or PRI • Data technology/VoIP e.g. Inter Asterisk Exchange (IAX) Asterisk Filesystem Organisation • /etc/asterisk • Contains Asterisk configuration files – NB directory • /usr/sbin • Contains Asterisk binaries • /usr/lib/asterisk/modules • Contains runtime modules for channel drivers, codecs, file formats, applications • /usr/include/asterisk • Contains Asterisk C header files for the building the software • /var/lib/asterisk/agi-bin • Location of Asterisk Gateway Interface (AGI) for use in dialplan Asterisk Filesystem Organisation • /var/lib/asterisk/astdb • Asterisk internal database • Roughly equivalent to Windows registry • /var/lib/asterisk/mohmp3 • Storage directory mp3s – used for music on hold • /var/lib/asterisk/sounds • Storage directory for Asterisk audio files e.g. voice prompts to be used in IVR menus • /var/spool/asterisk/outgoing • Spooling directory for making outgoing calls • Can be used for callback function • /var/spool/asterisk/voicemail • Storage directory for Asterisk voicemail boxes, announcements, etc Asterisk Channels • Channel naming convention in Asterisk is standard • Outgoing channel names (used in Dial application) named in format: • <technology>/<dialstring> • <technology> represents type of interface you want to address or use • E.g. Zap, SIP, IAX2, etc • <dialstring> is a driver-specific string representing destination desired Asterisk Channels (Zap) • <technology>/<dialstring> • Zap / [g] <identifier> • <identifier> = number of the channel you are trying to address • If <identifier> prefixed by ‘g’ then number is interpreted as a group instead of as a channel • e.g. • Zap/g1/0027466223458 (Any available line in group 1) • Zap/1/0027466223458 (TDM channel 1) Asterisk Channels (SIP) • Outgoing channels typical of the form • SIP / [exten@] <domain> [:<portno>] • E.g. • SIP/mos • SIP:3000@sip.ict.ru.ac.za • SIP/3000@sip.ict.ru.ac.za:5060 Asterisk Channels (IAX) • IAX2 / [<user> [:<secret>] @] <domain> [:<portno>] [/<exten>[@<context>][/<options>]] • Where <user> and <secret> are optional username and secret to connect to the host identified by <peer> and • <portno> = optional port number, • <exten> = specific extension at an optional context <context>, and optionally with <options> connection options • E.g • IAX2/authname:secretpass@voiptalk.org/442081234567@default • Call to voiptalk.org using “authname” as username and “secretpass” as password, and requesting extension 442081234567 in default context Running Asterisk and Environment • Asterisk can be run in console mode or as a daemon process • E.g. asterisk –vvvgc (console mode with verbose=3 debugging • Asterisk (daemon) – started by typing asterisk • Please always run asterisk as daemon and connect to daemon process using: • asterisk –r • asterisk -vvvvvr • When connecting to daemon process you will be connected to the command line interface of Astrerisk (CLI) • vitalstatistix*CLI> Asterisk CLI • When connected to the Asterisk CLI there are a number of commands you can use • Go and test them out, see what they do, familiarise yourself with the environment • E.g. • ‘help’ • ‘show applications’ • ‘show application x’ • ‘show codecs' • ‘show translation' • ‘extensions reload’ • ‘sip reload’ • CLI include command completion via the tab key sip.conf • Please set your phones up to connect to your development box • Box • IP = 146.231.121.165 Create a sip.conf file in your home directory, you can use the reference http://www.voip-info.org/wiki/view/Asterisk+config+sip.conf Tomorrow’s Tutorial 1) Create an account for your phone 2) Play around with some of the settings in the sip.conf file