diff --git a/CallAutomation_CallLiveTranscription/CallAutomationLiveTranscription/Helper.cs b/CallAutomation_CallLiveTranscription/CallAutomationLiveTranscription/Helper.cs index 0945ea44..fe48cc52 100644 --- a/CallAutomation_CallLiveTranscription/CallAutomationLiveTranscription/Helper.cs +++ b/CallAutomation_CallLiveTranscription/CallAutomationLiveTranscription/Helper.cs @@ -17,8 +17,7 @@ public static async Task ProcessRequest(WebSocket webSocket) while (webSocket.State == WebSocketState.Open || webSocket.State == WebSocketState.CloseSent) { var buffer = new byte[1024 * 4]; - var cancellationToken = new CancellationTokenSource(TimeSpan.FromSeconds(60)).Token; - WebSocketReceiveResult receiveResult = await webSocket.ReceiveAsync(new ArraySegment(buffer), cancellationToken); + WebSocketReceiveResult receiveResult = await webSocket.ReceiveAsync(new ArraySegment(buffer), CancellationToken.None); while (!receiveResult.CloseStatus.HasValue) { @@ -63,6 +62,9 @@ await webSocket.SendAsync( 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);