#104 - pad crypto option (#105)

This commit is contained in:
Dave Horton
2023-09-15 13:53:35 -04:00
committed by GitHub
parent 114d34def4
commit 454986edcd
2 changed files with 5 additions and 5 deletions

View File

@@ -177,7 +177,7 @@ class CallSession extends Emitter {
this.unsubscribe = unsubscribe;
this.srsClients = [];
this.rtpEngineOpts = makeRtpEngineOpts(this.req, false, this.useWss || teams, teams);
this.rtpEngineOpts = makeRtpEngineOpts(this.req, false, this.useWss || teams, false, teams);
this.rtpEngineResource = {destroy: this.del.bind(null, this.rtpEngineOpts.common)};
let proxy, uris;
const mapGateways = new Map();
@@ -293,8 +293,8 @@ class CallSession extends Emitter {
* but it will require more significant changes and right now it seems
* like a rare use case -- encryption is usually an all or nothing requirement.
*/
this.logger.info({u}, 'using SRTP for outbound call');
this.rtpEngineOpts = makeRtpEngineOpts(this.req, false, true, true);
this.logger.info({u}, `using SRTP for outbound call, pad crypto: ${o.pad_crypto ? 'yes' : 'no'}`);
this.rtpEngineOpts = makeRtpEngineOpts(this.req, false, true, o.pad_crypto, true);
}
});
this.logger.debug({uris, voip_carrier_sid}, 'selected outbound gateways for requested carrier');

View File

@@ -2,12 +2,12 @@ const rtpCharacteristics = require('../data/rtp-transcoding');
const srtpCharacteristics = require('../data/srtp-transcoding');
const debug = require('debug')('jambonz:sbc-outbound');
function makeRtpEngineOpts(req, srcIsUsingSrtp, dstIsUsingSrtp, teams = false) {
function makeRtpEngineOpts(req, srcIsUsingSrtp, dstIsUsingSrtp, padCrypto, teams) {
const from = req.getParsedHeader('from');
const rtpCopy = JSON.parse(JSON.stringify(rtpCharacteristics));
const srtpCopy = JSON.parse(JSON.stringify(srtpCharacteristics));
if (process.env.PAD_CRYPTO) {
if (padCrypto) {
srtpCopy['default'].flags.push('SDES-pad');
srtpCopy['teams'].flags.push('SDES-pad');
}