From e00379d1192c37fb1d75cbf65a289bb4e5bd6b14 Mon Sep 17 00:00:00 2001 From: Hoan Luu Huu <110280845+xquanluu@users.noreply.github.com> Date: Thu, 13 Apr 2023 18:43:29 +0700 Subject: [PATCH] update media session to callee (#78) --- lib/call-session.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/call-session.js b/lib/call-session.js index 37af179..5dc1a16 100644 --- a/lib/call-session.js +++ b/lib/call-session.js @@ -107,6 +107,11 @@ class CallSession extends Emitter { return this._mediaReleased; } + get calleeIsUsingSrtp() { + const tp = this.rtpEngineOpts?.uac?.mediaOpts['transport-protocol']; + return tp && -1 !== tp.indexOf('SAVP'); + } + subscribeForDTMF(dlg) { if (!this._subscribedForDTMF) { this._subscribedForDTMF = true; @@ -627,7 +632,7 @@ Duration=${payload.duration} ` /* if this is a re-invite from the FS to change media anchoring, avoid sending the reinvite out */ let sdp; - if (isReleasingMedia) { + if (isReleasingMedia && !this.calleeIsUsingSrtp) { this.logger.info(`got a reinvite from FS to ${reason}`); sdp = dlg.other.remote.sdp; if (!answerMedia.flags.includes('port latching')) answerMedia.flags.push('port latching');