getTurnServer method

  1. @override
Future<TurnServerCredentials> getTurnServer()
override

This API provides credentials for the client to use when initiating calls.

Implementation

@override
Future<TurnServerCredentials> getTurnServer() async {
  final json = await request(RequestType.GET, '/client/v3/voip/turnServer');

  // fix invalid responses from synapse
  // https://github.com/matrix-org/synapse/pull/10922
  final ttl = json['ttl'];
  if (ttl is double) {
    json['ttl'] = ttl.toInt();
  }

  return TurnServerCredentials.fromJson(json);
}