diff --git a/Cargo.toml b/Cargo.toml index 3ff0abb..c3a3b8e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "freeswitch-esl" version = "0.1.0-alpha.1" authors = ["KaranGauswami "] -edition = "2018" +edition = "2021" license = "MIT OR Apache-2.0" readme = "README.md" description = "FreeSwitch ESL implementation for Rust" diff --git a/src/dp_tools.rs b/src/dp_tools.rs index 96b641c..a9ad072 100644 --- a/src/dp_tools.rs +++ b/src/dp_tools.rs @@ -12,6 +12,39 @@ impl EslConnection { pub async fn playback(&self, file_path: &str) -> Result { self.execute(PLAYBACK_APP, file_path).await } + + /// record_session during outbound mode + pub async fn record_session(&self, file_path: &str) -> Result { + self.execute("record_session", file_path).await + } + + /// send dtmf during outbound mode + pub async fn send_dtmf(&self, dtmf_str: &str) -> Result { + self.execute("send_dtmf", dtmf_str).await + } + + /// wait for silence during outbound mode + pub async fn wait_for_silence(&self, silence_str: &str) -> Result { + self.execute("wait_for_silence", silence_str).await + } + + /// sleep for specified milliseconds in outbound mode + pub async fn sleep(&self, millis: i128) -> Result { + self.execute("sleep", &millis.to_string()).await + } + + ///set a channel variable + pub async fn set_variable(&self, var: &str, value: &str) -> Result { + let args = format!("{}={}", var, value); + self.execute("set", &args).await + } + + ///add a freeswitch log + pub async fn fs_log(&self, loglevel: &str, msg: &str) -> Result { + let args = format!("{} {}", loglevel, msg); + self.execute("log", &args).await + } + #[allow(clippy::too_many_arguments)] /// Used for mod_play_and_get_digits