2020-07-13 11:49:14 +02:00
|
|
|
//! # Calls controller
|
|
|
|
//!
|
|
|
|
//! @author Pierre Hubert
|
|
|
|
|
|
|
|
use std::collections::HashMap;
|
|
|
|
|
2021-02-08 18:24:28 +01:00
|
|
|
use crate::api_data::user_calls_config::UserCallsConfig;
|
2020-07-13 11:49:14 +02:00
|
|
|
use crate::controllers::routes::RequestResult;
|
2021-02-05 09:11:30 +01:00
|
|
|
use crate::data::base_request_handler::BaseRequestHandler;
|
2021-02-08 18:24:28 +01:00
|
|
|
use crate::data::config::conf;
|
|
|
|
use crate::data::error::ExecError;
|
2020-07-13 11:49:14 +02:00
|
|
|
use crate::data::http_request_handler::HttpRequestHandler;
|
2021-02-08 18:24:28 +01:00
|
|
|
use crate::data::user_ws_request_handler::UserWsRequestHandler;
|
2020-07-13 11:49:14 +02:00
|
|
|
|
|
|
|
/// Get legacy call configuration
|
|
|
|
pub fn get_legacy_config(r: &mut HttpRequestHandler) -> RequestResult {
|
|
|
|
let mut map = HashMap::new();
|
|
|
|
map.insert("enabled", false);
|
|
|
|
r.set_response(map)
|
2021-02-08 18:24:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Get calls configuration
|
|
|
|
pub fn get_config(r: &mut UserWsRequestHandler) -> RequestResult {
|
|
|
|
// TODO : check whether the user is the member of a call or not
|
|
|
|
|
|
|
|
if let Some(conf) = conf().rtc_relay.as_ref()
|
|
|
|
{
|
|
|
|
return r.set_response(UserCallsConfig::new(conf));
|
|
|
|
}
|
|
|
|
|
|
|
|
r.internal_error(ExecError::boxed_new("Missing calls configuration!"))
|
2020-07-13 11:49:14 +02:00
|
|
|
}
|