Book Image

Building Telephony Systems with OpenSIPS Second Edition - Second Edition

By : Flavio E. Goncalves, Bogdan-Andrei Iancu
Book Image

Building Telephony Systems with OpenSIPS Second Edition - Second Edition

By: Flavio E. Goncalves, Bogdan-Andrei Iancu

Overview of this book

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.
Table of Contents (21 chapters)
Building Telephony Systems with OpenSIPS Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Validating a dialog and fixing broken dialogs


One of the most useful features of the dialog module is the dialog validation. There are some cases where this can be very useful. It can prevent malicious BYEs to close dialogs without disconnecting the call causing billing problems and other injected in-dialog requests. The function used to perform dialog validation is validate_dialog() and the result codes are displayed here:

  • 1: Dialog exists and is valid

  • -1: Invalid cseq

  • -2: Invalid remote target

  • -3: Invalid route set

  • -4: Other errors (parsing, no dlg, and so on)

There are cases where a UAS sends a reply with invalid information in the headers. You can fix these headers based on the dialog information stored in the memory using the fix_route_dialog() function. This function recovers and fixes the RURI and Route headers and the destination URI using the data stored previously in the memory for the current dialog. The typical code for validation is as follows:

if (has_totag()) {
  loose_route...