Asterisk ARI Answer Stasis app

Hello!

I try to develop an interface for user where it’s possible to control actions like call, record, answer a call… with buttons who send Ajax requests.
The using of webSocket is ok and I’m just connected to my home network for the moment.

My problem is with the action of answering a call :

When a user call another, I succeed to detect it in my interface, but when I try to send the request “answer” to the server, I have the error message “channel not in stasis app”.

However, to my knowledge, I can join my channel in the stasis app only if I answer… but I probably didn’t understand a thing…

If I call from the interface, both channels join the stasis app and from this moment I can record, put on hold, hang up…

my dial plan looks like this:

exten => 102,1,Dial(SIP/102,15)
exten => 102,2,Stasis(hello-world)
exten => 102,3,Voicemail(${EXTEN}@context1)
exten => 102,4,Hangup()

thank you very much for your help

What exactly is the flow that you are attempting to do that isn’t working? And you can place a channel into Stasis before answer[1]. Whether that is what you need or not depends on what you are exactly doing though.

[1] https://blogs.asterisk.org/2016/08/24/asterisk-14-ari-create-bridge-dial/

Thanks for your answer jcolp,

when a user receives a call, there is a pop up with “do you want to answer” and 2 buttons : “yes” and “no”,
I would like that when I click on the button “yes” the user can enter into communication with the caller.
That’s why I try to send an Ajax request with this url: http://XXX.XXX.XXX.XXX:8088/ari/channels/"+idChannel+"/answer

Is it the good way of thinking?

Asterisk can’t control things like that, it can’t force it to answer.

Do you mean that I have inevitably to manually answer a call with the IP phone?

Unless the IP phone provides its own interface for control or has some mechanism (which would be outside of Asterisk most likely), then yes, you’d have to manually answer it.

Ok, thanks a lot, no way with Asterisk AMI or AGI?

So, in the same way of thinking, when I create a channel for the caller, that call automatically the caller and he have to manually answer this call with the IP phone too?

As I said, Asterisk ultimately can’t force or tell IP phones/devices to do that. Doesn’t matter if it’s AMI or AGI. Some devices do allow you to add a header which will cause them to auto answer the incoming call immediately for paging/announcements, but you can’t do that while the phone is ringing. The call has to be that way from the start.

Ok, thanks to you I can stop my researche for this impossible action here… maybe see you later for antoher question.

Have a nice day

I’m not sure of the current status of AgentLogin(), but you used to be able to have multiple calls offered to a phone that was dialled into Asterisk, and, if you interposed a local channel, you could even programmatically inject the DTMF tone to cause Asterisk to answer the Agent channel used.

To be clear, this does not cause the phone to answer the call, Typically the phone is in an incoming call to Asterisk and is off hook all the time that the human agent is logged in.

Although some Agent channel capabilities have been removed, it looks like this one was still present, at least up to Asterisk, as there is a wiki entry for AgentLogin.