1
0
Fork 0
mirror of https://gitlab.com/famedly/conduit.git synced 2025-06-27 16:35:59 +00:00
conduit/src/client_server/voip.rs

22 lines
787 B
Rust
Raw Normal View History

use crate::{database::DatabaseGuard, ConduitResult};
use ruma::api::client::r0::voip::get_turn_server_info;
use std::time::Duration;
2020-07-30 18:14:47 +02:00
#[cfg(feature = "conduit_bin")]
use rocket::get;
2021-08-31 19:14:37 +02:00
/// # `GET /_matrix/client/r0/voip/turnServer`
///
/// TODO: Returns information about the recommended turn server.
2020-07-30 18:14:47 +02:00
#[cfg_attr(feature = "conduit_bin", get("/_matrix/client/r0/voip/turnServer"))]
#[tracing::instrument(skip(db))]
pub async fn turn_server_route(db: DatabaseGuard) -> ConduitResult<get_turn_server_info::Response> {
Ok(get_turn_server_info::Response {
username: db.globals.turn_username().clone(),
password: db.globals.turn_password().clone(),
uris: db.globals.turn_uris().to_vec(),
ttl: Duration::from_secs(db.globals.turn_ttl()),
}
.into())
2020-07-30 18:14:47 +02:00
}