Main.News0042 History

Hide minor edits - Show changes to markup

April 25, 2013, at 04:05 PM by razvancrainea -
Added line 1:

(:redirect About/News0042 quiet=1:)

September 21, 2009, at 10:49 AM by bogdan -
Changed line 31 from:




September 21, 2009, at 10:49 AM by bogdan -
Added lines 1-34:

Main -> News -> Stun Server

Built-in STUN server for OpenSIPS

Thanks to Razvan Pistolea, there is a new STUN server(rfc 3489) module integrated in OpenSIPS.

Why an integrated STUN server module?

  • A STUN server uses 2 ips and 2 ports to create 4 sockets on which to listen or respond.
  • This integrated STUN module uses the SIPS sockets created by the OpenSIPS core:
    • one (or two) of the sockets will overlap with the SIP signaling socket
    • the rest will be created by this module for STUN only purposes.
  • In the case of a bad behaving NATs (such as symmetric NAT) only this integrated STUN server will increase the likelihood of STUN to solve the NAT traversal for a wider range of NAT implementations. This translates into less need of media relaying (for NAT traversal purposes).


  • It is important to set the primary_ip:primary_port to match the OpenSIPS signaling ip and ports.
  • If OpenSIPS binds one more interface this module will use that too; so make sure you set the correct alternate_ip:primary_port.
  • STUN requires 2 routable ip addresses; if in shortage create a virtual interface (i don't recommend because it destroys the purpose for some usages).

Example: [@

    Opensips listening for signaling traffic:
    for stun module we configure :
        primary_ip =; primary_port = 5060 - overlapping with signaling socket
        primary_ip =; alternate_port = 3478 - dedicated stun socket
        alternate_ip =; primary_port = 5060 - dedicated stun socket
        alternate_ip =; alternate_port = 3478 - dedicated stun socket


Documentation can be found here:

Page last modified on April 25, 2013, at 04:05 PM