Skip to content

Extend configuration for ice gathering process #550

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion lib/src/sip_ua_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,11 @@ 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': <String, dynamic>{
'audio': true,
Expand Down Expand Up @@ -853,6 +857,19 @@ 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();
Expand Down Expand Up @@ -918,6 +935,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"
Expand Down