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

Handling REGISTER Requests behind NAT


Now that we have learned how to use force_rport() to allow the return of the message to the right IP address and UDP port, let's see how to handle REGISTER requests and allow the UAC to receive calls behind a NAT device. When a UAC sends a REGISTER request we will do the following actions:

  1. Test if the UAC is behind NAT (this can be done using client_nat_test()) and if the request is not to unregister all contacts (using * in the contact header field).

  2. Force the use of the rport field to reply to the right IP address and UDP port back to the UAC.

  3. If the UAC is behind NAT we will fix the REGISTER using fix_nated_register() to request the insertion of the received IP address and UDP port into the location table.

  4. Keep the NAT mappings open using the natping parameter of the MediaProxy module after the first registration. This parameter is used to set the interval between sending UDP packets, to keep the NAT mappings open. Ping is used to test the connectivity...