ari
ari copied to clipboard
Couldn't able to place calls properly using Create() and Dial ()
On answering the channel when a call enters the Stasis App I create a new channel for "SIP/8312453028" with app "test" and then place the dial function to initiate the call with newly created channel id. I get the call on SIP/8312453028, then I answered but there are no media between both clients. Workflow is given below:
orig := &ari.ChannelCreateRequest{Endpoint: "SIP/8312453028", App: "test"}
channel, err1 := h.Create(*orig)
if err1 != nil {
log.Error("Failed to Create Channel", "error", err1)
return
}
err2 := channel.Dial(channel.ID(), 30)
if err2 != nil {
log.Error("Failed to Dial Call", "error", err2)
return
}
return
The console error I received:
EROR[07-15|16:04:20] failed to answer call error="Non-2XX response: 412 Precondition Failed"
It would be helpful if you guide more about it. Thanks.
I have the same problem. Can anyone provide a complete basic call example? Eg, call from 1000 to 1001. Thanks.
Using Create-Dial is tricky, because many things are not done for you. I recommend using Originate
instead. If you need a two-stage (create, attach a bunch of listeners, then execute), use StageOriginate
.
Regardless, the log error in the above example doesn't correspond with the code. It reads "failed to answer call", but there is no corresponding code. One cannot answer a dialed channel.