Stun Module

Razvan Pistolea

Edited by

Razvan Pistolea

Revision History
Revision $Revision:$$Date:$

Table of Contents

1. Admin Guide
1.1. Overview
1.1.1. The idea
1.1.2. Basic Operation
1.1.3. Supported STUN Attributes
1.2. Dependencies
1.2.1. OpenSIPS Modules
1.2.2. External Libraries or Applications
1.3. Exported Parameters
1.3.1. primary_ip (str)
1.3.2. primary_port (str)
1.3.3. alternate_ip (str)
1.3.4. alternate_port (str)
1.4. Exported MI Functions

List of Examples

1.1. Set primary_ip parameter
1.2. Set primary_port parameter
1.3. Set alternate_ip parameter
1.4. Set alternate_port parameter

Chapter 1. Admin Guide

1.1. Overview

1.1.1.  The idea

A stun server working with the same port as SIP (5060) in order to gain accurate information. The benefit would be an exact external address in the case of NATs translating differently when given different destination ports.

1.1.2.  Basic Operation

				The stun server will use 4 sockets:
					socket1 = ip1 : port1
					socket2 = ip1 : port2
					socket3 = ip2 : port1
					socket4 = ip2 : port2
				

The sockets come from existing SIP sockets or are created.

socket1 will allways be the the SIP socket.

The server will create a separate process. This process will listen for data on created sockets. The server will register a callback function to SIP. This function is called when a specific (stun)header is found.

1.1.3.  Supported STUN Attributes

This stun implements rfc 3489 (and XOR_MAPPED_ADDRESS from rfc 5389)

MAPPED_ADDRESS, RESPONSE_ADDRESS, CHANGE_REQUEST, SOURCE_ADDRESS, CHANGED_ADDRESS, ERROR_CODE, UNKNOWN_ATTRIBUTES, REFLECTED_FROM, XOR_MAPPED_ADDRESS

Not supported attributes:

USERNAME, PASSWORD, MESSAGE_INTEGRITY, and associated ERROR_CODEs

1.2. Dependencies

1.2.1. OpenSIPS Modules

The following modules must be loaded before this module:

  • None.

1.2.2. External Libraries or Applications

The following libraries or applications must be installed before running OpenSIPS with this module loaded:

  • None.

1.3. Exported Parameters

1.3.1.  primary_ip (str)

The ip of the interface SIP is working on.

Example 1.1. Set primary_ip parameter

...

modparam("stun","primary_ip","192.168.0.100")
...
                

1.3.2.  primary_port (str)

The port SIP is working on.

Example 1.2. Set primary_port parameter

...

modparam("stun","primary_port","5060")
...
                

1.3.3.  alternate_ip (str)

Another ip from another interface.

Example 1.3. Set alternate_ip parameter

...

modparam("stun","alternate_ip","11.22.33.44")
...
                

1.3.4.  alternate_port (str)

Another port used by STUN.

Example 1.4. Set alternate_port parameter

...

modparam("stun","alternate_port","3479")
...
                

1.4. Exported MI Functions