feat(gladia): Print Gladia errors in the console
This commit is contained in:
parent
a744193536
commit
388858000c
@ -4,6 +4,7 @@ import akka.actor.ActorContext
|
|||||||
|
|
||||||
class AudioCaptionsApp2x(implicit val context: ActorContext)
|
class AudioCaptionsApp2x(implicit val context: ActorContext)
|
||||||
extends UpdateTranscriptPubMsgHdlr
|
extends UpdateTranscriptPubMsgHdlr
|
||||||
|
with TranscriptionProviderErrorMsgHdlr
|
||||||
with AudioFloorChangedVoiceConfEvtMsgHdlr {
|
with AudioFloorChangedVoiceConfEvtMsgHdlr {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
package org.bigbluebutton.core.apps.audiocaptions
|
||||||
|
|
||||||
|
import org.bigbluebutton.common2.msgs._
|
||||||
|
import org.bigbluebutton.core.bus.MessageBus
|
||||||
|
import org.bigbluebutton.core.models.AudioCaptions
|
||||||
|
import org.bigbluebutton.core.running.LiveMeeting
|
||||||
|
|
||||||
|
trait TranscriptionProviderErrorMsgHdlr {
|
||||||
|
this: AudioCaptionsApp2x =>
|
||||||
|
|
||||||
|
def handleTranscriptionProviderErrorMsg(msg: TranscriptionProviderErrorMsg, liveMeeting: LiveMeeting, bus: MessageBus): Unit = {
|
||||||
|
val meetingId = liveMeeting.props.meetingProp.intId
|
||||||
|
|
||||||
|
def broadcastEvent(userId: String, errorCode: String, errorMessage: String): Unit = {
|
||||||
|
val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, meetingId, "nodeJSapp")
|
||||||
|
val envelope = BbbCoreEnvelope(TranscriptionProviderErrorEvtMsg.NAME, routing)
|
||||||
|
val header = BbbClientMsgHeader(TranscriptionProviderErrorEvtMsg.NAME, meetingId, userId)
|
||||||
|
val body = TranscriptionProviderErrorEvtMsgBody(errorCode, errorMessage)
|
||||||
|
val event = TranscriptionProviderErrorEvtMsg(header, body)
|
||||||
|
val msgEvent = BbbCommonEnvCoreMsg(envelope, event)
|
||||||
|
|
||||||
|
bus.outGW.send(msgEvent)
|
||||||
|
}
|
||||||
|
|
||||||
|
broadcastEvent(msg.header.userId, msg.body.errorCode, msg.body.errorMessage)
|
||||||
|
}
|
||||||
|
}
|
@ -406,6 +406,8 @@ class ReceivedJsonMsgHandlerActor(
|
|||||||
// AudioCaptions
|
// AudioCaptions
|
||||||
case UpdateTranscriptPubMsg.NAME =>
|
case UpdateTranscriptPubMsg.NAME =>
|
||||||
routeGenericMsg[UpdateTranscriptPubMsg](envelope, jsonNode)
|
routeGenericMsg[UpdateTranscriptPubMsg](envelope, jsonNode)
|
||||||
|
case TranscriptionProviderErrorMsg.NAME =>
|
||||||
|
routeGenericMsg[TranscriptionProviderErrorMsg](envelope, jsonNode)
|
||||||
|
|
||||||
// GroupChats
|
// GroupChats
|
||||||
case GetGroupChatsReqMsg.NAME =>
|
case GetGroupChatsReqMsg.NAME =>
|
||||||
|
@ -583,6 +583,7 @@ class MeetingActor(
|
|||||||
|
|
||||||
// AudioCaptions
|
// AudioCaptions
|
||||||
case m: UpdateTranscriptPubMsg => audioCaptionsApp2x.handle(m, liveMeeting, msgBus)
|
case m: UpdateTranscriptPubMsg => audioCaptionsApp2x.handle(m, liveMeeting, msgBus)
|
||||||
|
case m: TranscriptionProviderErrorMsg => audioCaptionsApp2x.handleTranscriptionProviderErrorMsg(m, liveMeeting, msgBus)
|
||||||
|
|
||||||
// GroupChat
|
// GroupChat
|
||||||
case m: CreateGroupChatReqMsg =>
|
case m: CreateGroupChatReqMsg =>
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
package org.bigbluebutton.common2.msgs
|
package org.bigbluebutton.common2.msgs
|
||||||
|
|
||||||
|
object TranscriptionProviderErrorMsg { val NAME = "TranscriptionProviderErrorMsg" }
|
||||||
|
case class TranscriptionProviderErrorMsg(header: BbbClientMsgHeader, body: TranscriptionProviderErrorMsgBody) extends StandardMsg
|
||||||
|
case class TranscriptionProviderErrorMsgBody(
|
||||||
|
errorCode: String,
|
||||||
|
errorMessage: String,
|
||||||
|
)
|
||||||
|
|
||||||
// In messages
|
// In messages
|
||||||
object UpdateTranscriptPubMsg { val NAME = "UpdateTranscriptPubMsg" }
|
object UpdateTranscriptPubMsg { val NAME = "UpdateTranscriptPubMsg" }
|
||||||
case class UpdateTranscriptPubMsg(header: BbbClientMsgHeader, body: UpdateTranscriptPubMsgBody) extends StandardMsg
|
case class UpdateTranscriptPubMsg(header: BbbClientMsgHeader, body: UpdateTranscriptPubMsgBody) extends StandardMsg
|
||||||
@ -14,6 +21,10 @@ case class UpdateTranscriptPubMsgBody(
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Out messages
|
// Out messages
|
||||||
|
object TranscriptionProviderErrorEvtMsg { val NAME = "TranscriptionProviderErrorEvtMsg" }
|
||||||
|
case class TranscriptionProviderErrorEvtMsg(header: BbbClientMsgHeader, body: TranscriptionProviderErrorEvtMsgBody) extends BbbCoreMsg
|
||||||
|
case class TranscriptionProviderErrorEvtMsgBody(errorCode: String, errorMessage: String)
|
||||||
|
|
||||||
object TranscriptUpdatedEvtMsg { val NAME = "TranscriptUpdatedEvtMsg" }
|
object TranscriptUpdatedEvtMsg { val NAME = "TranscriptUpdatedEvtMsg" }
|
||||||
case class TranscriptUpdatedEvtMsg(header: BbbClientMsgHeader, body: TranscriptUpdatedEvtMsgBody) extends BbbCoreMsg
|
case class TranscriptUpdatedEvtMsg(header: BbbClientMsgHeader, body: TranscriptUpdatedEvtMsgBody) extends BbbCoreMsg
|
||||||
case class TranscriptUpdatedEvtMsgBody(transcriptId: String, transcript: String, locale: String, result: Boolean)
|
case class TranscriptUpdatedEvtMsgBody(transcriptId: String, transcript: String, locale: String, result: Boolean)
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
import RedisPubSub from '/imports/startup/server/redis';
|
import RedisPubSub from '/imports/startup/server/redis';
|
||||||
import handleTranscriptUpdated from '/imports/api/audio-captions/server/handlers/transcriptUpdated';
|
import handleTranscriptUpdated from '/imports/api/audio-captions/server/handlers/transcriptUpdated';
|
||||||
|
import handleTranscriptionProviderError from '/imports/api/audio-captions/server/handlers/transcriptionProviderError';
|
||||||
|
|
||||||
RedisPubSub.on('TranscriptUpdatedEvtMsg', handleTranscriptUpdated);
|
RedisPubSub.on('TranscriptUpdatedEvtMsg', handleTranscriptUpdated);
|
||||||
|
RedisPubSub.on('TranscriptionProviderErrorEvtMsg', handleTranscriptionProviderError);
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
import Users from '/imports/api/users';
|
||||||
|
import Logger from '/imports/startup/server/logger';
|
||||||
|
|
||||||
|
export default async function handleTranscriptionProviderError({ header, body }) {
|
||||||
|
const {
|
||||||
|
meetingId,
|
||||||
|
userId,
|
||||||
|
} = header;
|
||||||
|
|
||||||
|
const selector = {
|
||||||
|
meetingId,
|
||||||
|
userId,
|
||||||
|
};
|
||||||
|
|
||||||
|
const {
|
||||||
|
errorCode,
|
||||||
|
errorMessage,
|
||||||
|
} = body;
|
||||||
|
|
||||||
|
const modifier = {
|
||||||
|
$set: {
|
||||||
|
transcriptionError: {
|
||||||
|
code: errorCode,
|
||||||
|
message: errorMessage,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
const numberAffected = await Users.updateAsync(selector, modifier);
|
||||||
|
|
||||||
|
if (numberAffected) {
|
||||||
|
Logger.error(`Transcription error errorCode=${errorCode} errorMessage=${errorMessage} meetingId=${meetingId}`);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
Logger.error(`Problem setting transcription error: ${err}`);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user