From ad7b3f184b340f5b23bc2612192e1550fcc43169 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20K=C3=B6sters?= <timo@koesters.xyz>
Date: Mon, 11 Jan 2021 17:26:47 +0100
Subject: [PATCH] improvement: send 200 response for turn server info

We didn't implement it, but this will stop clients from retrying the
endpoint every minute
---
 src/client_server/voip.rs | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/client_server/voip.rs b/src/client_server/voip.rs
index a8db62af..9216f1a6 100644
--- a/src/client_server/voip.rs
+++ b/src/client_server/voip.rs
@@ -1,13 +1,17 @@
-use crate::{ConduitResult, Error};
-use ruma::api::client::{error::ErrorKind, r0::message::send_message_event};
+use crate::ConduitResult;
+use ruma::api::client::r0::voip::get_turn_server_info;
+use std::time::Duration;
 
 #[cfg(feature = "conduit_bin")]
 use rocket::get;
 
 #[cfg_attr(feature = "conduit_bin", get("/_matrix/client/r0/voip/turnServer"))]
-pub async fn turn_server_route() -> ConduitResult<send_message_event::Response> {
-    Err(Error::BadRequest(
-        ErrorKind::NotFound,
-        "There is no turn server yet.",
-    ))
+pub async fn turn_server_route() -> ConduitResult<get_turn_server_info::Response> {
+    Ok(get_turn_server_info::Response {
+        username: "".to_owned(),
+        password: "".to_owned(),
+        uris: Vec::new(),
+        ttl: Duration::from_secs(60 * 60 * 24),
+    }
+    .into())
 }