Skip to content

Commit

Permalink
#104 - pad crypto option
Browse files Browse the repository at this point in the history
  • Loading branch information
davehorton committed Sep 15, 2023
1 parent 114d34d commit 02b4203
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/call-session.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down

0 comments on commit 02b4203

Please sign in to comment.