missions finition

This commit is contained in:
alma 2026-01-21 16:04:50 +01:00
parent d6055d9faa
commit d8410c5ab8

View File

@ -392,30 +392,52 @@ export class RocketChatCallListener {
// Check if this is a call ending notification // Check if this is a call ending notification
const notificationText = notification.text || payload?.text || notification.title || payload?.title || ''; const notificationText = notification.text || payload?.text || notification.title || payload?.title || '';
const messageAction = payload?.message?.action || payload?.action;
const messageStatus = payload?.message?.status || payload?.status;
const isCallEndedNotification = const isCallEndedNotification =
notificationText.toLowerCase().includes('call ended') || notificationText.toLowerCase().includes('call ended') ||
notificationText.toLowerCase().includes('appel terminé') || notificationText.toLowerCase().includes('appel terminé') ||
notificationText.toLowerCase().includes('call cancelled') || notificationText.toLowerCase().includes('call cancelled') ||
notificationText.toLowerCase().includes('appel annulé') || notificationText.toLowerCase().includes('appel annulé') ||
payload?.message?.action === 'end' || notificationText.toLowerCase().includes('call missed') ||
payload?.message?.action === 'hangup' || notificationText.toLowerCase().includes('appel manqué') ||
payload?.message?.action === 'cancel'; messageAction === 'end' ||
messageAction === 'hangup' ||
messageAction === 'cancel' ||
messageAction === 'reject' ||
messageStatus === 'ended' ||
messageStatus === 'cancelled' ||
messageStatus === 'rejected' ||
messageStatus === 'missed';
if (isCallEndedNotification) { if (isCallEndedNotification) {
logger.info('[ROCKETCHAT_CALL_LISTENER] 📞 CALL ENDED DETECTED in notification!', { logger.info('[ROCKETCHAT_CALL_LISTENER] 📞 CALL ENDED DETECTED in notification!', {
notificationText, notificationText,
roomId: payload?.rid, roomId: payload?.rid,
sender: payload?.sender, sender: payload?.sender,
messageAction,
messageStatus,
fullPayload: JSON.stringify(payload).substring(0, 1000),
});
console.log('[ROCKETCHAT_CALL_LISTENER] 📞 CALL ENDED in notification:', {
notificationText,
roomId: payload?.rid,
messageAction,
messageStatus,
payload,
}); });
// Handle as call ended event // Handle as call ended event
this.handleCallEvent({ this.handleCallEvent({
type: 'call-ended', type: 'call-ended',
action: 'end', action: messageAction || 'end',
from: payload?.sender || {}, from: payload?.sender || {},
roomId: payload?.rid, roomId: payload?.rid,
roomName: payload?.name || notification.title, roomName: payload?.name || notification.title,
message: payload?.message, message: payload?.message,
status: messageStatus,
}); });
} else if (isCallNotification) { } else if (isCallNotification) {
logger.info('[ROCKETCHAT_CALL_LISTENER] ✅ VIDEO/AUDIO CALL DETECTED in notification!', { logger.info('[ROCKETCHAT_CALL_LISTENER] ✅ VIDEO/AUDIO CALL DETECTED in notification!', {
@ -470,9 +492,22 @@ export class RocketChatCallListener {
type: webrtcData.type, type: webrtcData.type,
event: webrtcData.event, event: webrtcData.event,
status: webrtcData.status, status: webrtcData.status,
roomId: webrtcData.roomId || webrtcData.rid roomId: webrtcData.roomId || webrtcData.rid,
fullData: JSON.stringify(webrtcData).substring(0, 1000),
}); });
console.log('[ROCKETCHAT_CALL_LISTENER] 📞 Call ended in webrtc event:', webrtcData);
this.handleCallEvent(webrtcData); this.handleCallEvent(webrtcData);
} else {
// Log other webrtc events to see what we're missing
logger.debug('[ROCKETCHAT_CALL_LISTENER] ⚠️ Other webrtc event (not call start/end)', {
action: webrtcData.action,
type: webrtcData.type,
event: webrtcData.event,
status: webrtcData.status,
keys: Object.keys(webrtcData),
});
} }
} }
} }
@ -513,12 +548,15 @@ export class RocketChatCallListener {
eventName?.includes('call') || eventName?.includes('call') ||
eventName?.includes('webrtc') || eventName?.includes('webrtc') ||
eventName?.includes('videoconf') || eventName?.includes('videoconf') ||
eventName?.includes('notification') ||
args.some((arg: any) => args.some((arg: any) =>
arg?.action === 'hangup' || arg?.action === 'hangup' ||
arg?.action === 'end' || arg?.action === 'end' ||
arg?.action === 'cancel' || arg?.action === 'cancel' ||
arg?.type === 'call-ended' || arg?.type === 'call-ended' ||
arg?.message?.t === 'videoconf' arg?.message?.t === 'videoconf' ||
arg?.message?.t === 'audio' ||
arg?.message?.t === 'video'
); );
if (mightBeCallEvent) { if (mightBeCallEvent) {
@ -529,8 +567,16 @@ export class RocketChatCallListener {
hasArgs: args.length > 0, hasArgs: args.length > 0,
argsCount: args.length, argsCount: args.length,
firstArgKeys: args[0] ? Object.keys(args[0]) : [], firstArgKeys: args[0] ? Object.keys(args[0]) : [],
firstArgPreview: args[0] ? JSON.stringify(args[0]).substring(0, 500) : null,
fullFields: message.fields, fullFields: message.fields,
}); });
// Also log to console for immediate debugging
console.log('[ROCKETCHAT_CALL_LISTENER] 📢 POTENTIAL CALL EVENT:', {
eventName,
firstArg: args[0],
allArgs: args,
});
} else { } else {
logger.debug('[ROCKETCHAT_CALL_LISTENER] 📢 Stream notify user message', { logger.debug('[ROCKETCHAT_CALL_LISTENER] 📢 Stream notify user message', {
msg: message.msg, msg: message.msg,