Professional Documents
Culture Documents
Objectives
Implementing a complete VoIP solution using Asterisk
Version 0.9b Last update: 24/02/2011 Use: internal Authors: M. PYBOURDIN - C. BORCKE
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
Page 3 / 19
2. Case presentation
You work as an IT Manager for a 9 employees service company. This company has several office including : - An office in Toulouse, France - Its main office in Paris, France Those sites are linked thanks to a Site-To-Site VPN provided through a DSL line with QoS enabled. Many users complained about the company phone services. Indeed, the actual solution is made with a old PABX installed in the 90s 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 IT Budget is impacted by the cost of the phone services and the maintenance contract from the PABX provider. To improve the infrastructure, you boss ask you to conduct a study on the PABX migration to a Full-IP solution. Of course, this solution must have a cheap infrastructure cost and be as flexible as possible. Your company owns 10 phone number from 0140700500 to 0140700509 First you ask your intern to conduct a study on the users request. Here is below his feedback: Employees need to be directly reachable from the outside. Existing numbers must be transferred from the previous operator Employees need to have their personal voicemail box. Sites being separated, employees must be able to call themselves and be able to forward incoming calls. 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. Calls must be made from phones but also from Mac OS X or Microsoft Windows Computers.
You decide to sort all the needs in three categories according to their importance:
Page 4 / 19
Feature Employees need to be directly reachable from the outside. Existing numbers must be transfered from the previous operator Employees need to have their personal voicemail box. Sites being separed, employees must be able to call themselves and be able to forward incoming calls. 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. Calls must be made from phones but also from Mac OS X or MS Windows Computers.
Vital X
Important
Minor X
X X X X X X
Technical considerations During your search for a technical solution, you discover the Asterisk solution which is a open source and free software transforming your Linux server (Gentoo, CentOS, Debian, ) in a full VoIP server ! Since its features meet your requirements, you decide to prepare a demonstration of the solution for the company on a virtual Machine. In order not to saturate your DSL line, you decide to set on IPBX per office and link them with the IAX protocol.
First you need download the virtual machine and to check that your physical computer can dialog with it. Download the virtual machine located on ftp-ssc.supinfo.com and configure it so the network adapter is set to Bridged and that the virtual machine IP is set to dynamic. Note : - All the resources for this workshop are available on the virtual machine in /usr/src. - login/passwords of the machine : root/Supinf0 supinfo/P@ssw0rd Well start by implementing the IPBX which will be located in Paris.
3.2.
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). Is it also mandatory for MeetMe conferences and IAX trunking.
Page 5 / 19
3.3.
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.
3.4.
What is the libpri used for ? Libpri is mandatory for Asterisk, even if you dont use PRI telephony cards. Without the libpri, you wont be able to compile Asterisk.
Indicate the different steps to compile the libpri on your system : cd /usr/src/libpri-1.4.11.5/ make all make install
Page 6 / 19
Indicate the different steps to compile Asterisk and Asterisk modules on your system : cd /usr/src/asterisk-1.8.3-rc3 ./configure make make install make samples
Your IPBX is now install and ready to go ! Now, lets start the configuration in order to meet the employees requests.
3.6.
Modify the general context so : - You will just allow the ulaw codec for the communications - The Asterisk server will listen on all the interfaces on the port 5060 - The default context is internal_calls - The DMTF code is the one from the rfc2833 RFC - Overlap dialing is not allowed Which file has to be modified ? /etc/asterisk/sip.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
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, the call is considered as failed. Indicated the modifications you have to do to meet those requirements:
Dans /etc/asterisk/users.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.conf : [internal_calls] exten => 500,1,Dial(SIP/500,20) exten => 500,2,Hangup() exten => 501,1,Dial(SIP/501,20) exten => 501,2,Hangup() exten => _5XX,1,Dial(SIP/${EXTEN},20) exten => _5XX,2,Hangup()
3.7.
Note : At this moment of the lab, 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. If you decide to work alone, setting the network interfaces to NAT is a good option. To prepare your demonstration, you prepare a second virtual Machine to act as the Toulouse site IPBX. The architecture of the network is considered as below :
Page 8 / 19
To interconnect your two, you decide to use the IAX protocol. The extensions of the new site will start with the number 6. Modify the dialplan to meet those requirements and set the two servers so Paris users and Toulouse users can call themselves.
What do you need to configure to do so ? In both machines in iax.conf : [general] autokill=yes register => USERNAME-LOCAL:1234@IP-MACHINE-DISTANTE #Ici, username = paris ou toulouse [USERNAME-LOCAL] type=peer host=dynamic trunk=yes secret=1234 context=internal_calls qualify=yes In sip-paris machine : extensions.conf : exten => _6XX,1,Dial(IAX2/USERNAME-LOCAL/${EXTEN}) In sip-toulouse machine : extensions.conf : exten => _5XX,1,Dial(IAX2/USERNAME-LOCAL/${EXTEN})
Page 9 / 19
On each physical machine, configure your favorite SIP Clients to connect if to one of the server and try to make a call.
Page 9 / 19
4. Advanced configuration
Now that your demonstration with distributed IPBX installed on your virtual machines in functional, you decide to focus on the implementation of the different features that were requested. Modifications must be applied on both IPBX.
4.1.
Which file has to be modified? /etc/asterisk/meetme.conf /etc/asterisk/extensions.conf Which are the modifications to do? conf => 900 Dans extensions.conf: exten => 900,1,MeetMe(900)
Once configured, test this feature by calling the 900 from the 500 extension, then repeat the operation from the 501 extension.
4.2.
The objective of this part is to create a voicemail service for each user. The voicemail must be reachable with the number 777
Page 10 / 19
Which are the modifications to do ? In voicemail.conf of sip-paris : [sip-paris] 500 => 5678,Voicemail 500 501 => 8765,Voicemail 501 In voicemail.conf of sip-toulouse : [sip-toulouse] 600 => 5678,Voicemail 600 601 => 8765,Voicemail 601
Now, voicemail are configured but we still have to configure the voicemail number (which can be done by modifying the dialplan). Which file has to be modified ?
/etc/asterisk/extensions.conf Which are the modifications to do ? exten => 777,1,VoicemailMain(@sip-paris) # or exten => 777,1,VoicemailMain(@sip-toulouse)
/etc/asterisk/extensions.conf
In extensions.conf of sip-paris : exten => 500,2,Voicemail(500@sip-paris) exten => 500,3,Hangup() exten => 501,2,Voicemail(501@sip-paris) exten => 501,3,Hangup() exten => 777,1,VoicemailMain(@sip-paris) In extensions.conf of sip-toulouse : exten => 600,2,Voicemail(600@sip-toulouse) exten => 600,3,Hangup() exten => 601,2,Voicemail(601@sip-toulouse) exten => 601,3,Hangup() exten => 777,1,VoicemailMain(@sip-toulouse)
Page 12 / 19
To impress the users with Asterisk feature, you decide to implement a speaking clock system. This speaking clock will be available by calling the 3669 number and will be set to your own timezone. It will indicate the day of the week (Monday, Tuesday, ), the day in the month (1,2, ), the name of the month, the year and then the hour and minutes. To do so, go to the /etc/asterisk/extensions.conf file and modify it to configure the speaking clock.
exten => 3669,1,Answer() exten => 3669,2,SayUnixTime(,Europe/Paris,AdbY HM) exten => 3669,3,Hangup()
4.4.
Page 13 / 19
In the /etc/asterisk/extensions.conf file, add the lines to configure the interactive menu. exten => 888,1,Goto(ivr,s,1) [ivr] exten exten exten exten exten exten exten exten exten => => => => => => => => => s,1,Answer s,2,Playback(hello-world) s,3,Set(TIMEOUT(digit)=5) s,4,Set(TIMEOUT(response)=10) s,5,WaitExten 1,1,Goto(internal_calls,3669,1) 2,1,Goto(internal_calls,900,1) 3,1,Goto(internal_calls,777,1) _[04-9*#],1,Goto(ivr,s,1)
4.5.
Now we have to implement call forwarding. The conditional forward allows you to forward the call by announcing the forward to the recipient The unconditional forward directly forward the call. The call parking allows you to park the call temporarily, then to retake the call, which can be useful when you want to change of phone without knowing the one you will choose. A forward to 700 list the parking number which will have to be between 701 and 710.
In /etc/asterisk/features.conf, uncomment in the section [featuremap]: blindxfer => #1 atxfer => *2 parkcall => #72 In general context in the same file, modify lines : parkext => 700 parkpos => 701-710
Page 13 / 19
Once configured, test the call parking feature by calling the 500 extension from the 501, then initialize a forward by pressing the # key then 700. You will then hear the extension where the call is parked to.
4.6.
You decide to test the Qos configuration to be sure that the users will have the best quality of service the network can provide. You discover that Asterisk can modify the TOS (Type of service) field of the IPv4 header for several protocols (IAX, SIP ...) You decide then to configure Asterisk to modify those headers for the IAX and SIP protocols to use QoS. Which file has to be modified?
/etc/asterisk/sip.conf Which are the modifications to do? Uncomment lines : tos_sip=cs3 tos_audio=ef tos_video=af41
To test your configuration, you can listen the traffic with tcpdump between the elements (Client to IPBX for the SIP protocol and IPBX to IPBX for the IAX).
4.7.
Go to the /etc/asterisk/cdr.conf file and add logging to your solution. Uncomment in [general] context: enable=yes
Once configured, test the solution by placing a call and check the logs. tail -f /var/log/asterisk/cdr-csv/Master.csv to see change it in real-time.
Page 14 / 19
As a regular geek, 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. Now that you know that this solution will be implemented in your company, you know you will not have the time on a daily basis to deal with the extensions management and dialplan administration. 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.conf : exten => 777,1,VoicemailMain(${CALLERID(num)}@sip-paris) In /etc/asterisk/sip.conf : [suptemplate](!) type=friend nat=no disallow=all allow=ulaw context=internal_calls dtmfmode=rfc2833 In /etc/asterisk/users.conf : [503](suptemplate) secret=1234
4.9.
Everything works inside the company now, 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.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.
Note : If you have a SIP account from your ISP (Free for example), you can use it to test your configuration!
Page 15 / 19
Create a context for outgoing call with the following parameters : Name of the context : dial_out Calls to the french fixed phones (01, 02, 03, 04, 05, 09 followed by 8 digits) are routed to the SIP gateway. 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.
[dial_out] exten => _0[1-59]XXXXXXXX,1,Dial(SIP/external_trunk/${EXTEN}) exten => 0[1-59]XXXXXXXX,2,Playback(tt-allbusy) exten => _0[1-59]XXXXXXXX,3,Hangup()
Our futur VoIP provided displays the three last digits of each SDA. For each SDA we redirect the call according to the last 3 digits to a specific extension. 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
Note : - login/password of the machine : SOCIETY/Administrator / Supinf0 - 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.supinfo.com. Your Exchange UM server is already configured: you dont have to modify it. For this question you have to modify the hosts file of your IPBX to fit your configuration.
Modify the /etc/asterisk/sip.conf file to link to the Exchange Server : [general] () tcpenable=yes tcpbindaddr=0.0.0.0 promiscredir=yes () [exchange_trunk] host=society-dc-1.society.lan; FQDN of your Ms Exchange UM role server. type=friend
Page 17 / 19
Page 18 / 19
Page 19 / 19