From f24143d3b004b65db1e7dd44343445bf455170f6 Mon Sep 17 00:00:00 2001 From: Brad Pugh Date: Mon, 16 Nov 2020 16:27:20 -0800 Subject: [PATCH] Add support for turn logging id in ios sdk. This patch adds support for setting the TURN_LOGGING_ID in RTCConfig using the ios SDK. TURN_LOGGING_ID was added to webrtc in https://webrtc-review.googlesource.com/c/src/+/149829 The intended usage of this attribute is to correlate client and backend logs. This change was tested out with duo via wireshark. Bug: webrtc:10897 Change-Id: Iedbefdc6392c4df203aca08cf750028b450a11ad Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/191340 Reviewed-by: Anders Carlsson Commit-Queue: Brad Pugh Cr-Commit-Position: refs/heads/master@{#32626} --- sdk/objc/api/peerconnection/RTCConfiguration.h | 6 ++++++ sdk/objc/api/peerconnection/RTCConfiguration.mm | 3 +++ 2 files changed, 9 insertions(+) diff --git a/sdk/objc/api/peerconnection/RTCConfiguration.h b/sdk/objc/api/peerconnection/RTCConfiguration.h index 86eaa6cee5..cc6b88dec7 100644 --- a/sdk/objc/api/peerconnection/RTCConfiguration.h +++ b/sdk/objc/api/peerconnection/RTCConfiguration.h @@ -204,6 +204,12 @@ RTC_OBJC_EXPORT */ @property(nonatomic, nullable) RTC_OBJC_TYPE(RTCCryptoOptions) * cryptoOptions; +/** + * An optional string that will be attached to the TURN_ALLOCATE_REQUEST which + * which can be used to correlate client logs with backend logs. + */ +@property(nonatomic, nullable, copy) NSString *turnLoggingId; + /** * Time interval between audio RTCP reports. */ diff --git a/sdk/objc/api/peerconnection/RTCConfiguration.mm b/sdk/objc/api/peerconnection/RTCConfiguration.mm index 55abbcdb18..a4af7febbc 100644 --- a/sdk/objc/api/peerconnection/RTCConfiguration.mm +++ b/sdk/objc/api/peerconnection/RTCConfiguration.mm @@ -53,6 +53,7 @@ @synthesize activeResetSrtpParams = _activeResetSrtpParams; @synthesize allowCodecSwitching = _allowCodecSwitching; @synthesize cryptoOptions = _cryptoOptions; +@synthesize turnLoggingId = _turnLoggingId; @synthesize rtcpAudioReportIntervalMs = _rtcpAudioReportIntervalMs; @synthesize rtcpVideoReportIntervalMs = _rtcpVideoReportIntervalMs; @@ -129,6 +130,7 @@ sframeRequireFrameEncryption:config.crypto_options->sframe .require_frame_encryption]; } + _turnLoggingId = [NSString stringWithUTF8String:config.turn_logging_id.c_str()]; _rtcpAudioReportIntervalMs = config.audio_rtcp_report_interval_ms(); _rtcpVideoReportIntervalMs = config.video_rtcp_report_interval_ms(); _allowCodecSwitching = config.allow_codec_switching.value_or(false); @@ -258,6 +260,7 @@ _cryptoOptions.sframeRequireFrameEncryption ? true : false; nativeConfig->crypto_options = absl::optional(nativeCryptoOptions); } + nativeConfig->turn_logging_id = [_turnLoggingId UTF8String]; nativeConfig->set_audio_rtcp_report_interval_ms(_rtcpAudioReportIntervalMs); nativeConfig->set_video_rtcp_report_interval_ms(_rtcpVideoReportIntervalMs); nativeConfig->allow_codec_switching = _allowCodecSwitching;