From 5c3db7a6029ef29f3fb7d5526caa135991727a79 Mon Sep 17 00:00:00 2001 From: Lukas Lihotzki Date: Mon, 27 Sep 2021 13:25:12 +0200 Subject: [PATCH] chore: workaround for invalid getTurnServer responses from synapse --- lib/src/matrix_api.dart | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/src/matrix_api.dart b/lib/src/matrix_api.dart index 903d2bee..9494289f 100644 --- a/lib/src/matrix_api.dart +++ b/lib/src/matrix_api.dart @@ -186,4 +186,17 @@ class MatrixApi extends Api { ); return; } + + /// This API provides credentials for the client to use when initiating + /// calls. + @override + Future getTurnServer() async { + final json = await request(RequestType.GET, '/client/r0/voip/turnServer'); + + // fix invalid responses from synapse + // https://github.com/matrix-org/synapse/pull/10922 + json['ttl'] = json['ttl'].toInt(); + + return TurnServerCredentials.fromJson(json); + } }