in sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallAutomationEventParser.java [119:233]
private static CallAutomationEventBase parseSingleCloudEvent(String data, String eventType) {
try (JsonReader jsonReader = JsonProviders.createReader(data)) {
CallAutomationEventBase ret;
if (Objects.equals(eventType, "Microsoft.Communication.CallConnected")) {
ret = CallConnected.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.CallDisconnected")) {
ret = CallDisconnected.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.IncomingCall")) {
ret = IncomingCall.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.AddParticipantFailed")) {
ret = AddParticipantFailed.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.AddParticipantSucceeded")) {
ret = AddParticipantSucceeded.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.CallTransferAccepted")) {
ret = CallTransferAccepted.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.CallTransferFailed")) {
ret = CallTransferFailed.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.ParticipantsUpdated")) {
ret = ParticipantsUpdated.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.RecordingStateChanged")) {
ret = RecordingStateChanged.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.StartRecordingFailed")) {
ret = StartRecordingFailed.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.PlayCompleted")) {
ret = PlayCompleted.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.PlayFailed")) {
ret = PlayFailed.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.PlayStarted")) {
ret = PlayStarted.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.PlayCanceled")) {
ret = PlayCanceled.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.PlayPaused")) {
ret = PlayPaused.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.PlayResumed")) {
ret = PlayResumed.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.RecognizeCompleted")) {
ret = RecognizeCompleted.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.RecognizeFailed")) {
ret = RecognizeFailed.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.RecognizeCanceled")) {
ret = RecognizeCanceled.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.RemoveParticipantFailed")) {
ret = RemoveParticipantFailed.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.RemoveParticipantSucceeded")) {
ret = RemoveParticipantSucceeded.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.ContinuousDtmfRecognitionToneReceived")) {
ret = ContinuousDtmfRecognitionToneReceived.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.ContinuousDtmfRecognitionToneFailed")) {
ret = ContinuousDtmfRecognitionToneFailed.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.ContinuousDtmfRecognitionStopped")) {
ret = ContinuousDtmfRecognitionStopped.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.SendDtmfTonesCompleted")) {
ret = SendDtmfTonesCompleted.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.SendDtmfTonesFailed")) {
ret = SendDtmfTonesFailed.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.CancelAddParticipantSucceeded")) {
ret = CancelAddParticipantSucceeded.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.CancelAddParticipantFailed")) {
ret = CancelAddParticipantFailed.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.DialogStarted")) {
ret = DialogStarted.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.DialogCompleted")) {
ret = DialogCompleted.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.DialogFailed")) {
ret = DialogFailed.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.DialogConsent")) {
ret = DialogConsent.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.DialogHangup")) {
ret = DialogHangup.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.DialogLanguageChange")) {
ret = DialogLanguageChange.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.DialogTransfer")) {
ret = DialogTransfer.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.DialogSensitivityUpdate")) {
ret = DialogSensitivityUpdate.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.TranscriptionStarted")) {
ret = TranscriptionStarted.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.TranscriptionFailed")) {
ret = TranscriptionFailed.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.TranscriptionResumed")) {
ret = TranscriptionResumed.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.TranscriptionStopped")) {
ret = TranscriptionStopped.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.TranscriptionUpdated")) {
ret = TranscriptionUpdated.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.AnswerFailed")) {
ret = AnswerFailed.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.CreateCallFailed")) {
ret = CreateCallFailed.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.HoldAudioCompleted")) {
ret = HoldAudioCompleted.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.HoldAudioStarted")) {
ret = HoldAudioStarted.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.HoldAudioPaused")) {
ret = HoldAudioPaused.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.HoldAudioResumed")) {
ret = HoldAudioResumed.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.HoldFailed")) {
ret = HoldFailed.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.ConnectFailed")) {
ret = ConnectFailed.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.MediaStreamingStarted")) {
ret = MediaStreamingStarted.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.MediaStreamingStopped")) {
ret = MediaStreamingStopped.fromJson(jsonReader);
} else if (Objects.equals(eventType, "Microsoft.Communication.MediaStreamingFailed")) {
ret = MediaStreamingFailed.fromJson(jsonReader);
} else {
ret = null;
}
return ret;
} catch (IOException e) {
throw new RuntimeException(e);
}
}