Unit 16: VoIP- 4D Primer - Building Voice Infrastructure in Developing Regions Authors: Alberto Escudero-Pascual - Louise Berthilson Acknowledgements: Adel El Zaim (Arabic and French editor), Anas Tawileh (Arabic translator), Iñaki Cívico y Sylvia Cadena (Spanish editors), Johan Bilien (French translator) and Martin Benjamin (English editor). Table of Contents 1. About this document ...........................................................................................................................
4.7.1 Latency....................................................................................................................................18 4.7.2 Jitter.........................................................................................................................................18 5. Hands on – Building your PBX...........................................................................................................19 5.1 What do I need?....................................................
12.2 Limiting factors for IP telephony disemmination.........................................................................46 12.3 The jargon..................................................................................................................................47 12.3.1 LiveCD...................................................................................................................................47 12.3.2 GUI...............................................................................
1. About this document This material is part of the course package created for TRICALCAR project. For information on TRICALCAR, please consult the introductory module or, www.wilac.net/tricalcar/. This material was originally produced in Spanish for the TRICALCAR project. This unit is available under the terms of the Attribution-Noncommercial-Share Alike 3.0 Unported license (Creative Commons licences: http://creativecommons.org/).
Wireless technologies come in many flavors and their performance depends on the particular application.It was not until spring 2004 I first heard about a piece of free software that was able to do exactly what I needed. I was living in Tanzania with an unreliable phone line and prohibitive phone tariffs. As soon as I managed to get Internet access, I started to call abroad using a well known proprietary telephony software but I soon felt frustrated because it did not give me the flexibility I needed.
• Private telephony in a rural community (Section 6) • Connecting the local telephone network to the PSTN (Section 7) • Interconnecting two remote communities (Section 8) Finally, we conclude with a list of useful references and pointers to resources to learn more (Section 9). 3. The magic potion Three magic elements will enable you to deploy a flexible and self-managed telephony infrastructure: VoIP, open standards and free and open source software. 3.
bandwidth is highly limited and the costs for Internet access are at least 100 times higher than in Europe and North America.8 To get a sense of how big the overhead can be when sending voice over the Internet, consider the fact that a 5.6 kbit/s compressed audio will require 18 kbit/s of bandwidth. The difference between the 5.6 kbit/s and 18 kbit/s is the packet headers The packet headers are all the information that is necessary to carry the voice packets to the recipient.
To understand why open standards are important, let us start by providing a simple definition of a “standard.” A standard is a set of rules, conditions, or requirements describing materials, products, systems, services, or practices. In telephony, technical standards have ensured that telephone exchanges around the globe can interoperate with each other. Without standards a telephone system of one region might not interoperate with another system a few kilometres away.
4. The recipe This section summarizes the basic concepts behind VoIP. Understanding each of them will be very useful when you start configuring any software related to IP telephony. Although VoIP is a vast knowledge area, we have carefully selected a few essential concepts. This section provides a basic but still solid understanding of what you need to know to get started and build your first telephone system. 4.
4.2 PSTN PSTN stands for public switched telephone network, “the telephone network of the telephone networks” or most commonly known as “the telephone network.”PSTN stands for public switched telephone network, “the telephone network of the telephone networks” or most commonly known as “the telephone network.” In the same way that the Internet is the global IP network, the PSTN is the amalgamation of all circuitswitched telephone networks in the world.
A Foreign Exchange Station (FXS) is what is on the other side of a traditional telephone line. A FXS delivers the dial tone and ring tone to the phones. In analogue lines, an FXS supplies the ring tone and the power to the phones to work. To give you an idea, an FXS (telephone line) provides around 48 Volts DC to the phone during conversation, and up to 80 Volts AC (20 Hz) when generating a ring tone. A PBX that integrates FXO and FXS interfaces can connect to the PSTN or host telephones.
Unfortunately, there are many ways to generate these kind of signals. Each mechanism is known as a “signalling method”. Signalling methods vary from one place to another, so you need to know which type is used in your telephony lines. Two common access signalling methods are known as loop start and ground start. If you do not know which signalling method is used between your phones and your phone lines you can start by testing with “loop start.
Three important things that SIP does are : 1. Dealing with authentication 2. Negotiating the quality15 of the phone call 3. Handling the IP addresses and port numbers to use when sending the “voice conversations” 4.4.2 Proxy Servers Although two SIP devices (IP phones) can communicate directly, SIP makes use of some additional elements called proxy servers to facilitate the establishment of a phone call. With Internet telephony you can physically move your “phone number” to any location in the world.
Network Address Translators (NATs) are the big enemies of RTP. A NAT-network consists of several computers that share one public IP address with the external world. Computers that are inside of a NAT network use “private” addresses. NATs are very useful to easily connect many computers to the Internet, but at the price that the computers are not fully reachable (routable) from the outside of the network. There are several problems related to NAT and VoIP.
The concept of trunking can be explained with the following metaphor: Imagine that you need to send five letters to people living in another country. You can use one envelope per letter, or include the five letters in a single envelope and include the name of the final recipient in the first line of each letter. Trunking operates in the same form and allows you to send multiple letters (calls) in a single envelop (IP packet).
4.5.3 PSTN interface cards If you want to route calls from your VoIP terminals to the traditional telephone network (PSTN) you need to include dedicated hardware in the PBX for that purpose. A modular solution for Asterisk that allows you to connect analogue lines and phones is a PCI card from Digium: TDM400P wildcard. The card is known as a “TDM wildcard” because it provides the possibility of inserting any combination of FXO or FXS modules into 4 ports.
If you want to implement a network in a developing region you might consider using ATAs as they are normally cheaper than VoIP phones. ATAs are also smaller and “customs-friendly” for import. One of the advantages of using ATAs is that you can attach any type of phone to it, including a pay phone, a fax, or a cordless phone (DECT)21. One popular ATA solution that supports IAX2 is the s101i from Digium. The ATA is also known as IAXy22. 4.
4.7 Quality of Service Quality of Service (QoS) is the ability of a network to provide improved (better) service to selected network traffic. One of the main challenges of implementing VoIP, especially in developing regions, is to ensure that bandwidth for telephone calls will always be available no matter how busy the Internet connection is. When designing a VoIP network you should try to optimized the available bandwidth, control jitter, and minimize latency.24 4.7.
VoIP appliances will allow you to set a “jitter buffer.” A jitter buffer is a shared data area where voice packets can be collected, stored, and sent to the voice processor in evenly spaced intervals. The jitter buffer, which is located at the receiving end of the voice connection, intentionally delays the arriving packets so that the end user experiences a clear connection with little sound distortion. The two kinds of jitter buffers are called static and dynamic.
5.1.1 Installation Tips This is a list of installation tips: If you need to install a TDM400P card • Be sure that your PC has an empty 2.2 PCI slot. • If you are going to use an FXS module in the TDM400P card, you need to have a free big molex connector28 • If you are using a small form-factor mother board as a mini-ITX you need a PCI “raiser” card to be able fit the TDM400P by turning the card position 90 degrees Do not connect a phone line (FXS) into an FXS port. It will break the port.
The approach we are taking in this short guide is not to include a listing of all possible commands but rather to walk through three basic scenarios where Asterisk is used. We are intentionally keeping things as simple as possible. We are aware of that the included examples can be solved in many different ways, so do not hesitate to experiment yourself. 6.1 Compiling Asterisk As with much other free software, there are two methods to get Asterisk working in your computer.
6.2 Fetching Asterisk Packages It is also possible to get Asterisk pre-compiled. Pre-compiled software comes in the form of a “package.” Common formats for Linux packages (depend on your distribution) are rpm, deb or tgz.
also do far more things that you do not expect. By keeping things simple you will learn slowly but steadily. 6.4 Basic Asterisk Commands Asterisk has two built-in components: a server that normally runs as a background process, and a client (CLI) that can monitor the server. Both server and client are invoked using the same command “Asterisk” but appending different flags (options).
6.5 Configuration Files The number of configuration files that you need to edit in order to run Asterisk depends on the types of VoIP technologies that you want to use simultaneously in your actual installation. The basic logic behind the configuration of Asterisk can be summarized in two steps: Step 1: Define and Configure Communication Channels First, you need to define and configure the communication channels that you want to use. A simple way to picture a communication channel is a “phone wire.
Configuration file (always mandatory) /etc/asterisk/sip.conf Description Used to configure SIP based channels (SIP VoIP phones and /etc/asterisk/iax.conf /etc/asterisk/zapata.conf SIP providers) Used to configure IAX2 based channels Used to configure the hardware that interfaces with the PSTN. /etc/zaptel.conf Used by Asterisk at startup Low level configuration of zaptel interface card. Used by Zaptel Configurator tool ztcfg before starting Asterisk 6.
VIA or AMD Geode processors, these platforms have their limitations in terms of computational power and cost. In May 2007, I discovered the Free Telephony Project32, a project started by David Rowe in Australia that provides free reference designs for embedded telephony. The project has released a PBX known as the IP04. The IP04 is an open (free as in speech) four port IP-PBX that can be built in volume for around $100 and currently retails for around $400.
During the time of writing (September 2007), the unit can be configured editing the configuration files via a serial cable or the network interface. The on board memory consists of 64MB SDRAM and 256MB flash, which can be expanded using an optional removable MMC card up to 4 GB. 7.1 Background In our first scenario, we want to place a PBX in a rural Telecentre and provide IP telephony to four organizations in the neighbourhood.
Parameter Setting IP address of the VoIP phone 192.168.46.2 IP address of the SIP Proxy (our PBX) 192.168.46.1 Registration YES User name/Auth name 462 Caller ID 462 Authentication password 462pass Codec G.711 (u-law) Image 6: The Library is connected to the PBX via a point-to-point wireless bridge. A VoIP terminal is used in the library to place and receive phone calls. 7.2.2 Hospital The second client of our internal telephony network is an ATA box placed in the local hospital.
Instead of using a traditional fixed phone, we decide to connect a cordless DECT phone base station35 to the RJ-11 port of the ATA box. The result is that we can have a cordless phone in any part of the hospital. The ATA box bridges the cordless phone with the VoIP network. Image 7: The Hospital is connected via a 100 meter Cat5 Ethernet to the Telecentre. A DECT phone is connected to a ATA (running SIP) that has registered with the PBX of the Telecentre. 7.2.
[iaxy_school] register Assume that your local DHCP server assigns the IP address 192.168.46.100 to the IAXy. Then, from the Asterisk console run the following command: #asterisk -r #CLI> iax2 provision 192.164.46.100 iaxy_school An alternative to use Asterisk to provision the IAXy is available for Windows users.36 Image 8: The Primary school is connected to the Telecentre using a twisted pair cable (Ethernet). An ATA box running IAX2 is used to connect an analogue phone to the telephony system.
• Enable the possibility of receiving audio by the same port that we send audio. In the PBX: • Inform Asterisk that the softphone is inside of a NAT. A good softphone running SIP that works well inside of a NAT is X-Lite from Xten.38 IAX2 softphones inside of a NAT should not present major problems. Ensure that the IAX2 UDP port 4569 is not blocked. A good softphone running IAX2 is iaxcomm.
In sip.conf, the following data should be added: [462] type=friend ; We can call and receive calls secret=462pass context=internal_calls ; All “incoming calls” are associated ; to the context internal_calls host=192.168.46.2 callerid=Library disallow=all ; First we disallow all codecs allow=ulaw ; Then we list all the codecs we accept [463] type=friend secret=463pass context=internal_calls host=192.168.46.
qualify=yes ; We send dummy traffic to keep the NAT open In iax.conf , the following data should be added: [464] type=friend secret=464pass context=internal_calls host=192.168.46.
exten => 464,1,Dial(IAX2/464) exten => 466,1,Dial(IAX2/466) exten => t,1,Hangup() ; Special extension (Timeout) exten => i,1,Hangup() ; Special extension (Invalid) exten => s,1,Hangup() ; Special extension (No routing information) The syntax of the extensions.conf file is intuitive. • The brackets [context_name] indicates where the context starts and the name of the context as it is defined in the sip.conf and iax.conf.
The second step is to ensure that the hardware drivers have been properly compiled and loaded. By running #lsmod you should see that the wctdm driver is loaded. You should also see that the wctdm driver depends on the zaptel driver that depends on the crc_ccitt module. # lsmod zaptel crc_ccitt 191748 7 wctdm 2304 3 hisax,zaptel,irda Step 3: Configuring the TDM400P Card with ztcfg The third step is to configure the hardware.
Channel 01: FXS Loopstart (Default) (Slaves: 01) 1 channels configured. Step 4: Configuring Asterisk to use the Zapata Hardware The forth and final step is to configure Asterisk to use the hardware. This is done in the /etc/asterisk/zapata.
exten => s,1,Answer() ; We answer the call exten => s,2,DigitTimeout(10) ; Setting Timeout values in seconds exten => s,3,ResponseTimeout(20) exten => s,4,Background(vm-extension); Voice asking for an extension exten => i,1,Goto(incoming_pstn,s,1) ; Ask again if invalid extension exten => t,1,Hangup() ; Hang up if timeout include => internal_calls ; Makes internal_calls extensions available Note: The final and complete version of the extensions.conf file is available in Section 7.3 of this document.
The process is simple; after powering off the PBX, we plug an FXS module into the second port of the TDM card. After powering on the system again, we add one more line to the /etc/zaptel.conf configuration file.
echotraining=yes context=incoming_pstn signalling=fxs_ls channel => 1 context=internal_calls signalling=fxo_ls channel => 2 Image 10. The Telecentre uses a TDM400P wildcard to: (1) connect the PBX to the PSTN (FXO module) and (2) route calls to an analogue phone (FXS module). 8.3 Updating the Dialplan A new dialplan is needed to: 1. Allow incoming and outgoing calls via the zapata channel 1 (the PSTN) 2.
exten => t,1,Hangup() include => internal_calls [internal_calls] exten => 461,1,Dial(Zap/2) ; Extension 461 calls via Zap channel 2 exten => 462,1,Dial(SIP/462) exten => 463,1,Dial(SIP/463) exten => 465,1,Dial(SIP/465) exten => 464,1,Dial(IAX2/464) exten => 466,1,Dial(IAX2/466) exten => t,1,Hangup() exten => s,1,Hangup() exten => i,1,Hangup() include => outgoing_calls ; PSTN available to the VoIP clients [outgoing_calls] exten => _0.
Image 11: The Telecentre and the Training Centre are equipped with one PBX each. The PBX's are Interconnected via a VSAT satellite link. 9.1 Typical satellite connection issues The Internet connection at the Telecentre has a very limited bandwidth (128/64 Kbps) so our solution needs to optimize the bandwidth usage. In the next example we propose to link two PBX's using Asterisk and IAX2. To ensure good bandwidth usage we propose to use a high compression codec such as G.729 or Speex.
tos = lowdelay disallow = all allow = ulaw allow = g729 ; We add the G.729 codec register => server2:server2pass@training_voip.
exten => s,1,Dial(Zap/2) ; Calls from the Training Centre ring ; the Telecentre Phone 9.2.2 Training Centre The iax.conf configuration file in the Training Centre looks like this: [general] bindaddr = 0.0.0.0 tos = lowdelay disallow = all allow = ulaw allow = g729 ; We add the G.729 codec ; If you do not have a licence use Speex register => server1:server1pass@rural.telecentres.
In the Training Centre we decide that all calls coming from any Telecentre are forwarded using SIP to the support desk. [incoming_telecentres_calls] exten => _X.,1,Dial(SIP/support-desk) ; Calls from any Telecentre ; are forwarded to Support Desk42 9.2.3 The register command When the IP address of the peer is unknown, we have no way to place a call. Imagine the situation when one of the PBX's has a static IP address but the PBX at the other end does not.
services to digitally excluded areas, while promoting the creation of community operated and managed telephone networks. The samples files that we included are intended to serve as a guideline to get your first telephony system up and running. No document can replace anyone else's experience, so be patient. Your perseverance is key for (your) success. You are not alone – you can always ask for help in many online forums and share your unique experience with others.
During the review we have looked into three major areas: • Specialized Asterisk software distributions including graphical configuration tools (The Asterisk GUI-friendly projects) • Installing Asterisk using virtualization (Asterisk & VMware) • Specialized PBX hardware - Asterisk Appliances As any other booming technology you will find difficult to catch up with what is going on and what projects are around.
• Many of the projects and tools have changed name during the last years and it is difficult to understand what exactly each of the tools is providing, how and to whom. • There is not a holistic view of how to deploy IP Telephony (specially in developing regions) including the network provisioning, energy requirements, training and business models. 12.3 The jargon Let us start by describing a few terms that are commonly used in Asterisk-based software distributions. 12.3.
12.4.1 FreePBX It is a PBX framework build at the top of asterisk that includes a GUI to manage a asterisk based telephone system. FreePBX grew up in its youth as AMP (Asterisk Management Portal). Most of the development of FreePBX is under CentOS, a freely-available Linux distribution that is based on Red Hat's commercial products44. The FreePBX project has made made available a ISO Image that includes a standard implementation of asterisk in Linux with FreePBX.
12.6 Other GUIs 12.6.1 Switchbox A company recently acquired by Digium (the company behind Asterisk) that has released the Switchvox Free Edition50, a software package that runs on Linux Fedora Cora 6. 12.6.2 AstBill AstBill51 is a web based billing, routing and management software for Asterisk. AstBill LiveCD is based on Knoppix Linux distribution and Drupal. 12.6.
The following table summarizes our findings and positions the IP04 from the Free Telephony Project as the most mature low cost solution for embedded telephony today.
A big step towards the dissemination of IP Telephony can be found in the Free Telephony Project, a community project that has developed an open hardware appliance (IP04) that runs Asterisk in a very low power processor. 13. Appendix B: The IP04, Open telephony hardware for developing regions The Free Telephony Project 13.1 Executive Summary We have a vision. Anyone should be able to make a phone call to anyone else. Telephony should be regarded as a human right, not a privilege of the developed world.
13.2 The IP04 Open Hardware IP-PBX The IP04 is a 4 port IP-PBX that runs Asterisk and uClinux on a powerful embedded Blackfin processor54. To build an Asterisk IP-PBX you normally need a x86 PC plus PCI card for the analog ports. With the IP04 you get all of that functionality in a tiny, low cost, low power, silent box with no moving parts. Unlike many other embedded processors, the Blackfin has enough DSP horsepower to handle multiple channels of echo cancellation and speech compression.
for Linux. He has a broad range of telephony hardware, software, DSP, and management experience and has held executive level positions in the sat-com industry (www.dspace.com). In August 2005 David started porting Asterisk to the Blackfin processor, and a few months later had a basic version of Asterisk running on a STAMP development card. David was inspired by the Blackfin community who had released their development cards as "open hardware".
13.3.1 Community development model It should be stressed that the IP04 is a community effort, with many people contributing. particular order: the Astfin 56 In no & BlackfinOne teams, uClinux , Analog Devices Blackfin team, the 57 Asterisk community, and Atcom. 13.4 IP04 Design This section provides technical details of how the IP04 hardware and software works. When power is applied, the Blackfin boot ROM starts reading from the 256k SPI flash chip.
Some changes to Asterisk were required to account for the lack of FPU and MMU on the Blackfin, for example porting of DTMF routines from floating point to fixed point. The standard Asterisk PCI card FXS/FXO port device drivers were ported to the Blackfin. Due to the richness of the Blackfins peripherals (e.g. TDM serial and SPI ports), the Blackfin device drivers are actually simpler compared to their PCI equivalents. The 4 analog ports can be flexibly configured using single port FXS/FXO modules.
Bug counts have been very low and development cycles very fast due to re-use of existing open hardware modules. The IP04 was booting uClinux and making phone calls using Asterisk 1 week after the solder had cooled on the first prototype. This is practically unheard of in hardware development. The IP04 reached production 3 months later and the design has proven to be reliable and stable. Similar tools and techniques to open software are used for open hardware development.
same models can apply to the developing world. In fact VOIP models may offer GSM providers opportunities to expand their network and billed air time. First, lets examine the novel features of VOIP. Unlike cellular networks, a VOIP network can be deployed on a small scale at at low capital and operating costs. For a few $100, a village can install a VOIP over WiFi node that supports say 4 telephones and links to a nearby village via WiFi.
• Communication within organisations. Consider a university which has WiFi based Intranet but no fixed landlines. Rather than using GSM handset for inter-office calls, VOIP over WiFi can be used. • Local call mesh network. Statistics show that 60% of all phone calls are local. A group of villages several km apart could be linked by Wifi, and IP04s deployed to build a small local "mesh" telephone network.
14.
1st Edition (December 2006) 16. Description of illustrations PBX running Asterisk ATA IAXY Wireless router Wireless bridge Switch Router Analogue Phone DECT Phone VoIP Phone Page 60 TRICALCAR | www.wilac.
Softphone Parabolic antenna VSAT Satellite 17. Intellectual Property Rights The materials developed for the TRICALCAR project utilise a short version of the MMTK – Multimedia Training Kit, and have been created to be used and freely shared by instructors connected to new technologies for human development. All materials are available under one of the Creative Commons licences. .
• Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one. David Rowe for his contribution to the 2nd Edition of the VoIP-4D Primer with the IP04 architecture and the role of open hardware in developing regions (Appendix B). This work was carried out with the aid of a grant from the Acacia Initiative of the International Development Research Centre of Canada.