missions finition
This commit is contained in:
parent
d8410c5ab8
commit
7b022add81
@ -560,23 +560,80 @@ export class RocketChatCallListener {
|
||||
);
|
||||
|
||||
if (mightBeCallEvent) {
|
||||
const firstArg = args[0];
|
||||
const payload = firstArg?.payload || firstArg;
|
||||
const messageType = payload?.message?.t;
|
||||
const notificationText = firstArg?.text || payload?.text || firstArg?.title || payload?.title || '';
|
||||
const messageAction = payload?.message?.action || payload?.action || firstArg?.action;
|
||||
const messageStatus = payload?.message?.status || payload?.status || firstArg?.status;
|
||||
|
||||
logger.info('[ROCKETCHAT_CALL_LISTENER] 📢 Stream notify user message (POTENTIAL CALL EVENT)', {
|
||||
msg: message.msg,
|
||||
collection: message.collection,
|
||||
eventName,
|
||||
hasArgs: args.length > 0,
|
||||
argsCount: args.length,
|
||||
firstArgKeys: args[0] ? Object.keys(args[0]) : [],
|
||||
firstArgPreview: args[0] ? JSON.stringify(args[0]).substring(0, 500) : null,
|
||||
firstArgKeys: firstArg ? Object.keys(firstArg) : [],
|
||||
messageType,
|
||||
notificationText,
|
||||
messageAction,
|
||||
messageStatus,
|
||||
firstArgPreview: firstArg ? JSON.stringify(firstArg).substring(0, 1000) : null,
|
||||
fullFields: message.fields,
|
||||
});
|
||||
|
||||
// Also log to console for immediate debugging
|
||||
// Also log to console for immediate debugging with full details
|
||||
console.log('[ROCKETCHAT_CALL_LISTENER] 📢 POTENTIAL CALL EVENT:', {
|
||||
eventName,
|
||||
firstArg: args[0],
|
||||
firstArg: firstArg,
|
||||
payload: payload,
|
||||
messageType,
|
||||
notificationText,
|
||||
messageAction,
|
||||
messageStatus,
|
||||
allArgs: args,
|
||||
});
|
||||
|
||||
// Check if this might be a call ended event that we're missing
|
||||
const mightBeCallEnded =
|
||||
notificationText.toLowerCase().includes('call ended') ||
|
||||
notificationText.toLowerCase().includes('appel terminé') ||
|
||||
notificationText.toLowerCase().includes('call cancelled') ||
|
||||
notificationText.toLowerCase().includes('appel annulé') ||
|
||||
notificationText.toLowerCase().includes('call missed') ||
|
||||
notificationText.toLowerCase().includes('appel manqué') ||
|
||||
messageAction === 'end' ||
|
||||
messageAction === 'hangup' ||
|
||||
messageAction === 'cancel' ||
|
||||
messageAction === 'reject' ||
|
||||
messageStatus === 'ended' ||
|
||||
messageStatus === 'cancelled' ||
|
||||
messageStatus === 'rejected' ||
|
||||
messageStatus === 'missed' ||
|
||||
(messageType === 'videoconf' && (messageAction === 'end' || messageStatus === 'ended'));
|
||||
|
||||
if (mightBeCallEnded) {
|
||||
console.log('[ROCKETCHAT_CALL_LISTENER] 🚨 POTENTIAL CALL ENDED EVENT DETECTED!', {
|
||||
eventName,
|
||||
notificationText,
|
||||
messageAction,
|
||||
messageStatus,
|
||||
messageType,
|
||||
roomId: payload?.rid || firstArg?.rid,
|
||||
firstArg,
|
||||
});
|
||||
|
||||
// Try to handle it as a call ended event
|
||||
this.handleCallEvent({
|
||||
type: 'call-ended',
|
||||
action: messageAction || 'end',
|
||||
from: payload?.sender || firstArg?.sender || {},
|
||||
roomId: payload?.rid || firstArg?.rid || '',
|
||||
roomName: payload?.name || firstArg?.name || firstArg?.title || '',
|
||||
message: payload?.message || firstArg?.message,
|
||||
status: messageStatus,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
logger.debug('[ROCKETCHAT_CALL_LISTENER] 📢 Stream notify user message', {
|
||||
msg: message.msg,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user