api: add JSON-RPC API to get ICE servers

Currently with a hardcoded TURN server
so it can be used in the UIs.
This commit is contained in:
link2xt
2025-09-16 19:00:58 +00:00
parent 3d2805bc78
commit c5ada9b203
4 changed files with 68 additions and 0 deletions

View File

@@ -2,6 +2,7 @@
from __future__ import annotations
import json
from dataclasses import dataclass
from typing import TYPE_CHECKING, Optional, Union
from warnings import warn
@@ -470,3 +471,8 @@ class Account:
def initiate_autocrypt_key_transfer(self) -> None:
"""Send Autocrypt Setup Message."""
return self._rpc.initiate_autocrypt_key_transfer(self.id)
def ice_servers(self) -> list:
"""Return ICE servers for WebRTC configuration."""
ice_servers_json = self._rpc.ice_servers(self.id)
return json.loads(ice_servers_json)

View File

@@ -66,3 +66,10 @@ a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid\r
incoming_call_event = bob.wait_for_event(EventType.INCOMING_CALL)
assert incoming_call_event.place_call_info == place_call_info
assert incoming_call_event.has_video
def test_ice_servers(acfactory) -> None:
alice = acfactory.get_online_account()
ice_servers = alice.ice_servers()
assert len(ice_servers) == 1