private static SpeechResponse HandleSpeechResult(SpeechMessageSchema data, WebSocket clientConn) { if (_handler != null) { _handler.Update(data.results, data.result_index); } else { _handler = new MessageHandler(data.results, data.result_index); } ProcedureBase procedure = _handler.GetProcedure(); if (ProcedureBase.IsConfirmationRequested()) { switch (ProcedureBase.ParseConfirmation(data.results)) { case ConfirmationResult.UNKNOWN: return(IgnoreResponse(procedure)); case ConfirmationResult.CONFIRMED: ProcedureBase.Confirm(); _handler = null; return(new SpeechResponse { res = "confirmed", index = data.result_index }); case ConfirmationResult.REJECTED: ProcedureBase.Reject(); _handler = null; return(new SpeechResponse { res = "rejected", index = data.result_index }); } } if (!_handler.Execute(clientConn)) { return(IgnoreResponse(procedure)); } if (procedure == null) { _handler = null; } Console.WriteLine("Command executed, sending response to client"); return(new SpeechResponse { res = "executed", index = data.result_index }); }