Meetrix Coturn - Developer Guide

Meetrix Coturn - Developer Guide

Welcome to the Meetrix Coturn Developer Guide! This guide is designed to assist you in seamlessly integrating Coturn into your AWS environment. Whether you're new to AWS or an experienced developer, you'll discover step-by-step instructions, configuration details, and troubleshooting tips to ensure a smooth experience.

Meetrix Coturn is a robust solution designed to address NAT traversal challenges in real-time communication applications. Leveraging the capabilities of Coturn, Meetrix Coturn offers a seamless experience for applications such as VoIP (Voice over Internet Protocol), online gaming, and peer-to-peer (P2P) communication within the AWS ecosystem.

Video
Blog
Switch to Hassle-Free Set up of CoTurn: Explore One-Click Deployment at 75% Low Pricing
Transition to CoTurn with one-click deployment at 75% lower pricing, streamlined for organizations in the UK, USA, Europe, Ireland, Singapore, and Thailand. Simplify your setup process and achieve cost-effective solutions effortlessly.”

Prerequisites

Before you get started with the Coturn AMI, ensure you have the following prerequisites:

Launching the AMI

Step 1: Find and Select 'Coturn' AMI

  1. Log in to your AWS Management Console.
  2. Navigate to the "Meetrix Coturn" in  AWS Marketplace.

Step 2:  Initial Setup & Configuration

  1. Click the "Continue to Subscribe" button.
  2. After subscribing, you will need to accept the terms and conditions. Click on "Accept Terms" to proceed.
  3. Please wait for a few minutes while the processing takes place. Once it's completed, click on "Continue to Configuration".
  4. Select your preferred region in "Configure this software" page and click "Continue to Launch" button.
  5. From the "Choose Action" dropdown menu in "Launch this software" page, select "Launch CloudFormation" and click "Launch" button.

Create CloudFormation Stack

Step1: Create stack

  1. Ensure the "Template is ready" radio button is selected under "Prepare template".

2. Click "Next".

Step2: Specify stack options

  1. Provide a unique "Stack name".
  2. Provide the "Admin Email" for SSL generation.
  3. Choose an instance type, "CoturnInstanceType" (Recommended: t3.micro).
  4. For "DeploymentName", enter a name of your choice.
  5. Select your preferred "keyName".
  6. Set "SSHLocation" as "0.0.0.0/0".
  7. Keep "SubnetCidrBlock" as "10.0.0.0/24".
  8. Provide a public domain name for "TurnDomainName". (Coturn will automatically try to setup SSL based on provided domain name, if that domain hosted on Route53. Please make sure your turn domain name hosted on route53. If its unsuccessful then you have to setup SSL manually)
  9. Enter a descriptive string to "TurnRealm" (e.g. turn.example.com, meetrixCoturn123).
  10. Enter a strong password for "TurnStaticAuthSecret".
  11. Keep "VpcCidrBlock" as "10.0.0.0/16".
  12. Click "Next".

Step3: Configure stack options

  1. Under "Stack failure options", select "Roll back all stack resources".
  2. click "Next".

Step4: Review

  1. Review and verify the details you've entered.

2. Tick the box that says, "I acknowledge that AWS CloudFormation might create IAM resources with custom names".

3. Click "Submit".

Afterward, you'll be directed to the CloudFormation stacks page.

You can easily locate the corresponding stack by searching for the stack name you entered in Step 2.

Please wait for 5-10 minutes until the stack has been successfully created. Afterward, you can click the "Refresh" button under the "Stacks" section.

Generate SSL Manually

Coturn will automatically try to setup SSL based on provided domain name, if that domain hosted on Route53. If its unsuccessful then you have to setup SSL manually.

Step1: Copy IP Address

Copy the Public IP address indicated as "PublicIp" in the "Outputs" tab.

Step2: Log in to the server

  1. Open the terminal and go to the directory where your private key is located.
  2. Paste the following command into your terminal and press Enter: ssh -i <your key name> ubuntu@<Public IP address>.

3. Type "yes" and press Enter. This will log you into the server.

Step3: Generate SSL

Method1:

1. Paste the following command into your terminal and press Enter:

sudo /root/certificate_generate_dns.sh

Method2:

  1. Copy the "PublicIp" as previously explained in "Step1: Copy IP Address" within the "Set SSL Manually" section.
  2. Go to AWS "Route 53" and navigate to "Hosted Zones".
  3. From there, select the domain you provided to "TurnDomainName".

4. Click "Edit record" in the "Record details" and then paste the copied "PublicIp" into the "value" textbox and click "Save".

5. Paste the following command into your terminal and press Enter:

sudo /root/certificate_generate_standalone.sh

Admin Email is acquiring for generate SSL certificates.

Testing Coturn on Server

Test for UDP:

  1. Follow "step1" and "step2" in the "Generate SSL Manually" section to log in to the server.
  2. Copy the script provided below into the terminal and press Enter to generate a username and a password. Ensure that you replace "myscret" with the "TurnStaticAuthSecret" you provided in "Step2" under the "Create CloudFormation Stack" section.
secret=mysecret && \
time=$(date +%s) && \
expiry=8400 && \
username=$(( $time + $expiry )) &&\
echo username:$username && \
echo password : $(echo -n $username | openssl dgst -binary -sha1 -hmac $secret | openssl base64)

Output of this script would be some thing like following.

username:1525325424
password : YuzkH/Th9BBaRj4ivR03PiCfr+E=

3. For testing we can use Trickle-Ice testing tool. Go to trickle-ice page and enter following details.

STUN or TURN URI : turn:<PublicIp>:3478
TURN username: <Generated_username>
TURN password: <Generated_password>

Then click Add Server and then Gather candidates button. If you have done everything correctly, you should see Done as the final result.

If you do not get any response or if you see any error messages, please double check if you have followed this guide as it is.

Test for TCP:

  1. Follow the instructions in the "Generate SSL Manually" section to set up SSL manually if it is not configured automatically.
  2. Go to trickle-ice page and enter following details.
STUN or TURN URI : turns:<YOUR_DOMAIN>:443
TURN username: <Generated_username>
TURN password: <Generated_password>

Then click Add Server and then Gather candidates button. If you have done everything correctly, you should see Done as the final result.

If you do not get any response or if you see any error messages, please double check if you have followed this guide as it is.

Shutting Down Coturn

  1. Click the link labeled "Coturn" in the "Resources" tab to access the EC2 instance, you will be directed to the coturn instance in EC2.

2. Select the coturn instance by marking the checkbox and click "Stop instance" from the "Instance state" dropdown. You can restart the instance at your convenience by selecting "Start instance".

Remove Coturn

Delete the stack that has been created in the AWS Management Console under 'CloudFormation Stacks' by clicking the 'Delete' button.

Upgrades

When there is an upgrade, we will update the product with a newer version. You can check the product version in AWS Marketplace. If a newer version is available, you can remove the previous version and launch the product again using the newer version. Remember to backup the necessary server data before removing.

Troubleshoot

  1.  If you face the following error, please follow https://meetrix.io/articles/how-to-increase-aws-quota/ blog to increase vCPU quota.

2.  If you face the following error (do not have sufficient <instance_type> capacity...) while creating the stack, try changing the region or try creating the stack at a later time.

3. If you face the below error, when you try to access the API dashboard, please wait 5-10 minutes and then try.

Conclusion

In summary, the Meetrix Coturn Developer Guide empowers developers to seamlessly integrate Coturn into their AWS environments, addressing NAT traversal challenges and boosting the reliability of real-time communication applications like VoIP, online gaming, and peer-to-peer communication. Whether you're just starting out with AWS or have extensive experience, this guide provides the necessary tools—step-by-step instructions, configuration insights, and troubleshooting tips—for a successful integration. With Meetrix Coturn, enhance your application's real-time communication capabilities confidently and effectively.

Technical Support

Reach out to Meetrix Support (support@meetrix.io)  for assistance with Meetrix Coturn issues.

Discover Seamless Meetings with >>>
Meetrix