Skip to content

Commit c8937a2

Browse files
committed
Update PR
1 parent 3c0cad4 commit c8937a2

25 files changed

+928
-260
lines changed

sdk/communication/Azure.Communication.NetworkTraversal/README.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ The networking client can be authenticated using a connection string acquired fr
2525

2626
```C# Snippet:CreateCommunicationRelayClient
2727
// Get a connection string to our Azure Communication resource.
28-
//@@var connectionString = "<connection_string>";
28+
var connectionString = "<connection_string>";
2929
var client = new CommunicationRelayClient(connectionString);
3030
```
3131

@@ -34,16 +34,13 @@ Or alternatively using the endpoint and access key acquired from an Azure Commun
3434
```C# Snippet:CreateCommunicationRelayFromAccessKey
3535
var endpoint = new Uri("https://my-resource.communication.azure.com");
3636
var accessKey = "<access_key>";
37-
/*@@*/ endpoint = TestEnvironment.LiveTestDynamicEndpoint;
38-
/*@@*/ accessKey = TestEnvironment.LiveTestDynamicAccessKey;
3937
var client = new CommunicationRelayClient(endpoint, new AzureKeyCredential(accessKey));
4038
```
4139

4240
Clients also have the option to authenticate using a valid Active Directory token.
4341

4442
```C# Snippet:CreateCommunicationRelayFromToken
4543
var endpoint = new Uri("https://my-resource.communication.azure.com");
46-
/*@@*/ endpoint = TestEnvironment.LiveTestDynamicEndpoint;
4744
TokenCredential tokenCredential = new DefaultAzureCredential();
4845
var client = new CommunicationRelayClient(endpoint, tokenCredential);
4946
```
@@ -87,6 +84,24 @@ foreach (CommunicationIceServer iceServer in iceServers)
8784
}
8885
```
8986

87+
## Getting a Relay Configuration for a user without identity async
88+
89+
```C# Snippet:GetRelayConfigurationAsyncWithoutIdentity
90+
Response<CommunicationRelayConfiguration> relayConfiguration = await client.GetRelayConfigurationAsync();
91+
DateTimeOffset turnTokenExpiresOn = relayConfiguration.Value.ExpiresOn;
92+
IReadOnlyList<CommunicationIceServer> iceServers = relayConfiguration.Value.IceServers;
93+
Console.WriteLine($"Expires On: {turnTokenExpiresOn}");
94+
foreach (CommunicationIceServer iceServer in iceServers)
95+
{
96+
foreach (string url in iceServer.Urls)
97+
{
98+
Console.WriteLine($"ICE Server Url: {url}");
99+
}
100+
Console.WriteLine($"ICE Server Username: {iceServer.Username}");
101+
Console.WriteLine($"ICE Server Credential: {iceServer.Credential}");
102+
}
103+
```
104+
90105
## Troubleshooting
91106

92107
> TODO

sdk/communication/Azure.Communication.NetworkTraversal/api/Azure.Communication.NetworkTraversal.netstandard2.0.cs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ public partial class CommunicationIceServer
44
{
55
internal CommunicationIceServer() { }
66
public string Credential { get { throw null; } }
7+
public Azure.Communication.NetworkTraversal.RouteType RouteType { get { throw null; } }
78
public System.Collections.Generic.IReadOnlyList<string> Urls { get { throw null; } }
89
public string Username { get { throw null; } }
910
}
@@ -14,8 +15,8 @@ public CommunicationRelayClient(string connectionString) { }
1415
public CommunicationRelayClient(string connectionString, Azure.Communication.NetworkTraversal.CommunicationRelayClientOptions options) { }
1516
public CommunicationRelayClient(System.Uri endpoint, Azure.AzureKeyCredential keyCredential, Azure.Communication.NetworkTraversal.CommunicationRelayClientOptions options = null) { }
1617
public CommunicationRelayClient(System.Uri endpoint, Azure.Core.TokenCredential tokenCredential, Azure.Communication.NetworkTraversal.CommunicationRelayClientOptions options = null) { }
17-
public virtual Azure.Response<Azure.Communication.NetworkTraversal.CommunicationRelayConfiguration> GetRelayConfiguration(Azure.Communication.CommunicationUserIdentifier communicationUser = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
18-
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Communication.NetworkTraversal.CommunicationRelayConfiguration>> GetRelayConfigurationAsync(Azure.Communication.CommunicationUserIdentifier communicationUser = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
18+
public virtual Azure.Response<Azure.Communication.NetworkTraversal.CommunicationRelayConfiguration> GetRelayConfiguration(Azure.Communication.CommunicationUserIdentifier communicationUser = null, Azure.Communication.NetworkTraversal.RouteType? routeType = default(Azure.Communication.NetworkTraversal.RouteType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
19+
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Communication.NetworkTraversal.CommunicationRelayConfiguration>> GetRelayConfigurationAsync(Azure.Communication.CommunicationUserIdentifier communicationUser = null, Azure.Communication.NetworkTraversal.RouteType? routeType = default(Azure.Communication.NetworkTraversal.RouteType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
1920
}
2021
public partial class CommunicationRelayClientOptions : Azure.Core.ClientOptions
2122
{
@@ -33,7 +34,25 @@ internal CommunicationRelayConfiguration() { }
3334
}
3435
public static partial class NetworkTraversalModelFactory
3536
{
36-
public static Azure.Communication.NetworkTraversal.CommunicationIceServer CommunicationIceServer(System.Collections.Generic.IEnumerable<string> urls = null, string username = null, string credential = null) { throw null; }
37+
public static Azure.Communication.NetworkTraversal.CommunicationIceServer CommunicationIceServer(System.Collections.Generic.IEnumerable<string> urls = null, string username = null, string credential = null, Azure.Communication.NetworkTraversal.RouteType routeType = default(Azure.Communication.NetworkTraversal.RouteType)) { throw null; }
3738
public static Azure.Communication.NetworkTraversal.CommunicationRelayConfiguration CommunicationRelayConfiguration(System.DateTimeOffset expiresOn = default(System.DateTimeOffset), System.Collections.Generic.IEnumerable<Azure.Communication.NetworkTraversal.CommunicationIceServer> iceServers = null) { throw null; }
3839
}
40+
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
41+
public readonly partial struct RouteType : System.IEquatable<Azure.Communication.NetworkTraversal.RouteType>
42+
{
43+
private readonly object _dummy;
44+
private readonly int _dummyPrimitive;
45+
public RouteType(string value) { throw null; }
46+
public static Azure.Communication.NetworkTraversal.RouteType Any { get { throw null; } }
47+
public static Azure.Communication.NetworkTraversal.RouteType Nearest { get { throw null; } }
48+
public bool Equals(Azure.Communication.NetworkTraversal.RouteType other) { throw null; }
49+
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
50+
public override bool Equals(object obj) { throw null; }
51+
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
52+
public override int GetHashCode() { throw null; }
53+
public static bool operator ==(Azure.Communication.NetworkTraversal.RouteType left, Azure.Communication.NetworkTraversal.RouteType right) { throw null; }
54+
public static implicit operator Azure.Communication.NetworkTraversal.RouteType (string value) { throw null; }
55+
public static bool operator !=(Azure.Communication.NetworkTraversal.RouteType left, Azure.Communication.NetworkTraversal.RouteType right) { throw null; }
56+
public override string ToString() { throw null; }
57+
}
3958
}

sdk/communication/Azure.Communication.NetworkTraversal/samples/Sample1_CommunicationRelayClientAsync.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ foreach (CommunicationIceServer iceServer in iceServers)
5252
}
5353
Console.WriteLine($"ICE Server Username: {iceServer.Username}");
5454
Console.WriteLine($"ICE Server Credential: {iceServer.Credential}");
55+
Console.WriteLine($"Route type: {iceServer.RouteType}");
5556
}
5657
```
5758

sdk/communication/Azure.Communication.NetworkTraversal/tests/CommunicationRelayClient/CommunicationRelayClientLiveTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ public async Task GettingTurnCredentialsGeneratesTurnCredentials(AuthMethod auth
6060
}
6161

6262
[Test]
63-
[TestCase(AuthMethod.ConnectionString, TestName = "GettingTurnCredentialsWithConnectionString")]
64-
[TestCase(AuthMethod.KeyCredential, TestName = "GettingTurnCredentialsWithKeyCredential")]
65-
[TestCase(AuthMethod.TokenCredential, TestName = "GettingTurnCredentialsWithTokenCredential")]
63+
[TestCase(AuthMethod.ConnectionString, TestName = "GettingTurnCredentialsWithConnectionStringRouteType")]
64+
[TestCase(AuthMethod.KeyCredential, TestName = "GettingTurnCredentialsWithKeyCredentialRouteType")]
65+
[TestCase(AuthMethod.TokenCredential, TestName = "GettingTurnCredentialsWithTokenCredentialRouteType")]
6666
public async Task GettingTurnCredentialsGeneratesTurnCredentialsWithNearestRouteType(AuthMethod authMethod, params string[] scopes)
6767
{
6868
CommunicationRelayClient client = authMethod switch

sdk/communication/Azure.Communication.NetworkTraversal/tests/SessionRecords/CommunicationRelayClientLiveTests/GettingTurnCredentialsWithConnectionString.json

Lines changed: 20 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/communication/Azure.Communication.NetworkTraversal/tests/SessionRecords/CommunicationRelayClientLiveTests/GettingTurnCredentialsWithConnectionStringAsync.json

Lines changed: 20 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)