@@ -40,7 +40,7 @@ defmodule ExICE.ICEAgent do
4040 gathering_state_change ( )
4141 | connection_state_change ( )
4242 | { :data , binary ( ) }
43- | { :new_candidate , binary ( ) } }
43+ | { :new_candidate , String . t ( ) } }
4444
4545 @ typedoc """
4646 ICE Agent configuration options.
@@ -119,6 +119,25 @@ defmodule ExICE.ICEAgent do
119119 GenServer . call ( ice_agent , :get_local_credentials )
120120 end
121121
122+ @ doc """
123+ Gets all local candidates that have already been gathered.
124+ """
125+ @ spec get_local_candidates ( pid ( ) ) :: [ String . t ( ) ]
126+ def get_local_candidates ( ice_agent ) do
127+ GenServer . call ( ice_agent , :get_local_candidates )
128+ end
129+
130+ @ doc """
131+ Gets all remote candidates.
132+
133+ This includes candidates supplied by `add_remote_candidate/2` and candidates
134+ discovered during ICE connection establishment process (so called `prflx` candidates).
135+ """
136+ @ spec get_remote_candidates ( pid ( ) ) :: [ String . t ( ) ]
137+ def get_remote_candidates ( ice_agent ) do
138+ GenServer . call ( ice_agent , :get_remote_candidates )
139+ end
140+
122141 @ doc """
123142 Sets remote credentials.
124143
@@ -256,6 +275,18 @@ defmodule ExICE.ICEAgent do
256275 { :reply , { :ok , local_ufrag , local_pwd } , state }
257276 end
258277
278+ @ impl true
279+ def handle_call ( :get_local_candidates , _from , state ) do
280+ candidates = ICEAgent.Impl . get_local_candidates ( state . ice_agent )
281+ { :reply , candidates , state }
282+ end
283+
284+ @ impl true
285+ def handle_call ( :get_remote_candidates , _from , state ) do
286+ candidates = ICEAgent.Impl . get_remote_candidates ( state . ice_agent )
287+ { :reply , candidates , state }
288+ end
289+
259290 @ impl true
260291 def handle_call ( :get_stats , _from , state ) do
261292 stats = ICEAgent.Impl . get_stats ( state . ice_agent )
0 commit comments