Skip to content

Commit 9b48c19

Browse files
authored
Merge pull request #219338 from jasonshave/jasonshave/known-issues
Fixing several articles and adding images
2 parents a7d8130 + 12b0b76 commit 9b48c19

File tree

7 files changed

+47
-21
lines changed

7 files changed

+47
-21
lines changed

articles/communication-services/concepts/call-automation/call-automation.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ To understand which events are published for different actions, refer to [this g
144144

145145
1. Using the incorrect IdentifierType for endpoints for `Transfer` requests (like using CommunicationUserIdentifier to specify a phone number) returns a 500 error instead of a 400 error code. Solution: Use the correct type, CommunicationUserIdentifier for Communication Users and PhoneNumberIdentifier for phone numbers.
146146
2. Taking a pre-call action like Answer/Reject on the original call after redirected it gives a 200 success instead of failing on 'call not found'.
147+
3. Transferring a call with more than two participants is currently not supported.
148+
4. After transferring a call, you may receive two `CallDisconnected` events and will need to handle this behavior by ignoring the duplicate.
147149

148150
## Next steps
149151

articles/communication-services/concepts/call-automation/incoming-call-notification.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,21 @@ This architecture has the following benefits:
4747

4848
To check out a sample payload for the event and to learn about other calling events published to Event Grid, check out this [guide](../../../event-grid/communication-services-voice-video-events.md#microsoftcommunicationincomingcall).
4949

50+
Below is an example of an Event Grid Webhook subscription where the event type filter is listening only to the `IncomingCall` event.
51+
52+
![Image showing IncomingCall subscription.](./media/subscribe-incoming-call-event-grid.png)
53+
5054
## Call routing in Call Automation or Event Grid
5155

5256
You can use [advanced filters](../../../event-grid/event-filtering.md) in your Event Grid subscription to subscribe to an `IncomingCall` notification for a specific source/destination phone number or Azure Communication Services identity and sent it to an endpoint such as a Webhook subscription. That endpoint application can then make a decision to **redirect** the call using the Call Automation SDK to another Azure Communication Services identity or to the PSTN.
5357

58+
> [!NOTE]
59+
> In many cases you will want to configure filtering in Event Grid due to the scenarios described above generating an `IncomingCall` event so that your application only receives events it should be responding to. For example, if you want to redirect an inbound PSTN call to an ACS endpoint and you don't use a filter, your Event Grid subscription will receive two `IncomingCall` events; one for the PSTN call and one for the ACS user even though you had not intended to receive the second notification. Failure to handle these scenarios using filters or some other mechanism in your application can cause infinite loops and/or other undesired behavior.
60+
61+
Below is an example of an advanced filter on an Event Grid subscription watching for the `data.to.PhoneNumber.Value` string starting with a PSTN phone number of `+18005551212.
62+
63+
![Image showing Event Grid advanced filter.](./media/event-grid-advanced-filter.png)
64+
5465
## Number assignment
5566

5667
Since the `IncomingCall` notification doesn't have a specific destination other than the Event Grid subscription you've created, you're free to associate any particular number to any endpoint in Azure Communication Services. For example, if you acquired a PSTN phone number of `+14255551212` and want to assign it to a user with an identity of `375f0e2f-e8db-4449-9bf7-2054b02e42b4` in your application, you'll maintain a mapping of that number to the identity. When an `IncomingCall` notification is sent matching the phone number in the **to** field, you'll invoke the `Redirect` API and supply the identity of the user. In other words, you maintain the number assignment within your application and route or answer calls at runtime.
45.1 KB
Loading
48.6 KB
Loading

articles/communication-services/quickstarts/call-automation/includes/callflow-for-customer-interactions-csharp.md

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ You can download the sample app from [GitHub](https://github.com/Azure-Samples/c
2121
- An Azure account with an active subscription.
2222
- Azure Communication Services resource. See [Create an Azure Communication Services resource](../../create-communication-resource.md?tabs=windows&pivots=platform-azp). Note the resource connection string for this quickstart by navigating to your resource selecting 'Keys' from the left side menu.
2323
- [Acquire a phone number for your Communication Service resource](../../telephony/get-phone-number.md?pivots=programming-language-csharp). Note the phone number you acquired for use in this quickstart.
24-
- The latest [.NET library](https://dotnet.microsoft.com/download/dotnet-core) for your operating system. .NET 6.0 or higher is recommended as this quickstart uses the minimal API feature.
24+
- The latest [.NET library](https://dotnet.microsoft.com/download/dotnet-core) for your operating system. .NET 6.0 or higher is recommended as this quickstart uses the minimal API feature.
25+
- The latest version of Visual Studio 2022 (17.4.0 or higher)
2526
- An audio file for the message you want to play in the call. This audio should be accessible via a url.
2627

2728
## Create a new C# application
@@ -38,16 +39,15 @@ In the console window of your operating system, use the `dotnet` command to crea
3839
2. Install the NuGet packages: [Azure.Communication.CallAutomation](https://dev.azure.com/azure-sdk/public/_artifacts/feed/azure-sdk-for-net/NuGet/Azure.Communication.CallAutomation/versions/) and [Azure.Messaging.EventGrid](https://dev.azure.com/azure-sdk/public/_artifacts/feed/azure-sdk-for-net/NuGet/Azure.Messaging.EventGrid/versions/) to your project.
3940
```console
4041
dotnet add <path-to-project> package Azure.Communication.CallAutomation --prerelease
41-
dotnet add <path-to-project> package Azure.Messaging.EventGrid --prerelease
42+
dotnet add <path-to-project> package Azure.Messaging.EventGrid
4243
```
43-
## Set up a public URI for the local application
44+
## Use Visual Studio Dev Tunnels for your webhook
4445

45-
In this quick-start, you'll use [Ngrok tool](https://ngrok.com/) to project a public URI to the local port so that your local application can be visited by the internet. The public URI is needed to receive the Event Grid `IncomingCall` event and Call Automation events using webhooks.
46+
In this quick-start, you'll use the new [Visual Studio Dev Tunnels](/connectors/custom-connectors/port-tunneling) feature to obtain a public domain name so that your local application is reachable by the Call Automation platform on the Internet. The public name is needed to receive the Event Grid `IncomingCall` event and Call Automation events using webhooks.
4647

47-
First, determine the port of the .NET application. Minimal API dynamically allocates a port for the project at the time of creation. Find out the http port in <PROJECT_ROOT>\Properties\launchSettings.json.
48-
:::image type="content" source="./../media/dotnet-application-port.jpg" alt-text="Screenshot of demo application's launchsetting.json file":::
48+
If you haven't already configured your workstation, be sure to follow the steps in [this guide](/connectors/custom-connectors/port-tunneling). Once configured, your workstation will acquire a public domain name automatically allowing us to use the environment variable `["VS_TUNNEL_URL"]` as shown below.
4949

50-
Then, [install Ngrok](https://ngrok.com/download) and run Ngrok with the following command: `ngrok http <port>`. This command will create a public URI like `https://ff2f-75-155-253-232.ngrok.io/`, and it is your Ngrok Fully Qualified Domain Name(Ngrok_FQDN). Keep Ngrok running while following the rest of this quick-start.
50+
Set up your Event Grid subscription to receive the `IncomingCall` event by reading [this guide](../../../concepts/call-automation/incoming-call-notification.md).
5151

5252
## Update Program.cs
5353

@@ -69,22 +69,24 @@ using System.Text.Json.Nodes;
6969

7070
var builder = WebApplication.CreateBuilder(args);
7171

72-
var client = new CallAutomationClient("<resource_connection_string>"); //noted from pre-requisite step
73-
var callbackUriBase = "<public_url_generated_by_ngrok>";
74-
var mediaFileSource = new Uri("<url_to_media_file>"); //This URL should be public accessible and the file format should be WAV, 16KHz, Mono.
72+
var client = new CallAutomationClient("<resource_connection_string"); //noted from pre-requisite step
73+
var tunnelUrl = builder.Configuration["VS_TUNNEL_URL"]; // Visual Studio Dev Tunnel's dynamic FQDN
74+
var mediaFileSource = new Uri("<link_to_media_file>"); //This URL should be public accessible and the file format should be WAV, 16KHz, Mono.
7575
var applicationPhoneNumber = "<phone_number_acquired_as_prerequisite>";
76-
var phoneNumberToAddToCall = "<phone_number_to_add_to_call>"; //in format of +1...
76+
var phoneNumberToAddToCall = "<phone_number_to_add_to_call>"; //in E.164 format starting +...
77+
78+
Console.WriteLine($"Tunnel URL:{builder.Configuration["VS_TUNNEL_URL"]}"); // echo Tunnel URL to screen to configure Event Grid webhook
7779
7880
var app = builder.Build();
81+
7982
app.MapPost("/api/incomingCall", async (
8083
[FromBody] EventGridEvent[] eventGridEvents) =>
8184
{
8285
foreach (var eventGridEvent in eventGridEvents)
8386
{
84-
// Handle system events
8587
if (eventGridEvent.TryGetSystemEventData(out object eventData))
8688
{
87-
// Handle the subscription validation event.
89+
// Handle the webhook subscription validation event.
8890
if (eventData is SubscriptionValidationEventData subscriptionValidationEventData)
8991
{
9092
var responseData = new SubscriptionValidationResponse
@@ -97,7 +99,7 @@ app.MapPost("/api/incomingCall", async (
9799
var jsonObject = JsonNode.Parse(eventGridEvent.Data).AsObject();
98100
var callerId = (string)(jsonObject["from"]["rawId"]);
99101
var incomingCallContext = (string)jsonObject["incomingCallContext"];
100-
var callbackUri = new Uri(callbackUriBase + $"/api/calls/{Guid.NewGuid()}?callerId={callerId}");
102+
var callbackUri = new Uri(tunnelUrl + $"api/calls/{Guid.NewGuid()}?callerId={callerId}");
101103

102104
AnswerCallResult answerCallResult = await client.AnswerCallAsync(incomingCallContext, callbackUri);
103105
}
@@ -145,8 +147,14 @@ app.MapPost("/api/calls/{contextId}", async (
145147

146148
app.Run();
147149
```
148-
Replace the placeholders with the actual values in lines 12-16. In your production code, we recommend using [Secret Manager](https://learn.microsoft.com/aspnet/core/security/app-secrets) for storing sensitive information like this.
150+
Replace the placeholders with the actual values in lines 12-16. In your production code, we recommend using [Secret Manager](/aspnet/core/security/app-secrets) for storing sensitive information.
149151

150152
## Run the app
151153

152-
Open Your_Project_Name.csproj file in your project with Visual Studio, and then select Run button or press F5 on your keyboard.
154+
Within Visual Studio select the Run button or press F5 on your keyboard. You should have a dynamic FQDN echoed to the screen as per the above `Console.WriteLine()` command above. Use this FQDN to now configure your Event Grid webhook subscription to receive the inbound call.
155+
156+
## Configure Event Grid webhook subscription
157+
158+
In order to receive the `IncomingCall` event for the inbound PSTN call, you must configure an Event Grid subscription as described in this [concepts guide](../../../concepts/call-automation/incoming-call-notification.md). The most important thing to remember is that an Event Grid webhook subscription must be validated against a working web server. Since you've started the project in the previous step, and you have a public FQDN, set the webhook address in your subscription to the Dev Tunnel obtained by Visual Studio plus the path to your POST endpoint (i.e. `https://<dev_tunnel_fqdn>/api/incomingCall`).
159+
160+
Once your webhook subscription has been validated, it will show up in the portal and you're now ready to test your application by making an inbound call.

articles/communication-services/quickstarts/call-automation/includes/redirect-inbound-telephony-calls-csharp.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ ms.author: askaur
1717
- A deployed [Communication Service resource](../../create-communication-resource.md) and valid connection string found by selecting Keys in left side menu on Azure portal.
1818
- [Acquire a PSTN phone number from the Communication Service resource](../../telephony/get-phone-number.md). Note the phone number you acquired to use in this quickstart.
1919
- The latest [.NET library](https://dotnet.microsoft.com/download/dotnet-core) for your operating system.
20+
- The latest version of Visual Studio 2022 (17.4.0 or higher).
21+
- An Azure Event Grid subscription to receive the `IncomingCall` event.
2022

2123
## Create a new C# application
2224

@@ -36,13 +38,13 @@ dotnet add <path-to-project> package Azure.Communication.CallAutomation --prerel
3638
dotnet add <path-to-project> package Azure.Messaging.EventGrid --prerelease
3739
```
3840

39-
## Set up a public URI for the local application
40-
In this quick-start, you'll use Ngrok tool to project a public URI to the local port so that your local application can be visited by the internet. The public URI is needed to receive the Event Grid IncomingCall event and Call Automation events using webhooks.
41+
## Use Visual Studio Dev Tunnels for your Event Grid subscription
4142

42-
First, determine the port of the .NET application. Minimal API dynamically allocates a port for the project at the time of creation. Find out the http port in <PROJECT_ROOT>\Properties\launchSettings.json.
43-
![Screenshot of demo application's launchsetting.json file.](../media/dotnet-application-port.jpg)
43+
In this quick-start, you'll use the new [Visual Studio Dev Tunnels](/connectors/custom-connectors/port-tunneling) feature to obtain a public domain name so that your local application is reachable by the Call Automation platform on the Internet. The public name is needed to receive the Event Grid `IncomingCall` event and Call Automation events using webhooks.
4444

45-
Then, install Ngrok and run Ngrok with the following command: ngrok http <replace_with_port>. This command will create a public URI like `https://ff2f-75-155-253-232.ngrok.io/`, and it is your Ngrok Fully Qualified Domain Name(Ngrok_FQDN). Keep Ngrok running while following the rest of this quick-start.
45+
If you haven't already configured your workstation, be sure to follow the steps in [this guide](/connectors/custom-connectors/port-tunneling). Once configured, your workstation will acquire a public domain name automatically allowing us to use the environment variable `["VS_TUNNEL_URL"]` as shown below.
46+
47+
Set up your Event Grid subscription to receive the `IncomingCall` event by reading [this guide](../../../concepts/call-automation/incoming-call-notification.md).
4648

4749
## Configure Program.cs to redirect the call
4850

@@ -61,6 +63,8 @@ var builder = WebApplication.CreateBuilder(args);
6163

6264
var client = new CallAutomationClient("<resource_connection_string_obtained_in_pre-requisites>");
6365

66+
Console.WriteLine($"Tunnel URL:{builder.Configuration["VS_TUNNEL_URL"]}"); // echo Tunnel URL to screen to configure Event Grid webhook
67+
6468
var app = builder.Build();
6569

6670
app.MapPost("/api/incomingCall", async (

articles/communication-services/quickstarts/call-automation/includes/redirect-inbound-telephony-calls-java.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ ms.author: askaur
1818
- [Acquire a PSTN phone number from the Communication Service resource](../../telephony/get-phone-number.md). Note the phone number you acquired to use in this quickstart.
1919
- [Java Development Kit (JDK)](/java/azure/jdk/?preserve-view=true&view=azure-java-stable) version 8 or above.
2020
- [Apache Maven](https://maven.apache.org/download.cgi).
21+
- An Azure Event Grid subscription to receive the `IncomingCall` event.
2122

2223
## Create a new Java Spring application
2324

0 commit comments

Comments
 (0)