5 unstable releases
0.3.1 | Mar 28, 2023 |
---|---|
0.3.0 | Oct 31, 2022 |
0.2.0 | Oct 31, 2022 |
0.1.1 | Oct 15, 2022 |
0.1.0 | Oct 15, 2022 |
#5 in #authenticate
21 downloads per month
24KB
624 lines
Freeswitch ESL Rust implementation (WIP)
caution: not thread safe
extern crate freeswitch_esl_rs;
use std::net::{TcpStream};
use std::env;
use freeswitch_esl_rs::{Connection,Client,Event};
fn main() -> std::io::Result<()> {
let args: Vec<String> = env::args().collect();
let host = &args[1];
let event = &args[2];
// open stream
let mut stream = TcpStream::connect(host)?;
// open connection
let conn = Connection::new(&mut stream);
// create freeswitch esl client
let mut client = Client::new(conn);
// authenticate to freeswitch
client.auth("cloudpbx").expect("fails to authenticate");
// enable events
client.event(event).expect("fails enabling events");
loop {
// poll event
let event: Event = client.pull_event().unwrap();
println!("{:?}", event);
}
Ok(())
}
Dependencies
~27KB