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); + } }