Skip to content

Commit ffd9fd1

Browse files
VolsavrVolodymyr B
andauthored
Extend configuration for ice gathering process (#550)
* extend configuration for ice gathering process * fix code format --------- Co-authored-by: Volodymyr B <[email protected]>
1 parent 2109dd2 commit ffd9fd1

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

lib/src/sip_ua_helper.dart

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,11 @@ class SIPUAHelper extends EventManager {
373373
'iceTransportPolicy':
374374
(_uaSettings?.iceTransportPolicy ?? IceTransportPolicy.ALL)
375375
.toParameterString(),
376-
'iceServers': _uaSettings?.iceServers
376+
'iceServers': _uaSettings?.iceServers,
377+
'tcpCandidatePolicy':
378+
(_uaSettings?.tcpCandidatePolicy ?? TcpCandidatePolicy.ENABLED)
379+
.toParameterString(),
380+
'iceCandidatePoolSize': _uaSettings?.iceCandidatePoolSize
377381
},
378382
'mediaConstraints': <String, dynamic>{
379383
'audio': true,
@@ -854,6 +858,19 @@ extension _IceTransportPolicyEncoding on IceTransportPolicy {
854858
}
855859
}
856860

861+
enum TcpCandidatePolicy { ENABLED, DISABLED }
862+
863+
extension _TcpCandidatePolicyEncoding on TcpCandidatePolicy {
864+
String toParameterString() {
865+
switch (this) {
866+
case TcpCandidatePolicy.ENABLED:
867+
return 'enabled';
868+
case TcpCandidatePolicy.DISABLED:
869+
return 'disabled';
870+
}
871+
}
872+
}
873+
857874
class UaSettings {
858875
WebSocketSettings webSocketSettings = WebSocketSettings();
859876
TcpSocketSettings tcpSocketSettings = TcpSocketSettings();
@@ -922,6 +939,18 @@ class UaSettings {
922939
/// Will default to [IceTransportPolicy.ALL] if not specified.
923940
IceTransportPolicy? iceTransportPolicy;
924941

942+
/// Allows to disable tcp candidates gathering
943+
/// Will default to [TcpCandidatePolicy.ENABLED] if not specified.
944+
TcpCandidatePolicy? tcpCandidatePolicy;
945+
946+
/// An unsigned 16-bit integer value which specifies the size of the prefetched
947+
/// ICE candidate pool. The default value is 0 (meaning no candidate prefetching will occur).
948+
/// You may find in some cases that connections can be established more quickly
949+
/// by allowing the ICE agent to start fetching ICE candidates before you start
950+
/// trying to connect, so that they're already available for inspection
951+
/// when RTCPeerConnection.setLocalDescription() is called.
952+
int iceCandidatePoolSize = 0;
953+
925954
/// Controls which kind of messages are to be sent to keep a SIP session
926955
/// alive.
927956
/// Defaults to "UPDATE"

0 commit comments

Comments
 (0)