arnacon-webrtc-service 0.1.39 → 0.1.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -67,12 +67,24 @@ function createBridgeApi({
|
|
|
67
67
|
}
|
|
68
68
|
session._bridgeDisposers = [];
|
|
69
69
|
}
|
|
70
|
+
const isWinnerLockedLoser = reason === "mr-loser-winner-locked";
|
|
70
71
|
try {
|
|
72
|
+
if (isWinnerLockedLoser) {
|
|
73
|
+
// Losing leg should get a clear "someone else answered" semantic before hangup.
|
|
74
|
+
sendDataChannelMessage(sessionId, { msgType: "call", action: "reject", reason: "cancelled-answered-elsewhere" });
|
|
75
|
+
}
|
|
71
76
|
sendDataChannelMessage(sessionId, { msgType: "call", action: "end", reason });
|
|
72
77
|
} catch (_) {}
|
|
73
|
-
|
|
78
|
+
const finalize = () => {
|
|
79
|
+
if (typeof destroySession !== "function") return;
|
|
74
80
|
try { destroySession(sessionId, false); } catch (_) {}
|
|
81
|
+
};
|
|
82
|
+
if (isWinnerLockedLoser) {
|
|
83
|
+
// Give DC control messages a short chance to flush before tearing down.
|
|
84
|
+
setTimeout(finalize, 250);
|
|
85
|
+
return;
|
|
75
86
|
}
|
|
87
|
+
finalize();
|
|
76
88
|
}
|
|
77
89
|
|
|
78
90
|
function getCallerNumberLabel(identity) {
|
|
@@ -352,15 +364,16 @@ function createBridgeApi({
|
|
|
352
364
|
ringGroups.set(groupId, group);
|
|
353
365
|
logger.log(`[MR:${group.groupId}] created callerSessionId=${callerSessionId}`);
|
|
354
366
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
367
|
+
const inviteJobs = targets.map((destination, idx) =>
|
|
368
|
+
createMultiringLegOffer(group, callerSession, callerNumberLabel, destination, idx + 1)
|
|
369
|
+
);
|
|
370
|
+
const inviteResults = await Promise.allSettled(inviteJobs);
|
|
371
|
+
inviteResults.forEach((result, idx) => {
|
|
372
|
+
if (result.status === "rejected") {
|
|
373
|
+
const legIndex = idx + 1;
|
|
374
|
+
logger.error(`[MR:${group.groupId}] failed leg invite #${legIndex}: ${result.reason?.message || result.reason}`);
|
|
362
375
|
}
|
|
363
|
-
}
|
|
376
|
+
});
|
|
364
377
|
|
|
365
378
|
if (group.pendingWallets.size === 0) {
|
|
366
379
|
group.closed = true;
|