From bb0f8e173f93f315248c5fd7855d01203ffaf6ac Mon Sep 17 00:00:00 2001 From: Volodymyr B Date: Tue, 4 Mar 2025 13:21:51 +0200 Subject: [PATCH 1/2] extend configuration for ice gathering process --- lib/src/sip_ua_helper.dart | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/lib/src/sip_ua_helper.dart b/lib/src/sip_ua_helper.dart index 288d5e60..38d8886e 100644 --- a/lib/src/sip_ua_helper.dart +++ b/lib/src/sip_ua_helper.dart @@ -372,7 +372,10 @@ class SIPUAHelper extends EventManager { 'iceTransportPolicy': (_uaSettings?.iceTransportPolicy ?? IceTransportPolicy.ALL) .toParameterString(), - 'iceServers': _uaSettings?.iceServers + 'iceServers': _uaSettings?.iceServers, + 'tcpCandidatePolicy': (_uaSettings?.tcpCandidatePolicy ?? + TcpCandidatePolicy.ENABLED).toParameterString(), + 'iceCandidatePoolSize': _uaSettings?.iceCandidatePoolSize }, 'mediaConstraints': { 'audio': true, @@ -853,6 +856,22 @@ extension _IceTransportPolicyEncoding on IceTransportPolicy { } } +enum TcpCandidatePolicy{ + ENABLED, + DISABLED +} + +extension _TcpCandidatePolicyEncoding on TcpCandidatePolicy { + String toParameterString() { + switch (this) { + case TcpCandidatePolicy.ENABLED: + return 'enabled'; + case TcpCandidatePolicy.DISABLED: + return 'disabled'; + } + } +} + class UaSettings { WebSocketSettings webSocketSettings = WebSocketSettings(); TcpSocketSettings tcpSocketSettings = TcpSocketSettings(); @@ -918,6 +937,18 @@ class UaSettings { /// Will default to [IceTransportPolicy.ALL] if not specified. IceTransportPolicy? iceTransportPolicy; + /// Allows to disable tcp candidates gathering + /// Will default to [TcpCandidatePolicy.ENABLED] if not specified. + TcpCandidatePolicy? tcpCandidatePolicy; + + /// An unsigned 16-bit integer value which specifies the size of the prefetched + /// ICE candidate pool. The default value is 0 (meaning no candidate prefetching will occur). + /// You may find in some cases that connections can be established more quickly + /// by allowing the ICE agent to start fetching ICE candidates before you start + /// trying to connect, so that they're already available for inspection + /// when RTCPeerConnection.setLocalDescription() is called. + int iceCandidatePoolSize = 0; + /// Controls which kind of messages are to be sent to keep a SIP session /// alive. /// Defaults to "UPDATE" From 73dfb94721de807663803a49ae36d67098a4e497 Mon Sep 17 00:00:00 2001 From: Volodymyr B Date: Fri, 11 Jul 2025 08:13:15 +0300 Subject: [PATCH 2/2] fix code format --- lib/src/sip_ua_helper.dart | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/src/sip_ua_helper.dart b/lib/src/sip_ua_helper.dart index 38d8886e..2a15f98c 100644 --- a/lib/src/sip_ua_helper.dart +++ b/lib/src/sip_ua_helper.dart @@ -373,8 +373,9 @@ class SIPUAHelper extends EventManager { (_uaSettings?.iceTransportPolicy ?? IceTransportPolicy.ALL) .toParameterString(), 'iceServers': _uaSettings?.iceServers, - 'tcpCandidatePolicy': (_uaSettings?.tcpCandidatePolicy ?? - TcpCandidatePolicy.ENABLED).toParameterString(), + 'tcpCandidatePolicy': + (_uaSettings?.tcpCandidatePolicy ?? TcpCandidatePolicy.ENABLED) + .toParameterString(), 'iceCandidatePoolSize': _uaSettings?.iceCandidatePoolSize }, 'mediaConstraints': { @@ -856,10 +857,7 @@ extension _IceTransportPolicyEncoding on IceTransportPolicy { } } -enum TcpCandidatePolicy{ - ENABLED, - DISABLED -} +enum TcpCandidatePolicy { ENABLED, DISABLED } extension _TcpCandidatePolicyEncoding on TcpCandidatePolicy { String toParameterString() {