Skip to content

Commit bb0f8e1

Browse files
author
Volodymyr B
committed
extend configuration for ice gathering process
1 parent 38dbab7 commit bb0f8e1

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

lib/src/sip_ua_helper.dart

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,10 @@ class SIPUAHelper extends EventManager {
372372
'iceTransportPolicy':
373373
(_uaSettings?.iceTransportPolicy ?? IceTransportPolicy.ALL)
374374
.toParameterString(),
375-
'iceServers': _uaSettings?.iceServers
375+
'iceServers': _uaSettings?.iceServers,
376+
'tcpCandidatePolicy': (_uaSettings?.tcpCandidatePolicy ??
377+
TcpCandidatePolicy.ENABLED).toParameterString(),
378+
'iceCandidatePoolSize': _uaSettings?.iceCandidatePoolSize
376379
},
377380
'mediaConstraints': <String, dynamic>{
378381
'audio': true,
@@ -853,6 +856,22 @@ extension _IceTransportPolicyEncoding on IceTransportPolicy {
853856
}
854857
}
855858

859+
enum TcpCandidatePolicy{
860+
ENABLED,
861+
DISABLED
862+
}
863+
864+
extension _TcpCandidatePolicyEncoding on TcpCandidatePolicy {
865+
String toParameterString() {
866+
switch (this) {
867+
case TcpCandidatePolicy.ENABLED:
868+
return 'enabled';
869+
case TcpCandidatePolicy.DISABLED:
870+
return 'disabled';
871+
}
872+
}
873+
}
874+
856875
class UaSettings {
857876
WebSocketSettings webSocketSettings = WebSocketSettings();
858877
TcpSocketSettings tcpSocketSettings = TcpSocketSettings();
@@ -918,6 +937,18 @@ class UaSettings {
918937
/// Will default to [IceTransportPolicy.ALL] if not specified.
919938
IceTransportPolicy? iceTransportPolicy;
920939

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

0 commit comments

Comments
 (0)