caution: not thread safe
~~~rust extern crate freeswitcheslrs; use std::net::{TcpStream}; use std::env; use freeswitcheslrs::{Connection,Client,Event};
fn main() -> std::io::Result<()> {
let args: Vec
// 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(())
} ~~~