-
Notifications
You must be signed in to change notification settings - Fork 143
Multiple Dialouts(Move Participants) Sample - From New branch #225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
v-kuppu
wants to merge
3
commits into
main
Choose a base branch
from
users/v-kuppu/MultipleDialoutsSample
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
| ||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.12.35728.132 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MoveParticipantsSample", "MoveParticipantsSample\MoveParticipantsSample.csproj", "{006A8CF2-660F-CD4C-D92F-23DF7129C899}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{006A8CF2-660F-CD4C-D92F-23DF7129C899}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{006A8CF2-660F-CD4C-D92F-23DF7129C899}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{006A8CF2-660F-CD4C-D92F-23DF7129C899}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{006A8CF2-660F-CD4C-D92F-23DF7129C899}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {99998281-4DF2-4536-B2AD-266FB84E2025} | ||
EndGlobalSection | ||
EndGlobal |
15 changes: 15 additions & 0 deletions
15
MoveParticipantsSample/MoveParticipantsSample/ConfigurationRequest.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace MoveParticipantsSample | ||
{ | ||
public class ConfigurationRequest | ||
{ | ||
public string AcsConnectionString { get; set; } = string.Empty; | ||
public string AcsPhoneNumber { get; set; } = string.Empty; | ||
// public string CongnitiveServiceEndpoint { get; set; } = string.Empty; | ||
public string CallbackUriHost { get; set; } = string.Empty; | ||
public string AcsInboundSender { get; set; } = string.Empty; | ||
//public string User2 { get; set; } = string.Empty; | ||
//public string User3 { get; set; } = string.Empty; | ||
//public string ACSUserIdentity2 { get; set; } = string.Empty; | ||
//public string ACSUserIdentity3 { get; set; } = string.Empty; | ||
} | ||
} |
100 changes: 100 additions & 0 deletions
100
MoveParticipantsSample/MoveParticipantsSample/Helper.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
using Azure.Communication.CallAutomation; | ||
using System.Net.WebSockets; | ||
using System.Text; | ||
using System.Text.Json; | ||
|
||
namespace MoveParticipantsSample | ||
{ | ||
public static class Helper | ||
{ | ||
public static async Task ProcessRequest(WebSocket webSocket) | ||
{ | ||
try | ||
{ | ||
var buffer = new byte[1024 * 4]; | ||
var cancellationToken = new CancellationTokenSource(TimeSpan.FromSeconds(60)).Token; | ||
WebSocketReceiveResult receiveResult = await webSocket.ReceiveAsync(new ArraySegment<byte>(buffer), cancellationToken); | ||
|
||
while (!receiveResult.CloseStatus.HasValue) | ||
{ | ||
string msg = Encoding.UTF8.GetString(buffer, 0, receiveResult.Count); | ||
|
||
var response = StreamingData.Parse(msg); | ||
|
||
if (response != null) | ||
{ | ||
if (response is AudioMetadata audioMetadata) | ||
{ | ||
Console.WriteLine("***************************************************************************************"); | ||
Console.WriteLine("MEDIA SUBSCRIPTION ID-->" + audioMetadata.MediaSubscriptionId); | ||
Console.WriteLine("ENCODING-->" + audioMetadata.Encoding); | ||
Console.WriteLine("SAMPLE RATE-->" + audioMetadata.SampleRate); | ||
Console.WriteLine("CHANNELS-->" + audioMetadata.Channels); | ||
//Console.WriteLine("LENGTH-->" + audioMetadata.Length); | ||
Console.WriteLine("***************************************************************************************"); | ||
} | ||
if (response is AudioData audioData) | ||
{ | ||
Console.WriteLine("***************************************************************************************"); | ||
Console.WriteLine("DATA-->" + JsonSerializer.Serialize(audioData.Data)); | ||
Console.WriteLine("TIMESTAMP-->" + audioData.Timestamp); | ||
Console.WriteLine("IS SILENT-->" + audioData.IsSilent); | ||
if (audioData.Participant != null && audioData.Participant.RawId != null) | ||
{ | ||
Console.WriteLine("Participant Id-->" + audioData.Participant.RawId); | ||
} | ||
|
||
Console.WriteLine("***************************************************************************************"); | ||
} | ||
|
||
if (response is TranscriptionMetadata transcriptionMetadata) | ||
{ | ||
Console.WriteLine("***************************************************************************************"); | ||
Console.WriteLine("TRANSCRIPTION SUBSCRIPTION ID-->" + transcriptionMetadata.TranscriptionSubscriptionId); | ||
Console.WriteLine("LOCALE-->" + transcriptionMetadata.Locale); | ||
Console.WriteLine("CALL CONNECTION ID--?" + transcriptionMetadata.CallConnectionId); | ||
Console.WriteLine("CORRELATION ID-->" + transcriptionMetadata.CorrelationId); | ||
Console.WriteLine("***************************************************************************************"); | ||
} | ||
if (response is TranscriptionData transcriptionData) | ||
{ | ||
Console.WriteLine("***************************************************************************************"); | ||
Console.WriteLine("TEXT-->" + transcriptionData.Text); | ||
Console.WriteLine("FORMAT-->" + transcriptionData.Format); | ||
Console.WriteLine("OFFSET-->" + transcriptionData.Offset); | ||
Console.WriteLine("DURATION-->" + transcriptionData.Duration); | ||
Console.WriteLine("PARTICIPANT-->" + transcriptionData.Participant.RawId); | ||
Console.WriteLine("CONFIDENCE-->" + transcriptionData.Confidence); | ||
Console.WriteLine("RESULT STATUS-->" + transcriptionData.ResultState); | ||
foreach (var word in transcriptionData.Words) | ||
{ | ||
Console.WriteLine("WORDS TEXT-->" + word.Text); | ||
Console.WriteLine("WORDS OFFSET-->" + word.Offset); | ||
Console.WriteLine("WORDS DURATION-->" + word.Duration); | ||
} | ||
Console.WriteLine("***************************************************************************************"); | ||
} | ||
} | ||
|
||
await webSocket.SendAsync( | ||
new ArraySegment<byte>(buffer, 0, receiveResult.Count), | ||
receiveResult.MessageType, | ||
receiveResult.EndOfMessage, | ||
CancellationToken.None); | ||
|
||
receiveResult = await webSocket.ReceiveAsync( | ||
new ArraySegment<byte>(buffer), CancellationToken.None); | ||
} | ||
|
||
await webSocket.CloseAsync(receiveResult.CloseStatus.Value, receiveResult.CloseStatusDescription, CancellationToken.None); | ||
} | ||
catch (Exception ex) | ||
{ | ||
Console.WriteLine($"Exception -> {ex}"); | ||
} | ||
finally | ||
{ | ||
} | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
MoveParticipantsSample/MoveParticipantsSample/MoveParticipantsSample.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Compile Remove="Program1.cs" /> | ||
<Compile Remove="Program20250703.cs" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<!--<PackageReference Include="Azure.Communication.CallAutomation" Version="1.2.0-alpha.20250214.1" />--> | ||
<PackageReference Include="Azure.Communication.CallAutomation" Version="1.5.0-alpha.20250604.1" /> | ||
<PackageReference Include="Azure.Messaging.EventGrid" Version="4.31.0-alpha.20250513.1" /> | ||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" /> | ||
</ItemGroup> | ||
</Project> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.