diff --git a/Signal/src/call/CallService.swift b/Signal/src/call/CallService.swift index a43b6a025..584e374e5 100644 --- a/Signal/src/call/CallService.swift +++ b/Signal/src/call/CallService.swift @@ -407,6 +407,8 @@ private class SignalCallData: NSObject { throw CallError.obsoleteCall(description: "Missing peerConnectionClient") } + Logger.info("session description for outgoing call: \(call.identifiersForLogs), sdp: \(sessionDescription.logSafeDescription).") + return peerConnectionClient.setLocalSessionDescription(sessionDescription).then { do { let offerBuilder = SSKProtoCallMessageOffer.SSKProtoCallMessageOfferBuilder(id: call.signalingId, @@ -708,12 +710,12 @@ private class SignalCallData: NSObject { // Find a sessionDescription compatible with my constraints and the remote sessionDescription return peerConnectionClient.negotiateSessionDescription(remoteDescription: offerSessionDescription, constraints: constraints) }.then { (negotiatedSessionDescription: HardenedRTCSessionDescription) in - Logger.debug("set the remote description for: \(newCall.identifiersForLogs)") - guard self.call == newCall else { throw CallError.obsoleteCall(description: "negotiateSessionDescription() response for obsolete call") } + Logger.info("session description for incoming call: \(newCall.identifiersForLogs), sdp: \(negotiatedSessionDescription.logSafeDescription).") + do { let answerBuilder = SSKProtoCallMessageAnswer.SSKProtoCallMessageAnswerBuilder(id: newCall.signalingId, sessionDescription: negotiatedSessionDescription.sdp) diff --git a/Signal/src/call/PeerConnectionClient.swift b/Signal/src/call/PeerConnectionClient.swift index 3c13e9cfc..bc8ad66a0 100644 --- a/Signal/src/call/PeerConnectionClient.swift +++ b/Signal/src/call/PeerConnectionClient.swift @@ -1109,6 +1109,17 @@ class HardenedRTCSessionDescription { return RTCSessionDescription.init(type: rtcSessionDescription.type, sdp: description) } + + var logSafeDescription: String { + do { + let pattern = "\\d+\\.\\d+\\.\\d+\\.\\d+" + let regex = try NSRegularExpression(pattern: pattern, options: NSRegularExpression.Options.caseInsensitive) + let range = NSRange(location: 0, length: sdp.count) + return regex.stringByReplacingMatches(in: sdp, options: [], range: range, withTemplate: "") + } catch { + return "" + } + } } protocol VideoCaptureSettingsDelegate: class {