Book Image

Building Telephony Systems with OpenSER

Book Image

Building Telephony Systems with OpenSER

Overview of this book

Table of Contents (18 chapters)
Building Telephony Systems with OpenSER
Credits
About the Author
About the Reviewers
Preface
6
Building the User Portal with SerMyAdmin
Index

Preface

We are starting a new era in the collaboration area. Voice and Video over IP are starting to dominate the world of telecommunications in a disruptive movement capable of changing the whole industry. The SIP (Session Initiation protocol) technology is at the center of this revolution. I believe, at present, SIP is the most used protocol for Voice and Video over IP.

In the future, when people learn how to use the technology, SIP will be for voice communications what email is today for text communications. We are starting with islands of SIP communications inside VoIP providers, enterprises, and even governments. In the near future, the barriers between the islands will be broken and you will be able to communicate with anyone in anyplace without paying high fees. The only fees you will pay in the future will be the access to the data network, because with the pervasiveness of VoIP and Video over IP, everything will be simply data. I remember the first days of Internets email in the early 90s. It took some years until everyone had an email address. The same thing could be happening in the SIP world now. Unfortunately, the SIP providers still behave as islands not, usually, allowing free inter-domain routing.

With the introduction of 3G, 4G, and WiMAX, fast data communications are becoming widespread in the mobile industry. Newer phones from mainstream manufacturers are starting to support WiFI, WiMAX, and obviously 3G. SIP clients can run in these platforms changing the whole mobile communication industry in the near future. Sure, the telephone companies will try, legitimately, to protect their revenue sources, but they cannot hide for ever the SIP communication infrastructure already in place. Slowly, users will start to use SIP clients in their mobile phones hugely cutting the communication costs. The movement, even without a huge sponsor, will spread by word of mouth until it becomes pervasive.

The infrastructure required for SIP communication has as its main component a "SIP Proxy" server. OpenSER is one of the best SIP Proxies in the market. It is robust, scalable, and licensed according to GNU GPL. OpenSER is now in the stage of early adopters. It is still hard to learn and to use. The idea of this book is to teach you how to implement the architecture of the SIP protocol using OpenSER. I hope this book helps you, if you are starting to learn SIP, or implement a SIP infrastructure in your company, school, or government. I wish you success in your implementations and I sincerely hope that this material helps you.

What This Book Covers

Chapter 1 provides an overview of the SIP protocol, its architecture, and its main components. SIP flows are explained and will be essential for the future comprehension on this book. Some important concepts such as codecs, session description protocol, and real-time protocol are presented at the end of the chapter.

Chapter 2 will give you an overview of the OpenSER software. We also cover how SIP requests are processed and the basic concepts of transactions and dialogs after explaining what SIP is.

Chapter 3 is where you will learn how to install Linux prepared for OpenSER and OpenSER itself. After the installation, you will learn how to start and stop the daemon and how to initialize OpenSER at boot time.

Chapter 4 introduces you to the basic scripts and analyzes the default configuration. At the end it shows you some important concepts about routing transactions and dialogs. Be sure to understand the routing basics before going ahead.

Chapter 5 shows how to connect OpenSER to a MySQL database to authenticate all the initial requests. Later in this chapter you will see how to add some security mechanisms to improve your system.

Chapter 6 introduces some important concepts about the user portal. You will learn how to install and do the basic operations with SerMyAdmin. SerMyAdmin is a graphical user interface for OpenSER that aims to make your life easier in the administration of the server.

Chapter 7 teaches you how to connect to the PSTN (Public Switched Telephone Network) using a gateway. Details on how to connect to an Asterisk Server or a Cisco gateway are provided.

Chapter 8 introduces you to the concepts of call forwarding to a voicemail server. You can use Asterisk as a voicemail server connected to OpenSER. Concepts such as failure_route and AVPs are presented in this chapter.

Chapter 9 covers SIP NAT traversal. It introduces the problems and techniques to traverse NAT devices for SIP communications.

Chapter 10 is about billing. It teaches you how to send call detail records to a RADIUS Server and how to rate the calls using a GPL tool known as CDRTool.

Chapter 11 introduces some tools to help you in stress test your platform, detect voice quality problems, and trace SIP calls.

In After Words you can see last minute information covering newer versions of OpenSER, not available when the book was written.

What You Need for This Book

To use this book, I recommend that you have a formatted PC with at least 1GHz of CPU, 20G bytes of disk and 512 Mbytes of RAM. You can also use the free and downloadable VMWare Server (http://www.vmware.com), to install Linux and OpenSER safely in a VM (virtual machine) running inside your own machine. You will have to download the Debian distribution of Linux (www.debian.org). I used the version 4.0R3 (etch) to test the labs. All the software used in this book is freely available on the Internet, so in the proper chapters you will find the instructions on how to download and execute. You will need at least two SIP devices to test most of the labs. I use two PCs with a free SIP softphone and OpenSER in a virtual machine. For the PSTN and Voicemail chapters, you will need to use an external gateway, usually an Asterisk Server. In my testing environment I used a second virtual machine using VMWare server. If you are going to use VMWare, be sure to disable desktop firewall, a good source of headaches for labs.

Who This Book Is For

This book is intended for Linux and networking professionals, who want to understand SIP and OpenSER from a practical perspective, or are interested in IP telephony and call routing. It is suitable for VoIP provider personnel, because it covers most of the existing components. Some experience with Linux and Networks is required to be successful in the labs. Even inexperienced Linux users can complete the labs, but knowledge about computer networks is essential. For inexperienced Linux users I suggest using WinSCP and Putty to edit the configuration files and send commands; both are free downloads.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

There are three styles for code. Code words in text are shown as follows: "Notice that we have added only the keywords contrib and non-free after our repository definitions".

A block of code will be set as follows:

# /etc/apt/souces.list
deb http://ftp.br.debian.org/debian/ etch main contrib non-free
deb-src http://ftp.br.debian.org/debian/ etch main contrib non-free

When we wish to draw your attention to a particular part of a code block, the relevant lines or items will be made bold:

<?xml version="1.0" encoding="UTF-8"?>
<Context path="/serMyAdmin">
  <Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" maxActive="20" maxIdle="10" maxWait="-1" name="jdbc/openser_MySQL" type="javax.sql.DataSource" url="jdbc:mysql://localhost:3306/openser" username="sermyadmin" password="secret"/>
</Context>

Any command-line input and output is written as follows:

openser:/usr/src# cp mysql-connector-java-5.1.5/mysql-connector-java-5.1.5-bin.jar /usr/local/tomcat6/lib

New terms and important words are introduced in a bold-type font. Words that you see on the screen, in menus or dialog boxes for example, appear in our text like this: "To register a new user, in the login screen simply click on the Register Button".

Note

Important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader Feedback

Feedback from our readers is always welcome. Let us know what you think about this book, what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply drop an email to , making sure to mention the book title in the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or email .

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer Support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the Example Code for the Book

Visit http://www.packtpub.com/files/code/3735_Code.zip to directly downlad the example code.

The downloadable files contain instructions on how to use them.

Errata

Although we have taken every care to ensure the accuracy of our contents, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in text or code—we would be grateful if you would report this to us. By doing this you can save other readers from frustration, and help to improve subsequent versions of this book. If you find any errata, report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the Submit Errata link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be added to the list of existing errata. The existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Questions

You can contact us at if you are having a problem with some aspect of the book, and we will do our best to address it.