diff --git a/CallAutomation_Beta6_Test_sample/CallAutomation_Beta6_Test_sample.csproj b/CallAutomation_Beta6_Test_sample/CallAutomation_Beta6_Test_sample.csproj
new file mode 100644
index 00000000..3a12e8a5
--- /dev/null
+++ b/CallAutomation_Beta6_Test_sample/CallAutomation_Beta6_Test_sample.csproj
@@ -0,0 +1,23 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
+ ..\..\..\SDK\azure-sdk-for-net\artifacts\bin\Azure.Communication.CallAutomation\Debug\netstandard2.0\Azure.Communication.CallAutomation.dll
+
+
+ ..\..\..\SDK\azure-sdk-for-net\artifacts\bin\Azure.Communication.Common\Debug\netstandard2.0\Azure.Communication.Common.dll
+
+
+
+
diff --git a/CallAutomation_Beta6_Test_sample/CallAutomation_Beta6_Test_sample.sln b/CallAutomation_Beta6_Test_sample/CallAutomation_Beta6_Test_sample.sln
new file mode 100644
index 00000000..23389da8
--- /dev/null
+++ b/CallAutomation_Beta6_Test_sample/CallAutomation_Beta6_Test_sample.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.13.35913.81 d17.13
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CallAutomation_Beta6_Test_sample", "CallAutomation_Beta6_Test_sample.csproj", "{F12FD9EE-4816-40A6-94EA-3DF5075E42E7}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {F12FD9EE-4816-40A6-94EA-3DF5075E42E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F12FD9EE-4816-40A6-94EA-3DF5075E42E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F12FD9EE-4816-40A6-94EA-3DF5075E42E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F12FD9EE-4816-40A6-94EA-3DF5075E42E7}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {069D5CC6-E42C-4791-BCF3-7138896EDD10}
+ EndGlobalSection
+EndGlobal
diff --git a/CallAutomation_Beta6_Test_sample/ConfigurationRequest.cs b/CallAutomation_Beta6_Test_sample/ConfigurationRequest.cs
new file mode 100644
index 00000000..d8e53084
--- /dev/null
+++ b/CallAutomation_Beta6_Test_sample/ConfigurationRequest.cs
@@ -0,0 +1,10 @@
+namespace CallAutomation_Beta6_Test_sample
+{
+ 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;
+ }
+}
\ No newline at end of file
diff --git a/CallAutomation_Beta6_Test_sample/Helper.cs b/CallAutomation_Beta6_Test_sample/Helper.cs
new file mode 100644
index 00000000..7c091a73
--- /dev/null
+++ b/CallAutomation_Beta6_Test_sample/Helper.cs
@@ -0,0 +1,117 @@
+using Azure.Communication.CallAutomation;
+using System.Net.WebSockets;
+using System.Text;
+using System.Text.Json;
+
+namespace CallAutomation_Beta6_Test_sample
+{
+ 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(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("***************************************************************************************");
+ }
+ 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).Contains("87123"))
+ //&& !(audioData.Participant.RawId).Contains("2f6f-45f7-3a3a0d009a2d"))
+ {
+ Console.WriteLine("Participant Id-->" + audioData.Participant.RawId);
+ }
+
+ Console.WriteLine("***************************************************************************************");
+ }
+
+ //if (response is DtmfData dtmfData)
+ //{
+ // Console.WriteLine("***************************************************************************************");
+ // Console.WriteLine("DATA-->" + dtmfData.Data);
+ // Console.WriteLine("TIMESTAMP-->" + dtmfData.Timestamp);
+ // if (dtmfData.Participant != null && dtmfData.Participant.RawId != null)
+ // {
+ // Console.WriteLine("Participant Id-->" + dtmfData.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);
+
+ if (transcriptionData.Words != null)
+ {
+
+ 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(buffer, 0, receiveResult.Count),
+ receiveResult.MessageType,
+ receiveResult.EndOfMessage,
+ CancellationToken.None);
+
+ receiveResult = await webSocket.ReceiveAsync(
+ new ArraySegment(buffer), CancellationToken.None);
+ }
+
+ await webSocket.CloseAsync(receiveResult.CloseStatus.Value, receiveResult.CloseStatusDescription, CancellationToken.None);
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"Exception -> {ex}");
+ }
+ finally
+ {
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/CallAutomation_Beta6_Test_sample/Program.cs b/CallAutomation_Beta6_Test_sample/Program.cs
new file mode 100644
index 00000000..3dfd22f9
--- /dev/null
+++ b/CallAutomation_Beta6_Test_sample/Program.cs
@@ -0,0 +1,3618 @@
+using Azure.Communication;
+using Azure.Communication.CallAutomation;
+using Azure.Messaging;
+using Azure.Messaging.EventGrid;
+using Azure.Messaging.EventGrid.SystemEvents;
+using CallAutomation_Beta6_Test_sample;
+using Microsoft.Extensions.FileProviders;
+using System.Buffers.Text;
+using System.Text;
+using static System.Net.WebRequestMethods;
+using static System.Runtime.InteropServices.JavaScript.JSType;
+
+var builder = WebApplication.CreateBuilder(args);
+
+builder.Services.AddControllers();
+builder.Services.AddEndpointsApiExplorer();
+builder.Services.AddSwaggerGen();
+var app = builder.Build();
+
+app.UseSwagger();
+app.UseSwaggerUI();
+
+string acsConnectionString = "";
+string cognitiveServicesEndpoint = "";
+string acsPhoneNumber = "";
+
+string callbackUriHost = "https://bvm9l0s9.inc1.devtunnels.ms:8081";
+string fileSourceUri = "https://pixabay.com/sound-effects/countdown-from-10-190389/";
+
+string callConnectionId = string.Empty;
+string recordingId = string.Empty;
+string recordingLocation = string.Empty;
+string metadataLocation = string.Empty;
+string recordingFileFormat = string.Empty;
+Uri eventCallbackUri = null!;
+string callerId = string.Empty;
+string roomCallId = string.Empty;
+ConfigurationRequest configuration = new();
+CallAutomationClient client = new CallAutomationClient(new Uri("https://uswe-03.sdf.pma.teams.microsoft.com"), connectionString: acsConnectionString);
+//CallAutomationClient client = new CallAutomationClient(connectionString: acsConnectionString);
+
+app.MapPost("/api/incomingCall", async (EventGridEvent[] eventGridEvents, ILogger logger) =>
+{
+ foreach (var eventGridEvent in eventGridEvents)
+ {
+ logger.LogInformation($"Recording event received:{eventGridEvent.EventType}");
+ if (eventGridEvent.TryGetSystemEventData(out object eventData))
+ {
+ if (eventData is SubscriptionValidationEventData subscriptionValidationEventData)
+ {
+ var responseData = new SubscriptionValidationResponse
+ {
+ ValidationResponse = subscriptionValidationEventData.ValidationCode
+ };
+ return Results.Ok(responseData);
+ }
+ if (eventData is AcsIncomingCallEventData incomingCallEventData)
+ {
+ callerId = incomingCallEventData.FromCommunicationIdentifier.RawId;
+ Console.WriteLine("Caller Id--> " + callerId);
+ var callbackUri = new Uri(new Uri(callbackUriHost), $"/api/callbacks");
+ logger.LogInformation($"Incoming call - correlationId: {incomingCallEventData.CorrelationId}, " +
+ $"Callback url: {callbackUri}");
+
+ eventCallbackUri = callbackUri;
+ var websocketUri = callbackUriHost.Replace("https", "wss") + "/ws";
+ var mediaStreamingOptions = new MediaStreamingOptions(
+ MediaStreamingAudioChannel.Unmixed, StreamingTransport.Websocket)
+ {
+ StartMediaStreaming = false,
+ TransportUri = new Uri(websocketUri),
+ MediaStreamingContent = MediaStreamingContent.Audio,
+ };
+ TranscriptionOptions transcriptionOptions = new TranscriptionOptions("en-us", StreamingTransport.Websocket)
+ {
+ StartTranscription = false,
+ TransportUri = new Uri(websocketUri)
+ };
+ var options = new AnswerCallOptions(incomingCallEventData.IncomingCallContext, callbackUri)
+ {
+ //CallIntelligenceOptions = new CallIntelligenceOptions() { CognitiveServicesEndpoint = new Uri(cognitiveServicesEndpoint) },
+ //IsLoopbackAudioEnabled = true,
+ //MediaStreamingOptions = mediaStreamingOptions,
+ //TranscriptionOptions = transcriptionOptions
+ };
+
+ AnswerCallResult answerCallResult = await client.AnswerCallAsync(options);
+ var callConnectionMedia = answerCallResult.CallConnection.GetCallMedia();
+
+ }
+ if (eventData is AcsRecordingFileStatusUpdatedEventData statusUpdated)
+ {
+ recordingLocation = statusUpdated.RecordingStorageInfo.RecordingChunks[0].ContentLocation;
+ metadataLocation = statusUpdated.RecordingStorageInfo.RecordingChunks[0].MetadataLocation;
+ logger.LogInformation($"The recording location is : {recordingLocation}");
+ logger.LogInformation($"The recording metadata location is : {metadataLocation}");
+ }
+ }
+ }
+ return Results.Ok();
+});
+
+app.MapPost("/api/callbacks", (CloudEvent[] cloudEvents, ILogger logger) =>
+{
+ foreach (var cloudEvent in cloudEvents)
+ {
+ CallAutomationEventBase parsedEvent = CallAutomationEventParser.Parse(cloudEvent);
+ logger.LogInformation(
+ "Received call event: {type}, callConnectionID: {connId}, serverCallId: {serverId}",
+ parsedEvent.GetType(),
+ parsedEvent.CallConnectionId,
+ parsedEvent.ServerCallId);
+ callConnectionId = parsedEvent.CallConnectionId;
+ if (parsedEvent is CallConnected callConnected)
+ {
+ logger.LogInformation($"Received call event: {callConnected.GetType()}");
+ callConnectionId = callConnected.CallConnectionId;
+ CallConnectionProperties callConnectionProperties = GetCallConnectionProperties();
+ logger.LogInformation("************************************************************");
+ logger.LogInformation($"CORRELATION ID: {callConnectionProperties.CorrelationId}");
+ logger.LogInformation($"CALL CONNECTION ID: {callConnectionProperties.CallConnectionId}");
+ logger.LogInformation("************************************************************");
+ }
+ else if (parsedEvent is ConnectFailed connectFailed)
+ {
+ callConnectionId = connectFailed.CallConnectionId;
+ logger.LogInformation($"Received call event: {connectFailed.GetType()}, CorrelationId: {connectFailed.CorrelationId}, " +
+ $"subCode: {connectFailed.ResultInformation?.SubCode}, message: {connectFailed.ResultInformation?.Message}, context: {connectFailed.OperationContext}");
+ }
+ else if (parsedEvent is RecognizeCompleted recognizeCompleted)
+ {
+ logger.LogInformation($"Received call event: {recognizeCompleted.GetType()}");
+ callConnectionId = recognizeCompleted.CallConnectionId;
+
+ switch (recognizeCompleted.RecognizeResult)
+ {
+ case DtmfResult dtmfResult:
+ var tones = dtmfResult.Tones;
+ logger.LogInformation("Recognize completed successfully, tones={tones}", tones);
+ break;
+ case ChoiceResult choiceResult:
+ var labelDetected = choiceResult.Label;
+ var phraseDetected = choiceResult.RecognizedPhrase;
+ //var languageIdentified = choiceResult.LanguageIdentified;
+ //var sentimentAnalysisResult = choiceResult.SentimentAnalysisResult.Sentiment;
+ //logger.LogInformation("Recognize completed successfully, labelDetected={labelDetected}, phraseDetected={phraseDetected}", labelDetected, phraseDetected);
+ //logger.LogInformation("Recognize Language Identified: {languageIdentified}", languageIdentified);
+ //logger.LogInformation("Recognize Sentiment Analysis: {sentimentAnalysisResult}", sentimentAnalysisResult);
+ break;
+ case SpeechResult speechResult:
+ var text = speechResult.Speech;
+ //var identifiedLanguage = speechResult.LanguageIdentified;
+ //var sentimentAnalysis = speechResult.SentimentAnalysisResult.Sentiment;
+ logger.LogInformation("Recognize completed successfully, text={text}", text);
+ //logger.LogInformation("Recognize Language Identified: {identifiedLanguage}", identifiedLanguage);
+ //logger.LogInformation("Recognize Sentiment Analysis: {sentimentAnalysis}", sentimentAnalysis);
+ break;
+ default:
+ logger.LogInformation("Recognize completed successfully, recognizeResult={recognizeResult}", recognizeCompleted.RecognizeResult);
+ break;
+ }
+ }
+ else if (parsedEvent is RecognizeFailed recognizeFailed)
+ {
+ callConnectionId = recognizeFailed.CallConnectionId;
+ logger.LogInformation($"Received call event: {recognizeFailed.GetType()}, CorrelationId: {recognizeFailed.CorrelationId}, " +
+ $"subCode: {recognizeFailed.ResultInformation?.SubCode}, message: {recognizeFailed.ResultInformation?.Message}, context: {recognizeFailed.OperationContext}");
+ }
+ else if (parsedEvent is PlayCompleted playCompleted)
+ {
+ logger.LogInformation($"Received call event: {playCompleted.GetType()}");
+ callConnectionId = playCompleted.CallConnectionId;
+ }
+ else if (parsedEvent is PlayFailed playFailed)
+ {
+ callConnectionId = playFailed.CallConnectionId;
+ logger.LogInformation($"Received call event: {playFailed.GetType()}, CorrelationId: {playFailed.CorrelationId}, " +
+ $"subCode: {playFailed.ResultInformation?.SubCode}, message: {playFailed.ResultInformation?.Message}, context: {playFailed.OperationContext}");
+ }
+ else if (parsedEvent is PlayCanceled playCanceled)
+ {
+ logger.LogInformation($"Received call event: {playCanceled.GetType()}");
+ callConnectionId = playCanceled.CallConnectionId;
+ }
+ else if (parsedEvent is RecognizeCanceled recognizeCanceled)
+ {
+ logger.LogInformation($"Received call event: {recognizeCanceled.GetType()}");
+ callConnectionId = recognizeCanceled.CallConnectionId;
+ }
+ else if (parsedEvent is AddParticipantSucceeded addParticipantSucceeded)
+ {
+ logger.LogInformation($"Received call event: {addParticipantSucceeded.GetType()}");
+ callConnectionId = addParticipantSucceeded.CallConnectionId;
+ }
+ else if (parsedEvent is AddParticipantFailed addParticipantFailed)
+ {
+ callConnectionId = addParticipantFailed.CallConnectionId;
+ logger.LogInformation($"Received call event: {addParticipantFailed.GetType()}, CorrelationId: {addParticipantFailed.CorrelationId}, " +
+ $"subCode: {addParticipantFailed.ResultInformation?.SubCode}, message: {addParticipantFailed.ResultInformation?.Message}, context: {addParticipantFailed.OperationContext}");
+ }
+ else if (parsedEvent is RemoveParticipantSucceeded removeParticipantSucceeded)
+ {
+ logger.LogInformation($"Received call event: {removeParticipantSucceeded.GetType()}");
+ callConnectionId = removeParticipantSucceeded.CallConnectionId;
+ }
+ else if (parsedEvent is RemoveParticipantFailed removeParticipantFailed)
+ {
+ callConnectionId = removeParticipantFailed.CallConnectionId;
+ logger.LogInformation($"Received call event: {removeParticipantFailed.GetType()}, CorrelationId: {removeParticipantFailed.CorrelationId}, " +
+ $"subCode: {removeParticipantFailed.ResultInformation?.SubCode}, message: {removeParticipantFailed.ResultInformation?.Message}, context: {removeParticipantFailed.OperationContext}");
+ }
+ else if (parsedEvent is CancelAddParticipantSucceeded cancelAddParticipantSucceeded)
+ {
+ logger.LogInformation($"Received call event: {cancelAddParticipantSucceeded.GetType()}");
+ callConnectionId = cancelAddParticipantSucceeded.CallConnectionId;
+ }
+ else if (parsedEvent is CancelAddParticipantFailed cancelAddParticipantFailed)
+ {
+ callConnectionId = cancelAddParticipantFailed.CallConnectionId;
+ logger.LogInformation($"Received call event: {cancelAddParticipantFailed.GetType()}, CorrelationId: {cancelAddParticipantFailed.CorrelationId}, " +
+ $"subCode: {cancelAddParticipantFailed.ResultInformation?.SubCode}, message: {cancelAddParticipantFailed.ResultInformation?.Message}, context: {cancelAddParticipantFailed.OperationContext}");
+ }
+ else if (parsedEvent is SendDtmfTonesCompleted sendDtmfTonesCompleted)
+ {
+ logger.LogInformation($"Received call event: {sendDtmfTonesCompleted.GetType()}");
+ callConnectionId = sendDtmfTonesCompleted.CallConnectionId;
+ }
+ else if (parsedEvent is SendDtmfTonesFailed sendDtmfTonesFailed)
+ {
+ callConnectionId = sendDtmfTonesFailed.CallConnectionId;
+ logger.LogInformation($"Received call event: {sendDtmfTonesFailed.GetType()}, CorrelationId: {sendDtmfTonesFailed.CorrelationId}, " +
+ $"subCode: {sendDtmfTonesFailed.ResultInformation?.SubCode}, message: {sendDtmfTonesFailed.ResultInformation?.Message}, context: {sendDtmfTonesFailed.OperationContext}");
+ }
+ else if (parsedEvent is ContinuousDtmfRecognitionToneReceived continuousDtmfRecognitionToneReceived)
+ {
+ logger.LogInformation($"Received call event: {continuousDtmfRecognitionToneReceived.GetType()}");
+ callConnectionId = continuousDtmfRecognitionToneReceived.CallConnectionId;
+ logger.LogInformation("Tone?detected:?sequenceId={sequenceId},?tone={tone}",
+ continuousDtmfRecognitionToneReceived.SequenceId,
+ continuousDtmfRecognitionToneReceived.Tone);
+ }
+ else if (parsedEvent is ContinuousDtmfRecognitionStopped continuousDtmfRecognitionStopped)
+ {
+ logger.LogInformation($"Received call event: {continuousDtmfRecognitionStopped.GetType()}");
+ callConnectionId = continuousDtmfRecognitionStopped.CallConnectionId;
+ }
+ else if (parsedEvent is ContinuousDtmfRecognitionToneFailed continuousDtmfRecognitionToneFailed)
+ {
+ callConnectionId = continuousDtmfRecognitionToneFailed.CallConnectionId;
+ logger.LogInformation($"Received call event: {continuousDtmfRecognitionToneFailed.GetType()}, CorrelationId: {continuousDtmfRecognitionToneFailed.CorrelationId}, " +
+ $"subCode: {continuousDtmfRecognitionToneFailed.ResultInformation?.SubCode}, message: {continuousDtmfRecognitionToneFailed.ResultInformation?.Message}, context: {continuousDtmfRecognitionToneFailed.OperationContext}");
+ }
+ //else if (parsedEvent is HoldAudioStarted holdAudioStarted)
+ //{
+ // logger.LogInformation($"Received call event: {holdAudioStarted.GetType()}");
+ // logger.LogInformation($"Operation Context: {holdAudioStarted.OperationContext}");
+ // callConnectionId = holdAudioStarted.CallConnectionId;
+ //}
+ //else if (parsedEvent is HoldAudioPaused holdAudioPaused)
+ //{
+ // logger.LogInformation($"Received call event: {holdAudioPaused.GetType()}");
+ // logger.LogInformation($"Operation Context: {holdAudioPaused.OperationContext}");
+ // callConnectionId = holdAudioPaused.CallConnectionId;
+ //}
+ //else if (parsedEvent is HoldAudioResumed holdAudioResumed)
+ //{
+ // logger.LogInformation($"Received call event: {holdAudioResumed.GetType()}");
+ // logger.LogInformation($"Operation Context: {holdAudioResumed.OperationContext}");
+ // callConnectionId = holdAudioResumed.CallConnectionId;
+ //}
+ //else if (parsedEvent is HoldAudioCompleted holdAudioCompleted)
+ //{
+ // logger.LogInformation($"Received call event: {holdAudioCompleted.GetType()}");
+ // logger.LogInformation($"Operation Context: {holdAudioCompleted.OperationContext}");
+ // callConnectionId = holdAudioCompleted.CallConnectionId;
+ //}
+ else if (parsedEvent is HoldFailed holdFailed)
+ {
+ callConnectionId = holdFailed.CallConnectionId;
+ logger.LogInformation($"Received call event: {holdFailed.GetType()}, CorrelationId: {holdFailed.CorrelationId}, " +
+ $"subCode: {holdFailed.ResultInformation?.SubCode}, message: {holdFailed.ResultInformation?.Message}, context: {holdFailed.OperationContext}");
+ }
+ else if (parsedEvent is ParticipantsUpdated participantsUpdated)
+ {
+ logger.LogInformation($"Received call event: {participantsUpdated.GetType()}");
+ logger.LogInformation($"Operation Context: {participantsUpdated.OperationContext}");
+ callConnectionId = participantsUpdated.CallConnectionId;
+ }
+ else if (parsedEvent is TranscriptionStarted transcriptionStarted)
+ {
+ logger.LogInformation($"Received call event: {transcriptionStarted.GetType()}");
+ logger.LogInformation($"Operation context: {transcriptionStarted.OperationContext}");
+ callConnectionId = transcriptionStarted.CallConnectionId;
+ }
+ else if (parsedEvent is TranscriptionStopped transcriptionStopped)
+ {
+ logger.LogInformation($"Received call event: {transcriptionStopped.GetType()}");
+ logger.LogInformation($"Operation context: {transcriptionStopped.OperationContext}");
+ callConnectionId = transcriptionStopped.CallConnectionId;
+ }
+ else if (parsedEvent is TranscriptionUpdated transcriptionUpdated)
+ {
+ logger.LogInformation($"Received call event: {transcriptionUpdated.GetType()}");
+ logger.LogInformation($"Operation context: {transcriptionUpdated.OperationContext}");
+ callConnectionId = transcriptionUpdated.CallConnectionId;
+ }
+ else if (parsedEvent is TranscriptionFailed transcriptionFailed)
+ {
+ callConnectionId = transcriptionFailed.CallConnectionId;
+ logger.LogInformation($"Received call event: {transcriptionFailed.GetType()}, CorrelationId: {transcriptionFailed.CorrelationId}, " +
+ $"subCode: {transcriptionFailed.ResultInformation?.SubCode}, message: {transcriptionFailed.ResultInformation?.Message}, context: {transcriptionFailed.OperationContext}");
+ }
+ else if (parsedEvent is MediaStreamingStarted mediaStreamingStarted)
+ {
+ logger.LogInformation($"Received call event: {mediaStreamingStarted.GetType()}");
+ logger.LogInformation($"Operation context: {mediaStreamingStarted.OperationContext}");
+ callConnectionId = mediaStreamingStarted.CallConnectionId;
+ }
+ else if (parsedEvent is MediaStreamingStopped mediaStreamingStopped)
+ {
+ logger.LogInformation($"Received call event: {mediaStreamingStopped.GetType()}");
+ logger.LogInformation($"Operation context: {mediaStreamingStopped.OperationContext}");
+ callConnectionId = mediaStreamingStopped.CallConnectionId;
+ }
+ else if (parsedEvent is MediaStreamingFailed mediaStreamingFailed)
+ {
+ callConnectionId = mediaStreamingFailed.CallConnectionId;
+ logger.LogInformation($"Received call event: {mediaStreamingFailed.GetType()}, CorrelationId: {mediaStreamingFailed.CorrelationId}, " +
+ $"subCode: {mediaStreamingFailed.ResultInformation?.SubCode}, message: {mediaStreamingFailed.ResultInformation?.Message}, context: {mediaStreamingFailed.OperationContext}");
+ }
+ else if (parsedEvent is CallDisconnected callDisconnected)
+ {
+ logger.LogInformation($"Received call event: {callDisconnected.GetType()}");
+ logger.LogInformation("************************************************************");
+ logger.LogInformation($"CORRELATION ID: {callDisconnected.CorrelationId}");
+ logger.LogInformation("************************************************************");
+ }
+ else if (parsedEvent is CreateCallFailed createCallFailed)
+ {
+ callConnectionId = createCallFailed.CallConnectionId;
+ logger.LogInformation($"Received call event: {createCallFailed.GetType()}, CorrelationId: {createCallFailed.CorrelationId}, " +
+ $"subCode: {createCallFailed.ResultInformation?.SubCode}, message: {createCallFailed.ResultInformation?.Message}, context: {createCallFailed.OperationContext}");
+ }
+ else if (parsedEvent is CallTransferAccepted callTransferAccepted)
+ {
+ logger.LogInformation($"Received call event: {callTransferAccepted.GetType()}");
+ callConnectionId = callTransferAccepted.CallConnectionId;
+ }
+ else if (parsedEvent is CallTransferFailed callTransferFailed)
+ {
+ callConnectionId = callTransferFailed.CallConnectionId;
+ logger.LogInformation($"Received call event: {callTransferFailed.GetType()}, CorrelationId: {callTransferFailed.CorrelationId}, " +
+ $"subCode: {callTransferFailed.ResultInformation?.SubCode}, message: {callTransferFailed.ResultInformation?.Message}, context: {callTransferFailed.OperationContext}");
+ }
+ else if (parsedEvent is RecordingStateChanged recordingStateChanged)
+ {
+ logger.LogInformation($"Received call event: {recordingStateChanged.GetType()}");
+ logger.LogInformation($"Recording State: {recordingStateChanged.State}");
+ }
+ }
+ return Results.Ok();
+}).Produces(StatusCodes.Status200OK);
+
+#region Outbound Call
+
+app.MapPost("/outboundCallToTeamsExtensionAsync", async (string userId, string tenantId, string resourceId, string teamsAppId, ILogger logger) =>
+{
+ var target = new TeamsExtensionUserIdentifier(userId: userId, tenantId: tenantId, resourceId: resourceId);
+
+ var callbackUri = new Uri(new Uri(callbackUriHost), "/api/callbacks");
+ eventCallbackUri = callbackUri;
+ CallInvite callInvite = new CallInvite(target);
+ var websocketUri = callbackUriHost.Replace("https", "wss") + "/ws";
+ var mediaStreamingOptions = new MediaStreamingOptions(
+ MediaStreamingAudioChannel.Unmixed, StreamingTransport.Websocket)
+ {
+ StartMediaStreaming = false,
+ TransportUri = new Uri(websocketUri),
+ MediaStreamingContent = MediaStreamingContent.Audio,
+ };
+ TranscriptionOptions transcriptionOptions = new TranscriptionOptions("en-us", StreamingTransport.Websocket)
+ {
+ StartTranscription = false,
+ TransportUri = new Uri(websocketUri)
+ };
+ var createCallOptions = new CreateCallOptions(callInvite, callbackUri)
+ {
+ CallIntelligenceOptions = new CallIntelligenceOptions() { CognitiveServicesEndpoint = new Uri(cognitiveServicesEndpoint) },
+ TeamsAppSource = new MicrosoftTeamsAppIdentifier(teamsAppId),
+ MediaStreamingOptions = mediaStreamingOptions,
+ TranscriptionOptions = transcriptionOptions
+ };
+ CreateCallResult createCallResult = await client.CreateCallAsync(createCallOptions);
+
+ logger.LogInformation($"Created async call with connection id: {createCallResult.CallConnectionProperties.CallConnectionId}");
+
+}).WithTags("Create Outbound Call APIs");
+
+app.MapPost("/outboundCallToPstnAsync", async (string targetPhoneNumber, bool isEnableLoopbackAudio, ILogger < Program> logger) =>
+{
+ PhoneNumberIdentifier target = new PhoneNumberIdentifier(targetPhoneNumber);
+ PhoneNumberIdentifier caller = new PhoneNumberIdentifier(acsPhoneNumber);
+
+
+ var callbackUri = new Uri(new Uri(callbackUriHost), "/api/callbacks");
+ eventCallbackUri = callbackUri;
+ CallInvite callInvite = new CallInvite(target, caller);
+
+ var websocketUri = callbackUriHost.Replace("https", "wss") + "/ws";
+ var mediaStreamingOptions = new MediaStreamingOptions(
+ MediaStreamingAudioChannel.Unmixed, StreamingTransport.Websocket)
+ {
+ StartMediaStreaming = false,
+ TransportUri = new Uri(websocketUri),
+ MediaStreamingContent = MediaStreamingContent.Audio,
+ };
+ TranscriptionOptions transcriptionOptions = new TranscriptionOptions("en-us", StreamingTransport.Websocket)
+ {
+ StartTranscription = false,
+ TransportUri = new Uri(websocketUri)
+ };
+ var createCallOptions = new CreateCallOptions(callInvite, callbackUri)
+ {
+ CallIntelligenceOptions = new CallIntelligenceOptions() { CognitiveServicesEndpoint = new Uri(cognitiveServicesEndpoint) },
+ TranscriptionOptions = transcriptionOptions,
+ MediaStreamingOptions = mediaStreamingOptions,
+ //IsLoopbackAudioEnabled = isEnableLoopbackAudio,
+ };
+
+ CreateCallResult createCallResult = await client.CreateCallAsync(createCallOptions);
+
+ logger.LogInformation($"Created async pstn call with connection id: {createCallResult.CallConnectionProperties.CallConnectionId}");
+}).WithTags("Create Outbound Call APIs");
+
+
+
+//app.MapPost("/outboundCallToPstn", (string targetPhoneNumber, bool isEnableLoopbackAudio, ILogger logger) =>
+//{
+// PhoneNumberIdentifier target = new PhoneNumberIdentifier(targetPhoneNumber);
+// PhoneNumberIdentifier caller = new PhoneNumberIdentifier(acsPhoneNumber);
+
+
+// var callbackUri = new Uri(new Uri(callbackUriHost), "/api/callbacks");
+// eventCallbackUri = callbackUri;
+// CallInvite callInvite = new CallInvite(target, caller);
+// var websocketUri = callbackUriHost.Replace("https", "wss") + "/ws";
+// var mediaStreamingOptions = new MediaStreamingOptions(
+// MediaStreamingAudioChannel.Unmixed, StreamingTransport.Websocket)
+// {
+// StartMediaStreaming = false,
+// TransportUri = new Uri(websocketUri),
+// MediaStreamingContent = MediaStreamingContent.Audio,
+// };
+// TranscriptionOptions transcriptionOptions = new TranscriptionOptions("en-us", StreamingTransport.Websocket)
+// {
+// StartTranscription = false,
+// TransportUri = new Uri(websocketUri)
+// };
+
+// var createCallOptions = new CreateCallOptions(callInvite, callbackUri)
+// {
+// CallIntelligenceOptions = new CallIntelligenceOptions() { CognitiveServicesEndpoint = new Uri(cognitiveServicesEndpoint) },
+// //EnableLoopbackAudio = isEnableLoopbackAudio
+// };
+
+// CreateCallResult createCallResult = client.CreateCall(createCallOptions);
+
+// logger.LogInformation($"Created call with connection id: {createCallResult.CallConnectionProperties.CallConnectionId}");
+//}).WithTags("Create Outbound Call APIs");
+
+app.MapPost("/outboundCallToAcsAsync", async (string acsTarget, ILogger logger) =>
+{
+ var callbackUri = new Uri(new Uri(callbackUriHost), "/api/callbacks");
+ eventCallbackUri = callbackUri;
+ CallInvite callInvite = new CallInvite(new CommunicationUserIdentifier(acsTarget));
+ var websocketUri = callbackUriHost.Replace("https", "wss") + "/ws";
+ var mediaStreamingOptions = new MediaStreamingOptions(
+ MediaStreamingAudioChannel.Unmixed, StreamingTransport.Websocket)
+ {
+ StartMediaStreaming = true,
+ TransportUri = new Uri(websocketUri),
+ MediaStreamingContent = MediaStreamingContent.Audio,
+ };
+ TranscriptionOptions transcriptionOptions = new TranscriptionOptions("en-us", StreamingTransport.Websocket)
+ {
+ StartTranscription = false,
+ TransportUri = new Uri(websocketUri)
+ };
+ var createCallOptions = new CreateCallOptions(callInvite, callbackUri)
+ {
+ CallIntelligenceOptions = new CallIntelligenceOptions() { CognitiveServicesEndpoint = new Uri(cognitiveServicesEndpoint) },
+ //MediaStreamingOptions = mediaStreamingOptions,
+ //TranscriptionOptions = transcriptionOptions,
+ OperationContext = "OutboundCallToAcsAsync"
+ };
+
+ CreateCallResult createCallResult = await client.CreateCallAsync(createCallOptions);
+
+ logger.LogInformation($"Created async acs call with connection id: {createCallResult.CallConnectionProperties.CallConnectionId}");
+}).WithTags("Create Outbound Call APIs");
+
+//app.MapPost("/outboundCallToAcs", (string acsTarget, ILogger logger) =>
+//{
+// var callbackUri = new Uri(new Uri(callbackUriHost), "/api/callbacks");
+// eventCallbackUri = callbackUri;
+// CallInvite callInvite = new CallInvite(new CommunicationUserIdentifier(acsTarget));
+
+// var createCallOptions = new CreateCallOptions(callInvite, callbackUri)
+// {
+// CallIntelligenceOptions = new CallIntelligenceOptions() { CognitiveServicesEndpoint = new Uri(cognitiveServicesEndpoint) },
+
+// };
+
+// CreateCallResult createCallResult = client.CreateCall(createCallOptions);
+
+// logger.LogInformation($"Created acs call with connection id: {createCallResult.CallConnectionProperties.CallConnectionId}");
+//}).WithTags("Create Outbound Call APIs");
+
+app.MapPost("/outboundCallToTeamsAsync", async (string teamsObjectId, ILogger logger) =>
+{
+ var callbackUri = new Uri(new Uri(callbackUriHost), "/api/callbacks");
+ eventCallbackUri = callbackUri;
+ CallInvite callInvite = new CallInvite(new MicrosoftTeamsUserIdentifier(teamsObjectId));
+
+ var createCallOptions = new CreateCallOptions(callInvite, callbackUri)
+ {
+ CallIntelligenceOptions = new CallIntelligenceOptions() { CognitiveServicesEndpoint = new Uri(cognitiveServicesEndpoint) },
+
+ };
+
+ CreateCallResult createCallResult = await client.CreateCallAsync(createCallOptions);
+
+ logger.LogInformation($"Created async teams call with connection id: {createCallResult.CallConnectionProperties.CallConnectionId}");
+}).WithTags("Create Outbound Call APIs");
+
+app.MapPost("/outboundCallToTeams", (string teamsObjectId, ILogger logger) =>
+{
+ var callbackUri = new Uri(new Uri(callbackUriHost), "/api/callbacks");
+ eventCallbackUri = callbackUri;
+ CallInvite callInvite = new CallInvite(new MicrosoftTeamsUserIdentifier(teamsObjectId));
+
+ var createCallOptions = new CreateCallOptions(callInvite, callbackUri)
+ {
+ CallIntelligenceOptions = new CallIntelligenceOptions() { CognitiveServicesEndpoint = new Uri(cognitiveServicesEndpoint) },
+
+ };
+
+ CreateCallResult createCallResult = client.CreateCall(createCallOptions);
+
+ logger.LogInformation($"Created teams call with connection id: {createCallResult.CallConnectionProperties.CallConnectionId}");
+}).WithTags("Create Outbound Call APIs");
+
+#endregion
+
+#region Group Call
+
+app.MapPost("/createGroupCallAsync", async (string targetPhoneNumber, string acsTarget, bool isEnableLoopbackAudio, ILogger logger) =>
+{
+ PhoneNumberIdentifier target = new PhoneNumberIdentifier(targetPhoneNumber);
+ PhoneNumberIdentifier sourceCallerId = new PhoneNumberIdentifier(acsPhoneNumber);
+ CommunicationUserIdentifier acsTargetIdentifier = new CommunicationUserIdentifier(acsTarget);
+
+ var callbackUri = new Uri(new Uri(callbackUriHost), "/api/callbacks");
+ eventCallbackUri = callbackUri;
+ var websocketUri = callbackUriHost.Replace("https", "wss") + "/ws";
+
+ IEnumerable targets = new List()
+ {
+ target,
+ acsTargetIdentifier
+ };
+
+ var mediaStreamingOptions = new MediaStreamingOptions(
+ MediaStreamingAudioChannel.Unmixed, StreamingTransport.Websocket)
+ {
+ StartMediaStreaming = false,
+ TransportUri = new Uri(websocketUri),
+ MediaStreamingContent = MediaStreamingContent.Audio,
+ };
+ TranscriptionOptions transcriptionOptions = new TranscriptionOptions("en-us", StreamingTransport.Websocket)
+ {
+ StartTranscription = false,
+ TransportUri = new Uri(websocketUri)
+ };
+ var createGroupCallOptions = new CreateGroupCallOptions(targets, callbackUri)
+ {
+ CallIntelligenceOptions = new CallIntelligenceOptions() { CognitiveServicesEndpoint = new Uri(cognitiveServicesEndpoint) },
+ SourceCallerIdNumber = sourceCallerId,
+ //IsLoopbackAudioEnabled = isEnableLoopbackAudio,
+ MediaStreamingOptions = mediaStreamingOptions,
+ TranscriptionOptions = transcriptionOptions
+ };
+
+ CreateCallResult createCallResult = await client.CreateGroupCallAsync(createGroupCallOptions);
+
+ logger.LogInformation($"Created async group call with connection id: {createCallResult.CallConnectionProperties.CallConnectionId}");
+}).WithTags("Create Group Call APIs");
+
+app.MapPost("/createGroupCall", (string targetPhoneNumber, string acsTarget, bool isEnableLoopbackAudio, ILogger logger) =>
+{
+ PhoneNumberIdentifier target = new PhoneNumberIdentifier(targetPhoneNumber);
+ PhoneNumberIdentifier sourceCallerId = new PhoneNumberIdentifier(acsPhoneNumber);
+ CommunicationUserIdentifier acsTargetIdentifier = new CommunicationUserIdentifier(acsTarget);
+
+ var callbackUri = new Uri(new Uri(callbackUriHost), "/api/callbacks");
+ eventCallbackUri = callbackUri;
+ var websocketUri = callbackUriHost.Replace("https", "wss") + "/ws";
+ var mediaStreamingOptions = new MediaStreamingOptions(
+ MediaStreamingAudioChannel.Unmixed, StreamingTransport.Websocket)
+ {
+ StartMediaStreaming = false,
+ TransportUri = new Uri(websocketUri),
+ MediaStreamingContent = MediaStreamingContent.Audio,
+ };
+ TranscriptionOptions transcriptionOptions = new TranscriptionOptions("en-us", StreamingTransport.Websocket)
+ {
+ StartTranscription = false,
+ TransportUri = new Uri(websocketUri)
+ };
+
+ IEnumerable targets = new List()
+ {
+ target,
+ acsTargetIdentifier
+ };
+
+ var createGroupCallOptions = new CreateGroupCallOptions(targets, callbackUri)
+ {
+ CallIntelligenceOptions = new CallIntelligenceOptions() { CognitiveServicesEndpoint = new Uri(cognitiveServicesEndpoint) },
+ SourceCallerIdNumber = sourceCallerId,
+ MediaStreamingOptions = mediaStreamingOptions,
+ TranscriptionOptions = transcriptionOptions,
+ //IsLoopbackAudioEnabled = isEnableLoopbackAudio
+ };
+
+ CreateCallResult createCallResult = client.CreateGroupCall(createGroupCallOptions);
+
+ logger.LogInformation($"Created group call with id: {createCallResult.CallConnectionProperties.CallConnectionId}");
+}).WithTags("Create Group Call APIs");
+
+#endregion
+
+#region Connect Api
+
+app.MapPost("/ConnectRoomCallAsync", async (string roomId, ILogger logger) =>
+{
+ roomCallId = roomId;
+ RoomCallLocator roomCallLocator = !string.IsNullOrEmpty(roomId) ? new RoomCallLocator(roomId) : throw new ArgumentNullException(nameof(roomId));
+ var callbackUri = new Uri(new Uri(callbackUriHost), "/api/callbacks");
+ eventCallbackUri = callbackUri;
+ var websocketUri = callbackUriHost.Replace("https", "wss") + "/ws";
+ MediaStreamingOptions mediaStreamingOptions = new MediaStreamingOptions(MediaStreamingAudioChannel.Unmixed, StreamingTransport.Websocket)
+ {
+ TransportUri = new Uri(websocketUri),
+ MediaStreamingContent = MediaStreamingContent.Audio,
+ StartMediaStreaming = false
+ };
+ TranscriptionOptions transcriptionOptions = new TranscriptionOptions("en-us", StreamingTransport.Websocket)
+ {
+ TransportUri = new Uri(websocketUri),
+ StartTranscription = false
+ };
+ ConnectCallOptions connectCallOptions = new ConnectCallOptions(roomCallLocator, callbackUri)
+ {
+ CallIntelligenceOptions = new CallIntelligenceOptions() { CognitiveServicesEndpoint = new Uri(cognitiveServicesEndpoint) },
+ OperationContext = "ConnectRoomCallContext",
+ MediaStreamingOptions = mediaStreamingOptions,
+ TranscriptionOptions = transcriptionOptions
+ };
+ ConnectCallResult connectCallResult = await client.ConnectCallAsync(connectCallOptions);
+ logger.LogInformation($"Connected room async call with connection id: {connectCallResult.CallConnectionProperties.CallConnectionId}");
+ return Results.Ok();
+}).WithTags("Connect Call APIs");
+
+//app.MapPost("/ConnectRoomCall", (string roomId, ILogger logger) =>
+//{
+// RoomCallLocator roomCallLocator = !string.IsNullOrEmpty(roomId) ? new RoomCallLocator(roomId) : throw new ArgumentNullException(nameof(roomId));
+// var callbackUri = new Uri(new Uri(callbackUriHost), "/api/callbacks");
+// var websocketUri = callbackUriHost.Replace("https", "wss") + "/ws";
+// MediaStreamingOptions mediaStreamingOptions = new MediaStreamingOptions(new Uri(websocketUri), MediaStreamingContent.Audio,
+// MediaStreamingAudioChannel.Unmixed, MediaStreamingTransport.Websocket, false);
+// TranscriptionOptions transcriptionOptions = new TranscriptionOptions(new Uri(websocketUri), "en-us", false, TranscriptionTransport.Websocket);
+// ConnectCallOptions connectCallOptions = new ConnectCallOptions(roomCallLocator, callbackUri)
+// {
+// CallIntelligenceOptions = new CallIntelligenceOptions() { CognitiveServicesEndpoint = new Uri(cognitiveServicesEndpoint) },
+// OperationContext = "ConnectRoomCallContext",
+// MediaStreamingOptions = mediaStreamingOptions,
+// TranscriptionOptions = transcriptionOptions
+// };
+// ConnectCallResult connectCallResult = client.ConnectCall(connectCallOptions);
+// logger.LogInformation($"Connected room call with connection id: {connectCallResult.CallConnectionProperties.CallConnectionId}");
+// return Results.Ok();
+//}).WithTags("Connect Call APIs");
+
+//app.MapPost("/ConnectGroupCallAsync", async (string groupId, ILogger logger) =>
+//{
+// GroupCallLocator groupCallLocator = !string.IsNullOrEmpty(groupId) ? new GroupCallLocator(groupId) : throw new ArgumentNullException(nameof(groupId));
+// var callbackUri = new Uri(new Uri(callbackUriHost), "/api/callbacks");
+// var websocketUri = callbackUriHost.Replace("https", "wss") + "/ws";
+// MediaStreamingOptions mediaStreamingOptions = new MediaStreamingOptions(new Uri(websocketUri), MediaStreamingContent.Audio,
+// MediaStreamingAudioChannel.Unmixed, MediaStreamingTransport.Websocket, false);
+// TranscriptionOptions transcriptionOptions = new TranscriptionOptions(new Uri(websocketUri), "en-us", false, TranscriptionTransport.Websocket);
+// ConnectCallOptions connectCallOptions = new ConnectCallOptions(groupCallLocator, callbackUri)
+// {
+// CallIntelligenceOptions = new CallIntelligenceOptions() { CognitiveServicesEndpoint = new Uri(cognitiveServicesEndpoint) },
+// OperationContext = "ConnectRoomCallContext",
+// MediaStreamingOptions = mediaStreamingOptions,
+// TranscriptionOptions = transcriptionOptions
+// };
+// ConnectCallResult connectCallResult = await client.ConnectCallAsync(connectCallOptions);
+// logger.LogInformation($"Connected group async call with connection id: {connectCallResult.CallConnectionProperties.CallConnectionId}");
+// return Results.Ok();
+//}).WithTags("Connect Call APIs");
+
+//app.MapPost("/ConnectGroupCall", (string groupId, ILogger logger) =>
+//{
+// GroupCallLocator groupCallLocator = !string.IsNullOrEmpty(groupId) ? new GroupCallLocator(groupId) : throw new ArgumentNullException(nameof(groupId));
+// var callbackUri = new Uri(new Uri(callbackUriHost), "/api/callbacks");
+// var websocketUri = callbackUriHost.Replace("https", "wss") + "/ws";
+// MediaStreamingOptions mediaStreamingOptions = new MediaStreamingOptions(new Uri(websocketUri), MediaStreamingContent.Audio,
+// MediaStreamingAudioChannel.Unmixed, MediaStreamingTransport.Websocket, false);
+// TranscriptionOptions transcriptionOptions = new TranscriptionOptions(new Uri(websocketUri), "en-us", false, TranscriptionTransport.Websocket);
+// ConnectCallOptions connectCallOptions = new ConnectCallOptions(groupCallLocator, callbackUri)
+// {
+// CallIntelligenceOptions = new CallIntelligenceOptions() { CognitiveServicesEndpoint = new Uri(cognitiveServicesEndpoint) },
+// OperationContext = "ConnectGroupCallContext",
+// MediaStreamingOptions = mediaStreamingOptions,
+// TranscriptionOptions = transcriptionOptions
+// };
+// ConnectCallResult connectCallResult = client.ConnectCall(connectCallOptions);
+// logger.LogInformation($"Connected group call with connection id: {connectCallResult.CallConnectionProperties.CallConnectionId}");
+// return Results.Ok();
+//}).WithTags("Connect Call APIs");
+
+//app.MapPost("/ConnectOneToNCallAsync", async (string serverCallId, ILogger logger) =>
+//{
+// ServerCallLocator serverCallLocator = !string.IsNullOrEmpty(serverCallId) ? new ServerCallLocator(serverCallId) : throw new ArgumentNullException(nameof(serverCallId));
+// var callbackUri = new Uri(new Uri(callbackUriHost), "/api/callbacks");
+// var websocketUri = callbackUriHost.Replace("https", "wss") + "/ws";
+// MediaStreamingOptions mediaStreamingOptions = new MediaStreamingOptions(new Uri(websocketUri), MediaStreamingContent.Audio,
+// MediaStreamingAudioChannel.Unmixed, MediaStreamingTransport.Websocket, false);
+// TranscriptionOptions transcriptionOptions = new TranscriptionOptions(new Uri(websocketUri), "en-us", false, TranscriptionTransport.Websocket);
+// ConnectCallOptions connectCallOptions = new ConnectCallOptions(serverCallLocator, callbackUri)
+// {
+// CallIntelligenceOptions = new CallIntelligenceOptions() { CognitiveServicesEndpoint = new Uri(cognitiveServicesEndpoint) },
+// OperationContext = "ConnectOneToNCallContext",
+// MediaStreamingOptions = mediaStreamingOptions,
+// TranscriptionOptions = transcriptionOptions
+// };
+// ConnectCallResult connectCallResult = await client.ConnectCallAsync(connectCallOptions);
+// logger.LogInformation($"Connected 1 to N async call with connection id: {connectCallResult.CallConnectionProperties.CallConnectionId}");
+// return Results.Ok();
+//}).WithTags("Connect Call APIs");
+
+//app.MapPost("/ConnectOneToNCall", (string serverCallId, ILogger logger) =>
+//{
+// ServerCallLocator serverCallLocator = !string.IsNullOrEmpty(serverCallId) ? new ServerCallLocator(serverCallId) : throw new ArgumentNullException(nameof(serverCallId));
+// var callbackUri = new Uri(new Uri(callbackUriHost), "/api/callbacks");
+// var websocketUri = callbackUriHost.Replace("https", "wss") + "/ws";
+// MediaStreamingOptions mediaStreamingOptions = new MediaStreamingOptions(new Uri(websocketUri), MediaStreamingContent.Audio,
+// MediaStreamingAudioChannel.Unmixed, MediaStreamingTransport.Websocket, false);
+// TranscriptionOptions transcriptionOptions = new TranscriptionOptions(new Uri(websocketUri), "en-us", false, TranscriptionTransport.Websocket);
+// ConnectCallOptions connectCallOptions = new ConnectCallOptions(serverCallLocator, callbackUri)
+// {
+// CallIntelligenceOptions = new CallIntelligenceOptions() { CognitiveServicesEndpoint = new Uri(cognitiveServicesEndpoint) },
+// OperationContext = "ConnectOneToNCallContext",
+// MediaStreamingOptions = mediaStreamingOptions,
+// TranscriptionOptions = transcriptionOptions
+// };
+// ConnectCallResult connectCallResult = client.ConnectCall(connectCallOptions);
+// logger.LogInformation($"Connected 1 to N call with connection id: {connectCallResult.CallConnectionProperties.CallConnectionId}");
+// return Results.Ok();
+//}).WithTags("Connect Call APIs");
+
+#endregion
+
+#region Add Remove Participant
+
+app.MapPost("/addPstnParticipantAsync", async (string pstnParticipant, ILogger logger) =>
+{
+CallConnection callConnection = GetConnection();
+//CallInvite callInvite = new CallInvite(new PhoneNumberIdentifier(pstnParticipant), new PhoneNumberIdentifier(acsPhoneNumber));
+
+//ops
+CallInvite callInvite = new CallInvite(new PhoneNumberIdentifier(pstnParticipant), null);
+var addParticipantOptions = new AddParticipantOptions(callInvite)
+{
+OperationContext = "addPstnUserContext",
+InvitationTimeoutInSeconds = 60,
+OperationCallbackUri = eventCallbackUri
+
+};
+
+var result = await callConnection.AddParticipantAsync(addParticipantOptions);
+return Results.Ok(result);
+}).WithTags("Add/Remove Participant APIs");
+
+app.MapPost("/addPstnParticipant", (string pstnParticipant, ILogger logger) =>
+{
+CallConnection callConnection = GetConnection();
+CallInvite callInvite = new CallInvite(new PhoneNumberIdentifier(pstnParticipant),
+ new PhoneNumberIdentifier(acsPhoneNumber));
+var addParticipantOptions = new AddParticipantOptions(callInvite)
+{
+OperationContext = "addPstnUserContext",
+InvitationTimeoutInSeconds = 30,
+};
+
+var result = callConnection.AddParticipant(addParticipantOptions);
+return Results.Ok(result);
+}).WithTags("Add/Remove Participant APIs");
+
+app.MapPost("/addAcsParticipantAsync", async (string acsParticipant, ILogger logger) =>
+{
+CallConnection callConnection = GetConnection();
+CallInvite callInvite = new CallInvite(new CommunicationUserIdentifier(acsParticipant));
+var addParticipantOptions = new AddParticipantOptions(callInvite)
+{
+OperationContext = "addAcsUserContext",
+InvitationTimeoutInSeconds = 30,
+};
+
+var result = await callConnection.AddParticipantAsync(addParticipantOptions);
+return Results.Ok(result);
+}).WithTags("Add/Remove Participant APIs");
+
+app.MapPost("/addAcsParticipant", (string acsParticipant, ILogger logger) =>
+{
+CallConnection callConnection = GetConnection();
+CallInvite callInvite = new CallInvite(new CommunicationUserIdentifier(acsParticipant));
+var addParticipantOptions = new AddParticipantOptions(callInvite)
+{
+OperationContext = "addPstnUserContext",
+InvitationTimeoutInSeconds = 30,
+};
+
+var result = callConnection.AddParticipant(addParticipantOptions);
+return Results.Ok(result);
+}).WithTags("Add/Remove Participant APIs");
+
+app.MapPost("/addTeamsParticipantAsync", async (string teamsObjectId, ILogger logger) =>
+{
+CallConnection callConnection = GetConnection();
+CallInvite callInvite = new CallInvite(new MicrosoftTeamsUserIdentifier(teamsObjectId));
+callInvite.CustomCallingContext.AddSipUui("OBOuuivalue");
+callInvite.CustomCallingContext.AddSipX("XheaderOBO", "value");
+
+// Create TeamsPhoneCallerDetails
+var teamsPhoneCallerDetails = new TeamsPhoneCallerDetails(new MicrosoftTeamsUserIdentifier(teamsObjectId), name: "John Doe", phoneNumber: "+14256451678")
+{
+ IsAuthenticated = true,
+ ScreenPopUrl = "abcdef", //prescriptionDetails?.ScreenPopUpUrl,
+ RecordId = "recordId-12345",
+};
+teamsPhoneCallerDetails.AdditionalCallerInformation.Add("Department", "Sales");
+teamsPhoneCallerDetails.AdditionalCallerInformation.Add("Priority", "High");
+
+// Create TeamsPhoneSourceDetails
+var teamsPhoneSourceDetails = new TeamsPhoneSourceDetails(new MicrosoftTeamsUserIdentifier(teamsObjectId), language: "en-US", status: "Active");
+
+// Create TeamsPhoneCallDetails
+var teamsPhoneCallDetails = new TeamsPhoneCallDetails()
+{
+TeamsPhoneCallerDetails = teamsPhoneCallerDetails,
+TeamsPhoneSourceDetails = teamsPhoneSourceDetails,
+SessionId = "session-123-abc",
+Intent = "Sales Inquiry",
+CallTopic = "New Product Information",
+CallContext = "Customer is interested in our latest product line",
+CallSentiment = "Positive",
+SuggestedActions = "Offer product demo, Schedule follow-up"
+};
+callInvite.CustomCallingContext.SetTeamsPhoneCallDetails(teamsPhoneCallDetails);
+
+var addParticipantOptions = new AddParticipantOptions(callInvite)
+{
+OperationContext = "addTeamsUserContext",
+InvitationTimeoutInSeconds = 30,
+};
+
+var result = await callConnection.AddParticipantAsync(addParticipantOptions);
+return Results.Ok(result);
+}).WithTags("Add/Remove Participant APIs");
+
+app.MapPost("/addDuelPersonaParticipantAsync", async (string userId, string tenantId, string ResourceId, ILogger logger) =>
+{
+CallConnection callConnection = GetConnection();
+CallInvite callInvite = new CallInvite(new TeamsExtensionUserIdentifier(userId, tenantId, ResourceId));
+var addParticipantOptions = new AddParticipantOptions(callInvite)
+{
+OperationContext = "addDuelPersonaUserContext",
+InvitationTimeoutInSeconds = 30,
+};
+
+var result = await callConnection.AddParticipantAsync(addParticipantOptions);
+logger.LogInformation($"Added Duel Persona participant with user id: {userId}");
+return Results.Ok(result);
+}).WithTags("Add/Remove Participant APIs");
+
+app.MapPost("/addTeamsParticipant", (string teamsObjectId, ILogger logger) =>
+{
+CallConnection callConnection = GetConnection();
+CallInvite callInvite = new CallInvite(new MicrosoftTeamsUserIdentifier(teamsObjectId));
+var addParticipantOptions = new AddParticipantOptions(callInvite)
+{
+OperationContext = "addTeamsUserContext",
+InvitationTimeoutInSeconds = 30,
+};
+
+var result = callConnection.AddParticipant(addParticipantOptions);
+return Results.Ok(result);
+}).WithTags("Add/Remove Participant APIs");
+
+app.MapPost("/removePstnParticipantAsync", async (string pstnTarget, ILogger logger) =>
+{
+CallConnection callConnection = GetConnection();
+RemoveParticipantOptions removeParticipantOptions = new RemoveParticipantOptions(new PhoneNumberIdentifier(pstnTarget))
+{
+OperationContext = "removePstnParticipantContext"
+};
+
+await callConnection.RemoveParticipantAsync(removeParticipantOptions);
+return Results.Ok();
+}).WithTags("Add/Remove Participant APIs");
+
+app.MapPost("/removePstnParticipant", (string pstnTarget, ILogger logger) =>
+{
+CallConnection callConnection = GetConnection();
+RemoveParticipantOptions removeParticipantOptions = new RemoveParticipantOptions(new PhoneNumberIdentifier(pstnTarget))
+{
+OperationContext = "removePstnParticipantContext"
+};
+
+callConnection.RemoveParticipant(removeParticipantOptions);
+return Results.Ok();
+}).WithTags("Add/Remove Participant APIs");
+
+app.MapPost("/removeAcsParticipantAsync", async (string acsTarget, ILogger logger) =>
+{
+CallConnection callConnection = GetConnection();
+RemoveParticipantOptions removeParticipantOptions = new RemoveParticipantOptions(new CommunicationUserIdentifier(acsTarget))
+{
+OperationContext = "removeAcsParticipantContext"
+};
+
+await callConnection.RemoveParticipantAsync(removeParticipantOptions);
+return Results.Ok();
+}).WithTags("Add/Remove Participant APIs");
+
+app.MapPost("/removeAcsParticipant", (string acsTarget, ILogger logger) =>
+{
+CallConnection callConnection = GetConnection();
+RemoveParticipantOptions removeParticipantOptions = new RemoveParticipantOptions(new CommunicationUserIdentifier(acsTarget))
+{
+OperationContext = "removeAcsParticipantContext"
+};
+
+callConnection.RemoveParticipant(removeParticipantOptions);
+return Results.Ok();
+}).WithTags("Add/Remove Participant APIs");
+
+app.MapPost("/removeTeamsParticipantAsync", async (string teamsObjectId, ILogger logger) =>
+{
+CallConnection callConnection = GetConnection();
+RemoveParticipantOptions removeParticipantOptions = new RemoveParticipantOptions(new MicrosoftTeamsUserIdentifier(teamsObjectId))
+{
+OperationContext = "removeTeamsParticipantContext"
+};
+
+await callConnection.RemoveParticipantAsync(removeParticipantOptions);
+return Results.Ok();
+}).WithTags("Add/Remove Participant APIs");
+
+app.MapPost("/removeTeamsParticipant", (string teamsObjectId, ILogger logger) =>
+{
+CallConnection callConnection = GetConnection();
+RemoveParticipantOptions removeParticipantOptions = new RemoveParticipantOptions(new MicrosoftTeamsUserIdentifier(teamsObjectId))
+{
+OperationContext = "removeTeamsParticipantContext"
+};
+
+callConnection.RemoveParticipantAsync(removeParticipantOptions);
+return Results.Ok();
+}).WithTags("Add/Remove Participant APIs");
+
+app.MapPost("/cancelAddParticipantAsync", async (string invitationId, ILogger logger) =>
+{
+CallConnection callConnection = GetConnection();
+
+CancelAddParticipantOperationOptions cancelAddParticipantOperationOptions = new CancelAddParticipantOperationOptions(invitationId)
+{
+OperationContext = "CancelAddingParticipantContext"
+};
+var result = await callConnection.CancelAddParticipantOperationAsync(cancelAddParticipantOperationOptions);
+
+return Results.Ok(result);
+}).WithTags("Add/Remove Participant APIs");
+
+app.MapPost("/cancelAddParticipant", (string invitationId, ILogger logger) =>
+{
+CallConnection callConnection = GetConnection();
+CancelAddParticipantOperationOptions cancelAddParticipantOperationOptions = new CancelAddParticipantOperationOptions(invitationId)
+{
+ OperationContext = "CancelAddingParticipantContext"
+};
+var result = callConnection.CancelAddParticipantOperationAsync(cancelAddParticipantOperationOptions);
+return Results.Ok(result);
+}).WithTags("Add/Remove Participant APIs");
+
+#endregion
+
+# region Play Media with text Source
+
+app.MapPost("/playTextSourceToPstnTargetAsync", async (string pstnTarget, bool isLoop, ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+
+ TextSource textSource = new TextSource("Hi, this is test source played through play source thanks. Goodbye!.")
+ {
+ VoiceName = "en-US-NancyNeural"
+ };
+
+ List playTo = new List { new PhoneNumberIdentifier(pstnTarget) };
+ PlayOptions playToOptions = new PlayOptions(textSource, playTo)
+ {
+ OperationContext = "playToContext",
+ OperationCallbackUri = eventCallbackUri, // Set the callback URI for operation events
+ Loop = isLoop, // Set Loop to true or false based on the input parameter,
+ };
+
+ await callMedia.PlayAsync(playToOptions);
+
+ return Results.Ok();
+}).WithTags("Play TextSource Media APIs");
+
+app.MapPost("/playTextSourceToPstnTarget", (string pstnTarget, bool isLoop, ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+
+ TextSource textSource = new TextSource("Hi, this is test source played through play source thanks. Goodbye!.")
+ {
+ VoiceName = "en-US-NancyNeural"
+ };
+
+ List playTo = new List { new PhoneNumberIdentifier(pstnTarget) };
+ PlayOptions playToOptions = new PlayOptions(textSource, playTo)
+ {
+ OperationContext = "playToContext",
+ OperationCallbackUri = eventCallbackUri,
+ Loop = isLoop // Set Loop to true or false based on the input parameter
+ };
+
+ callMedia.Play(playToOptions);
+
+ return Results.Ok();
+}).WithTags("Play TextSource Media APIs");
+
+//app.MapPost("/playTextSourceAcsTargetAsync", async (string acsTarget, ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+
+// TextSource textSource = new TextSource("Hi, this is test source played through play source thanks. Goodbye!.")
+// {
+// VoiceName = "en-US-NancyNeural"
+// };
+
+// List playTo = new List { new CommunicationUserIdentifier(acsTarget) };
+// PlayOptions playToOptions = new PlayOptions(textSource, playTo)
+// {
+// OperationContext = "playToContext"
+// };
+
+// await callMedia.PlayAsync(playToOptions);
+
+// return Results.Ok();
+//}).WithTags("Play TextSource Media APIs");
+
+//app.MapPost("/playTextSourceToAcsTarget", (string acsTarget, ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+
+// TextSource textSource = new TextSource("Hi, this is test source played through play source thanks. Goodbye!.")
+// {
+// VoiceName = "en-US-NancyNeural"
+// };
+
+// List playTo = new List { new CommunicationUserIdentifier(acsTarget) };
+// PlayOptions playToOptions = new PlayOptions(textSource, playTo)
+// {
+// OperationContext = "playToContext"
+// };
+
+// callMedia.Play(playToOptions);
+
+// return Results.Ok();
+//}).WithTags("Play TextSource Media APIs");
+
+//app.MapPost("/playTextSourceToTeamsTargetAsync", async (string teamsObjectId, ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+
+// TextSource textSource = new TextSource("Hi, this is test source played through play source thanks. Goodbye!.")
+// {
+// VoiceName = "en-US-NancyNeural"
+// };
+
+// List playTo = new List { new MicrosoftTeamsUserIdentifier(teamsObjectId) };
+// PlayOptions playToOptions = new PlayOptions(textSource, playTo)
+// {
+// OperationContext = "playToContext"
+// };
+
+// await callMedia.PlayAsync(playToOptions);
+
+// return Results.Ok();
+//}).WithTags("Play TextSource Media APIs");
+
+//app.MapPost("/playTextSourceToTeamsTarget", (string teamsObjectId, ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+
+// TextSource textSource = new TextSource("Hi, this is test source played through play source thanks. Goodbye!.")
+// {
+// VoiceName = "en-US-NancyNeural"
+// };
+
+// List playTo = new List { new MicrosoftTeamsUserIdentifier(teamsObjectId) };
+// PlayOptions playToOptions = new PlayOptions(textSource, playTo)
+// {
+// OperationContext = "playToContext"
+// };
+
+// callMedia.Play(playToOptions);
+
+// return Results.Ok();
+//}).WithTags("Play TextSource Media APIs");
+
+app.MapPost("/playTextSourceToAllAsync", async (bool isLoop, bool isInterruptCallMediaOperation, ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+
+ TextSource textSource = new TextSource("Hi, this is test source played through play source thanks. Goodbye!.")
+ {
+ VoiceName = "en-US-NancyNeural"
+ };
+
+ PlayToAllOptions playToAllOptions = new PlayToAllOptions(textSource)
+ {
+ OperationContext = "playToAllContext",
+ OperationCallbackUri = eventCallbackUri, // Set the callback URI for operation events
+ Loop = isLoop, // Set Loop to true or false based on the input parameter
+ InterruptCallMediaOperation = isInterruptCallMediaOperation // Set to true if you want to allow barge-in
+ };
+ await callMedia.PlayToAllAsync(playToAllOptions);
+
+ return Results.Ok();
+}).WithTags("Play TextSource Media APIs");
+
+app.MapPost("/playTextSourceToAll", (bool isLoop, bool isInterruptCallMediaOperation, ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+
+ TextSource textSource = new TextSource("Hi, this is test source played through play source thanks. Goodbye!.")
+ {
+ VoiceName = "en-US-NancyNeural"
+ };
+
+ PlayToAllOptions playToAllOptions = new PlayToAllOptions(textSource)
+ {
+ OperationContext = "playToAllContext",
+ OperationCallbackUri = eventCallbackUri,
+ Loop = isLoop,
+ InterruptCallMediaOperation = isInterruptCallMediaOperation // Set to true if you want to allow barge-in
+ };
+ callMedia.PlayToAll(playToAllOptions);
+
+ return Results.Ok();
+}).WithTags("Play TextSource Media APIs");
+
+//app.MapPost("/playTextSourceBargeInAsync", async (ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+
+// TextSource textSource = new TextSource("Hi, this is barge in test played through play source thanks. Goodbye!.")
+// {
+// VoiceName = "en-US-NancyNeural"
+// };
+
+// PlayToAllOptions playToAllOptions = new PlayToAllOptions(textSource)
+// {
+// OperationContext = "playToAllContext",
+// InterruptCallMediaOperation = true
+// };
+// await callMedia.PlayToAllAsync(playToAllOptions);
+
+// return Results.Ok();
+//}).WithTags("Play TextSource Media APIs");
+
+#endregion
+
+# region Play Media with Ssml Source
+
+//app.MapPost("/playSsmlSourceToPstnTargetAsync", async (string pstnTarget, ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+
+// SsmlSource ssmlSource = new SsmlSource("Hi, this is ssml test played through ssml source thanks. Goodbye!");
+
+// List playTo = new List { new PhoneNumberIdentifier(pstnTarget) };
+// PlayOptions playToOptions = new PlayOptions(ssmlSource, playTo)
+// {
+// OperationContext = "playToContext"
+// };
+
+// await callMedia.PlayAsync(playToOptions);
+
+// return Results.Ok();
+//}).WithTags("Play SsmlSource Media APIs");
+
+//app.MapPost("/playSsmlSourceToPstnTarget", (string pstnTarget, ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+// SsmlSource ssmlSource = new SsmlSource("Hi, this is ssml test played through ssml source thanks. Goodbye!");
+// List playTo = new List { new PhoneNumberIdentifier(pstnTarget) };
+// PlayOptions playToOptions = new PlayOptions(ssmlSource, playTo)
+// {
+// OperationContext = "playToContext"
+// };
+
+// callMedia.Play(playToOptions);
+
+// return Results.Ok();
+//}).WithTags("Play SsmlSource Media APIs");
+
+//app.MapPost("/playSsmlSourceAcsTargetAsync", async (string acsTarget, ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+// SsmlSource ssmlSource = new SsmlSource("Hi, this is ssml test played through ssml source thanks. Goodbye!");
+// List playTo = new List { new CommunicationUserIdentifier(acsTarget) };
+// PlayOptions playToOptions = new PlayOptions(ssmlSource, playTo)
+// {
+// OperationContext = "playToContext"
+// };
+
+// await callMedia.PlayAsync(playToOptions);
+
+// return Results.Ok();
+//}).WithTags("Play SsmlSource Media APIs");
+
+//app.MapPost("/playSsmlSourceToAcsTarget", (string acsTarget, ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+// SsmlSource ssmlSource = new SsmlSource("Hi, this is ssml test played through ssml source thanks. Goodbye!");
+
+// List playTo = new List { new CommunicationUserIdentifier(acsTarget) };
+// PlayOptions playToOptions = new PlayOptions(ssmlSource, playTo)
+// {
+// OperationContext = "playToContext"
+// };
+
+// callMedia.Play(playToOptions);
+
+// return Results.Ok();
+//}).WithTags("Play SsmlSource Media APIs");
+
+//app.MapPost("/playSsmlSourceToTeamsTargetAsync", async (string teamsObjectId, ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+// SsmlSource ssmlSource = new SsmlSource("Hi, this is ssml test played through ssml source thanks. Goodbye!");
+// List playTo = new List { new MicrosoftTeamsUserIdentifier(teamsObjectId) };
+// PlayOptions playToOptions = new PlayOptions(ssmlSource, playTo)
+// {
+// OperationContext = "playToContext"
+// };
+
+// await callMedia.PlayAsync(playToOptions);
+
+// return Results.Ok();
+//}).WithTags("Play SsmlSource Media APIs");
+
+//app.MapPost("/playSsmlSourceToTeamsTarget", (string teamsObjectId, ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+// SsmlSource ssmlSource = new SsmlSource("Hi, this is ssml test played through ssml source thanks. Goodbye!");
+// List playTo = new List { new MicrosoftTeamsUserIdentifier(teamsObjectId) };
+// PlayOptions playToOptions = new PlayOptions(ssmlSource, playTo)
+// {
+// OperationContext = "playToContext"
+// };
+
+// callMedia.Play(playToOptions);
+
+// return Results.Ok();
+//}).WithTags("Play SsmlSource Media APIs");
+
+//app.MapPost("/playSsmlSourceToAllAsync", async (ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+// SsmlSource ssmlSource = new SsmlSource("Hi, this is ssml test played through ssml source thanks. Goodbye!");
+// PlayToAllOptions playToAllOptions = new PlayToAllOptions(ssmlSource)
+// {
+// OperationContext = "playToAllContext"
+// };
+// await callMedia.PlayToAllAsync(playToAllOptions);
+
+// return Results.Ok();
+//}).WithTags("Play SsmlSource Media APIs");
+
+//app.MapPost("/playSsmlSourceToAll", (ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+// SsmlSource ssmlSource = new SsmlSource("Hi, this is ssml test played through ssml source thanks. Goodbye!");
+
+// PlayToAllOptions playToAllOptions = new PlayToAllOptions(ssmlSource)
+// {
+// OperationContext = "playToAllContext"
+// };
+// callMedia.PlayToAll(playToAllOptions);
+
+// return Results.Ok();
+//}).WithTags("Play SsmlSource Media APIs");
+
+//app.MapPost("/playSsmlSourceBargeInAsync", async (ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+// SsmlSource ssmlSource = new SsmlSource("Hi, this is ssml barge in test played through ssml source thanks. Goodbye!");
+// PlayToAllOptions playToAllOptions = new PlayToAllOptions(ssmlSource)
+// {
+// OperationContext = "playBargeInContext",
+// InterruptCallMediaOperation = true
+// };
+// await callMedia.PlayToAllAsync(playToAllOptions);
+
+// return Results.Ok();
+//}).WithTags("Play SsmlSource Media APIs");
+
+#endregion
+
+# region Play Media with File Source
+
+//app.MapPost("/playFileSourceToPstnTargetAsync", async (string pstnTarget, ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+// FileSource fileSource = new FileSource(new Uri(fileSourceUri));
+// List playTo = new List { new PhoneNumberIdentifier(pstnTarget) };
+// PlayOptions playToOptions = new PlayOptions(fileSource, playTo)
+// {
+// OperationContext = "playToContext"
+// };
+
+// await callMedia.PlayAsync(playToOptions);
+
+// return Results.Ok();
+//}).WithTags("Play FileSource Media APIs");
+
+//app.MapPost("/playFileSourceToPstnTarget", (string pstnTarget, ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+// FileSource fileSource = new FileSource(new Uri(fileSourceUri));
+// List playTo = new List { new PhoneNumberIdentifier(pstnTarget) };
+// PlayOptions playToOptions = new PlayOptions(fileSource, playTo)
+// {
+// OperationContext = "playToContext"
+// };
+
+// callMedia.Play(playToOptions);
+
+// return Results.Ok();
+//}).WithTags("Play FileSource Media APIs");
+
+//app.MapPost("/playFileSourceAcsTargetAsync", async (string acsTarget, ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+// FileSource fileSource = new FileSource(new Uri(fileSourceUri));
+// List playTo = new List { new CommunicationUserIdentifier(acsTarget) };
+// PlayOptions playToOptions = new PlayOptions(fileSource, playTo)
+// {
+// OperationContext = "playToContext"
+// };
+
+// await callMedia.PlayAsync(playToOptions);
+
+// return Results.Ok();
+//}).WithTags("Play FileSource Media APIs");
+
+//app.MapPost("/playFileSourceToAcsTarget", (string acsTarget, ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+// FileSource fileSource = new FileSource(new Uri(fileSourceUri));
+
+// List playTo = new List { new CommunicationUserIdentifier(acsTarget) };
+// PlayOptions playToOptions = new PlayOptions(fileSource, playTo)
+// {
+// OperationContext = "playToContext"
+// };
+
+// callMedia.Play(playToOptions);
+
+// return Results.Ok();
+//}).WithTags("Play FileSource Media APIs");
+
+//app.MapPost("/playFileSourceToTeamsTargetAsync", async (string teamsObjectId, ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+// FileSource fileSource = new FileSource(new Uri(fileSourceUri));
+// List playTo = new List { new MicrosoftTeamsUserIdentifier(teamsObjectId) };
+// PlayOptions playToOptions = new PlayOptions(fileSource, playTo)
+// {
+// OperationContext = "playToContext"
+// };
+
+// await callMedia.PlayAsync(playToOptions);
+
+// return Results.Ok();
+//}).WithTags("Play FileSource Media APIs");
+
+//app.MapPost("/playFileSourceToTeamsTarget", (string teamsObjectId, ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+// FileSource fileSource = new FileSource(new Uri(fileSourceUri));
+// List playTo = new List { new MicrosoftTeamsUserIdentifier(teamsObjectId) };
+// PlayOptions playToOptions = new PlayOptions(fileSource, playTo)
+// {
+// OperationContext = "playToContext"
+// };
+
+// callMedia.Play(playToOptions);
+
+// return Results.Ok();
+//}).WithTags("Play FileSource Media APIs");
+
+//app.MapPost("/playFileSourceToAllAsync", async (ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+// FileSource fileSource = new FileSource(new Uri(fileSourceUri));
+// PlayToAllOptions playToAllOptions = new PlayToAllOptions(fileSource)
+// {
+// OperationContext = "playToAllContext"
+// };
+// await callMedia.PlayToAllAsync(playToAllOptions);
+
+// return Results.Ok();
+//}).WithTags("Play FileSource Media APIs");
+
+//app.MapPost("/playFileSourceToAll", (ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+// FileSource fileSource = new FileSource(new Uri(fileSourceUri));
+
+// PlayToAllOptions playToAllOptions = new PlayToAllOptions(fileSource)
+// {
+// OperationContext = "playToAllContext"
+// };
+// callMedia.PlayToAll(playToAllOptions);
+
+// return Results.Ok();
+//}).WithTags("Play FileSource Media APIs");
+
+//app.MapPost("/playFileSourceBargeInAsync", async (ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+// FileSource fileSource = new FileSource(new Uri(fileSourceUri));
+// PlayToAllOptions playToAllOptions = new PlayToAllOptions(fileSource)
+// {
+// OperationContext = "playBargeInContext",
+// InterruptCallMediaOperation = true
+// };
+// await callMedia.PlayToAllAsync(playToAllOptions);
+
+// return Results.Ok();
+//}).WithTags("Play FileSource Media APIs");
+
+#endregion
+
+
+//# region Play Media With Multiple Play Source
+
+//app.MapPost("/playMultipleSourceToPstnTargetAsync", async (string pstnTarget, bool isLoop, ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+
+// TextSource textSource = new TextSource("Hi, this is test source played through play source thanks. Goodbye!.")
+// {
+// VoiceName = "en-US-NancyNeural"
+// };
+// SsmlSource ssmlSource = new SsmlSource("Hi, this is ssml test played through ssml source thanks. Goodbye!");
+// FileSource fileSource = new FileSource(new Uri(fileSourceUri));
+// List playTo = new List { new PhoneNumberIdentifier(pstnTarget) };
+// List playSources = new List
+// {
+// textSource,
+// ssmlSource,
+// //fileSource
+// };
+// PlayOptions playToOptions = new PlayOptions(playSources, playTo)
+// {
+// OperationContext = "playToContext",
+// OperationCallbackUri = eventCallbackUri, // Set the callback URI for operation events
+// Loop = isLoop // Set Loop to true or false based on the input parameter
+
+// };
+
+// await callMedia.PlayAsync(playToOptions);
+
+// return Results.Ok();
+//}).WithTags("Play Multiple Source Media APIs");
+
+//app.MapPost("/playMultipleSourceToPstnTarget", (string pstnTarget, bool isLoop, ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+
+// TextSource textSource = new TextSource("Hi, this is test source played through play source thanks. Goodbye!.")
+// {
+// VoiceName = "en-US-NancyNeural"
+// };
+// SsmlSource ssmlSource = new SsmlSource("Hi, this is ssml test played through ssml source thanks. Goodbye!");
+// FileSource fileSource = new FileSource(new Uri(fileSourceUri));
+// List playSources = new List
+// {
+// textSource,
+// ssmlSource,
+// //fileSource
+// };
+// List playTo = new List { new PhoneNumberIdentifier(pstnTarget) };
+// PlayOptions playToOptions = new PlayOptions(playSources, playTo)
+// {
+// OperationContext = "playToContext",
+// OperationCallbackUri = eventCallbackUri,
+// Loop = isLoop // Set Loop to true or false based on the input parameter
+// };
+
+// callMedia.Play(playToOptions);
+
+// return Results.Ok();
+//}).WithTags("Play Multiple Source Media APIs");
+
+//app.MapPost("/playMultipleSourceToAllAsync", async (bool isLoop, ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+
+// TextSource textSource = new TextSource("Hi, this is test source played through play source thanks. Goodbye!.")
+// {
+// VoiceName = "en-US-NancyNeural"
+// };
+// SsmlSource ssmlSource = new SsmlSource("Hi, this is ssml test played through ssml source thanks. Goodbye!");
+// FileSource fileSource = new FileSource(new Uri(fileSourceUri));
+// List playSources = new List
+//{
+// textSource,
+// ssmlSource,
+// //fileSource
+//};
+// PlayToAllOptions playToAllOptions = new PlayToAllOptions(playSources)
+// {
+// OperationContext = "playToAllContext",
+// OperationCallbackUri = eventCallbackUri, // Set the callback URI for operation events
+// Loop = isLoop // Set Loop to true or false based on the input parameter
+// };
+// await callMedia.PlayToAllAsync(playToAllOptions);
+
+// return Results.Ok();
+//}).WithTags("Play Multiple Source Media APIs");
+
+//app.MapPost("/playMultipleSourceToAll", (bool isLoop, ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+
+// TextSource textSource = new TextSource("Hi, this is test source played through play source thanks. Goodbye!.")
+// {
+// VoiceName = "en-US-NancyNeural"
+// };
+// SsmlSource ssmlSource = new SsmlSource("Hi, this is ssml test played through ssml source thanks. Goodbye!");
+// FileSource fileSource = new FileSource(new Uri(fileSourceUri));
+// List playSources = new List
+//{
+// textSource,
+// ssmlSource,
+// //fileSource
+//};
+// PlayToAllOptions playToAllOptions = new PlayToAllOptions(playSources)
+// {
+// OperationContext = "playToAllContext",
+// OperationCallbackUri = eventCallbackUri,
+// Loop = isLoop
+// };
+// callMedia.PlayToAll(playToAllOptions);
+
+// return Results.Ok();
+//}).WithTags("Play Multiple Source Media APIs");
+//#endregion
+
+#region Recognization
+
+app.MapPost("/recognizeDTMFAsync", async (string pstnTarget, ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+ TextSource textSource = new TextSource("Hi, this is recognize test. please provide input thanks!.")
+ {
+ VoiceName = "en-US-NancyNeural"
+ };
+
+ var target = new PhoneNumberIdentifier(pstnTarget);
+
+ var recognizeOptions =
+ new CallMediaRecognizeDtmfOptions(
+ targetParticipant: target, maxTonesToCollect: 4)
+ {
+ InterruptPrompt = false,
+ InterToneTimeout = TimeSpan.FromSeconds(5),
+ OperationContext = "DtmfContext",
+ InitialSilenceTimeout = TimeSpan.FromSeconds(15),
+ Prompt = textSource
+ };
+
+ await callMedia.StartRecognizingAsync(recognizeOptions);
+
+ return Results.Ok();
+}).WithTags("Start Recognization APIs");
+
+app.MapPost("/recognizeDTMF", (string pstnTarget, ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+ TextSource textSource = new TextSource("Hi, this is recognize test. please provide input thanks!.")
+ {
+ VoiceName = "en-US-NancyNeural"
+ };
+
+ var target = new CommunicationUserIdentifier(pstnTarget);
+
+ var recognizeOptions =
+ new CallMediaRecognizeDtmfOptions(
+ targetParticipant: target, maxTonesToCollect: 4)
+ {
+ InterruptPrompt = false,
+ InterToneTimeout = TimeSpan.FromSeconds(5),
+ OperationContext = "DtmfContext",
+ InitialSilenceTimeout = TimeSpan.FromSeconds(15),
+ Prompt = textSource
+ };
+
+ callMedia.StartRecognizing(recognizeOptions);
+
+ return Results.Ok();
+}).WithTags("Start Recognization APIs");
+
+
+app.MapPost("/recognizeSpeechAsync", async (string pstnTarget, ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+ TextSource textSource = new TextSource("Hi, this is recognize test. please provide input thanks!.")
+ {
+ VoiceName = "en-US-NancyNeural"
+ };
+
+ var target = new CommunicationUserIdentifier(pstnTarget);
+
+ var recognizeOptions = new CallMediaRecognizeSpeechOptions(targetParticipant: target)
+ {
+ InterruptPrompt = false,
+ OperationContext = "SpeechContext",
+ InitialSilenceTimeout = TimeSpan.FromSeconds(15),
+ Prompt = textSource,
+ EndSilenceTimeout = TimeSpan.FromSeconds(5),
+ IsSentimentAnalysisEnabled = true,
+ SpeechLanguages = new List { "en-US", "en-IN" },
+ OperationCallbackUri = eventCallbackUri
+ };
+
+ await callMedia.StartRecognizingAsync(recognizeOptions);
+
+ return Results.Ok();
+}).WithTags("Start Recognization APIs");
+
+app.MapPost("/recognizeSpeech", (string pstnTarget, ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+ TextSource textSource = new TextSource("Hi, this is recognize test. please provide input thanks!.")
+ {
+ VoiceName = "en-US-NancyNeural"
+ };
+
+ var target = new CommunicationUserIdentifier(pstnTarget);
+
+ var recognizeOptions = new CallMediaRecognizeSpeechOptions(targetParticipant: target)
+ {
+ InterruptPrompt = false,
+ OperationContext = "SpeechContext",
+ InitialSilenceTimeout = TimeSpan.FromSeconds(15),
+ Prompt = textSource,
+ EndSilenceTimeout = TimeSpan.FromSeconds(5),
+ IsSentimentAnalysisEnabled = true,
+ SpeechLanguages = new List { "en-US", "en-IN" },
+ OperationCallbackUri = eventCallbackUri
+ };
+
+ callMedia.StartRecognizing(recognizeOptions);
+
+ return Results.Ok();
+}).WithTags("Start Recognization APIs");
+
+app.MapPost("/recognizeSpeechOrDtmfAsync", async (string pstnTarget, ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+ TextSource textSource = new TextSource("Hi, this is recognize test. please provide input thanks!.")
+ {
+ VoiceName = "en-US-NancyNeural"
+ };
+
+ var target = new CommunicationUserIdentifier(pstnTarget);
+
+ var recognizeOptions =
+ new CallMediaRecognizeSpeechOrDtmfOptions(
+ targetParticipant: target, maxTonesToCollect: 4)
+ {
+ InterruptPrompt = false,
+ OperationContext = "SpeechOrDTMFContext",
+ InitialSilenceTimeout = TimeSpan.FromSeconds(15),
+ Prompt = textSource,
+ EndSilenceTimeout = TimeSpan.FromSeconds(5),
+ IsSentimentAnalysisEnabled = true,
+ SpeechLanguages = new List { "en-US", "en-IN" },
+ OperationCallbackUri = eventCallbackUri
+ };
+ await callMedia.StartRecognizingAsync(recognizeOptions);
+
+ return Results.Ok();
+}).WithTags("Start Recognization APIs");
+
+app.MapPost("/recognizeSpeechOrDtmf", (string pstnTarget, ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+ TextSource textSource = new TextSource("Hi, this is recognize test. please provide input thanks!.")
+ {
+ VoiceName = "en-US-NancyNeural"
+ };
+
+ var target = new CommunicationUserIdentifier(pstnTarget);
+
+ var recognizeOptions =
+ new CallMediaRecognizeSpeechOrDtmfOptions(
+ targetParticipant: target, maxTonesToCollect: 4)
+ {
+ InterruptPrompt = false,
+ OperationContext = "SpeechOrDTMFContext",
+ InitialSilenceTimeout = TimeSpan.FromSeconds(15),
+ Prompt = textSource,
+ EndSilenceTimeout = TimeSpan.FromSeconds(5),
+ IsSentimentAnalysisEnabled = true,
+ SpeechLanguages = new List { "en-US", "en-IN" },
+ OperationCallbackUri = eventCallbackUri
+ };
+ callMedia.StartRecognizingAsync(recognizeOptions);
+
+ return Results.Ok();
+}).WithTags("Start Recognization APIs");
+
+app.MapPost("/recognizeChoiceAsync", async (string pstnTarget, ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+ TextSource textSource = new TextSource("Hi, this is recognize test. please provide input thanks!.")
+ {
+ VoiceName = "en-US-NancyNeural"
+ };
+
+ var target = new CommunicationUserIdentifier(pstnTarget);
+
+
+ var recognizeOptions =
+ new CallMediaRecognizeChoiceOptions(targetParticipant: target, GetChoices())
+ {
+ InterruptCallMediaOperation = false,
+ InterruptPrompt = false,
+ InitialSilenceTimeout = TimeSpan.FromSeconds(15),
+ Prompt = textSource,
+ OperationContext = "ChoiceContext",
+ IsSentimentAnalysisEnabled = true,
+ SpeechLanguages = new List { "en-US", "en-IN" },
+ OperationCallbackUri = eventCallbackUri
+ };
+
+
+ await callMedia.StartRecognizingAsync(recognizeOptions);
+
+ return Results.Ok();
+}).WithTags("Start Recognization APIs");
+
+app.MapPost("/recognizeChoice", (string pstnTarget, ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+ TextSource textSource = new TextSource("Hi, this is recognize test. please provide input thanks!.")
+ {
+ VoiceName = "en-US-NancyNeural"
+ };
+
+ var target = new CommunicationUserIdentifier(pstnTarget);
+
+
+ var recognizeOptions =
+ new CallMediaRecognizeChoiceOptions(targetParticipant: target, GetChoices())
+ {
+ InterruptCallMediaOperation = false,
+ InterruptPrompt = false,
+ InitialSilenceTimeout = TimeSpan.FromSeconds(15),
+ Prompt = textSource,
+ OperationContext = "ChoiceContext",
+ IsSentimentAnalysisEnabled = true,
+ SpeechLanguages = new List { "en-US", "en-IN" },
+ OperationCallbackUri = eventCallbackUri
+ };
+
+ callMedia.StartRecognizingAsync(recognizeOptions);
+
+ return Results.Ok();
+}).WithTags("Start Recognization APIs");
+
+#endregion
+
+
+//#region Recognization multiple play sources
+
+//app.MapPost("/recognizeDTMFWithMultiplePlaySourcesAsync", async (string pstnTarget, ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+// TextSource textSource = new TextSource("Hi, this is recognize test. please provide input thanks!.")
+// {
+// VoiceName = "en-US-NancyNeural"
+// };
+// SsmlSource ssmlSource = new SsmlSource("Hi, this is ssml test played through ssml source thanks. Goodbye!");
+// FileSource fileSource = new FileSource(new Uri(fileSourceUri));
+// List playSources = new List
+// {
+// textSource,
+// //fileSource,
+// ssmlSource
+// };
+// var target = new CommunicationUserIdentifier(pstnTarget);
+
+// var recognizeOptions =
+// new CallMediaRecognizeDtmfOptions(
+// targetParticipant: target, maxTonesToCollect: 4)
+// {
+// InterruptPrompt = false,
+// InterToneTimeout = TimeSpan.FromSeconds(5),
+// OperationContext = "DtmfContext",
+// InitialSilenceTimeout = TimeSpan.FromSeconds(15),
+// //Prompt = textSource,
+// PlayPrompts = playSources,
+// };
+
+// await callMedia.StartRecognizingAsync(recognizeOptions);
+
+// return Results.Ok();
+//}).WithTags("Start Recognization APIs");
+
+//app.MapPost("/recognizeDTMFWithMultiplePlaySources", (string pstnTarget, ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+// TextSource textSource = new TextSource("Hi, this is recognize test. please provide input thanks!.")
+// {
+// VoiceName = "en-US-NancyNeural"
+// };
+// SsmlSource ssmlSource = new SsmlSource("Hi, this is ssml test played through ssml source thanks. Goodbye!");
+// FileSource fileSource = new FileSource(new Uri(fileSourceUri));
+// List playSources = new List
+// {
+// textSource,
+// //fileSource,
+// ssmlSource
+// };
+// var target = new CommunicationUserIdentifier(pstnTarget);
+
+// var recognizeOptions =
+// new CallMediaRecognizeDtmfOptions(
+// targetParticipant: target, maxTonesToCollect: 4)
+// {
+// InterruptPrompt = false,
+// InterToneTimeout = TimeSpan.FromSeconds(5),
+// OperationContext = "DtmfContext",
+// InitialSilenceTimeout = TimeSpan.FromSeconds(15),
+// //Prompt = textSource,
+// PlayPrompts = playSources,
+// };
+
+// callMedia.StartRecognizing(recognizeOptions);
+
+// return Results.Ok();
+//}).WithTags("Start Recognize with multiple play sources APIs");
+
+
+//app.MapPost("/recognizeSpeechWithMultiplePlaySourcesAsync", async (string pstnTarget, ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+// TextSource textSource = new TextSource("Hi, this is recognize test. please provide input thanks!.")
+// {
+// VoiceName = "en-US-NancyNeural"
+// };
+// SsmlSource ssmlSource = new SsmlSource("Hi, this is ssml test played through ssml source thanks. Goodbye!");
+// FileSource fileSource = new FileSource(new Uri(fileSourceUri));
+// List playSources = new List
+// {
+// textSource,
+// //fileSource,
+// ssmlSource
+// };
+// var target = new CommunicationUserIdentifier(pstnTarget);
+
+// var recognizeOptions = new CallMediaRecognizeSpeechOptions(targetParticipant: target)
+// {
+// InterruptPrompt = false,
+// OperationContext = "SpeechContext",
+// InitialSilenceTimeout = TimeSpan.FromSeconds(15),
+// //Prompt = textSource,
+// PlayPrompts = playSources,
+// EndSilenceTimeout = TimeSpan.FromSeconds(5),
+// IsSentimentAnalysisEnabled = true,
+// SpeechLanguages = new List { "en-US", "en-IN" },
+// OperationCallbackUri = eventCallbackUri
+// };
+
+// await callMedia.StartRecognizingAsync(recognizeOptions);
+
+// return Results.Ok();
+//}).WithTags("Start Recognize with multiple play sources APIs");
+
+//app.MapPost("/recognizeSpeechWithMultiplePlaySources", (string pstnTarget, ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+// TextSource textSource = new TextSource("Hi, this is recognize test. please provide input thanks!.")
+// {
+// VoiceName = "en-US-NancyNeural"
+// };
+// SsmlSource ssmlSource = new SsmlSource("Hi, this is ssml test played through ssml source thanks. Goodbye!");
+// FileSource fileSource = new FileSource(new Uri(fileSourceUri));
+// List playSources = new List
+// {
+// textSource,
+// //fileSource,
+// ssmlSource
+// };
+// var target = new CommunicationUserIdentifier(pstnTarget);
+
+// var recognizeOptions = new CallMediaRecognizeSpeechOptions(targetParticipant: target)
+// {
+// InterruptPrompt = false,
+// OperationContext = "SpeechContext",
+// InitialSilenceTimeout = TimeSpan.FromSeconds(15),
+// //Prompt = textSource,
+// PlayPrompts = playSources,
+// EndSilenceTimeout = TimeSpan.FromSeconds(5),
+// IsSentimentAnalysisEnabled = true,
+// SpeechLanguages = new List { "en-US", "en-IN" },
+// OperationCallbackUri = eventCallbackUri
+// };
+
+// callMedia.StartRecognizing(recognizeOptions);
+
+// return Results.Ok();
+//}).WithTags("Start Recognize with multiple play sources APIs");
+
+//app.MapPost("/recognizeSpeechOrDtmfWithMultiplePlaySourcesAsync", async (string pstnTarget, ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+// TextSource textSource = new TextSource("Hi, this is recognize test. please provide input thanks!.")
+// {
+// VoiceName = "en-US-NancyNeural"
+// };
+// SsmlSource ssmlSource = new SsmlSource("Hi, this is ssml test played through ssml source thanks. Goodbye!");
+// FileSource fileSource = new FileSource(new Uri(fileSourceUri));
+// List playSources = new List
+// {
+// textSource,
+// //fileSource,
+// ssmlSource
+// };
+// var target = new CommunicationUserIdentifier(pstnTarget);
+
+// var recognizeOptions =
+// new CallMediaRecognizeSpeechOrDtmfOptions(
+// targetParticipant: target, maxTonesToCollect: 4)
+// {
+// InterruptPrompt = false,
+// OperationContext = "SpeechOrDTMFContext",
+// InitialSilenceTimeout = TimeSpan.FromSeconds(15),
+// //Prompt = textSource,
+// PlayPrompts = playSources,
+// EndSilenceTimeout = TimeSpan.FromSeconds(5),
+// IsSentimentAnalysisEnabled = true,
+// SpeechLanguages = new List { "en-US", "en-IN" },
+// OperationCallbackUri = eventCallbackUri
+// };
+// await callMedia.StartRecognizingAsync(recognizeOptions);
+
+// return Results.Ok();
+//}).WithTags("Start Recognize with multiple play sources APIs");
+
+//app.MapPost("/recognizeSpeechOrDtmfWithMultiplePlaySources", (string pstnTarget, ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+// TextSource textSource = new TextSource("Hi, this is recognize test. please provide input thanks!.")
+// {
+// VoiceName = "en-US-NancyNeural"
+// };
+// SsmlSource ssmlSource = new SsmlSource("Hi, this is ssml test played through ssml source thanks. Goodbye!");
+// FileSource fileSource = new FileSource(new Uri(fileSourceUri));
+// List playSources = new List
+// {
+// textSource,
+// //fileSource,
+// ssmlSource
+// };
+// var target = new CommunicationUserIdentifier(pstnTarget);
+
+// var recognizeOptions =
+// new CallMediaRecognizeSpeechOrDtmfOptions(
+// targetParticipant: target, maxTonesToCollect: 4)
+// {
+// InterruptPrompt = false,
+// OperationContext = "SpeechOrDTMFContext",
+// InitialSilenceTimeout = TimeSpan.FromSeconds(15),
+// //Prompt = textSource,
+// PlayPrompts = playSources,
+// EndSilenceTimeout = TimeSpan.FromSeconds(5),
+// IsSentimentAnalysisEnabled = true,
+// SpeechLanguages = new List { "en-US", "en-IN" },
+// OperationCallbackUri = eventCallbackUri
+// };
+// callMedia.StartRecognizingAsync(recognizeOptions);
+
+// return Results.Ok();
+//}).WithTags("Start Recognize with multiple play sources APIs");
+
+//app.MapPost("/recognizeChoiceWithMultiplePlaySourcesAsync", async (string pstnTarget, ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+// TextSource textSource = new TextSource("Hi, this is recognize test. please provide input thanks!.")
+// {
+// VoiceName = "en-US-NancyNeural"
+// };
+// SsmlSource ssmlSource = new SsmlSource("Hi, this is ssml test played through ssml source thanks. Goodbye!");
+// FileSource fileSource = new FileSource(new Uri(fileSourceUri));
+// List playSources = new List
+// {
+// textSource,
+// //fileSource,
+// ssmlSource
+// };
+// var target = new CommunicationUserIdentifier(pstnTarget);
+
+
+// var recognizeOptions =
+// new CallMediaRecognizeChoiceOptions(targetParticipant: target, GetChoices())
+// {
+// InterruptCallMediaOperation = false,
+// InterruptPrompt = false,
+// InitialSilenceTimeout = TimeSpan.FromSeconds(15),
+// //Prompt = textSource,
+// PlayPrompts = playSources,
+// OperationContext = "ChoiceContext",
+// IsSentimentAnalysisEnabled = true,
+// SpeechLanguages = new List { "en-US", "en-IN" },
+// OperationCallbackUri = eventCallbackUri
+// };
+
+
+// await callMedia.StartRecognizingAsync(recognizeOptions);
+
+// return Results.Ok();
+//}).WithTags("Start Recognize with multiple play sources APIs");
+
+//app.MapPost("/recognizeChoiceWithMultiplePlaySources", (string pstnTarget, ILogger logger) =>
+//{
+// CallMedia callMedia = GetCallMedia();
+// TextSource textSource = new TextSource("Hi, this is recognize test. please provide input thanks!.")
+// {
+// VoiceName = "en-US-NancyNeural"
+// };
+// SsmlSource ssmlSource = new SsmlSource("Hi, this is ssml test played through ssml source thanks. Goodbye!");
+// FileSource fileSource = new FileSource(new Uri(fileSourceUri));
+// List playSources = new List
+// {
+// textSource,
+// //fileSource,
+// ssmlSource
+// };
+// var target = new CommunicationUserIdentifier(pstnTarget);
+
+
+// var recognizeOptions =
+// new CallMediaRecognizeChoiceOptions(targetParticipant: target, GetChoices())
+// {
+// InterruptCallMediaOperation = false,
+// InterruptPrompt = false,
+// InitialSilenceTimeout = TimeSpan.FromSeconds(15),
+// //Prompt = textSource,
+// PlayPrompts = playSources,
+// OperationContext = "ChoiceContext",
+// IsSentimentAnalysisEnabled = true,
+// SpeechLanguages = new List { "en-US", "en-IN" },
+// OperationCallbackUri = eventCallbackUri
+// };
+
+// callMedia.StartRecognizingAsync(recognizeOptions);
+
+// return Results.Ok();
+//}).WithTags("Start Recognize with multiple play sources APIs");
+
+//#endregion
+
+//# region DTMF
+
+//app.MapPost("/sendDTMFTonesAsync", async (string pstnTarget, ILogger logger) =>
+//{
+// CommunicationIdentifier target = new PhoneNumberIdentifier(pstnTarget);
+
+// List tones = new List
+// {
+// DtmfTone.Zero,
+// DtmfTone.One
+// };
+
+// CallMedia callMedia = GetCallMedia();
+
+// await callMedia.SendDtmfTonesAsync(tones, target);
+// return Results.Ok();
+//}).WithTags("Send or Start DTMF APIs");
+
+//app.MapPost("/sendDTMFTones", (string pstnTarget, ILogger logger) =>
+//{
+// CommunicationIdentifier target = new PhoneNumberIdentifier(pstnTarget);
+
+// List tones = new List
+// {
+// DtmfTone.Zero,
+// DtmfTone.One
+// };
+
+// CallMedia callMedia = GetCallMedia();
+
+// callMedia.SendDtmfTones(tones, target);
+// return Results.Ok();
+//}).WithTags("Send or Start DTMF APIs");
+
+//app.MapPost("/startContinuousDTMFTonesAsync", async (string pstnTarget, ILogger logger) =>
+//{
+// CommunicationIdentifier target = new PhoneNumberIdentifier(pstnTarget);
+
+// CallMedia callMedia = GetCallMedia();
+
+// await callMedia.StartContinuousDtmfRecognitionAsync(target);
+// return Results.Ok();
+//}).WithTags("Send or Start DTMF APIs");
+
+//app.MapPost("/startContinuousDTMFTones", (string pstnTarget, ILogger logger) =>
+//{
+// CommunicationIdentifier target = new PhoneNumberIdentifier(pstnTarget);
+
+// CallMedia callMedia = GetCallMedia();
+
+// callMedia.StartContinuousDtmfRecognition(target);
+// return Results.Ok();
+//}).WithTags("Send or Start DTMF APIs");
+
+//app.MapPost("/stopContinuousDTMFTonesAsync", async (string pstnTarget, ILogger logger) =>
+//{
+// CommunicationIdentifier target = new PhoneNumberIdentifier(pstnTarget);
+
+// CallMedia callMedia = GetCallMedia();
+
+// await callMedia.StopContinuousDtmfRecognitionAsync(target);
+// return Results.Ok();
+//}).WithTags("Send or Start DTMF APIs");
+
+//app.MapPost("/stopContinuousDTMFTones", (string pstnTarget, ILogger logger) =>
+//{
+// CommunicationIdentifier target = new PhoneNumberIdentifier(pstnTarget);
+
+// CallMedia callMedia = GetCallMedia();
+
+// callMedia.StopContinuousDtmfRecognition(target);
+// return Results.Ok();
+//}).WithTags("Send or Start DTMF APIs");
+
+//# endregion
+
+# region Hold/Unhold
+
+app.MapPost("/holdParticipantAsync", async (string pstnTarget, bool isPlaySource, ILogger logger) =>
+{
+ CommunicationIdentifier target = new PhoneNumberIdentifier(pstnTarget);
+
+ CallMedia callMedia = GetCallMedia();
+ TextSource textSource = new TextSource("You are on hold please wait..")
+ {
+ VoiceName = "en-US-NancyNeural"
+ };
+
+ if (isPlaySource)
+ {
+ HoldOptions holdOptions = new HoldOptions(target)
+ {
+ PlaySource = textSource,
+ OperationContext = "holdUserContext"
+ };
+ await callMedia.HoldAsync(holdOptions);
+ }
+ else
+ {
+ HoldOptions holdOptions = new HoldOptions(target)
+ {
+ OperationContext = "holdUserContext"
+ };
+ await callMedia.HoldAsync(holdOptions);
+ }
+
+ return Results.Ok();
+}).WithTags("Hold Participant APIs");
+
+////app.MapPost("/holdTeamsParticipantAsync", async (string teamsId, bool isPlaySource, ILogger logger) =>
+////{
+//// CommunicationIdentifier target = new MicrosoftTeamsUserIdentifier(teamsId);
+
+//// CallMedia callMedia = GetCallMedia();
+//// TextSource textSource = new TextSource("You are on hold please wait..")
+//// {
+//// VoiceName = "en-US-NancyNeural"
+//// };
+
+//// if (isPlaySource)
+//// {
+//// HoldOptions holdOptions = new HoldOptions(target)
+//// {
+//// PlaySource = textSource,
+//// OperationContext = "holdUserContext"
+//// };
+//// await callMedia.HoldAsync(holdOptions);
+//// }
+//// else
+//// {
+//// HoldOptions holdOptions = new HoldOptions(target)
+//// {
+//// OperationContext = "holdUserContext"
+//// };
+//// await callMedia.HoldAsync(holdOptions);
+//// }
+
+//// return Results.Ok();
+////}).WithTags("Hold Participant APIs");
+
+app.MapPost("/holdTPEParticipantAsync", async (string userId, string tenantId, string resourceId, bool isPlaySource, ILogger logger) =>
+{
+ CommunicationIdentifier target = new TeamsExtensionUserIdentifier(userId, tenantId, resourceId);
+
+ CallMedia callMedia = GetCallMedia();
+ TextSource textSource = new TextSource("You are on hold please wait..")
+ {
+ VoiceName = "en-US-NancyNeural"
+ };
+
+ if (isPlaySource)
+ {
+ HoldOptions holdOptions = new HoldOptions(target)
+ {
+ PlaySource = textSource,
+ OperationContext = "holdUserContext"
+ };
+ await callMedia.HoldAsync(holdOptions);
+ }
+ else
+ {
+ HoldOptions holdOptions = new HoldOptions(target)
+ {
+ OperationContext = "holdUserContext"
+ };
+ await callMedia.HoldAsync(holdOptions);
+ }
+
+ return Results.Ok();
+}).WithTags("Hold Participant APIs");
+
+////app.MapPost("/holdParticipant", (string pstnTarget, bool isPlaySource, ILogger logger) =>
+////{
+//// CommunicationIdentifier target = new PhoneNumberIdentifier(pstnTarget);
+
+//// CallMedia callMedia = GetCallMedia();
+//// TextSource textSource = new TextSource("You are on hold please wait..")
+//// {
+//// VoiceName = "en-US-NancyNeural"
+//// };
+
+//// if (isPlaySource)
+//// {
+//// HoldOptions holdOptions = new HoldOptions(target)
+//// {
+//// PlaySource = textSource,
+//// OperationContext = "holdUserContext"
+//// };
+//// callMedia.Hold(holdOptions);
+//// }
+//// else
+//// {
+//// HoldOptions holdOptions = new HoldOptions(target)
+//// {
+//// OperationContext = "holdUserContext"
+//// };
+//// callMedia.Hold(holdOptions);
+//// }
+
+//// return Results.Ok();
+////}).WithTags("Hold Participant APIs");
+
+app.MapPost("/unholdParticipantAsync", async (string pstnTarget, ILogger logger) =>
+{
+ CommunicationIdentifier target = new PhoneNumberIdentifier(pstnTarget);
+
+ CallMedia callMedia = GetCallMedia();
+
+ UnholdOptions unholdOptions = new UnholdOptions(target)
+ {
+ OperationContext = "unholdUserContext"
+ };
+
+ await callMedia.UnholdAsync(unholdOptions);
+ return Results.Ok();
+}).WithTags("Hold Participant APIs");
+
+////app.MapPost("/unholdTeamsParticipantAsync", async (string teamsId, ILogger logger) =>
+////{
+//// CommunicationIdentifier target = new MicrosoftTeamsUserIdentifier(teamsId);
+
+//// CallMedia callMedia = GetCallMedia();
+
+//// UnholdOptions unholdOptions = new UnholdOptions(target)
+//// {
+//// OperationContext = "unholdUserContext"
+//// };
+
+//// await callMedia.UnholdAsync(unholdOptions);
+//// return Results.Ok();
+////}).WithTags("Hold Participant APIs");
+
+app.MapPost("/unholdTPEParticipantAsync", async (string userId, string tenantId, string resourceId, ILogger logger) =>
+{
+ CommunicationIdentifier target = new TeamsExtensionUserIdentifier(userId, tenantId, resourceId);
+
+ CallMedia callMedia = GetCallMedia();
+
+ UnholdOptions unholdOptions = new UnholdOptions(target)
+ {
+ OperationContext = "unholdUserContext"
+ };
+
+ await callMedia.UnholdAsync(unholdOptions);
+ return Results.Ok();
+}).WithTags("Hold Participant APIs");
+
+////app.MapPost("/unholdParticipant", (string pstnTarget, ILogger logger) =>
+////{
+//// CommunicationIdentifier target = new PhoneNumberIdentifier(pstnTarget);
+
+//// CallMedia callMedia = GetCallMedia();
+
+//// UnholdOptions unholdOptions = new UnholdOptions(target)
+//// {
+//// OperationContext = "unholdUserContext"
+//// };
+
+//// callMedia.Unhold(unholdOptions);
+//// return Results.Ok();
+////}).WithTags("Hold Participant APIs");
+
+//app.MapPost("/holdParticipantWithoutOptionsAsync", async (string pstnTarget, bool isPlaySource, ILogger logger) =>
+//{
+// CommunicationIdentifier target = new PhoneNumberIdentifier(pstnTarget);
+
+// CallMedia callMedia = GetCallMedia();
+// TextSource textSource = new TextSource("You are on hold please wait..")
+// {
+// VoiceName = "en-US-NancyNeural"
+// };
+
+// if (isPlaySource)
+// {
+// await callMedia.HoldAsync(target, textSource);
+// }
+// else
+// {
+// await callMedia.HoldAsync(target, textSource);
+// }
+
+// return Results.Ok();
+//}).WithTags("Hold Participant APIs");
+
+////app.MapPost("/holdParticipantWithoutOptions", (string pstnTarget, bool isPlaySource, ILogger logger) =>
+////{
+//// CommunicationIdentifier target = new PhoneNumberIdentifier(pstnTarget);
+
+//// CallMedia callMedia = GetCallMedia();
+//// TextSource textSource = new TextSource("You are on hold please wait..")
+//// {
+//// VoiceName = "en-US-NancyNeural"
+//// };
+
+//// if (isPlaySource)
+//// {
+//// callMedia.Hold(target, textSource);
+//// }
+//// else
+//// {
+//// callMedia.Hold(target);
+//// }
+
+//// return Results.Ok();
+////}).WithTags("Hold Participant APIs");
+
+
+//app.MapPost("/holdACSParticipantAsync", async (string acsTarget, bool isPlaySource, ILogger logger) =>
+//{
+// CommunicationIdentifier target = new CommunicationUserIdentifier(acsTarget);
+
+// CallMedia callMedia = GetCallMedia();
+// TextSource textSource = new TextSource("You are on hold please wait..")
+// {
+// VoiceName = "en-US-NancyNeural"
+// };
+
+// if (isPlaySource)
+// {
+// HoldOptions holdOptions = new HoldOptions(target)
+// {
+// PlaySource = textSource,
+// OperationContext = "holdUserContext"
+// };
+// await callMedia.HoldAsync(holdOptions);
+// }
+// else
+// {
+// HoldOptions holdOptions = new HoldOptions(target)
+// {
+// OperationContext = "holdUserContext"
+// };
+// await callMedia.HoldAsync(holdOptions);
+// }
+
+// return Results.Ok();
+//}).WithTags("Hold Participant APIs");
+
+////app.MapPost("/holdACSParticipant", (string acsTarget, bool isPlaySource, ILogger logger) =>
+////{
+//// CommunicationIdentifier target = new CommunicationUserIdentifier(acsTarget);
+
+//// CallMedia callMedia = GetCallMedia();
+//// TextSource textSource = new TextSource("You are on hold please wait..")
+//// {
+//// VoiceName = "en-US-NancyNeural"
+//// };
+
+//// if (isPlaySource)
+//// {
+//// HoldOptions holdOptions = new HoldOptions(target)
+//// {
+//// PlaySource = textSource,
+//// OperationContext = "holdUserContext"
+//// };
+//// callMedia.Hold(holdOptions);
+//// }
+//// else
+//// {
+//// HoldOptions holdOptions = new HoldOptions(target)
+//// {
+//// OperationContext = "holdUserContext"
+//// };
+//// callMedia.Hold(holdOptions);
+//// }
+
+//// return Results.Ok();
+////}).WithTags("Hold Participant APIs");
+
+//app.MapPost("/unholdACSParticipantAsync", async (string acsTarget, ILogger logger) =>
+//{
+// CommunicationIdentifier target = new CommunicationUserIdentifier(acsTarget);
+
+// CallMedia callMedia = GetCallMedia();
+
+// UnholdOptions unholdOptions = new UnholdOptions(target)
+// {
+// OperationContext = "unholdUserContext"
+// };
+
+// await callMedia.UnholdAsync(unholdOptions);
+// return Results.Ok();
+//}).WithTags("Hold Participant APIs");
+
+////app.MapPost("/unholdACSParticipant", (string acsTarget, ILogger logger) =>
+////{
+//// CommunicationIdentifier target = new CommunicationUserIdentifier(acsTarget);
+
+//// CallMedia callMedia = GetCallMedia();
+
+//// UnholdOptions unholdOptions = new UnholdOptions(target)
+//// {
+//// OperationContext = "unholdUserContext"
+//// };
+
+//// callMedia.Unhold(unholdOptions);
+//// return Results.Ok();
+////}).WithTags("Hold Participant APIs");
+
+//app.MapPost("/holdACSParticipantWithoutOptionsAsync", async (string acsTarget, bool isPlaySource, ILogger logger) =>
+//{
+// CommunicationIdentifier target = new CommunicationUserIdentifier(acsTarget);
+
+// CallMedia callMedia = GetCallMedia();
+// TextSource textSource = new TextSource("You are on hold please wait..")
+// {
+// VoiceName = "en-US-NancyNeural"
+// };
+
+// if (isPlaySource)
+// {
+// await callMedia.HoldAsync(target, textSource);
+// }
+// else
+// {
+// await callMedia.HoldAsync(target, textSource);
+// }
+
+// return Results.Ok();
+//}).WithTags("Hold Participant APIs");
+
+////app.MapPost("/holdAcsParticipantWithoutOptions", (string acsTarget, bool isPlaySource, ILogger logger) =>
+////{
+//// CommunicationIdentifier target = new CommunicationUserIdentifier(acsTarget);
+
+//// CallMedia callMedia = GetCallMedia();
+//// TextSource textSource = new TextSource("You are on hold please wait..")
+//// {
+//// VoiceName = "en-US-NancyNeural"
+//// };
+
+//// if (isPlaySource)
+//// {
+//// callMedia.Hold(target, textSource);
+//// }
+//// else
+//// {
+//// callMedia.Hold(target);
+//// }
+
+//// return Results.Ok();
+////}).WithTags("Hold Participant APIs");
+
+# endregion
+
+#region Disconnect call
+
+app.MapPost("/hangupAsync", async (bool isForEveryOne, ILogger logger) =>
+{
+ CallConnection callConnection = GetConnection();
+ await callConnection.HangUpAsync(isForEveryOne);
+ return Results.Ok();
+}).WithTags("Disconnect call APIs");
+
+app.MapPost("/hangup", (bool isForEveryOne, ILogger logger) =>
+{
+ CallConnection callConnection = GetConnection();
+ callConnection.HangUp(isForEveryOne);
+ return Results.Ok();
+}).WithTags("Disconnect call APIs");
+
+#endregion
+
+# region Mute Particiapant
+
+app.MapPost("/muteTeamsParticipantAsync", async (string teamsId, ILogger logger) =>
+{
+ CommunicationIdentifier target = new MicrosoftTeamsUserIdentifier(teamsId);
+
+ CallConnection callConnection = GetConnection();
+
+ await callConnection.MuteParticipantAsync(target);
+
+ return Results.Ok();
+}).WithTags("Mute Participant APIs");
+
+
+app.MapPost("/muteDuelPersonaParticipantAsync", async (string userId, string tenantId, string resourceId, ILogger logger) =>
+{
+ CommunicationIdentifier target = new TeamsExtensionUserIdentifier(userId, tenantId, resourceId);
+
+ CallConnection callConnection = GetConnection();
+
+ await callConnection.MuteParticipantAsync(target);
+
+ return Results.Ok();
+}).WithTags("Mute Participant APIs");
+
+app.MapPost("/muteAcsParticipantAsync", async (string acsTarget, ILogger logger) =>
+{
+ CommunicationIdentifier target = new CommunicationUserIdentifier(acsTarget);
+
+ CallConnection callConnection = GetConnection();
+
+ await callConnection.MuteParticipantAsync(target);
+
+ return Results.Ok();
+}).WithTags("Mute Participant APIs");
+
+app.MapPost("/muteAcsParticipant", (string acsTarget, ILogger logger) =>
+{
+ CommunicationIdentifier target = new CommunicationUserIdentifier(acsTarget);
+
+ CallConnection callConnection = GetConnection();
+
+ callConnection.MuteParticipant(target);
+
+ return Results.Ok();
+}).WithTags("Mute Participant APIs");
+
+#endregion
+
+# region Media streaming
+
+//app.MapPost("/createCallToPstnWithMediaStreamingAsync", async (string targetPhoneNumber, bool isEnableBidirectional, bool isPcm24kMono, ILogger logger) =>
+//{
+// PhoneNumberIdentifier target = new PhoneNumberIdentifier(targetPhoneNumber);
+// PhoneNumberIdentifier caller = new PhoneNumberIdentifier(acsPhoneNumber);
+
+
+// var callbackUri = new Uri(new Uri(callbackUriHost), "/api/callbacks");
+// eventCallbackUri = callbackUri;
+// CallInvite callInvite = new CallInvite(target, caller);
+// var websocketUri = callbackUriHost.Replace("https", "wss") + "/ws";
+// MediaStreamingOptions mediaStreamingOptions = new MediaStreamingOptions(new Uri(websocketUri), MediaStreamingContent.Audio,
+// MediaStreamingAudioChannel.Unmixed, MediaStreamingTransport.Websocket, true);
+// mediaStreamingOptions.EnableBidirectional = isEnableBidirectional;
+// mediaStreamingOptions.AudioFormat = isPcm24kMono ? AudioFormat.Pcm24KMono : AudioFormat.Pcm16KMono;
+
+// var createCallOptions = new CreateCallOptions(callInvite, callbackUri)
+// {
+// CallIntelligenceOptions = new CallIntelligenceOptions() { CognitiveServicesEndpoint = new Uri(cognitiveServicesEndpoint) },
+// MediaStreamingOptions = mediaStreamingOptions
+// };
+
+// CreateCallResult createCallResult = await client.CreateCallAsync(createCallOptions);
+
+// logger.LogInformation($"Created async pstn media streaming call with connection id: {createCallResult.CallConnectionProperties.CallConnectionId}");
+//}).WithTags("Media streaming APIs");
+
+//app.MapPost("/createCallToPstnWithMediaStreaming", (string targetPhoneNumber, bool isEnableBidirectional, bool isPcm24kMono, ILogger logger) =>
+//{
+// PhoneNumberIdentifier target = new PhoneNumberIdentifier(targetPhoneNumber);
+// PhoneNumberIdentifier caller = new PhoneNumberIdentifier(acsPhoneNumber);
+
+
+// var callbackUri = new Uri(new Uri(callbackUriHost), "/api/callbacks");
+// eventCallbackUri = callbackUri;
+// CallInvite callInvite = new CallInvite(target, caller);
+// var websocketUri = callbackUriHost.Replace("https", "wss") + "/ws";
+// MediaStreamingOptions mediaStreamingOptions = new MediaStreamingOptions(new Uri(websocketUri), MediaStreamingContent.Audio,
+// MediaStreamingAudioChannel.Unmixed, MediaStreamingTransport.Websocket, true);
+// mediaStreamingOptions.EnableBidirectional = isEnableBidirectional;
+// mediaStreamingOptions.AudioFormat = isPcm24kMono ? AudioFormat.Pcm24KMono : AudioFormat.Pcm16KMono;
+
+// var createCallOptions = new CreateCallOptions(callInvite, callbackUri)
+// {
+// CallIntelligenceOptions = new CallIntelligenceOptions() { CognitiveServicesEndpoint = new Uri(cognitiveServicesEndpoint) },
+// MediaStreamingOptions = mediaStreamingOptions
+// };
+
+// CreateCallResult createCallResult = client.CreateCall(createCallOptions);
+
+// logger.LogInformation($"Created async pstn media streaming call with connection id: {createCallResult.CallConnectionProperties.CallConnectionId}");
+//}).WithTags("Media streaming APIs");
+
+//app.MapPost("/createCallToAcsWithMediaStreamingAsync", async (string acsTarget, bool isEnableBidirectional, bool isPcm24kMono, ILogger logger) =>
+//{
+// var callbackUri = new Uri(new Uri(callbackUriHost), "/api/callbacks");
+// eventCallbackUri = callbackUri;
+// CallInvite callInvite = new CallInvite(new CommunicationUserIdentifier(acsTarget));
+// var websocketUri = callbackUriHost.Replace("https", "wss") + "/ws";
+// MediaStreamingOptions mediaStreamingOptions = new MediaStreamingOptions(new Uri(websocketUri), MediaStreamingContent.Audio,
+// MediaStreamingAudioChannel.Unmixed, MediaStreamingTransport.Websocket, true);
+// mediaStreamingOptions.EnableBidirectional = isEnableBidirectional;
+// mediaStreamingOptions.AudioFormat = isPcm24kMono ? AudioFormat.Pcm24KMono : AudioFormat.Pcm16KMono;
+
+// var createCallOptions = new CreateCallOptions(callInvite, callbackUri)
+// {
+// CallIntelligenceOptions = new CallIntelligenceOptions() { CognitiveServicesEndpoint = new Uri(cognitiveServicesEndpoint) },
+// MediaStreamingOptions = mediaStreamingOptions
+// };
+
+// CreateCallResult createCallResult = await client.CreateCallAsync(createCallOptions);
+
+// logger.LogInformation($"Created async acs call with connection id: {createCallResult.CallConnectionProperties.CallConnectionId}");
+//}).WithTags("Media streaming APIs");
+
+//app.MapPost("/createCallToAcsWithMediaStreaming", (string acsTarget, bool isEnableBidirectional, bool isPcm24kMono, ILogger logger) =>
+//{
+// var callbackUri = new Uri(new Uri(callbackUriHost), "/api/callbacks");
+// eventCallbackUri = callbackUri;
+// CallInvite callInvite = new CallInvite(new CommunicationUserIdentifier(acsTarget));
+// var websocketUri = callbackUriHost.Replace("https", "wss") + "/ws";
+// MediaStreamingOptions mediaStreamingOptions = new MediaStreamingOptions(new Uri(websocketUri), MediaStreamingContent.Audio,
+// MediaStreamingAudioChannel.Unmixed, MediaStreamingTransport.Websocket, true);
+// mediaStreamingOptions.EnableBidirectional = isEnableBidirectional;
+// mediaStreamingOptions.AudioFormat = isPcm24kMono ? AudioFormat.Pcm24KMono : AudioFormat.Pcm16KMono;
+
+// var createCallOptions = new CreateCallOptions(callInvite, callbackUri)
+// {
+// CallIntelligenceOptions = new CallIntelligenceOptions() { CognitiveServicesEndpoint = new Uri(cognitiveServicesEndpoint) },
+// MediaStreamingOptions = mediaStreamingOptions
+// };
+
+// CreateCallResult createCallResult = client.CreateCall(createCallOptions);
+
+// logger.LogInformation($"Created acs call with connection id: {createCallResult.CallConnectionProperties.CallConnectionId}");
+//}).WithTags("Media streaming APIs");
+
+//app.MapPost("/createCallToTeamsWithMediaStreamingAsync", async (string teamsObjectId, bool isEnableBidirectional, bool isPcm24kMono, ILogger logger) =>
+//{
+// var callbackUri = new Uri(new Uri(callbackUriHost), "/api/callbacks");
+// eventCallbackUri = callbackUri;
+// CallInvite callInvite = new CallInvite(new MicrosoftTeamsUserIdentifier(teamsObjectId));
+// var websocketUri = callbackUriHost.Replace("https", "wss") + "/ws";
+// MediaStreamingOptions mediaStreamingOptions = new MediaStreamingOptions(new Uri(websocketUri), MediaStreamingContent.Audio,
+// MediaStreamingAudioChannel.Unmixed, MediaStreamingTransport.Websocket, true);
+// mediaStreamingOptions.EnableBidirectional = isEnableBidirectional;
+// mediaStreamingOptions.AudioFormat = isPcm24kMono ? AudioFormat.Pcm24KMono : AudioFormat.Pcm16KMono;
+
+// var createCallOptions = new CreateCallOptions(callInvite, callbackUri)
+// {
+// CallIntelligenceOptions = new CallIntelligenceOptions() { CognitiveServicesEndpoint = new Uri(cognitiveServicesEndpoint) },
+// MediaStreamingOptions = mediaStreamingOptions
+// };
+
+// CreateCallResult createCallResult = await client.CreateCallAsync(createCallOptions);
+
+// logger.LogInformation($"Created async teams call with connection id: {createCallResult.CallConnectionProperties.CallConnectionId}");
+//}).WithTags("Media streaming APIs");
+
+//app.MapPost("/createCallToTeamsWithMediaStreaming", (string teamsObjectId, bool isEnableBidirectional, bool isPcm24kMono, ILogger logger) =>
+//{
+// var callbackUri = new Uri(new Uri(callbackUriHost), "/api/callbacks");
+// eventCallbackUri = callbackUri;
+// CallInvite callInvite = new CallInvite(new MicrosoftTeamsUserIdentifier(teamsObjectId));
+// var websocketUri = callbackUriHost.Replace("https", "wss") + "/ws";
+// MediaStreamingOptions mediaStreamingOptions = new MediaStreamingOptions(new Uri(websocketUri), MediaStreamingContent.Audio,
+// MediaStreamingAudioChannel.Unmixed, MediaStreamingTransport.Websocket, true);
+// mediaStreamingOptions.EnableBidirectional = isEnableBidirectional;
+// mediaStreamingOptions.AudioFormat = isPcm24kMono ? AudioFormat.Pcm24KMono : AudioFormat.Pcm16KMono;
+
+// var createCallOptions = new CreateCallOptions(callInvite, callbackUri)
+// {
+// CallIntelligenceOptions = new CallIntelligenceOptions() { CognitiveServicesEndpoint = new Uri(cognitiveServicesEndpoint) },
+// MediaStreamingOptions = mediaStreamingOptions
+// };
+
+// CreateCallResult createCallResult = client.CreateCall(createCallOptions);
+
+// logger.LogInformation($"Created teams call with connection id: {createCallResult.CallConnectionProperties.CallConnectionId}");
+//}).WithTags("Media streaming APIs");
+
+
+app.MapPost("/startMediaStreamingAsync", async (ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+ await callMedia.StartMediaStreamingAsync();
+ return Results.Ok();
+}).WithTags("Media streaming APIs");
+
+app.MapPost("/startMediaStreaming", (ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+ callMedia.StartMediaStreaming();
+ return Results.Ok();
+}).WithTags("Media streaming APIs");
+
+app.MapPost("/stopMediaStreamingAsync", async (ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+ await callMedia.StopMediaStreamingAsync();
+ return Results.Ok();
+}).WithTags("Media streaming APIs");
+
+app.MapPost("/stopMediaStreaming", (ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+ callMedia.StopMediaStreaming();
+ return Results.Ok();
+}).WithTags("Media streaming APIs");
+
+app.MapPost("/startMediaStreamingWithOptionsAsync", async (ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+ StartMediaStreamingOptions startMediaStreamingOptions = new()
+ {
+ OperationContext = "StartMediaStreamingContext",
+ OperationCallbackUri = eventCallbackUri
+ };
+ await callMedia.StartMediaStreamingAsync(startMediaStreamingOptions);
+ return Results.Ok();
+}).WithTags("Media streaming APIs");
+
+app.MapPost("/startMediaStreamingWithOptions", (ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+ StartMediaStreamingOptions startMediaStreamingOptions = new()
+ {
+ OperationContext = "StartMediaStreamingContext",
+ OperationCallbackUri = eventCallbackUri
+ };
+ callMedia.StartMediaStreaming(startMediaStreamingOptions);
+ return Results.Ok();
+}).WithTags("Media streaming APIs");
+
+app.MapPost("/stopMediaStreamingWithOptionsAsync", async (ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+ StopMediaStreamingOptions stopMediaStreamingOptions = new()
+ {
+ OperationContext = "StopMediaStreamingContext",
+ OperationCallbackUri = eventCallbackUri
+ };
+ await callMedia.StopMediaStreamingAsync();
+ return Results.Ok();
+}).WithTags("Media streaming APIs");
+
+app.MapPost("/stopMediaStreamingWithOptions", (ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+ StopMediaStreamingOptions stopMediaStreamingOptions = new()
+ {
+ OperationContext = "StopMediaStreamingContext",
+ OperationCallbackUri = eventCallbackUri
+ };
+ callMedia.StopMediaStreaming(stopMediaStreamingOptions);
+ return Results.Ok();
+}).WithTags("Media streaming APIs");
+
+#endregion
+
+#region Transcription
+
+//app.MapPost("/createCallToPstnWithTranscriptionAsync", async (string targetPhoneNumber, ILogger logger) =>
+//{
+// PhoneNumberIdentifier target = new PhoneNumberIdentifier(targetPhoneNumber);
+// PhoneNumberIdentifier caller = new PhoneNumberIdentifier(acsPhoneNumber);
+
+
+// var callbackUri = new Uri(new Uri(callbackUriHost), "/api/callbacks");
+// eventCallbackUri = callbackUri;
+// CallInvite callInvite = new CallInvite(target, caller);
+// var websocketUri = callbackUriHost.Replace("https", "wss") + "/ws";
+// TranscriptionOptions transcriptionOptions = new TranscriptionOptions(new Uri(websocketUri),
+// "en-us", true, TranscriptionTransport.Websocket);
+
+// var createCallOptions = new CreateCallOptions(callInvite, callbackUri)
+// {
+// CallIntelligenceOptions = new CallIntelligenceOptions() { CognitiveServicesEndpoint = new Uri(cognitiveServicesEndpoint) },
+// TranscriptionOptions = transcriptionOptions
+// };
+
+// CreateCallResult createCallResult = await client.CreateCallAsync(createCallOptions);
+
+// logger.LogInformation($"Created async pstn transcription call with connection id: {createCallResult.CallConnectionProperties.CallConnectionId}");
+//}).WithTags("Transcription APIs");
+
+//app.MapPost("/createCallToPstnWithTranscription", (string targetPhoneNumber, ILogger logger) =>
+//{
+// PhoneNumberIdentifier target = new PhoneNumberIdentifier(targetPhoneNumber);
+// PhoneNumberIdentifier caller = new PhoneNumberIdentifier(acsPhoneNumber);
+
+// var callbackUri = new Uri(new Uri(callbackUriHost), "/api/callbacks");
+// eventCallbackUri = callbackUri;
+// CallInvite callInvite = new CallInvite(target, caller);
+
+// var websocketUri = callbackUriHost.Replace("https", "wss") + "/ws";
+// TranscriptionOptions transcriptionOptions = new TranscriptionOptions(new Uri(websocketUri),
+// "en-us", true, TranscriptionTransport.Websocket);
+// var createCallOptions = new CreateCallOptions(callInvite, callbackUri)
+// {
+// CallIntelligenceOptions = new CallIntelligenceOptions() { CognitiveServicesEndpoint = new Uri(cognitiveServicesEndpoint) },
+// TranscriptionOptions = transcriptionOptions
+// };
+
+// CreateCallResult createCallResult = client.CreateCall(createCallOptions);
+
+// logger.LogInformation($"Created pstn transcription call with connection id: {createCallResult.CallConnectionProperties.CallConnectionId}");
+//}).WithTags("Transcription APIs");
+
+//app.MapPost("/createCallToAcsWithTranscriptionAsync", async (string acsTarget, ILogger logger) =>
+//{
+// var callbackUri = new Uri(new Uri(callbackUriHost), "/api/callbacks");
+// eventCallbackUri = callbackUri;
+// CallInvite callInvite = new CallInvite(new CommunicationUserIdentifier(acsTarget));
+// var websocketUri = callbackUriHost.Replace("https", "wss") + "/ws";
+// TranscriptionOptions transcriptionOptions = new TranscriptionOptions(new Uri(websocketUri),
+// "en-us", true, TranscriptionTransport.Websocket);
+
+// var createCallOptions = new CreateCallOptions(callInvite, callbackUri)
+// {
+// CallIntelligenceOptions = new CallIntelligenceOptions() { CognitiveServicesEndpoint = new Uri(cognitiveServicesEndpoint) },
+// TranscriptionOptions = transcriptionOptions
+// };
+
+// CreateCallResult createCallResult = await client.CreateCallAsync(createCallOptions);
+
+// logger.LogInformation($"Created async acs transcription call with connection id: {createCallResult.CallConnectionProperties.CallConnectionId}");
+//}).WithTags("Transcription APIs");
+
+//app.MapPost("/createCallToAcsWithTranscription", (string acsTarget, ILogger logger) =>
+//{
+// var callbackUri = new Uri(new Uri(callbackUriHost), "/api/callbacks");
+// eventCallbackUri = callbackUri;
+// CallInvite callInvite = new CallInvite(new CommunicationUserIdentifier(acsTarget));
+// var websocketUri = callbackUriHost.Replace("https", "wss") + "/ws";
+// TranscriptionOptions transcriptionOptions = new TranscriptionOptions(new Uri(websocketUri),
+// "en-us", true, TranscriptionTransport.Websocket);
+
+// var createCallOptions = new CreateCallOptions(callInvite, callbackUri)
+// {
+// CallIntelligenceOptions = new CallIntelligenceOptions() { CognitiveServicesEndpoint = new Uri(cognitiveServicesEndpoint) },
+// TranscriptionOptions = transcriptionOptions
+// };
+
+// CreateCallResult createCallResult = client.CreateCall(createCallOptions);
+
+// logger.LogInformation($"Created acs transcription call with connection id: {createCallResult.CallConnectionProperties.CallConnectionId}");
+//}).WithTags("Transcription APIs");
+
+//app.MapPost("/createCallToTeamsWithTranscriptionAsync", async (string teamsObjectId, ILogger logger) =>
+//{
+// var callbackUri = new Uri(new Uri(callbackUriHost), "/api/callbacks");
+// eventCallbackUri = callbackUri;
+// CallInvite callInvite = new CallInvite(new MicrosoftTeamsUserIdentifier(teamsObjectId));
+// var websocketUri = callbackUriHost.Replace("https", "wss") + "/ws";
+// TranscriptionOptions transcriptionOptions = new TranscriptionOptions(new Uri(websocketUri),
+// "en-us", true, TranscriptionTransport.Websocket);
+
+// var createCallOptions = new CreateCallOptions(callInvite, callbackUri)
+// {
+// CallIntelligenceOptions = new CallIntelligenceOptions() { CognitiveServicesEndpoint = new Uri(cognitiveServicesEndpoint) },
+// TranscriptionOptions = transcriptionOptions
+// };
+
+// CreateCallResult createCallResult = await client.CreateCallAsync(createCallOptions);
+
+// logger.LogInformation($"Created async teams transcription call with connection id: {createCallResult.CallConnectionProperties.CallConnectionId}");
+//}).WithTags("Transcription APIs");
+
+//app.MapPost("/createCallToTeamsWithTranscription", (string teamsObjectId, ILogger logger) =>
+//{
+// var callbackUri = new Uri(new Uri(callbackUriHost), "/api/callbacks");
+// eventCallbackUri = callbackUri;
+// CallInvite callInvite = new CallInvite(new MicrosoftTeamsUserIdentifier(teamsObjectId));
+// var websocketUri = callbackUriHost.Replace("https", "wss") + "/ws";
+// TranscriptionOptions transcriptionOptions = new TranscriptionOptions(new Uri(websocketUri),
+// "en-us", true, TranscriptionTransport.Websocket);
+
+// var createCallOptions = new CreateCallOptions(callInvite, callbackUri)
+// {
+// CallIntelligenceOptions = new CallIntelligenceOptions() { CognitiveServicesEndpoint = new Uri(cognitiveServicesEndpoint) },
+// TranscriptionOptions = transcriptionOptions
+// };
+
+// CreateCallResult createCallResult = client.CreateCall(createCallOptions);
+
+// logger.LogInformation($"Created teams transcription call with connection id: {createCallResult.CallConnectionProperties.CallConnectionId}");
+//}).WithTags("Transcription APIs");
+
+app.MapPost("/startTranscriptionAsync", async (ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+ await callMedia.StartTranscriptionAsync();
+ return Results.Ok();
+}).WithTags("Transcription APIs");
+
+app.MapPost("/startTranscription", (ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+ callMedia.StartTranscription();
+ return Results.Ok();
+}).WithTags("Transcription APIs");
+
+app.MapPost("/updateTranscriptionAsync", async (string locale, ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+ await callMedia.UpdateTranscriptionAsync(locale);
+ return Results.Ok();
+}).WithTags("Transcription APIs");
+
+app.MapPost("/updateTranscription", (string locale, ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+ callMedia.UpdateTranscription(locale);
+ return Results.Ok();
+}).WithTags("Transcription APIs");
+
+app.MapPost("/stopTranscriptionAsync", async (ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+ await callMedia.StopTranscriptionAsync();
+ return Results.Ok();
+}).WithTags("Transcription APIs");
+
+app.MapPost("/stopTranscription", (ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+ callMedia.StopTranscription();
+ return Results.Ok();
+}).WithTags("Transcription APIs");
+
+app.MapPost("/startTranscriptionWithOptionsAsync", async (ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+ StartTranscriptionOptions startTranscriptionOptions = new StartTranscriptionOptions()
+ {
+ OperationContext = "StartTranscriptionContext",
+ Locale = "en-us"
+ };
+ await callMedia.StartTranscriptionAsync(startTranscriptionOptions);
+ return Results.Ok();
+}).WithTags("Transcription APIs");
+
+app.MapPost("/startTranscriptionWithOptions", (ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+ StartTranscriptionOptions startTranscriptionOptions = new StartTranscriptionOptions()
+ {
+ OperationContext = "StartTranscriptionContext",
+ Locale = "en-us"
+ };
+ callMedia.StartTranscription(startTranscriptionOptions);
+ return Results.Ok();
+}).WithTags("Transcription APIs");
+
+app.MapPost("/stopTranscriptionWithOptionsAsync", async (ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+ StopTranscriptionOptions stopTranscriptionOptions = new StopTranscriptionOptions()
+ {
+ OperationContext = "StopTranscriptionContext"
+ };
+ await callMedia.StopTranscriptionAsync(stopTranscriptionOptions);
+ return Results.Ok();
+}).WithTags("Transcription APIs");
+
+app.MapPost("/stopTranscriptionWithOptions", (ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+ callMedia.StopTranscription();
+ return Results.Ok();
+}).WithTags("Transcription APIs");
+
+#endregion
+
+#region Transfer Call
+
+app.MapPost("/transferCallPstnToPstnParticipantAsync", async (string pstnTransferTarget, string pstnTarget, ILogger logger) =>
+{
+ CallConnection callConnection = GetConnection();
+
+ TransferToParticipantOptions transferToParticipantOptions = new TransferToParticipantOptions(new PhoneNumberIdentifier(pstnTransferTarget))
+ {
+ OperationContext = "TransferCallContext",
+ Transferee = new PhoneNumberIdentifier(pstnTarget),
+ OperationCallbackUri = eventCallbackUri
+ };
+
+ await callConnection.TransferCallToParticipantAsync(transferToParticipantOptions);
+ return Results.Ok();
+}).WithTags("Transfer Call APIs");
+
+//app.MapPost("/transferCallPstnToACSParticipantAsync", async (string acsTransferTarget, string pstnTarget, ILogger logger) =>
+//{
+// CallConnection callConnection = GetConnection();
+
+// TransferToParticipantOptions transferToParticipantOptions = new TransferToParticipantOptions(new CommunicationUserIdentifier(acsTransferTarget))
+// {
+// OperationContext = "TransferCallContext",
+// Transferee = new PhoneNumberIdentifier(pstnTarget),
+// OperationCallbackUri = eventCallbackUri
+// };
+
+// await callConnection.TransferCallToParticipantAsync(transferToParticipantOptions);
+// return Results.Ok();
+//}).WithTags("Transfer Call APIs");
+
+app.MapPost("/transferCallToPstnParticipant", (string pstnTransferTarget, string pstnTarget, ILogger logger) =>
+{
+ CallConnection callConnection = GetConnection();
+
+ TransferToParticipantOptions transferToParticipantOptions = new TransferToParticipantOptions(new PhoneNumberIdentifier(pstnTransferTarget))
+ {
+ OperationContext = "TransferCallContext",
+ Transferee = new PhoneNumberIdentifier(acsPhoneNumber),
+ OperationCallbackUri = eventCallbackUri
+ };
+
+ callConnection.TransferCallToParticipant(transferToParticipantOptions);
+ return Results.Ok();
+}).WithTags("Transfer Call APIs");
+
+app.MapPost("/transferCallTPEToPSTNParticipantAsync", async (string userId, string tenantId, string resourceId, string pstnTarget, ILogger logger) =>
+{
+ CallConnection callConnection = GetConnection();
+
+ TransferToParticipantOptions transferToParticipantOptions = new TransferToParticipantOptions(new PhoneNumberIdentifier(pstnTarget))
+ {
+ OperationContext = "TransferCallContext",
+ Transferee = new TeamsExtensionUserIdentifier(userId, tenantId, resourceId),
+ OperationCallbackUri = eventCallbackUri
+ };
+
+ await callConnection.TransferCallToParticipantAsync(transferToParticipantOptions);
+ return Results.Ok();
+}).WithTags("Transfer Call APIs");
+
+app.MapPost("/transferCallPSTNToTPEParticipantAsync", async (string userId, string tenantId, string resourceId, string pstnTarget, ILogger logger) =>
+{
+ CallConnection callConnection = GetConnection();
+
+ TransferToParticipantOptions transferToParticipantOptions = new TransferToParticipantOptions(new TeamsExtensionUserIdentifier(userId, tenantId, resourceId))
+ {
+ OperationContext = "TransferCallContext",
+ Transferee = new PhoneNumberIdentifier(pstnTarget),
+ OperationCallbackUri = eventCallbackUri
+ };
+
+ await callConnection.TransferCallToParticipantAsync(transferToParticipantOptions);
+ return Results.Ok();
+}).WithTags("Transfer Call APIs");
+
+app.MapPost("/transferCallPSTNToTeamsParticipantAsync", async (string teamsTransferTarget, string pstnTarget, ILogger logger) =>
+{
+ CallConnection callConnection = GetConnection();
+
+ TransferToParticipantOptions transferToParticipantOptions = new TransferToParticipantOptions(new MicrosoftTeamsUserIdentifier(teamsTransferTarget))
+ {
+ OperationContext = "TransferCallContext",
+ Transferee = new PhoneNumberIdentifier(pstnTarget),
+ OperationCallbackUri = eventCallbackUri,
+ };
+
+ await callConnection.TransferCallToParticipantAsync(transferToParticipantOptions);
+ return Results.Ok();
+}).WithTags("Transfer Call APIs");
+
+app.MapPost("/transferCallTeamsUserToPSTNAsync", async (string pstnTransferTarget, string teamsTarget, ILogger logger) =>
+{
+ CallConnection callConnection = GetConnection();
+
+ TransferToParticipantOptions transferToParticipantOptions = new TransferToParticipantOptions(new PhoneNumberIdentifier(pstnTransferTarget))
+ {
+ OperationContext = "TransferCallContext",
+ Transferee = new MicrosoftTeamsUserIdentifier(teamsTarget),
+ OperationCallbackUri = eventCallbackUri
+ };
+
+ await callConnection.TransferCallToParticipantAsync(transferToParticipantOptions);
+ return Results.Ok();
+}).WithTags("Transfer Call APIs");
+#endregion
+
+#region Get Participant
+
+app.MapPost("/getPstnParticipantAsync", async (string pstnTarget, ILogger logger) =>
+{
+ CallConnection callConnection = GetConnection();
+
+ CallParticipant participant = await callConnection.GetParticipantAsync(new PhoneNumberIdentifier(pstnTarget));
+
+ if (participant != null)
+ {
+ Console.WriteLine("Participant:-->" + participant.Identifier.RawId.ToString());
+ Console.WriteLine("Is Participant on hold:-->" + participant.IsOnHold);
+ }
+ return Results.Ok();
+}).WithTags("Get Participant APIs");
+
+app.MapPost("/getPstnParticipant", (string pstnTarget, ILogger logger) =>
+{
+ CallConnection callConnection = GetConnection();
+
+ CallParticipant participant = callConnection.GetParticipant(new PhoneNumberIdentifier(pstnTarget));
+
+ if (participant != null)
+ {
+ Console.WriteLine("Participant:-->" + participant.Identifier.RawId.ToString());
+ Console.WriteLine("Is Participant on hold:-->" + participant.IsOnHold);
+ }
+ return Results.Ok();
+}).WithTags("Get Participant APIs");
+
+app.MapPost("/getAcsParticipantAsync", async (string acsTarget, ILogger logger) =>
+{
+ CallConnection callConnection = GetConnection();
+
+ CallParticipant participant = await callConnection.GetParticipantAsync(new CommunicationUserIdentifier(acsTarget));
+
+ if (participant != null)
+ {
+ Console.WriteLine("Participant:-->" + participant.Identifier.RawId.ToString());
+ Console.WriteLine("Is Participant on hold:-->" + participant.IsOnHold);
+ }
+ return Results.Ok();
+}).WithTags("Get Participant APIs");
+
+app.MapPost("/getAcsParticipant", (string acsTarget, ILogger logger) =>
+{
+ CallConnection callConnection = GetConnection();
+
+ CallParticipant participant = callConnection.GetParticipant(new CommunicationUserIdentifier(acsTarget));
+
+ if (participant != null)
+ {
+ Console.WriteLine("Participant:-->" + participant.Identifier.RawId.ToString());
+ Console.WriteLine("Is Participant on hold:-->" + participant.IsOnHold);
+ }
+ return Results.Ok();
+}).WithTags("Get Participant APIs");
+
+//app.MapPost("/getTeamsParticipantAsync", async (string teamsObjectId, ILogger logger) =>
+//{
+// CallConnection callConnection = GetConnection();
+
+// CallParticipant participant = await callConnection.GetParticipantAsync(new MicrosoftTeamsUserIdentifier(teamsObjectId));
+
+// if (participant != null)
+// {
+// Console.WriteLine("Participant:-->" + participant.Identifier.RawId.ToString());
+// Console.WriteLine("Is Participant on hold:-->" + participant.IsOnHold);
+// }
+// return Results.Ok();
+//}).WithTags("Get Participant APIs");
+
+//app.MapPost("/getTeamsParticipant", (string teamsObjectId, ILogger logger) =>
+//{
+// CallConnection callConnection = GetConnection();
+
+// CallParticipant participant = callConnection.GetParticipant(new MicrosoftTeamsUserIdentifier(teamsObjectId));
+
+// if (participant != null)
+// {
+// Console.WriteLine("Participant:-->" + participant.Identifier.RawId.ToString());
+// Console.WriteLine("Is Participant on hold:-->" + participant.IsOnHold);
+// }
+// return Results.Ok();
+//}).WithTags("Get Participant APIs");
+
+app.MapPost("/getParticipantListAsync", async (ILogger logger) =>
+{
+ CallConnection callConnection = GetConnection();
+
+ var list = await callConnection.GetParticipantsAsync();
+
+ foreach (var participant in list.Value)
+ {
+ Console.WriteLine("----------------------------------------------------------------------");
+ Console.WriteLine("Participant:-->" + participant.Identifier.RawId.ToString());
+ Console.WriteLine("Is Participant on hold:-->" + participant.IsOnHold);
+ Console.WriteLine("Is Participant on mute:-->" + participant.IsMuted);
+ Console.WriteLine("----------------------------------------------------------------------");
+ }
+ return Results.Ok();
+}).WithTags("Get Participant APIs");
+
+app.MapPost("/getParticipantList", (ILogger logger) =>
+{
+ CallConnection callConnection = GetConnection();
+
+ var list = callConnection.GetParticipants();
+
+ foreach (var participant in list.Value)
+ {
+ Console.WriteLine("----------------------------------------------------------------------");
+ Console.WriteLine("Participant:-->" + participant.Identifier.RawId.ToString());
+ Console.WriteLine("Is Participant on hold:-->" + participant.IsOnHold);
+ Console.WriteLine("Is Participant on mute:-->" + participant.IsMuted);
+ Console.WriteLine("----------------------------------------------------------------------");
+ }
+ return Results.Ok();
+}).WithTags("Get Participant APIs");
+
+#endregion
+
+#region Recording
+
+app.MapPost("/startRecordingWithVideoMp4MixedAsync", async (bool isPauseOnStart, ILogger logger) =>
+{
+ CallConnectionProperties callConnectionProperties = GetCallConnectionProperties();
+ var serverCallId = callConnectionProperties.ServerCallId;
+ CallLocator callLocator = new ServerCallLocator(serverCallId);
+ var recordingOptions = new StartRecordingOptions(callConnectionProperties.CallConnectionId);
+ recordingOptions.RecordingContent = RecordingContent.AudioVideo;
+ recordingOptions.RecordingFormat = RecordingFormat.Mp4;
+ recordingOptions.RecordingChannel = RecordingChannel.Mixed;
+ recordingOptions.RecordingStateCallbackUri = eventCallbackUri;
+ recordingOptions.PauseOnStart = isPauseOnStart;
+ //recordingOptions.RecordingStorage = RecordingStorage.CreateAzureBlobContainerRecordingStorage(new Uri("https://waferwirestorage.blob.core.windows.net/ga5byos"));
+ recordingFileFormat = "mp4";
+ var recordingResult = await client.GetCallRecording().StartAsync(recordingOptions);
+ recordingId = recordingResult.Value.RecordingId;
+ logger.LogInformation($"Recording started. RecordingId: {recordingId}");
+ return Results.Ok();
+}).WithTags("Recording APIs");
+
+app.MapPost("/startRecordingWithVideoMp4Mixed", (bool isPauseOnStart, ILogger logger) =>
+{
+ CallConnectionProperties callConnectionProperties = GetCallConnectionProperties();
+ var serverCallId = callConnectionProperties.ServerCallId;
+ CallLocator callLocator = new ServerCallLocator(serverCallId);
+ var recordingOptions = new StartRecordingOptions(callLocator);
+ recordingOptions.RecordingContent = RecordingContent.AudioVideo;
+ recordingOptions.RecordingFormat = RecordingFormat.Mp4;
+ recordingOptions.RecordingChannel = RecordingChannel.Mixed;
+ recordingOptions.RecordingStateCallbackUri = eventCallbackUri;
+ recordingOptions.PauseOnStart = isPauseOnStart;
+ recordingFileFormat = "mp4";
+
+ var recordingResult = client.GetCallRecording().Start(recordingOptions);
+ recordingId = recordingResult.Value.RecordingId;
+ logger.LogInformation($"Recording started. RecordingId: {recordingId}");
+ return Results.Ok();
+}).WithTags("Recording APIs");
+
+app.MapPost("/startRecordingWithAudioMp3MixedAsync", async (bool isPauseOnStart, ILogger logger) =>
+{
+ CallConnectionProperties callConnectionProperties = GetCallConnectionProperties();
+ var serverCallId = callConnectionProperties.ServerCallId;
+ CallLocator callLocator = new ServerCallLocator(serverCallId);
+ var recordingOptions = new StartRecordingOptions(callLocator);
+ recordingOptions.RecordingContent = RecordingContent.Audio;
+ recordingOptions.RecordingFormat = RecordingFormat.Mp3;
+ recordingOptions.RecordingChannel = RecordingChannel.Mixed;
+ recordingOptions.RecordingStateCallbackUri = eventCallbackUri;
+ recordingOptions.PauseOnStart = isPauseOnStart;
+ recordingFileFormat = "mp3";
+
+ var recordingResult = await client.GetCallRecording().StartAsync(recordingOptions);
+ recordingId = recordingResult.Value.RecordingId;
+ logger.LogInformation($"Recording started. RecordingId: {recordingId}");
+ return Results.Ok();
+}).WithTags("Recording APIs");
+
+app.MapPost("/startRecordingWithAudioMp3Mixed", (bool isPauseOnStart, ILogger logger) =>
+{
+ CallConnectionProperties callConnectionProperties = GetCallConnectionProperties();
+ var serverCallId = callConnectionProperties.ServerCallId;
+ CallLocator callLocator = new ServerCallLocator(serverCallId);
+ var recordingOptions = new StartRecordingOptions(callLocator);
+ recordingOptions.RecordingContent = RecordingContent.Audio;
+ recordingOptions.RecordingFormat = RecordingFormat.Mp3;
+ recordingOptions.RecordingChannel = RecordingChannel.Mixed;
+ recordingOptions.RecordingStateCallbackUri = eventCallbackUri;
+ recordingOptions.PauseOnStart = isPauseOnStart;
+ recordingFileFormat = "mp3";
+
+ var recordingResult = client.GetCallRecording().Start(recordingOptions);
+ recordingId = recordingResult.Value.RecordingId;
+ logger.LogInformation($"Recording started. RecordingId: {recordingId}");
+ return Results.Ok();
+}).WithTags("Recording APIs");
+
+app.MapPost("/startRecordingWithAudioWavMixedAsync", async (bool isPauseOnStart, ILogger logger) =>
+{
+ CallConnectionProperties callConnectionProperties = GetCallConnectionProperties();
+ var serverCallId = callConnectionProperties.ServerCallId;
+ CallLocator callLocator = new ServerCallLocator(serverCallId);
+ var recordingOptions = new StartRecordingOptions(callLocator);
+ recordingOptions.RecordingContent = RecordingContent.Audio;
+ recordingOptions.RecordingFormat = RecordingFormat.Wav;
+ recordingOptions.RecordingChannel = RecordingChannel.Mixed;
+ recordingOptions.RecordingStateCallbackUri = eventCallbackUri;
+ recordingOptions.PauseOnStart = isPauseOnStart;
+ recordingFileFormat = "wav";
+
+ var recordingResult = await client.GetCallRecording().StartAsync(recordingOptions);
+ recordingId = recordingResult.Value.RecordingId;
+ logger.LogInformation($"Recording started. RecordingId: {recordingId}");
+ return Results.Ok();
+}).WithTags("Recording APIs");
+
+app.MapPost("/startRecordingWithAudioWavMixed", (bool isPauseOnStart, ILogger logger) =>
+{
+ CallConnectionProperties callConnectionProperties = GetCallConnectionProperties();
+ var serverCallId = callConnectionProperties.ServerCallId;
+ CallLocator callLocator = new ServerCallLocator(serverCallId);
+ var recordingOptions = new StartRecordingOptions(callLocator);
+ recordingOptions.RecordingContent = RecordingContent.Audio;
+ recordingOptions.RecordingFormat = RecordingFormat.Wav;
+ recordingOptions.RecordingChannel = RecordingChannel.Mixed;
+ recordingOptions.RecordingStateCallbackUri = eventCallbackUri;
+ recordingOptions.PauseOnStart = isPauseOnStart;
+ recordingFileFormat = "wav";
+
+ var recordingResult = client.GetCallRecording().Start(recordingOptions);
+ recordingId = recordingResult.Value.RecordingId;
+ logger.LogInformation($"Recording started. RecordingId: {recordingId}");
+ return Results.Ok();
+}).WithTags("Recording APIs");
+
+app.MapPost("/startRecordingWithAudioWavUnMixedAsync", async (bool isPauseOnStart, ILogger logger) =>
+{
+ CallConnectionProperties callConnectionProperties = GetCallConnectionProperties();
+ var serverCallId = callConnectionProperties.ServerCallId;
+ CallLocator callLocator = new ServerCallLocator(serverCallId);
+ var recordingOptions = new StartRecordingOptions(callLocator);
+ recordingOptions.RecordingContent = RecordingContent.Audio;
+ recordingOptions.RecordingFormat = RecordingFormat.Wav;
+ recordingOptions.RecordingChannel = RecordingChannel.Unmixed;
+ recordingOptions.RecordingStateCallbackUri = eventCallbackUri;
+ recordingOptions.PauseOnStart = isPauseOnStart;
+ recordingFileFormat = "wav";
+
+ var recordingResult = await client.GetCallRecording().StartAsync(recordingOptions);
+ recordingId = recordingResult.Value.RecordingId;
+ logger.LogInformation($"Recording started. RecordingId: {recordingId}");
+ return Results.Ok();
+}).WithTags("Recording APIs");
+
+app.MapPost("/startRecordingWithAudioWavUnmixed", (bool isPauseOnStart, ILogger logger) =>
+{
+ CallConnectionProperties callConnectionProperties = GetCallConnectionProperties();
+ var serverCallId = callConnectionProperties.ServerCallId;
+ CallLocator callLocator = new ServerCallLocator(serverCallId);
+ var recordingOptions = new StartRecordingOptions(callLocator);
+ recordingOptions.RecordingContent = RecordingContent.Audio;
+ recordingOptions.RecordingFormat = RecordingFormat.Wav;
+ recordingOptions.RecordingChannel = RecordingChannel.Unmixed;
+ recordingOptions.RecordingStateCallbackUri = eventCallbackUri;
+ recordingOptions.PauseOnStart = isPauseOnStart;
+ recordingFileFormat = "wav";
+
+ var recordingResult = client.GetCallRecording().Start(recordingOptions);
+ recordingId = recordingResult.Value.RecordingId;
+ logger.LogInformation($"Recording started. RecordingId: {recordingId}");
+ return Results.Ok();
+}).WithTags("Recording APIs");
+
+
+
+app.MapPost("/pauseRecordingAsync", async () =>
+{
+ await client.GetCallRecording().PauseAsync(recordingId);
+ return Results.Ok();
+}).WithTags("Recording APIs");
+
+app.MapPost("/pauseRecording", () =>
+{
+ client.GetCallRecording().Pause(recordingId);
+ return Results.Ok();
+}).WithTags("Recording APIs");
+
+app.MapPost("/resumeRecordingAsync", async () =>
+{
+ await client.GetCallRecording().ResumeAsync(recordingId);
+ return Results.Ok();
+}).WithTags("Recording APIs");
+
+app.MapPost("/resumeRecording", () =>
+{
+ client.GetCallRecording().Resume(recordingId);
+ return Results.Ok();
+}).WithTags("Recording APIs");
+
+app.MapPost("/stopRecordingAsync", async () =>
+{
+ await client.GetCallRecording().StopAsync(recordingId);
+ return Results.Ok();
+}).WithTags("Recording APIs");
+
+app.MapPost("/stopRecording", () =>
+{
+ client.GetCallRecording().Stop(recordingId);
+ return Results.Ok();
+}).WithTags("Recording APIs");
+
+app.MapGet("/downloadRecording", async (ILogger logger) =>
+{
+ recordingLocation = " https://us-storage.asm.skype.com/v1/objects/0-cus-d16-6803d3d1120ae9a5ce21a1c664841cd3/content/video";
+ if (!string.IsNullOrEmpty(recordingLocation))
+ {
+ string downloadsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads");
+ var date = DateTime.Now.ToString("yyyyMMdd_HHmmss");
+ string fileName = $"Recording_{date}.{recordingFileFormat}";
+
+ logger.LogInformation($"Downloading recording location {recordingLocation}");
+ string recordingLocationNew = recordingLocation.Replace("https://us-storage.asm.skype.com/", "https://prod.asyncgw.teams.microsoft.com/");
+ logger.LogInformation($"Downloading recording location new {recordingLocationNew}");
+
+ //var response = await client.GetCallRecording().DownloadStreamingAsync(new Uri(recordingLocationNew));
+
+ var response2 = await client.GetCallRecording().DownloadToAsync(new Uri(recordingLocationNew), $"{downloadsPath}\\{fileName}");
+ }
+ else
+ {
+ logger.LogError("Recording is not available");
+ }
+ return Results.Ok();
+}).WithTags("Recording APIs");
+app.MapGet("/downloadRecordingMetadata", async (ILogger logger) =>
+{
+ if (!string.IsNullOrEmpty(metadataLocation))
+ {
+ string downloadsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads");
+ var recordingDownloadUri = new Uri(metadataLocation);
+ var date = DateTime.Now.ToString("yyyyMMdd_HHmmss");
+ string fileName = $"Recording_{date}.json";
+ logger.LogInformation($"Downloading recording location {recordingLocation}");
+ string recordingLocationNew = metadataLocation.Replace("https://as-storage.asm.skype.com/", "https://prod.asyncgw.teams.microsoft.com/");
+ logger.LogInformation($"Downloading recording location new {recordingLocationNew}");
+
+ var response = await client.GetCallRecording().DownloadStreamingAsync(new Uri(metadataLocation));
+
+ //var response2 = await client.GetCallRecording().DownloadToAsync(new Uri(recordingLocationNew), $"{downloadsPath}\\{fileName}");
+ }
+ else
+ {
+ logger.LogError("Metadata location is empty.");
+ }
+ return Results.Ok();
+}).WithTags("Recording APIs");
+
+#endregion
+
+#region Cancel All Media Operations
+
+app.MapPost("/cancelAllMediaOperationAsync", async (ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+ await callMedia.CancelAllMediaOperationsAsync();
+ return Results.Ok();
+}).WithTags("Cancel All Media Opertation APIs");
+
+app.MapPost("/cancelAllMediaOperation", (ILogger logger) =>
+{
+ CallMedia callMedia = GetCallMedia();
+ callMedia.CancelAllMediaOperations();
+ return Results.Ok();
+}).WithTags("Cancel All Media Opertation APIs");
+
+#endregion
+
+CallMedia GetCallMedia()
+{
+ CallMedia callMedia = !string.IsNullOrEmpty(callConnectionId) ?
+ client.GetCallConnection(callConnectionId).GetCallMedia()
+ : throw new ArgumentNullException("Call connection id is empty");
+
+ return callMedia;
+}
+
+CallConnection GetConnection()
+{
+ CallConnection callConnection = !string.IsNullOrEmpty(callConnectionId) ?
+ client.GetCallConnection(callConnectionId)
+ : throw new ArgumentNullException("Call connection id is empty");
+ return callConnection;
+}
+
+CallConnectionProperties GetCallConnectionProperties()
+{
+ CallConnectionProperties callConnectionProperties = !string.IsNullOrEmpty(callConnectionId) ?
+ client.GetCallConnection(callConnectionId).GetCallConnectionProperties()
+ : throw new ArgumentNullException("Call connection id is empty");
+ return callConnectionProperties;
+}
+
+List GetChoices()
+{
+ return new List {
+ new RecognitionChoice("Confirm", new List {
+ "Confirm",
+ "First",
+ "One"
+ }) {
+ Tone = DtmfTone.One
+ },
+ new RecognitionChoice("Cancel", new List {
+ "Cancel",
+ "Second",
+ "Two"
+ }) {
+ Tone = DtmfTone.Two
+ }
+ };
+}
+
+app.UseWebSockets();
+app.Use(async (context, next) =>
+{
+ if (context.Request.Path == "/ws")
+ {
+ if (context.WebSockets.IsWebSocketRequest)
+ {
+ using var webSocket = await context.WebSockets.AcceptWebSocketAsync();
+ await Helper.ProcessRequest(webSocket);
+ }
+ else
+ {
+ context.Response.StatusCode = StatusCodes.Status400BadRequest;
+ }
+ }
+ else
+ {
+ await next(context);
+ }
+});
+
+//app.UseStaticFiles(new StaticFileOptions
+//{
+// FileProvider = new PhysicalFileProvider(Path.Combine(builder.Environment.ContentRootPath, "wwwroot", "audio")),
+// RequestPath = "/audio"
+//});
+
+
+app.Run();
\ No newline at end of file
diff --git a/CallAutomation_Beta6_Test_sample/Properties/launchSettings.json b/CallAutomation_Beta6_Test_sample/Properties/launchSettings.json
new file mode 100644
index 00000000..370280c7
--- /dev/null
+++ b/CallAutomation_Beta6_Test_sample/Properties/launchSettings.json
@@ -0,0 +1,41 @@
+{
+ "$schema": "http://json.schemastore.org/launchsettings.json",
+ "iisSettings": {
+ "windowsAuthentication": false,
+ "anonymousAuthentication": true,
+ "iisExpress": {
+ "applicationUrl": "http://localhost:6043",
+ "sslPort": 44349
+ }
+ },
+ "profiles": {
+ "http": {
+ "commandName": "Project",
+ "dotnetRunMessages": true,
+ "launchBrowser": true,
+ "launchUrl": "swagger",
+ "applicationUrl": "http://localhost:5072",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ },
+ "https": {
+ "commandName": "Project",
+ "dotnetRunMessages": true,
+ "launchBrowser": true,
+ "launchUrl": "swagger",
+ "applicationUrl": "https://localhost:7286;http://localhost:5072",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ },
+ "IIS Express": {
+ "commandName": "IISExpress",
+ "launchBrowser": true,
+ "launchUrl": "swagger",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ }
+ }
+}
diff --git a/CallAutomation_Beta6_Test_sample/appsettings.Development.json b/CallAutomation_Beta6_Test_sample/appsettings.Development.json
new file mode 100644
index 00000000..0c208ae9
--- /dev/null
+++ b/CallAutomation_Beta6_Test_sample/appsettings.Development.json
@@ -0,0 +1,8 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ }
+}
diff --git a/CallAutomation_Beta6_Test_sample/appsettings.json b/CallAutomation_Beta6_Test_sample/appsettings.json
new file mode 100644
index 00000000..10f68b8c
--- /dev/null
+++ b/CallAutomation_Beta6_Test_sample/appsettings.json
@@ -0,0 +1,9 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ },
+ "AllowedHosts": "*"
+}