Skip to content

Commit 20472ec

Browse files
author
Jill Grant
authored
Merge pull request #234973 from sloanster/patch-16
Patch 16
2 parents 2d2f606 + 4bd64a9 commit 20472ec

File tree

2 files changed

+86
-1
lines changed

2 files changed

+86
-1
lines changed

articles/communication-services/toc.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ items:
197197
- name: Add video calling to your Android WebView client app
198198
href: quickstarts/voice-video-calling/get-started-android-webview.md
199199
- name: Build virtual visit
200-
href: tutorials/virtual-visits/sample-builder.md
200+
href: tutorials/virtual-visits/sample-builder.md
201+
- name: Proxy your calling traffic
202+
href: tutorials/proxy-calling-support-tutorial.md
201203
- name: Call management
202204
items:
203205
- name: Manage calls
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
title: Tutorial - Proxy your ACS calling traffic across your own servers
3+
titleSuffix: An Azure Communication Services tutorial
4+
description: Learn how to have your media and signaling traffic be proxied to servers that you can control.
5+
author: sloanster
6+
services: azure-communication-services
7+
8+
ms.author: micahvivion
9+
ms.date: 04/18/2023
10+
ms.topic: quickstart
11+
ms.service: azure-communication-services
12+
ms.subservice: calling
13+
ms.custom: mode-other
14+
---
15+
# How to force calling traffic to be proxied across your own servers
16+
17+
In certain situations, it might be useful to have all your client traffic proxied to a server that you can control. When the SDK is initializing, you can provide the details of your servers that you would like the traffic to route to. Once enabled all the media traffic (audio/video/screen sharing) travel through the provided TURN servers instead of the Azure Communication Services defaults. This tutorial guides on how to have WebJS SDK calling traffic be proxied to servers that you control.
18+
19+
>[!IMPORTANT]
20+
> The proxy feature is available starting in the public preview version [1.13.0-beta.4](https://www.npmjs.com/package/@azure/communication-calling/v/1.13.0-beta.4) of the Calling SDK. Please ensure that you use this or a newer SDK when trying to use this feature. This Quickstart uses the Azure Communication Services Calling SDK version greater than `1.13.0`.
21+
22+
[!INCLUDE [Public Preview](../includes/public-preview-include-document.md)]
23+
24+
## What is a TURN server?
25+
Many times, establishing a network connection between two peers isn't straightforward. A direct connection might not work because of many reasons: firewalls with strict rules, peers sitting behind a private network, or computers are running in a NAT environment. To solve these network connection issues, you can use a TURN server. The term stands for Traversal Using Relays around NAT, and it's a protocol for relaying network traffic STUN and TURN servers are the relay servers here. Learn more about how ACS [mitigates](../concepts/network-traversal.md) network challenges by utilizing STUN and TURN.
26+
27+
## Provide your TURN servers details to the SDK
28+
To provide the details of your TURN servers, you need to pass details of what TURN server to use as part of `CallClientOptions` while initializing the `CallClient`. For more details how to setup a call see [Azure Communication Services Web SDK](../quickstarts/voice-video-calling/get-started-with-video-calling.md?pivots=platform-web)) for the Quickstart on how to setup Voice and Video.
29+
30+
```js
31+
import { CallClient } from '@azure/communication-calling';
32+
33+
const myTurn1 = {
34+
urls: [
35+
'turn:turn.azure.com:3478?transport=udp',
36+
'turn:turn1.azure.com:3478?transport=udp',
37+
],
38+
username: 'turnserver1username',
39+
credential: 'turnserver1credentialorpass'
40+
};
41+
42+
const myTurn2 = {
43+
urls: [
44+
'turn:20.202.255.255:3478',
45+
'turn:20.202.255.255:3478?transport=tcp',
46+
],
47+
username: 'turnserver2username',
48+
credential: 'turnserver2credentialorpass'
49+
};
50+
51+
// While you are creating an instance of the CallClient (the entry point of the SDK):
52+
const callClient = new CallClient({
53+
networkConfiguration: {
54+
turn: {
55+
iceServers: [
56+
myTurn1,
57+
myTurn2
58+
]
59+
}
60+
}
61+
});
62+
63+
64+
65+
66+
// ...continue normally with your SDK setup and usage.
67+
```
68+
69+
> [!IMPORTANT]
70+
> Note that if you have provided your TURN server details while initializing the `CallClient`, all the media traffic will <i>exclusively</i> flow through these TURN servers. Any other ICE candidates that are normally generated when creating a call won't be considered while trying to establish connectivity between peers i.e. only 'relay' candidates will be considered. To learn more about different types of Ice candidates can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/RTCIceCandidate/type).
71+
72+
> [!NOTE]
73+
> If the '?transport' query parameter is not present as part of the TURN url or is not one of these values - 'udp', 'tcp', 'tls', the default will behaviour will be UDP.
74+
75+
> [!NOTE]
76+
> If any of the URLs provided are invalid or don't have one of these schemas - 'turn:', 'turns:', 'stun:', the `CallClient` initialization will fail and will throw errors accordingly. The error messages thrown should help you troubleshoot if you run into issues.
77+
78+
The API reference for the `CallClientOptions` object, and the `networkConfiguration` property within it can be found here - [CallClientOptions](/javascript/api/azure-communication-services/@azure/communication-calling/callclientoptions?view=azure-communication-services-js&preserve-view=true).
79+
80+
## Set up a TURN server in Azure
81+
You can create a Linux virtual machine in the Azure portal using this [guide](/azure/virtual-machines/linux/quick-create-portal?tabs=ubuntu), and deploy a TURN server using [coturn](https://github.com/coturn/coturn), a free and open source implementation of a TURN and STUN server for VoIP and WebRTC.
82+
83+
Once you have setup a TURN server, you can test it using the WebRTC Trickle ICE page - [Trickle ICE](https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/).

0 commit comments

Comments
 (0)