diff --git a/offeransweroptions.go b/offeransweroptions.go index 17435566a29..2bc6352ab29 100644 --- a/offeransweroptions.go +++ b/offeransweroptions.go @@ -9,6 +9,10 @@ type OfferAnswerOptions struct { // VoiceActivityDetection allows the application to provide information // about whether it wishes voice detection feature to be enabled or disabled. VoiceActivityDetection bool + // ICETricklingSupported indicates whether the ICE agent should use trickle ICE + // If set, the "a=ice-options:trickle" attribute is added to the generated SDP payload. + // (See https://datatracker.ietf.org/doc/html/rfc9725#section-4.3.3) + ICETricklingSupported bool } // AnswerOptions structure describes the options used to control the answer diff --git a/peerconnection.go b/peerconnection.go index a2d1a7afb77..e9db1f5775e 100644 --- a/peerconnection.go +++ b/peerconnection.go @@ -718,6 +718,10 @@ func (pc *PeerConnection) CreateOffer(options *OfferOptions) (SessionDescription return SessionDescription{}, err } + if options.ICETricklingSupported { + descr.WithICETrickleAdvertised() + } + offer = SessionDescription{ Type: SDPTypeOffer, SDP: string(sdpBytes), @@ -836,7 +840,7 @@ func (pc *PeerConnection) createICETransport() *ICETransport { // CreateAnswer starts the PeerConnection and generates the localDescription. // //nolint:cyclop -func (pc *PeerConnection) CreateAnswer(*AnswerOptions) (SessionDescription, error) { +func (pc *PeerConnection) CreateAnswer(options *AnswerOptions) (SessionDescription, error) { useIdentity := pc.idpLoginURL != nil remoteDesc := pc.RemoteDescription() switch { @@ -876,6 +880,10 @@ func (pc *PeerConnection) CreateAnswer(*AnswerOptions) (SessionDescription, erro return SessionDescription{}, err } + if options.ICETricklingSupported { + descr.WithICETrickleAdvertised() + } + desc := SessionDescription{ Type: SDPTypeAnswer, SDP: string(sdpBytes),