getTurnServer method

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/sdn-org/synapse/pull/10922
  final ttl = json['ttl'];
  if (ttl is double) {
    json['ttl'] = ttl.toInt();
  }

  return TurnServerCredentials.fromJson(json);
}