Skip to content

Commit fbb6d8d

Browse files
fix: server crashes if drachtio connection is lost mid-call
1 parent 21cd54f commit fbb6d8d

5 files changed

Lines changed: 27 additions & 5 deletions

File tree

.changeset/witty-ravens-end.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@rocket.chat/media-calls': minor
3+
---
4+
5+
Fixes a server error when Drachtio connection is lost while a SIP call is active

.yarn/patches/drachtio-srf-npm-5.0.12-b0b1afaad6.patch

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
diff --git a/lib/@types/index.d.ts b/lib/@types/index.d.ts
2-
index f71a82f458c1432202be8d4585fc70ba94bee4a4..b874ee9e1fa8a051f06d4824fc12161acfadb78a 100644
2+
index f71a82f458c1432202be8d4585fc70ba94bee4a4..2ad273d1efcaaa54b0a1326ff1c15b6cfc199be3 100644
33
--- a/lib/@types/index.d.ts
44
+++ b/lib/@types/index.d.ts
5+
@@ -101,7 +101,7 @@ declare namespace Srf {
6+
local: { uri: string; sdp: string; };
7+
remote: { uri: string; sdp: string; };
8+
req: SrfRequest;
9+
- destroy(opts?: { headers: Record<string, string>; }, callback?: (err: any, msg: SrfRequest) => void): void;
10+
+ destroy(opts?: { headers: Record<string, string>; }, callback?: (err: any, msg: SrfRequest) => void): Promise<void>;
11+
modify(sdp: string, opts?: { noAck: boolean }): Promise<string>;
12+
modify(opts: { noAck: boolean }): Promise<string>;
13+
modify(sdp: string, opts?: { noAck: boolean }, callback?: (err: any, msg: SrfResponse) => void): void;
514
@@ -119,12 +119,12 @@ declare namespace Srf {
615
on(messageType: "modify", callback: (req: SrfRequest, res: SrfResponse) => void): void;
716
once(messageType: string, callback: (msg: SrfResponse) => void): void;

ee/packages/media-calls/src/sip/providers/IncomingSipCall.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,11 @@ export class IncomingSipCall extends BaseSipCall {
298298
this.lastCallState = 'hangup';
299299

300300
if (sipDialog) {
301-
sipDialog.destroy();
301+
try {
302+
await sipDialog.destroy();
303+
} catch (err) {
304+
logger.error({ msg: 'Failed to destroy SIP dialog', err, method: 'IncomingSipCall.processEndedCall' });
305+
}
302306
}
303307
}
304308

ee/packages/media-calls/src/sip/providers/OutgoingSipCall.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,11 @@ export class OutgoingSipCall extends BaseSipCall {
407407
this.lastCallState = 'hangup';
408408

409409
if (sipDialog) {
410-
sipDialog.destroy();
410+
try {
411+
await sipDialog.destroy();
412+
} catch (err) {
413+
logger.error({ msg: 'Failed to destroy SIP dialog', err, method: 'OutgoingSipCall.processEndedCall' });
414+
}
411415
}
412416
}
413417

yarn.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20576,7 +20576,7 @@ __metadata:
2057620576

2057720577
"drachtio-srf@patch:drachtio-srf@npm%3A5.0.12#~/.yarn/patches/drachtio-srf-npm-5.0.12-b0b1afaad6.patch":
2057820578
version: 5.0.12
20579-
resolution: "drachtio-srf@patch:drachtio-srf@npm%3A5.0.12#~/.yarn/patches/drachtio-srf-npm-5.0.12-b0b1afaad6.patch::version=5.0.12&hash=1f708c"
20579+
resolution: "drachtio-srf@patch:drachtio-srf@npm%3A5.0.12#~/.yarn/patches/drachtio-srf-npm-5.0.12-b0b1afaad6.patch::version=5.0.12&hash=cb2b94"
2058020580
dependencies:
2058120581
debug: "npm:^3.2.7"
2058220582
delegates: "npm:^0.1.0"
@@ -20588,7 +20588,7 @@ __metadata:
2058820588
sip-status: "npm:^0.1.0"
2058920589
utils-merge: "npm:^1.0.0"
2059020590
uuid-random: "npm:^1.3.2"
20591-
checksum: 10/ed791d8c614fa409b55cac896ac36cf4b3930dcb29c5e24a5be964e690c62707a48035d1482d7b79d420b2c4623581f6bfa301b06918b6b9a11ab73a5f297147
20591+
checksum: 10/c05e197e4f1b2bd93e8cc85356207f2b62fcd764447cbbf895d1876ad0d8aa6e3ef84f12734f91b922aa9bb5d542ecf37d703d5a361af2536833a93eb40544b9
2059220592
languageName: node
2059320593
linkType: hard
2059420594

0 commit comments

Comments
 (0)