Building Telephony Systems with OpenSIPS - 2nd Ed.

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Build high-speed and highly scalable telephony systems using OpenSIPS. About This Book: • Install and configure OpenSIPS to authenticate, route, bill, and monitor VoIP calls • Gain a competitive edge using the most scalable VoIP technology • Discover the latest features of OpenSIPS with practical examples and case studies If you want to understand how to build a SIP provider from scratch using OpenSIPS, then this book is ideal for you. It is beneficial for VoIP providers, large enterprises, and universities. This book will also help readers who were using OpenSER but are now confused with the new OpenSIPS. Telephony and Linux experience will be helpful to get the most out of this book but is not essential. Prior knowledge of OpenSIPS is not assumed. What You Will Learn: • Learn to prepare and configure a Linux system for OpenSIPS • Familiarise yourself with the installation and configuration of OpenSIPS • Understand how to set a domain and create users/extensions • Configure SIP endpoints and make calls between them • Make calls to and from the PSTN and create access control lists to authorize calls • Install a graphical user interface to simplify the task of provisioning user and system information • Implement an effective billing system with OpenSIPS • Monitor and troubleshoot OpenSIPS to keep it running smoothly OpenSIPS is a multifunctional, multipurpose signalling SIP server. SIP (Session Initiation Protocol) is nowadays the most important VoIP protocol and OpenSIPS is the open source leader in VoIP platforms based on SIP. OpenSIPS is used to set up SIP Proxy servers. The purpose of these servers is to receive, examine, and classify SIP requests. The whole telecommunication industry is changing to an IP environment, and telephony as we know it today will completely change in less than ten years. SIP is the protocol leading this disruptive revolution and it is one of the main protocols on next generation networks. While a VoIP provider is not the only kind of SIP infrastructure created using OpenSIPS, it is certainly one of the most difficult to implement. This book will give you a competitive edge by helping you to create a SIP infrastructure capable of handling tens of thousands of subscribers. Starting with an introduction to SIP and OpenSIPS, you will begin by installing and configuring OpenSIPS. You will be introduced to OpenSIPS Scripting language and OpenSIPS Routing concepts, followed by comprehensive coverage of Subscriber Management. Next, you will learn to install, configure, and customize the OpenSIPS control panel and explore dialplans and routing. You will discover how to manage the dialog module, accounting, NATTraversal, and other new SIP services. The final chapters of the book are dedicated to troubleshooting tools, SIP security, and advanced scenarios including TCP/TLS support, load balancing, asynchronous processing, and more. A fictional VoIP provider is used to explain OpenSIPS and by the end of the book, you will have a simple but complete system to run a VoIP provider. Style and approach. This book is a step-by-step guide based on the example of a VoIP provider. You will start with OpenSIPS installation and gradually, your knowledge depth will increase.

Author(s): Flavio E. Goncalves, Bogdan-Andrei Iancu
Publisher: PackT Publishing
Year: 2016

Language: English
Pages: 381
Tags: Telephony Systems, OpenSIPS

Cover......Page 1
Copyright......Page 3
Credits......Page 4
About the Authors......Page 5
About the Reviewers......Page 7
www.PacktPub.com......Page 10
Table of Contents......Page 12
Preface......Page 20
Chapter 1: Introduction to SIP......Page 26
Understanding the SIP architecture......Page 27
The SIP registration process......Page 30
The proxy server......Page 32
The B2BUA server......Page 33
SIP request messages......Page 34
The SIP dialog flow......Page 35
SIP transactions and dialogs......Page 41
Locating the SIP servers......Page 42
SIP services......Page 43
The SIP identity......Page 44
Codecs......Page 45
DTMF-relay......Page 46
Session Description Protocol......Page 47
The SIP protocol and OSI model......Page 48
The SIP proxy......Page 49
The media proxy or RTP proxy for NAT traversal......Page 50
Summary......Page 51
Understanding OpenSIPS......Page 52
OpenSIPS capabilities......Page 54
An overview of the OpenSIPS project......Page 57
OpenSIPS knowledge transfer and support......Page 58
Usage scenarios for OpenSIPS......Page 59
The ingress side......Page 60
The core side......Page 63
The egress side......Page 65
Who's using OpenSIPS?......Page 67
The OpenSIPS design......Page 68
The OpenSIPS core......Page 69
The OpenSIPS modules......Page 73
Summary......Page 75
Hardware and software requirements......Page 76
Installing Linux for OpenSIPS......Page 77
Downloading and installing OpenSIPS v2.1.X......Page 90
Generating OpenSIPS scripts......Page 92
Running OpenSIPS at the Linux boot time......Page 93
Modules......Page 94
Working with the log files......Page 95
Startup options......Page 97
Summary......Page 98
Chapter 4: OpenSIPS Language
and Routing Concepts......Page 100
The OpenSIPS configuration file......Page 101
Global parameters......Page 103
The modules section......Page 105
Scripting routes......Page 106
The request route......Page 107
The branch route......Page 109
The failure route......Page 110
The reply route......Page 112
The start up route......Page 114
The event route......Page 115
The error route......Page 116
The scripting functions......Page 117
The scripting variables......Page 119
The reference variables......Page 120
The AVP variables......Page 121
Scripting transformations......Page 122
Scripting flags......Page 125
Scripting operators......Page 127
Script statements......Page 128
Mapping SIP traffic over the routing script......Page 129
Stateless and stateful routing......Page 133
In-dialog SIP routing......Page 136
Summary......Page 140
Chapter 5: Subscriber Management......Page 142
The AUTH_DB module......Page 143
The REGISTER sequence......Page 145
The INVITE authentication sequence......Page 148
The INVITE sequence packet capture......Page 149
The INVITE code snippet......Page 150
Digest authentication......Page 151
Quality of protection......Page 152
Installing MySQL support......Page 153
The REGISTER requests......Page 156
The non-REGISTER requests......Page 157
The opensipsctl shell script......Page 159
Configuring the opensipsctl utility......Page 160
Using OpenSIPS with authentication......Page 164
The registration process......Page 167
Enhancing the opensips.cfg routing script......Page 168
Managing multiple domains......Page 170
Using aliases......Page 171
Lab – multidomain support......Page 172
IP authentication......Page 173
Summary......Page 175
Chapter 6: OpenSIPS Control Panel......Page 176
The OpenSIPS control panel......Page 177
Installation of OpenSIPS-CP......Page 178
Configuring the OpenSIPS CP......Page 180
Installing Monit......Page 182
Configuring administrators......Page 184
Manage the access control lists or groups......Page 185
Managing aliases......Page 186
Managing subscribers......Page 187
Verifying the subscriber registration......Page 188
Managing permissions and IP authentication......Page 189
Sending commands to the management interface......Page 190
A generic table viewer......Page 191
Summary......Page 194
Chapter 7: Dialplan and Routing......Page 196
The dialplan module......Page 197
Gateway authentication......Page 199
Caller identification......Page 201
Identifying PSTN calls......Page 203
Authorizing PSTN calls......Page 204
Caller ID in PSTN calls......Page 208
Routing to PSTN GWs......Page 209
Script samples......Page 218
Summary......Page 221
Chapter 8: Managing Dialogs......Page 222
Creating a dialog......Page 223
Dialog states......Page 224
Dialog variables and flags......Page 225
Setting and reading the dialog flags......Page 226
Profiling a dialog......Page 227
Counting calls from the MI interface......Page 228
Disconnecting a call using the MI interface......Page 229
Topology hiding......Page 230
Initial request after topology hiding......Page 231
Sequential request after topology hiding......Page 232
Validating a dialog and fixing broken dialogs......Page 233
Description of the statistics......Page 234
How the SIP session timer works......Page 235
Summary......Page 238
Chapter 9: Accounting......Page 240
Selecting a backend......Page 241
Automatic accounting......Page 242
Multi-leg accounting......Page 244
Lab - accounting using MySQL......Page 245
Call end reason......Page 247
Generating CDRs......Page 248
Lab – generating CDRs......Page 249
CDRviewer and extra accounting......Page 250
Accounting using RADIUS......Page 252
Package and dependencies......Page 253
FreeRADIUS client and server configuration......Page 254
Configuring the OpenSIPS server......Page 256
Missing BYEs and CDRs......Page 257
Summary......Page 259
Port address translation......Page 260
Where does NAT break SIP?......Page 261
Types of NAT......Page 262
Restricted cone......Page 263
Symmetric......Page 264
The NAT firewall table......Page 265
Solving the SIP NAT traversal challenge......Page 266
The solution's topology......Page 267
Installing STUN......Page 268
Implementing NAT detection......Page 270
Handling the REGISTER requests and pings......Page 271
Handling sequential requests......Page 273
Solving the traversal of the RTP packets......Page 275
Understanding the solution flow......Page 276
(1) First INVITE......Page 277
(3) Reply 200 OK with SDP......Page 279
Acknowledgements (ACK packets)......Page 281
Summary......Page 283
Chapter 11: Implementing SIP Services......Page 284
Where to implement SIP services......Page 285
Playing demo-thanks......Page 287
Call forwarding......Page 289
Loading the AVPops module and its parameters......Page 290
Lab – implementing blind call forwarding......Page 291
Implementing call forward on busy or unanswered......Page 292
Debugging the routing script......Page 293
Lab – testing the call forwarding feature......Page 295
Integrating Asterisk realtime with OpenSIPS......Page 296
Call transfer......Page 300
An unattended transfer......Page 301
Tips for call transfer......Page 319
Summary......Page 320
Chapter 12: Monitoring Tools......Page 322
Built-in tools......Page 323
Configuring SIPTRACE......Page 325
Script trace......Page 326
Troubleshooting routing scripts......Page 327
A system crash......Page 329
Benchmarking segments of code......Page 331
The sipsak tool......Page 332
Installing SIPp......Page 333
Stress testing......Page 334
Ngrep......Page 336
Wireshark......Page 337
Summary......Page 341
Chapter 13: OpenSIPS Security......Page 342
Blocking multiple unsuccessful authentication attempts......Page 343
PIKE in manual mode......Page 344
PIKE in automatic mode......Page 345
Preventing DNS and registration poisoning......Page 346
Enabling Transport Layer Security......Page 349
Generating a script for TLS......Page 350
Creating the root certificate authority......Page 351
Creating the server certificate......Page 352
Installing the root certificate authority in your softphone......Page 353
Enabling Secure Real-time Protocol......Page 354
ZRTP......Page 355
Enabling the anti-fraud module......Page 356
Event generation......Page 358
Script integration......Page 359
Summary......Page 361
Asynchronous operations......Page 362
Asynchronous support in the OpenSIPS script......Page 365
Available asynchronous functions......Page 366
Binary replication......Page 367
Dialog replication......Page 368
The usrloc replication......Page 369
Enabling TCP......Page 370
Summary......Page 371
Index......Page 372