Open akmitrich opened 1 week ago
Hi @akmitrich ,
Could you please share a minimal example so that I can review and check it?
The example is quite close to outbound.rs in examples folder...
pub async fn process_call(conn: freeswitch_esl::EslConnection) {
log::info!("INCOMING {:?}", conn);
log::trace!("[{:?}] Start Welcome", std::time::SystemTime::now());
conn.playback("ivr/ivr-welcome.wav").await.unwrap();
log::trace!(
"[{:?}] Complete Welcome. Start sleeping",
std::time::SystemTime::now()
);
tokio::time::sleep(tokio::time::Duration::from_secs(3)).await;
log::trace!("[{:?}] Complete sleeping", std::time::SystemTime::now());
conn.playback("ivr/ivr-you_entered.wav").await.unwrap();
conn.playback("digits/5.wav").await.unwrap();
log::trace!("[{:?}] PROCESS STOP", std::time::SystemTime::now());
}
#[tokio::main]
async fn main() {
env_logger::init();
let addr = "0.0.0.0:8085";
log::info!("Wait for calls at {:?}", addr);
let listener = freeswitch_esl::Esl::outbound(addr).await.unwrap();
loop {
let (socket, _) = listener.accept().await.unwrap();
tokio::spawn(async move { process_call(socket).await });
}
}
The FreeSWITCH does play "ivr/ivr-welcome.wav" but my server never reaches "Complete Welcome. Start sleeping" line of code.
@KaranGauswami seems like I found the root of my problem.
my FreeSWITCH responds with -Err
on command event json BACKGROUND_JOB CHANNEL_EXECUTE_COMPLETE
which is issued by subscribe
call. After that error channel in send_recv
awaits forever because if let
prevents from sending any command reply on line 155
Problem solved: in dialplan there must be full
argument in socket app args.
I am to create an ESL server to control FreeSWITCH calls. I try to follow an outbound socket example. So my FreeSWITCH sent an event stream to my ESL server and ESL server issued a playback command on FreeSWITCH but after this the server got stuck. Logs revealed that the server never returns from playback call. I started reading the source and found there the method send_recv of the
EslConnection
. The method awaits on a oneshot channel which is ok but I haven't found anywhere in the source code where any reply is sent via this channel. Please tell me, am I doing something wrong? or is this a bug? or is this a work in progress?