VoIP Study and ImplementationVoIP – Study and Implementation Labs Objectives Implementing a complete VoIP solution using Asterisk Version 0.9b Last update: 24/02/2011 Use: internal Authors: M. PYBOURDIN - C. BORCKE VoIP Study and Implementation Labs Index 1. 2. 3. ABOUT THIS DOCUMENT ...........................................................................................................................................3 CASE PRESENTATION .................................................................................................................................................4 IMPLEMENTING THE SOLUTION .................................................................................................................................5 3.1. 3.2. 3.3. 3.4. 3.5. 3.6. 3.7. 3.8. 4. STEP 1.1 – PREPARING THE VIRTUAL MACHINE ..................................................................................................................... 5 STEP 1.2 – DAHDI INSTALLATION ...................................................................................................................................... 5 STEP 1.3: DAHDI CONFIGURATION .................................................................................................................................... 6 STEP 1.4 – LIBPRI COMPILATION......................................................................................................................................... 6 STEP 1.5 – ASTERISK COMPILATION .................................................................................................................................... 7 STEP 1.6 – CREATING A SIMPLE DIALPLAN ........................................................................................................................... 7 STEP 1.7 – IMPLEMENTING THE TOULOUSE IPBX .................................................................................................................. 8 STEP 1.8 – TESTING THE SOLUTION..................................................................................................................................... 9 ADVANCED CONFIGURATION .................................................................................................................................. 10 4.1. 4.2. 4.3. 4.4. 4.5. 4.6. 4.7. 4.8. 4.9. 4.10. 4.11. STEP 2.1 – AUDIO CONFERENCE....................................................................................................................................... 10 STEP 2.2 - VOICEMAIL.................................................................................................................................................... 10 STEP 2.3 – SPEAKING CLOCK ........................................................................................................................................... 12 STEP 2.4 - INTERACTIVE MENU......................................................................................................................................... 12 STEP 2.5 – CALL FORWARD ............................................................................................................................................. 13 STEP 2.6 – QOS CONFIGURATION .................................................................................................................................... 14 STEP 2.7 - LOGGING ...................................................................................................................................................... 14 STEP 2.8 - AUTOMATION................................................................................................................................................ 15 STEP 2.9 – TIME TO GO ONLINE ....................................................................................................................................... 15 STEP 2.10 – UNIFIED COMMUNICATION .......................................................................................................................... 17 STEP 2.11 - MONITORING ............................................................................................................................................ 18 Page 2 / 19 9a: Initial version 0. About this document This document contains the two activities for the SUPINFO VoIP Course taught to the M1 Students.VoIP Study and Implementation Labs 1. Document versioning: 0.9b: Minor correction Page 3 / 19 . The scenario of this course is as below : Core Knowledge – VoIP Ecosystem and Strategy (2 hours) Core Knowledge – Asterisk Overview (2 hours) Labs – Part 1 – Implementing an Asterisk Solution (6 hours) Core Knowledge – Quality of Service (2 hours) Labs – Part 2 – Advanced configuration (8 hours) Those labs are built upon a case study which aims at being as close as possible as professional context. VoIP Study and Implementation Labs 2. France . Here is below his feedback: Employees need to be directly reachable from the outside. employees must be able to call themselves and be able to forward incoming calls.An office in Toulouse. Indeed. To improve the infrastructure. France Those sites are linked thanks to a Site-To-Site VPN provided through a DSL line with QoS enabled. You decide to sort all the needs in three categories according to their importance: Page 4 / 19 . the actual solution is made with a old PABX installed in the 90’s with very limited features : Only the boss of the company has a direct line No answering machine features Users cannot put a call on hold Users have to user their own solutions for conferencing Also. Your company owns 10 phone number from 0140700500 to 0140700509 First you ask your intern to conduct a study on the users request. Many users complained about the company phone services. you boss ask you to conduct a study on the PABX migration to a « Full-IP » solution.Its main office in Paris. This company has several office including : . Case presentation You work as an IT Manager for a 9 employees service company. your IT Budget is impacted by the cost of the phone services and the maintenance contract from the PABX provider. Of course. A main number must redirect to the boss assistant phone Call must be able to be placed on hold An audio conference solution must be implemented. Existing numbers must be transferred from the previous operator Employees need to have their personal voicemail box. Sites being separated. this solution must have a cheap infrastructure cost and be as flexible as possible. Calls must be made from phones but also from Mac OS X or Microsoft Windows Computers. 3. …) in a full VoIP server ! Since its features meet your requirements. A main number must redirect to the boss assistant phone Call must be able to be placed on hold An audio conference solution must be implemented. Sites being separed.1. Download the virtual machine located on ftp-ssc. employees must be able to call themselves and be able to forward incoming calls.VoIP Study and Implementation Labs Feature Employees need to be directly reachable from the outside. Vital X Important Minor X X X X X X X Technical considerations During your search for a technical solution. . In order not to saturate your DSL line. you decide to prepare a demonstration of the solution for the company on a virtual Machine. Debian. Is it also mandatory for MeetMe conferences and IAX trunking. CentOS. Step 1. Implementing the solution 3. Page 5 / 19 .2 – DAHDI installation Why do we have to install DAHDI on our system ? We have to install DAHDI on our system because we need to provide to Asterisk the interface that allow communication between hardware telephony cards and the software(here Asterisk). Note : . Step 1.supinfo.2.All the resources for this workshop are available on the virtual machine in /usr/src.com and configure it so the network adapter is set to “Bridged” and that the virtual machine IP is set to dynamic. Calls must be made from phones but also from Mac OS X or MS Windows Computers. you discover the Asterisk solution which is a open source and free software transforming your Linux server (Gentoo. Existing numbers must be transfered from the previous operator Employees need to have their personal voicemail box. you decide to set on IPBX per office and link them with the IAX protocol. 3.login/passwords of the machine : root/Supinf0 supinfo/P@ssw0rd We’ll start by implementing the IPBX which will be located in Paris.1 – Preparing the virtual Machine First you need download the virtual machine and to check that your physical computer can dialog with it. VoIP Study and Implementation Labs Indicate the different steps to install DAHDI on your system : cd /usr/src/dahdi-linux-complete-2.11.4.4. even if you don’t use PRI telephony cards. Step 1. Indicate the different steps to compile the libpri on your system : cd /usr/src/libpri-1.3. Without the libpri.0+2.0/ make all make install make config 3.4.3: DAHDI configuration Indicate the different steps to configure DAHDI on your system : cd /etc/dahdi ls -l # Explore files in this directory and watch the comments to understand the purpose of each file.4.5/ make all make install Page 6 / 19 . 3.4 – libpri compilation What is the libpri used for ? Libpri is mandatory for Asterisk. Step 1. you won’t be able to compile Asterisk. The Asterisk server will listen on all the interfaces on the port 5060 .Overlap dialing is not allowed Which file has to be modified ? /etc/asterisk/sip./configure make make install make samples Your IPBX is now install and ready to go ! Now. Step 1.The default context is « internal_calls » .The DMTF code is the one from the rfc2833 RFC .VoIP Study and Implementation Labs 3.6.conf Which are the modifications to do ? In the [general] section: context=internal_calls port=5060 disallow = all allow = ulaw dtmfmode = rfc2833 allowoverlap=no Create two extensions with the following parameters : Username: 500 Password : 1234 The extension is not NATed The extension can be qualified by default (60 seconds) The host has a dynamic address The RTP flow is redirected from the caller to the receiver Username: 501 Password : 4321 Page 7 / 19 .You will just allow the ulaw codec for the communications .5 – Asterisk compilation Indicate the different steps to compile Asterisk and Asterisk modules on your system : cd /usr/src/asterisk-1.6 – Creating a simple DialPlan Modify the general context so : . 3.8. Step 1.5. let’s start the configuration in order to meet the employees requests.3-rc3 . Dial(SIP/500.VoIP Study and Implementation Labs The extension is not NATed The extension can be qualified by default (60 seconds) The host has a dynamic address The RTP flow is redirected from the caller to the receiver Create a context for internal calls with the following parameters: Name of the context : « internal_calls » A call to the 500 extension make the 500 extension ring A call to the 501 extension make the 501 extension ring After 20 seconds.Dial(SIP/${EXTEN}.2. Step 1. If you decide to work alone.20) exten => _5XX.2.conf : [internal_calls] exten => 500. the call is considered as failed. The architecture of the network is considered as below : Page 8 / 19 . setting the network interfaces to NAT is a good option.2. you prepare a second virtual Machine to act as the Toulouse site IPBX. you have two possibilites: Make a clone of the first machine Start a second virtual Machine on your computer or work in team with another student.1. Indicated the modifications you have to do to meet those requirements: Dans /etc/asterisk/users.7 – Implementing the Toulouse IPBX Note : At this moment of the lab.1.Hangup() exten => 501.1.7.Hangup() 3.conf : [500] type=friend secret=1234 nat=no qualify=yes host=dynamic context=internal_calls canreinvite=yes [501] type=friend secret=4321 nat=no qualify=yes host=dynamic context=internal_calls canreinvite=yes Dans /etc/asterisk/extensions.Dial(SIP/501.20) exten => 501.20) exten => 500. To prepare your demonstration.Hangup() exten => _5XX. conf : exten => _6XX. username = paris ou toulouse [USERNAME-LOCAL] type=peer host=dynamic trunk=yes secret=1234 context=internal_calls qualify=yes In sip-paris machine : extensions. Modify the dialplan to meet those requirements and set the two servers so Paris users and Toulouse users can call themselves.conf : exten => _5XX.Dial(IAX2/USERNAME-LOCAL/${EXTEN}) Page 9 / 19 . What do you need to configure to do so ? In both machines in iax.VoIP Study and Implementation Labs To interconnect your two. you decide to use the IAX protocol.Dial(IAX2/USERNAME-LOCAL/${EXTEN}) In sip-toulouse machine : extensions.1.conf : [general] autokill=yes register => USERNAME-LOCAL:1234@IP-MACHINE-DISTANTE #Ici. The extensions of the new site will start with the number 6.1. 8 – Testing the solution On each physical machine.8. Step 1.VoIP Study and Implementation Labs 3. Page 9 / 19 . configure your favorite SIP Clients to connect if to one of the server and try to make a call. 1. Modifications must be applied on both IPBX. Step 2.conf Which are the modifications to do? conf => 900 Dans extensions. you decide to focus on the implementation of the different features that were requested.conf: exten => 900. audio mixing is performed within the internals of Asterisk.Voicemail The objective of this part is to create a voicemail service for each user. Instead.1.2.VoIP Study and Implementation Labs 4. Which file has to be modified? /etc/asterisk/meetme. 4.2 . 4. Once configured.conf /etc/asterisk/extensions. ConfBridge does not perform audio mixing using DAHDI.MeetMe(900) What is the main difference between MeetMe and ConfBridge? Unlike MeetMe. then repeat the operation from the 501 extension. test this feature by calling the 900 from the 500 extension.1 – Audio conference The objective of this part is to set an audio conference room available from everyone by calling the number 900. Advanced configuration Now that your demonstration with distributed IPBX installed on your virtual machines in functional. Step 2. The voicemail must be reachable with the number 777 Page 10 / 19 . Page 11 / 19 .VoIP Study and Implementation Labs The users will have to authenticate to their own voicemail box with a specific password.Voicemail 500 501 => 8765.1.VoicemailMain(@sip-paris) # or exten => 777.conf of sip-toulouse : [sip-toulouse] 600 => 5678. If no one answer after 20 seconds. User 500 501 600 601 Voicemail number Paris 500 501 Toulouse 600 601 Voicemail password 5678 8765 1234 4321 Which files should be modified ? /etc/asterisk/voicemail.conf Which are the modifications to do ? exten => 777.1. voicemail are configured but we still have to configure the voicemail number (which can be done by modifying the dialplan).conf of sip-paris : [sip-paris] 500 => 5678.Voicemail 501 In voicemail.Voicemail 600 601 => 8765. Which file has to be modified ? /etc/asterisk/extensions. the call is redirected to the voice mail.conf Which are the modifications to do ? In voicemail.Voicemail 601 Now.VoicemailMain(@sip-toulouse) The final step is to configure the redirection after 20 seconds.conf /etc/asterisk/extensions. Hangup() exten => 501.Hangup() exten => 777.Voicemail(501@sip-paris) exten => 501.3.3.conf Which are the modifications to do ? In extensions.VoicemailMain(@sip-paris) In extensions.Hangup() exten => 777.1.conf of sip-toulouse : exten => 600.2.Voicemail(601@sip-toulouse) exten => 601.3.2.1.2.VoIP Study and Implementation Labs Which file has to be modified? /etc/asterisk/extensions.Hangup() exten => 601.VoicemailMain(@sip-toulouse) Page 12 / 19 .Voicemail(500@sip-paris) exten => 500.conf of sip-paris : exten => 500.3.2.Voicemail(600@sip-toulouse) exten => 600. 2.Hangup() Once configured. 4.3 – Speaking Clock To impress the users with Asterisk feature. test the solution. go to the /etc/asterisk/extensions. …).Interactive menu Your boss comes into your office to see how the demonstration is evolving. He tells you that.Europe/Paris.3. the year and then the hour and minutes.AdbY HM) exten => 3669. It will indicate the day of the week (Monday. …).conf file and modify it to configure the speaking clock. Tuesday.2.1. To do so. You find that this feature is called an IVR and you decide to implement it in your solution. the name of the month. the day in the month (1. Step 2.4 . Step 2.SayUnixTime(. This speaking clock will be available by calling the 3669 number and will be set to your own timezone.gsm Page 13 / 19 . exten => 3669. you decide to implement a speaking clock system.4. considering the number of numbers to remember.Answer() exten => 3669. he would like an interactive menu to guide to caller to the requested service. The arrival message will be located in /var/lib/asterisk/sounds/en/hello-world.3.VoIP Study and Implementation Labs 4. Set(TIMEOUT(digit)=5) s.1) [ivr] exten exten exten exten exten exten exten exten exten => => => => => => => => => s. The conditional forward allows you to forward the call by announcing the forward to the recipient The unconditional forward directly forward the call. then to retake the call.1.Goto(internal_calls.WaitExten 1.conf file.VoIP Study and Implementation Labs 1 redirects to the speaking clock 2 redirects to the conference room 3 redirects to the voice mail Any other key redirects to the interactive menu In the /etc/asterisk/extensions. The « call parking » allows you to park the call temporarily.1.5.1) Once configured.1) 2.1.777.Goto(ivr. add the lines to configure the interactive menu.1. 4.s.2.3669.1) 3. which can be useful when you want to change of phone without knowing the one you will choose.1) _[04-9*#].3.5.conf. test the solution calling the appropriate number.5 – Call forward Now we have to implement call forwarding.Answer s.4.1.1. modify lines : parkext => 700 parkpos => 701-710 Page 13 / 19 . A forward to 700 list the parking number which will have to be between 701 and 710.Goto(ivr.Goto(internal_calls.Playback(hello-world) s.Goto(internal_calls. Indicate the steps to configure the call forward : In /etc/asterisk/features. Step 2.900. uncomment in the section [featuremap]: blindxfer => #1 atxfer => *2 parkcall => #72 In general context in the same file.Set(TIMEOUT(response)=10) s.s. exten => 888. test the « call parking » feature by calling the 500 extension from the 501. You will then hear the extension where the call is parked to.VoIP Study and Implementation Labs Once configured.6 – QoS configuration You decide to test the Qos configuration to be sure that the users will have the best quality of service the network can provide. Go to the /etc/asterisk/cdr. test the solution by placing a call and check the logs. 4.) You decide then to configure Asterisk to modify those headers for the IAX and SIP protocols to use QoS.6.csv to see change it in real-time. Step 2.Logging After a talk with the accounting department. you boss comes to your office indicating that he needs to have a log of all the calls for each users in order to monitor them and to see if there are no abuse on personal calls during work time. Step 2. then initialize a forward by pressing the « # » key then 700.7 .conf file and add logging to your solution. Which file has to be modified? /etc/asterisk/sip.. tail -f /var/log/asterisk/cdr-csv/Master. Those files will be in the /var/log/asterisk/cdr-csv/ folder. you can listen the traffic with tcpdump between the elements (Client to IPBX for the SIP protocol and IPBX to IPBX for the IAX).7. You decide to active and configure logging on the system. You discover that Asterisk can modify the TOS (Type of service) field of the IPv4 header for several protocols (IAX. Page 14 / 19 .conf Which are the modifications to do? Uncomment lines : tos_sip=cs3 tos_audio=ef tos_video=af41 To test your configuration. 4. Uncomment in [general] context: enable=yes Once configured.. SIP . Automation As a regular geek.8 .VoIP Study and Implementation Labs 4.conf : [503](suptemplate) secret=1234 Once configured.9 – Time to go online Everything works inside the company now. Step 2. you can use it to test your configuration! Page 15 / 19 .9. Note : If you have a SIP account from your ISP (Free for example).net secret=s3cret Then you are going to create a section for the outgoing calls what will be used for any outgoing call from the company.8. but you now need to configure the connection to a SIP provider to be able to reach any phone in the world ! The authentication string to the provider will be: user=user domain= myprovider. test the solution.conf : [suptemplate](!) type=friend nat=no disallow=all allow=ulaw context=internal_calls dtmfmode=rfc2833 In /etc/asterisk/users. Now that you know that this solution will be implemented in your company.1. you had quite some fun in configuring thoses IPBX but you notice that the number of parameters to set for each new extension is huge and wastes a lot of time you do not have.VoicemailMain(${CALLERID(num)}@sip-paris) In /etc/asterisk/sip. 4. You decide to implement a macro system with variables to same time and gain in productivity. First. you modify the voicemail context so users will be identified with their extension calling number : In /etc/asterisk/extensions. Step 2.conf : exten => 777. you know you will not have the time on a daily basis to deal with the extensions management and dialplan administration. 03.2.Playback(tt-allbusy) exten => _0[1-59]XXXXXXXX.net [external_trunk] type=peer context=dial_out username=user secret=s3cret disallow=all allow=ulaw Create a context for outgoing call with the following parameters : Name of the context : dial_out Calls to the french fixed phones (01. For each SDA we redirect the call according to the last 3 digits to a specific extension.1. 04. 02.VoIP Study and Implementation Labs Modify the /etc/asterisk/sip. If the gateway is already in use. a message will tell the user that the gateway is busy and then the call will be hangup. We are going to create a context named “Incoming Calls” that will be used to receive the calls from the SIP trunk with the following parameters: Name of the context : « incoming_calls » A call to the 0140700500 number (SDA 500) redirects to the 500 A call to the 0140700501 number (SDA 501) redirects to the 501 Note : A SDA is a direct selection that can be used to redirect external calls to a specific extension Page 16 / 19 . 05.Dial(SIP/external_trunk/${EXTEN}) exten => 0[1-59]XXXXXXXX. [dial_out] exten => _0[1-59]XXXXXXXX.Hangup() Our futur VoIP provided displays the three last digits of each SDA. 09 followed by 8 digits) are routed to the SIP gateway.conf file to configure outgoing calls : register => user:[email protected]. 10 – Unified communication Employees are thrilled by having soon this new phone system in the company.2.Dial(SIP/501) 4.com.VoIP Study and Implementation Labs [incoming_calls] exten => exten => 0140700500.0.conf file to link to the Exchange Server : [general] (…) tcpenable=yes tcpbindaddr=0.login/password/PIN Number of the mail accounts : SOCIETY/jlocke / Supinf0 / 081987 SOCIETY/ctroy / Supinf0 / 081987 Outlook Auto-Attendant extension: 444 Outlook Voicemail extension: 777 Note: You can download the Microsoft Exchange Server Virtual machine from ftp-ssc.login/password of the machine : SOCIETY/Administrator / Supinf0 . you tell yourself : Wouldn’t it be great to link the Microsoft Exchange Server of the company to your Asterisk ? Note : .supinfo. Your Exchange UM server is already configured: you don’t have to modify it. FQDN of your Ms Exchange UM role server. type=friend Page 17 / 19 . One day.Dial(SIP/500) 0140700501.lan.society. Modify the /etc/asterisk/sip.0 promiscredir=yes (…) [exchange_trunk] host=society-dc-1. while you are reading your mail. you received a lot of mails to thank you for your work on this demonstration.1.10. Step 2. For this question you have to modify the hosts file of your IPBX to fit your configuration.0. conf file as follow : [macro-Internal_calls] exten => s.Dial(${ARG1}. 2.conf file as follow : [to_exchange] exten => 444.VoIP Study and Implementation Labs qualify=yes canreinvite=no disallow=all allow=ulaw dtmfmode=auto insecure=very transport=tcp port=5065 context=intenal_calls Then edit your /etc/asterisk/extensions. Dial(SIP/exchange_trunk/444) exten => 444. The « message » file journalize all the warnings.SIPAddHeader(Diversion: <tel:${ARG1:4}>\. Dial(SIP/exchange_trunk/777) exten => 777. 1.1. mission complete! Now let’s focus on the maintenance of our IPBX : Log files are store in /var/log/asterisk.Hangup() 4.privacy=off) exten => s.Answer() exten => s.20.2.Monitoring Everything is working.Dial(SIP/exchange_trunk/777) exten => s.11 .3.2.11. Test the following commands : To connect to the Asterisk console : sip:~# asterisk –r sip*CLI> To visualize the registed SIP users on the server : sip*CLI> iax2 show registry To visualize the SIP extentions authenticated on the server : sip*CLI> sip show peers Page 18 / 19 . users are thrilled. Step 2.1. Congestion() [voicemail] exten => 777.4.reason=no-answer\.5.Ttr) exten => s. Congestion() [internal_calls] Include=>to_exchange Finally you will modify the macros of internal calls in the /etc/asterisk/extensions.screen=no\. the errors and the notices. VoIP Study and Implementation Labs To visualize IAX users : sip*CLI> iax2 show users To see the state of the voicemail boxes : sip*CLI> voicemail show users To list the « meetme » conferences sip*CLI> meetme list To set a debut on a SIP extension : sip*CLI> sip set debug peer XXX To raise the verbose level of the console sip*CLI> core set verbose XX To display current calls : sip*CLI> core show calls To display parked calls : sip*CLI> parkedcalls show Page 19 / 19 .