Log call session description.

pull/1/head
Matthew Chen 7 years ago
parent 77711df274
commit 329f8d6f45

@ -407,6 +407,8 @@ private class SignalCallData: NSObject {
throw CallError.obsoleteCall(description: "Missing peerConnectionClient") throw CallError.obsoleteCall(description: "Missing peerConnectionClient")
} }
Logger.info("session description for outgoing call: \(call.identifiersForLogs), sdp: \(sessionDescription.logSafeDescription).")
return peerConnectionClient.setLocalSessionDescription(sessionDescription).then { return peerConnectionClient.setLocalSessionDescription(sessionDescription).then {
do { do {
let offerBuilder = SSKProtoCallMessageOffer.SSKProtoCallMessageOfferBuilder(id: call.signalingId, 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 // Find a sessionDescription compatible with my constraints and the remote sessionDescription
return peerConnectionClient.negotiateSessionDescription(remoteDescription: offerSessionDescription, constraints: constraints) return peerConnectionClient.negotiateSessionDescription(remoteDescription: offerSessionDescription, constraints: constraints)
}.then { (negotiatedSessionDescription: HardenedRTCSessionDescription) in }.then { (negotiatedSessionDescription: HardenedRTCSessionDescription) in
Logger.debug("set the remote description for: \(newCall.identifiersForLogs)")
guard self.call == newCall else { guard self.call == newCall else {
throw CallError.obsoleteCall(description: "negotiateSessionDescription() response for obsolete call") throw CallError.obsoleteCall(description: "negotiateSessionDescription() response for obsolete call")
} }
Logger.info("session description for incoming call: \(newCall.identifiersForLogs), sdp: \(negotiatedSessionDescription.logSafeDescription).")
do { do {
let answerBuilder = SSKProtoCallMessageAnswer.SSKProtoCallMessageAnswerBuilder(id: newCall.signalingId, let answerBuilder = SSKProtoCallMessageAnswer.SSKProtoCallMessageAnswerBuilder(id: newCall.signalingId,
sessionDescription: negotiatedSessionDescription.sdp) sessionDescription: negotiatedSessionDescription.sdp)

@ -1109,6 +1109,17 @@ class HardenedRTCSessionDescription {
return RTCSessionDescription.init(type: rtcSessionDescription.type, sdp: description) 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 { protocol VideoCaptureSettingsDelegate: class {

Loading…
Cancel
Save