Log call session description.

This commit is contained in:
Matthew Chen 2018-08-23 13:37:22 -04:00
parent 77711df274
commit 329f8d6f45
2 changed files with 15 additions and 2 deletions

View file

@ -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)

View file

@ -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: "<ip address>")
} catch {
return "<Could not filter session description>"
}
}
}
protocol VideoCaptureSettingsDelegate: class {