Skip to content

Commit e8c50cb

Browse files
committed
edit pass: communication-services-telephony
1 parent 1d256ff commit e8c50cb

File tree

6 files changed

+118
-139
lines changed

6 files changed

+118
-139
lines changed
Lines changed: 31 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: include file
3-
description: A quickstart on how to use Number Management C# SDK to configure direct routing.
3+
description: Learn how to use the Number Management C# SDK to configure direct routing.
44
services: azure-communication-services
55
author: boris-bazilevskiy
66

@@ -16,24 +16,27 @@ ms.author: nikuklic
1616

1717
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
1818
- An active Communication Services resource and connection string. [Create a Communication Services resource](../../create-communication-resource.md).
19-
- The latest version [.NET Core client library](https://dotnet.microsoft.com/download/dotnet-core) for your operating system.
20-
- Fully Qualified Domain Name (FQDN) and port number of a Session Border Controller (SBC) in operational telephony system.
21-
- [Verified domain name](../../../how-tos/telephony/domain-validation.md) of the SBC FQDN.
19+
- The latest version of the [.NET Core client library](https://dotnet.microsoft.com/download/dotnet-core) for your operating system.
20+
- The fully qualified domain name (FQDN) and port number of a session border controller (SBC) in an operational telephony system.
21+
- The [verified domain name](../../../how-tos/telephony/domain-validation.md) of the SBC FQDN.
2222

2323
## Final code
2424

25-
Find the finalized code for this quickstart on [GitHub](https://github.com/Azure-Samples/communication-services-dotnet-quickstarts/tree/main/DirectRouting)
25+
Find the finalized code for this quickstart on [GitHub](https://github.com/Azure-Samples/communication-services-dotnet-quickstarts/tree/main/DirectRouting).
2626

27-
## Create a new C# application
27+
You can also find more usage examples for `SipRoutingClient` on [GitHub](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/communication/Azure.Communication.PhoneNumbers/README.md#siproutingclient).
2828

29-
In a console window (such as cmd, PowerShell, or Bash), use the `dotnet new` command to create a new console app.
29+
## Create a C# application
30+
31+
In a console window (such as Command Prompt, PowerShell, or Bash), use the `dotnet new` command to create a new console app:
3032

3133
```console
3234
dotnet new console -o DirectRoutingQuickstart
3335
```
3436

35-
This command creates a simple "Hello World" C# project with a single source file: **Program.cs**.
36-
Change your directory to the newly created app folder and use the dotnet build command to compile your application.
37+
This command creates a simple "Hello World" C# project with a single source file: *Program.cs*.
38+
39+
Change your directory to the newly created app folder, and use the `dotnet build` command to compile your application:
3740

3841
``` console
3942
cd DirectRoutingQuickstart
@@ -42,39 +45,35 @@ Change your directory to the newly created app folder and use the dotnet build c
4245

4346
## Install the package
4447

45-
While still in the application directory, install the Azure Communication PhoneNumbers client library for .NET package by using the dotnet add package command.
48+
While you're still in the application directory, install the Azure Communication PhoneNumbers client library for .NET package by using the `dotnet add package` command:
4649

4750
``` console
4851
dotnet add package Azure.Communication.PhoneNumbers --version 1.1.0
4952
```
5053

51-
Add a using directive to the top of **Program.cs** to include the namespaces.
54+
Add a `using` directive to the top of *Program.cs* to include the namespaces:
5255

5356
``` csharp
5457
using Azure.Communication.PhoneNumbers.SipRouting;
5558
```
5659

5760
## Authenticate the client
5861

59-
Phone Number clients can be authenticated using [connection string from an Azure Communication Services resource](../../create-communication-resource.md#access-your-connection-strings-and-service-endpoints).
62+
Authenticate phone number clients by using a [connection string from an Azure Communication Services resource](../../create-communication-resource.md#access-your-connection-strings-and-service-endpoints):
6063

6164
``` csharp
62-
// Get a connection string to our Azure Communication Services resource.
65+
// Get a connection string to the Azure Communication Services resource.
6366
var connectionString = "<connection_string>";
6467
var client = new SipRoutingClient(connectionString);
6568
```
6669

67-
## Setup direct routing configuration
70+
## Set up a direct routing configuration
6871

69-
Direct routing configuration consists of:
72+
In the [prerequisites](#prerequisites), you verified domain ownership. The next steps are to create trunks (add SBCs) and create voice routes.
7073

71-
1. Domain ownership verification - see [prerequisites](#prerequisites)
72-
1. Creating trunks (adding SBCs)
73-
1. Creating voice routes
74+
### Create or update trunks
7475

75-
### Create or update Trunks
76-
77-
Azure Communication Services direct routing allows communication with registered SBCs only. To register an SBC you need its FQDN and port.
76+
Azure Communication Services direct routing allows communication with registered SBCs only. To register an SBC, you need its FQDN and port:
7877

7978
``` csharp
8079
// Register your SBCs by providing their fully qualified domain names and port numbers.
@@ -90,10 +89,11 @@ await client.SetTrunksAsync(new List<SipTrunk> { usTrunk, euTrunk });
9089

9190
### Create or update routes
9291

93-
> [!NOTE]
94-
> Order of routes does matter, as it determines priority of routes. The first route that matches the regex will be picked for a call.
92+
Provide routing rules for outbound calls. Each rule consists of two parts: a regex pattern that should match a dialed phone number, and the FQDN of a registered trunk where the call is routed.
93+
94+
The order of routes determines the priority of routes. The first route that matches the regex will be picked for a call.
9595

96-
For outbound calling routing rules should be provided. Each rule consists of two parts: regex pattern that should match dialed phone number and FQDN of a registered trunk where call is routed. In this example, we create one route for numbers that start with `+1` and a second route for numbers that start with just `+`
96+
In this example, you create one route for numbers that start with `+1` and a second route for numbers that start with just `+`:
9797

9898
``` csharp
9999
var usRoute = new SipTrunkRoute("UsRoute", "^\\+1(\\d{10})$", trunks: new List<string> { usSbcFqdn });
@@ -102,37 +102,31 @@ var defaultRoute = new SipTrunkRoute("DefaultRoute", "^\\+\\d+$", trunks: new Li
102102
await client.SetRoutesAsync(new List<SipTrunkRoute> { usRoute, defaultRoute });
103103
```
104104

105-
### Updating existing configuration
105+
## Update a direct routing configuration
106106

107-
Properties of specific Trunk can be updated by overwriting the record with the same FQDN. For example, you can set new SBC Port value.
107+
You can update the properties of a specific trunk by overwriting the record with the same FQDN. For example, you can set a new SBC port value:
108108

109109
``` csharp
110110
var usTrunk = new SipTrunk("sbc.us.contoso.com", 5063);
111111
await client.SetTrunkAsync(usTrunk);
112112
```
113113

114-
> [!IMPORTANT]
115-
>The same method is used to create and update routing rules. When updating routes, all routes should be sent in single update and routing configuration will be fully overwritten by the new one.
114+
You use the same method to create and update routing rules. When you update routes, send all of them in a single update. The new routing configuration fully overwrites the former one.
116115

117-
### Removing a direct routing configuration
116+
## Remove a direct routing configuration
118117

119-
You can't edit or remove single voice route. Entire voice routing configuration should be overwritten. Here's the example of an empty list that removes all the routes and trunks:
118+
You can't edit or remove a single voice route. You should overwrite the entire voice routing configuration. Here's an example of an empty list that removes all the routes and trunks:
120119

121120
``` csharp
122121
//delete all configured voice routes
123122
await client.SetRoutesAsync(new List<SipTrunkRoute>());
124123

125124
//delete all trunks
126125
await client.SetTrunksAsync(new List<SipTrunk>());
127-
```
126+
```
128127

129-
You can delete a single trunk (SBC), if it isn't used in any voice route. If SBC is listed in any voice route, that route should be deleted first.
128+
You can use the following example to delete a single trunk (SBC), if no voice routes are using it. If the SBC is listed in any voice route, delete that route first.
130129

131130
``` csharp
132131
await client.DeleteTrunkAsync("sbc.us.contoso.com");
133132
```
134-
135-
<!-- All direct routing configuration can be deleted by overriding routes and trunks configuration with a new configuration or an empty list. Same methods are used in "Create or Update Trunks" and "Create or Update Routes" sections. -->
136-
137-
> [!NOTE]
138-
> More usage examples for SipRoutingClient can be found [here](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/communication/Azure.Communication.PhoneNumbers/README.md#siproutingclient).
Lines changed: 41 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: include file
3-
description: A quickstart on how to use Number Management Java SDK to configure direct routing.
3+
description: Learn how to use the Number Management Java SDK to configure direct routing.
44
services: azure-communication-services
55
author: boris-bazilevskiy
66

@@ -15,31 +15,31 @@ ms.author: nikuklic
1515
## Prerequisites
1616

1717
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
18-
- [Java Development Kit (JDK)](/java/azure/jdk/?preserve-view=true&view=azure-java-stable) version 8 or above.
18+
- [Java Development Kit (JDK)](/java/azure/jdk/?preserve-view=true&view=azure-java-stable) version 8 or later.
1919
- [Apache Maven](https://maven.apache.org/download.cgi).
2020
- A deployed Communication Services resource and connection string. [Create a Communication Services resource](../../create-communication-resource.md).
21-
- Fully Qualified Domain Name (FQDN) and port number of a Session Border Controller (SBC) in operational telephony system.
22-
- [Verified domain name](../../../how-tos/telephony/domain-validation.md) of the SBC FQDN.
21+
- The fully qualified domain name (FQDN) and port number of a session border controller (SBC) in an operational telephony system.
22+
- The [verified domain name](../../../how-tos/telephony/domain-validation.md) of the SBC FQDN.
2323

2424
## Final code
2525

26-
Find the finalized code for this quickstart on [GitHub](https://github.com/Azure-Samples/communication-services-java-quickstarts/tree/main/DirectRouting)
26+
Find the finalized code for this quickstart on [GitHub](https://github.com/Azure-Samples/communication-services-java-quickstarts/tree/main/DirectRouting).
2727

28-
## Setting Up
28+
You can also find more usage examples for `SipRoutingClient` on [GitHub](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/communication/azure-communication-phonenumbers/src/samples/java/com/azure/communication/phonenumbers/siprouting/AsyncClientJavaDocCodeSnippets.java).
2929

30-
### Create a new Java application
30+
## Create a Java application
3131

32-
Open your terminal or command window. Navigate to the directory where you'd like to create your Java application. Run the command to generate the Java project from the maven-archetype-quickstart template.
32+
Open your terminal or command window. Go to the directory where you want to create your Java application. Then, run the command to generate the Java project from the *maven-archetype-quickstart* template:
3333

3434
```console
3535
mvn archetype:generate -DgroupId=com.communication.quickstart -DartifactId=communication-quickstart -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false
3636
```
3737

38-
You notice that the 'generate' task created a directory with the same name as the `artifactId`. Under this directory, the src/main/java directory contains the project source code, the `src/test/java directory` contains the test source, and the **pom.xml** file is the project's Project Object Model, or POM.
38+
The `generate` task created a directory with the same name as the `artifactId` value. Under this directory, the *src/main/java* directory contains the project source code, the *src/test/java* directory contains the test source, and the *pom.xml* file is the project's Project Object Model, or POM.
3939

40-
### Install the package
40+
## Install the package
4141

42-
Open the **pom.xml** file in your text editor. Add the following dependency elements to the group of dependencies.
42+
Open the *pom.xml* file in your text editor. Add the following dependency elements to the group of dependencies:
4343

4444
```xml
4545
<dependencies>
@@ -51,14 +51,14 @@ Open the **pom.xml** file in your text editor. Add the following dependency elem
5151
</dependencies>
5252
```
5353

54-
### Set up the app framework
54+
## Set up the app framework
5555

5656
From the project directory:
5757

58-
1. Navigate to the */src/main/java/com/communication/quickstart* directory
59-
1. Open the **App.java** file in your editor
58+
1. Go to the */src/main/java/com/communication/quickstart* directory.
59+
1. Open the *App.java* file in your editor.
6060
1. Replace the `System.out.println("Hello world!");` statement
61-
1. Add `import` directives
61+
1. Add `import` directives.
6262

6363
Use the following code to begin:
6464

@@ -81,7 +81,7 @@ public class App
8181

8282
## Authenticate the client
8383

84-
The SipRoutingClientBuilder is enabled to use Azure Active Directory Authentication
84+
With `SipRoutingClientBuilder`, you can use Azure Active Directory authentication:
8585

8686
```java
8787
// You can find your endpoint and access key from your resource in the Azure portal
@@ -93,7 +93,7 @@ SipRoutingAsyncClient sipRoutingAsyncClient = new SipRoutingClientBuilder()
9393
.buildClient();
9494
```
9595

96-
Alternatively, use the endpoint and access key from the communication resource to authenticate.
96+
Alternatively, use the endpoint and access key from the communication resource to authenticate:
9797

9898
```java
9999
// You can find your connection string from your resource in the Azure portal
@@ -104,17 +104,13 @@ SipRoutingAsyncClient sipRoutingAsyncClient = new SipRoutingClientBuilder()
104104
.buildClient();
105105
```
106106

107-
## Setup direct routing configuration
107+
## Set up a direct routing configuration
108108

109-
Direct routing configuration consists of:
109+
In the [prerequisites](#prerequisites), you verified domain ownership. The next steps are to create trunks (add SBCs) and create voice routes.
110110

111-
- Domain ownership verification - see [prerequisites](#prerequisites)
112-
- Creating trunks (adding SBCs)
113-
- Creating voice routes
111+
### Create or update trunks
114112

115-
### Create or Update Trunks
116-
117-
Azure Communication Services direct routing allows communication with registered SBCs only. To register an SBC, you need its FQDN and port.
113+
Azure Communication Services direct routing allows communication with registered SBCs only. To register an SBC, you need its FQDN and port:
118114

119115
```java
120116
sipRoutingAsyncClient.setTrunksWithResponse(asList(
@@ -123,12 +119,13 @@ sipRoutingAsyncClient.setTrunksWithResponse(asList(
123119
)).block();
124120
```
125121

126-
### Create or Update Routes
122+
### Create or update routes
123+
124+
Provide routing rules for outbound calls. Each rule consists of two parts: a regex pattern that should match a dialed phone number, and the FQDN of a registered trunk where the call is routed.
127125

128-
> [!NOTE]
129-
> Order of routes does matter, as it determines priority of routes. The first route that matches the regex will be picked for a call.
126+
The order of routes determines the priority of routes. The first route that matches the regex will be picked for a call.
130127

131-
For outbound calling routing rules should be provided. Each rule consists of two parts: regex pattern that should match dialed phone number and FQDN of a registered trunk where call is routed. In this example, we create one route for numbers that start with `+1` and a second route for numbers that start with just `+`.
128+
In this example, you create one route for numbers that start with `+1` and a second route for numbers that start with just `+`:
132129

133130
```java
134131
sipRoutingAsyncClient.setRoutes(asList(
@@ -137,29 +134,28 @@ sipRoutingAsyncClient.setRoutes(asList(
137134
)).block();
138135
```
139136

140-
### Updating existing configuration
137+
## Update a direct routing configuration
141138

142-
Properties of specific Trunk can be updated by overwriting the record with the same FQDN. For example, you can set new SBC Port value.
139+
You can update the properties of a specific trunk by overwriting the record with the same FQDN. For example, you can set a new SBC port value:
143140

144141
``` java
145142
sipRoutingClient.setTrunk(new SipTrunk("sbc.us.contoso.com", 5063));
146143
```
147144

148-
> [!IMPORTANT]
149-
>The same method is used to create and update routing rules. When updating routes, all routes should be sent in single update and routing configuration will be fully overwritten by the new one.
145+
You use the same method to create and update routing rules. When you update routes, send all of them in a single update. The new routing configuration fully overwrites the former one.
150146

151-
### Removing a direct routing configuration
147+
## Remove a direct routing configuration
152148

153-
You can't edit or remove single voice route. Entire voice routing configuration should be overwritten. Here's the example of an empty list that removes all the routes and trunks:
149+
You can't edit or remove a single voice route. You should overwrite the entire voice routing configuration. Here's an example of an empty list that removes all the routes and trunks.
154150

155-
Add 2 imports:
151+
Add two imports:
156152

157153
```java
158154
import java.util.Collections;
159155
import java.util.List;
160156
```
161157

162-
Code to Delete Direct Routing config:
158+
Use the following code to delete a direct routing configuration:
163159

164160
```java
165161
//delete all configured voice routes
@@ -173,31 +169,28 @@ List<SipTrunk> trunks = Collections.<SipTrunk> emptyList();
173169
sipRoutingAsyncClient.setTrunksWithResponse(trunks).block();
174170
```
175171

176-
You can delete a single trunk (SBC), if it isn't used in any voice route. If SBC is listed in any voice route, that route should be deleted first.
172+
You can use the following example to delete a single trunk (SBC), if no voice routes are using it. If the SBC is listed in any voice route, delete that route first.
177173

178174
``` java
179175
sipRoutingClient.deleteTrunk("sbc.us.contoso.com");
180176
```
181177

182-
### Run the code
178+
## Run the code
183179

184-
Navigate to the directory containing the **pom.xml** file and compile the project by using the following `mvn` command.
180+
Go to the directory that contains the *pom.xml* file and compile the project by using the following `mvn` command:
185181

186182
``` console
187-
mvn clean compile
183+
mvn clean compile
188184
```
189185

190-
Then, build the package.
186+
Then, build the package:
191187

192188
``` console
193-
mvn package
189+
mvn package
194190
```
195191

196-
Run the following mvn command to execute the app.
192+
Run the following `mvn` command to run the app:
197193

198194
``` console
199-
mvn exec:java -Dexec.mainClass="com.communication.quickstart.App" -Dexec.cleanupDaemonThreads=false
195+
mvn exec:java -Dexec.mainClass="com.communication.quickstart.App" -Dexec.cleanupDaemonThreads=false
200196
```
201-
202-
> [!NOTE]
203-
> More usage examples for SipRoutingClient can be found [here](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/communication/azure-communication-phonenumbers/src/samples/java/com/azure/communication/phonenumbers/siprouting/AsyncClientJavaDocCodeSnippets.java).

0 commit comments

Comments
 (0)