From 182c310191b38b32e04361fbf047aee68f79ae83 Mon Sep 17 00:00:00 2001 From: rammohan-y <37395033+rammohan-y@users.noreply.github.com> Date: Fri, 18 Apr 2025 19:03:16 +0530 Subject: [PATCH] remove video from sdp in case of reInvite if the call is audio call (#1159) https://github.com/jambonz/jambonz-feature-server/issues/1158 --- lib/utils/place-outdial.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/utils/place-outdial.js b/lib/utils/place-outdial.js index 6cbf7798..59414320 100644 --- a/lib/utils/place-outdial.js +++ b/lib/utils/place-outdial.js @@ -279,7 +279,12 @@ class SingleDialer extends Emitter { this.logger.info('dial is onhold, emit event'); this.emit('reinvite', req, res); } else { - const newSdp = await this.ep.modify(req.body); + let newSdp = await this.ep.modify(req.body); + // in case of reINVITE if video call is enabled in FS and the call is not a video call, + // remove video media from the SDP + if (process.env.JAMBONES_VIDEO_CALLS_ENABLED_IN_FS && !this.opts?.isVideoCall) { + newSdp = removeVideoSdp(newSdp); + } res.send(200, {body: newSdp}); this.logger.info({offer: req.body, answer: newSdp}, 'SingleDialer:exec: handling reINVITE'); } @@ -565,7 +570,8 @@ function placeOutdial({ }) { const myOpts = deepcopy(opts); const sd = new SingleDialer({ - logger, sbcAddress, target, myOpts, application, callInfo, accountInfo, rootSpan, startSpan, dialTask, onHoldMusic + logger, sbcAddress, target, opts: myOpts, application, callInfo, + accountInfo, rootSpan, startSpan, dialTask, onHoldMusic }); sd.exec(srf, ms, myOpts); return sd;