From 4338ae9411364bcf210ff28749898f41b6ca648e Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Fri, 7 Oct 2022 11:52:36 +0100 Subject: [PATCH] bugfix: inject DMTF flag was inserted over and over --- lib/utils.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index d335afc..84d2de2 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -4,9 +4,11 @@ const debug = require('debug')('jambonz:sbc-outbound'); function makeRtpEngineOpts(req, srcIsUsingSrtp, dstIsUsingSrtp, teams = false) { const from = req.getParsedHeader('from'); - const srtpOpts = teams ? srtpCharacteristics['teams'] : srtpCharacteristics['default']; - const dstOpts = dstIsUsingSrtp ? srtpOpts : rtpCharacteristics; - const srcOpts = srcIsUsingSrtp ? srtpOpts : rtpCharacteristics; + const rtpCopy = JSON.parse(JSON.stringify(rtpCharacteristics)); + const srtpCopy = JSON.parse(JSON.stringify(srtpCharacteristics)); + const srtpOpts = teams ? srtpCopy['teams'] : srtpCopy['default']; + const dstOpts = dstIsUsingSrtp ? srtpOpts : rtpCopy; + const srcOpts = srcIsUsingSrtp ? srtpOpts : rtpCopy; /* webrtc clients (e.g. sipjs) send DMTF via SIP INFO */ if ((srcIsUsingSrtp || dstIsUsingSrtp) && !teams) {