support for gateways sending TLS with SRTP but not dtls (#66)

This commit is contained in:
Dave Horton
2022-12-01 09:49:25 -05:00
committed by GitHub
parent 5b88065925
commit c34da3cfa8
3 changed files with 8 additions and 2 deletions

View File

@@ -8,7 +8,7 @@
},
"teams": {
"transport-protocol": "RTP/SAVP",
"ICE": "force",
"ICE": "default",
"SDES": "off",
"flags": ["generate mid", "SDES-no", "media handover", "port latching"],
"rtcp-mux": ["accept"]

View File

@@ -3,6 +3,7 @@ const SrsClient = require('@jambonz/siprec-client-utils');
const {
makeRtpEngineOpts,
SdpWantsSrtp,
SdpDoesNotWantDTLS,
nudgeCallCounts,
roundTripTime,
parseConnectionIp
@@ -152,7 +153,8 @@ class CallSession extends Emitter {
this.logger.debug(`using feature server ${featureServer}`);
const wantsSrtp = this.req.locals.possibleWebRtcClient = SdpWantsSrtp(sdp);
this.rtpEngineOpts = makeRtpEngineOpts(this.req, wantsSrtp, false, this.isFromMSTeams);
const doesNotWantDTLS = wantsSrtp && SdpDoesNotWantDTLS(sdp);
this.rtpEngineOpts = makeRtpEngineOpts(this.req, wantsSrtp, false, this.isFromMSTeams || doesNotWantDTLS);
this.rtpEngineResource = {destroy: this.del.bind(null, this.rtpEngineOpts.common)};
const obj = parseUri(this.req.uri);
let proxy, host, uri;

View File

@@ -41,6 +41,9 @@ function makeRtpEngineOpts(req, srcIsUsingSrtp, dstIsUsingSrtp, teams = false) {
};
}
const SdpDoesNotWantDTLS = (sdp) => {
return /m=audio.*\s+RTP\/SAVP/.test(sdp);
};
const SdpWantsSrtp = (sdp) => {
return /m=audio.*SAVP/.test(sdp);
};
@@ -178,6 +181,7 @@ const parseConnectionIp = (sdp) => {
module.exports = {
isWSS,
SdpWantsSrtp,
SdpDoesNotWantDTLS,
getAppserver,
makeRtpEngineOpts,
makeAccountCallCountKey,