Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Haven't found where command replies #13

Closed
akmitrich opened this issue Nov 27, 2024 · 5 comments
Closed

Haven't found where command replies #13

akmitrich opened this issue Nov 27, 2024 · 5 comments

Comments

@akmitrich
Copy link

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?

@KaranGauswami
Copy link
Owner

Hi @akmitrich ,

Could you please share a minimal example so that I can review and check it?

@akmitrich
Copy link
Author

akmitrich commented Dec 2, 2024

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.

@akmitrich
Copy link
Author

@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

@akmitrich
Copy link
Author

Problem solved: in dialplan there must be full argument in socket app args.

@KaranGauswami
Copy link
Owner

Fixed the documentation in #14 to include the additional arguments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants