Context and requirements
Genymotion Android 8.0 and above images require a STUN/TURN server for WebRTC connections.
Genymotion Device Image ver. 13.0.0 forwards all WebRTC connections to Genymotion's STUN/TURN server.
Genymotion instances require a public IP and Internet access to reach the STUN/TURN server.
If a public IP is not available, you can deploy your own STUN/TURN server.
This tutorial shows how to install and configure a STUN/TURN server on AWS.
Prerequisites
- Ubuntu Server 20.04 LTS (Focal) x86_64 is recommended for General purpose.
- Instance type: t3.micro.
- Inbound rules on the TURN/STUN server EC2 security group must allow inbound connections from Genymotion instances to TCP port 443 and UDP port 443.
Install and configure CoTURN server
- Connect to your Ubuntu server with SSH.
- Add the Universe repository: sudo apt-add-repository universe.
- Update and upgrade Ubuntu: sudo apt update && sudo apt upgrade.
- Reboot the server: sudo reboot.
- Install CoTURN server: sudo apt-get install coturn.
- Edit the file /etc/default/coturn and un-comment TURNSERVER_ENABLED=1.
- Edit the file /etc/turnserver.conf and un-comment listening-port=3478 and change it to listening-port=443.
- Note: We chose to use TCP port 443 to ensure best compliance with security requirements.
- Un-comment listening-ip and replace the default IP with your Ubuntu server private IP: listening-ip=xxx.xxx.xxx.xxx.
- Add a user and password for Genymotion by uncommenting and replacing with your values: user=my_username:123456.
- Edit the file /lib/systemd/system/coturn.service and add AmbientCapabilities=CAP_NET_BIND_SERVICE in the [Service] section.
- Reboot the instance.
- Verify that the CoTURN server started correctly and is listening to port 443 by running: sudo systemctl status coturn.
- If everything is in order, you should see output indicating two TURN servers created and the service started.
Configuring the Genymotion instance to use your TURN server
- From the instance UI, go to the Configuration panel.
- Fill the TURN & STUN box with your STUN/TURN server URIs, username and password.
- The TURN URI syntax should be turn:xxx.xxx.xxx.xxx:443.
- The STUN URI should be stun:xxx.xxx.xxx.xxx:443.
- The server private IP is xxx.xxx.xxx.xxx.
- Click APPLY.
- The Genymotion instance now uses your TURN/TURN server on port 443 for WebRTC connections.
- For more details and alternate methods with command line tools, refer to Genymotion Device image user guide.