From dbedd7419e3075267134e78549e1b0980306c27f Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Thu, 20 Oct 2022 23:05:34 -0400 Subject: [PATCH] block media going back to Five9 voicestream --- lib/call-session.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/call-session.js b/lib/call-session.js index c968152..1ec3530 100644 --- a/lib/call-session.js +++ b/lib/call-session.js @@ -80,6 +80,10 @@ class CallSession extends Emitter { return tp && -1 !== tp.indexOf('SAVP'); } + get isFive9VoiceStream() { + return this.req.has('X-Five9-StreamingPairId'); + } + async connect() { const {sdp} = this.req.locals; this.logger.info('inbound call accepted for routing'); @@ -168,6 +172,13 @@ class CallSession extends Emitter { throw new Error('rtpengine failed: answer'); } + /* special case: Five9 Voicestream calls do not advertise a:sendonly, though they should */ + if (this.isFive9VoiceStream) { + this.logger.info('Voicestream call from Five9, blocking audio in the reverse direction'); + const response = Promise.all([this.blockMedia(opts), this.blockDTMF(opts)]); + this.logger.debug({response}, 'response to blocMedia'); + } + let headers = { 'From': createBLegFromHeader(this.req), 'To': this.req.get('To'),