A bash script for easy installation and configuration of a COTURN server. This script helps you set up a STUN/TURN server with basic authentication and no SSL.
This STUN/TURN server can be used in various WebRTC applications and VoIP solutions:
- Video conferencing applications
- Peer-to-peer file sharing
- Live streaming solutions
- Browser-based chat applications
- Online gaming platforms
- Remote desktop applications
- SIP clients (JsSIP, SIP.js)
- WebRTC-based softphones
- VoIP mobile applications
- IP PBX systems
- Video calling applications
Can be integrated with:
- JsSIP
- SIP.js
- WebRTC.js
- Janus Gateway
- FreeSWITCH
- Asterisk
- Kamailio
- OpenSIPS
let socket = new JsSIP.WebSocketInterface('wss://your-websocket-server');
let configuration = {
sockets : [ socket ],
uri : 'sip:your_extension@your-sip-domain',
password : 'your-password',
iceServers: [
{ urls: ['stun:your-ip:3478'] },
{
urls: ['turn:your-ip:3478'],
username: 'your-turn-username',
credential: 'your-turn-password'
},
{
urls: ['stun:your-ip:3478'],
username: 'your-turn-username',
credential: 'your-turn-password'
}
]
};
let phone = new JsSIP.UA(configuration);
phone.start();
const configuration = {
iceServers: [
{
urls: "stun:your-ip:3478"
},
{
urls: "turn:your-ip:3478",
username: "your-turn-username",
credential: "your-turn-password"
},
{
urls: ['stun:your-ip:3478'],
username: 'your-turn-username',
credential: 'your-turn-password'
}
]
};
const pc = new RTCPeerConnection(configuration);
- Simple interactive installation
- Basic STUN/TURN server configuration
- No SSL/TLS (suitable for basic setups)
- Automatic firewall configuration
- User credential management
- Uses IP as realm
- Ubuntu/Debian based system
- Root privileges
- Internet connection for package installation
- Clone the repository:
git clone https://github.com/wwwakcan/coturn-setup.git
- Make the script executable:
chmod +x coturn-setup.sh
- Run the script:
sudo ./coturn-setup.sh
The script provides an interactive menu with the following options:
-
Install COTURN
- Updates system packages
- Installs COTURN server
- Enables the service
-
Configure COTURN
- Sets server IP address
- Creates user credentials
- Configures firewall rules
- Generates configuration file
-
Exit
The script will configure COTURN with:
- STUN/TURN ports: 3478 (UDP/TCP)
- Alternative port: 5349
- UDP relay ports: 49152-65535
- No TLS/DTLS encryption
- Simple logging
- Basic authentication
After configuration, you'll receive:
Access Information:
----------------------------------------
STUN Server : stun:YOUR_IP:3478
TURN Server : turn:YOUR_IP:3478
Username : your_username
Password : your_password
Realm : YOUR_IP
Supported Protocols:
- STUN/TURN UDP : Port 3478
- STUN/TURN TCP : Port 3478
----------------------------------------
This script configures COTURN without SSL/TLS encryption. It's suitable for basic testing or development environments. For production use, consider adding proper SSL/TLS configuration.
Feel free to fork the repository and submit pull requests for any improvements.
MIT License - feel free to use and modify as needed.