add support for tls with srtp media encryption (#83)

This commit is contained in:
Dave Horton
2023-05-10 16:02:08 -04:00
committed by GitHub
parent 76558cc5c9
commit 750294eab2
+12 -1
View File
@@ -256,7 +256,8 @@ class CallSession extends Emitter {
const obj = {
name: vc.name,
diversion: vc.diversion,
hostport
hostport,
protocol: o.protocol
};
if (vc.register_username && vc.register_password) {
obj.auth = {
@@ -266,6 +267,16 @@ class CallSession extends Emitter {
}
mapGateways.set(u, obj);
uris.push(u);
if (o.protocol === 'tls/srtp') {
/** TODO: this is a bit of a hack in the sense that we are not
* supporting a scenario where you have a carrier with several outbound
* gateways, some requiring encrypted media and some not. This should be rectified
* 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.debug({uris, voip_carrier_sid}, 'selected outbound gateways for requested carrier');
}