Comparing VoIP SIP STUN/TURN servers: Good, Better, Best?
Tags: webdev, javascript, opensource, devops
Published: 2024-05-09 15:15:12

In this article we are going to consider carious stun and turn service provides and let you know which one is the best for your VoIP SIP client.

Here is what we are going to learn in this article:

* Overview of VoIP and SIP technologies
    
* Understanding STUN and TURN servers in VoIP SIP Systems
    
* Key considerations when selecting a STUN and TURN server
    
* Review of Popular STUN and TURN service Providers
    
* Metered Global TURN servers
    
* Google STUN Server
    
* CoTURN STUN / TURN service
    

## Overview Of VoIP and SIP technologies

VoIP means voice over internet protocol. Using this protocol you can make calls over the internet instead of traditional phones

The VoIP converts the voice into digital packets and send them over the internet, which are then converted again into voice on the other end of the call.

VoIP supports both voice as well as multimedia messages, including video calls.

### Session Initialization Protocol (SIP)

SIP is a protocol that is used for initiating, managing and terminating real time sessions

the SIP protocol supports voice, video and other messaging in different types of devices

Using SIP you can setup the sessions for messaging, video calling and audio calling, SIP handles the signaling between different participants

## The role of STUN and TURN servers in VoIP

The STUN and TURN servers are needed to be integrated into VoIP systems to facilitate effective NAT traversal

these protocols and servers ensure that all the participants in a SIP session are connected to each other.

TURN servers ensure that voice and video traffic can reah its destination when direct p2p connection

### STUN ( Session traversal utilities for NAT)

STUN servers helps a device in knowing what its public IP and port number is, so that devices can connect with each other directly if the nat and firewall rules are lax

### TURN (Traversal using relays around NAT)

TURN is useful when STUN fails, this is typical in most NAT scenarios and firewall rules. You can choose to go TURN only as well, this imporves the video quality and audio quality in VoIP systems

The TURN server relays all the traffic between the VoIP client to TURN server and from TURN server to another VoIP client. Thus facilitates connections between different clients

### Integrating STUN adn TURN in VoIP SIP Systems

The STUN and TURN servers are needed in VoIP SIP systems to effectively facilitate NAT scenarios

These protocols ensure and TURN servers ensure that all participants in SIP session can connect reliably, regardless of tough NAT rules and firewall rules

## Key considerations when selecting a STUN and TURN server

1. TURN server API: TURN servers with API for everything including creating credentials, retrieve Per user credentials and usage metrics through API, Enable Disable credentials via API, retrive data by date via API.
    
2. Reliability and Uptime: With turn servers you need reliability, look for service with 99.999% Uptime such as Metered TURN servers
    
3. Scalability: Scalability is another checck mark, if you are making a lot of calls you need a TURN server that scales. Metered TURN servers have unlimited scalability.
    
4. Global reach and Latency: You need TURN server service with servers in all parts of the world. This reduces latency and increases call quality. Metered TURN servers have servers all around the world and gives you 50 ms latency from anywhere in the world
    
5. Security: TURN servers need to be end to end encrypted for security purposes. Metered TURN servers are end to end encrypted, so that no one not even the Metered TURN servers have access to your data
    
6. Cost Effectiveness: You need a TURN server that is cost effective. With pay as you go plans in Metered TURN servers and free 5 GB data every month. Metered TURN servers are a cost effective solution
    
7. Technical Support and Documentation: A TURN server service needs to have clear documentation and awesome technical support as well. This is the case with Metered TURN servers.
    
8. Multi-tenancy and Administration: You can create credentials for different apps with Metered TURN servers. You can see detailed usage logs and control how much you want to spend with Metered TURN server service
    
9. Standards Compliant: Conforms to RFCs 5389, 5769, 5780, 5766, 6062, 6156, 5245, 5768, 6336, 6544, 5928 over UDP, TCP, TLS, and DTLS.
    

## Review of popular STUN and TURN service providers

### Metered Global STUN/TURN servers

1. Metered global turn servers offers the best solution for different types of businesses from startups to enterprises
    
2. here are some of the features of Metered turn and stun servers
    

## [Metered Global TURN servers​](https://www.metered.ca/stun-turn)

1. API: TURN server management with powerful API. You can do things like Add/ Remove credentials via the API, Retrieve Per User / Credentials and User metrics via the API, Enable/ Disable credentials via the API, Retrive Usage data by date via the API.
2. Global Geo-Location targeting: Automatically directs traffic to the nearest servers, for lowest possible latency and highest quality performance.
3. Servers in 13 Regions of the world: Toronto, Miami, San Francisco, Amsterdam, London, Frankfurt, Bangalore, Singapore,Sydney, São Paulo
4. Low Latency: less than 50 ms latency, anywhere across the world.
5. Cost-Effective: pay-as-you-go pricing with bandwidth and volume discounts available.
6. Easy Administration: Get usage logs, emails when accounts reach threshold limits, billing records and email and phone support.
7. Standards Compliant: Conforms to RFCs 5389, 5769, 5780, 5766, 6062, 6156, 5245, 5768, 6336, 6544, 5928 over UDP, TCP, TLS, and DTLS.
8. Multi‑Tenancy: Create multiple credentials and separate the usage by customer, or different apps. Get Usage logs, billing records and threshold alerts.
9. Enterprise Reliability: 99.999% Uptime with SLA.
10. Enterprise Scale: : With no limit on concurrent traffic or total traffic. Metered TURN Servers provide Enterprise Scalability
11. 5 GB/mo Free: Get 5 GB every month free TURN server usage with the Free Plan
    

### Google STUN servers

1. Google offers a free STUN server that is used for its simplicity and 0 cost
    
2. This could be a good choice if you have a simpler NAT and firewall rules that allow for direct p2p connections
    
3. If you want to learn more about [google stun server](https://dev.to/alakkadshaw/google-stun-server-list-21n4)
    
4. Google STUN server is quite reliable but does not include turn capabilities
    
5. Also, google stun server is free but it does not come with any kind of support including documentation and otherwise. You are on your own
    

### CoTURN STUN/TURN servers

1. CoTURN is an open source turn server that supports both stun and turn capabilities, making it a good choice for developers that want to build their own turn servers
    
2. Remember although CoTURN is free software, you will need to rent cloud servers to run it thus incurring cost. So, it is not a totally free options
    
3. the costs include cloud server rent plus bandwidth costs, plus maintainence costs and required devops to properly maintain and run the turn server
    
4. CoTURN does not come with any support, there is documentation but apart from that you are on your own
    
5. No API capabilites, unlike Metered TURN servers CoTURN does not have API for TURN server management as well.
    
6. If you want to go with CoTURN. Here are some helpful resources
    
[**How to setup and configure TURN server using coTURN?**](https://www.metered.ca/blog/coturn/)
        
[**AWS TURN server: In 7 Simple Steps**](https://www.metered.ca/blog/aws-turn-server-in-7-simple-steps/)
        
[**Azure TURN Server: The Step by Step Guide.**](https://www.metered.ca/blog/azure-turn-server/)
        

In this article we considered some of the leading options for STUN and TURN servers for VoIP SIP providers

I hope you liked the article. Thank you for reading.