Is it possible to have a Stasis call controlled through ARI and use the Dial to connect the channel's audio to a websocket server?

We have an older application using AMI. It can send the audio to our websocket server.
Kudos to those who worked on this new feature!!!

Action: AGI
ActionID: C59
Channel: PJSIP/100-00000003
CommandID: C59
Command: EXEC Dial WebSocket/1/c(slin16)v(urlparamname1=urlparamvalue1,urlparamname2=urlparamvalue2),30

  1. Is it possible for the Dial to be used for this as well?
  2. If so, would the channel value be?

WebSocket/1/c(slin16)v(urlparamname1=urlparamvalue1,urlparamname2=urlparamvalue2)

I haven’t attempted a Dial via ARI before, but ran some tests by hand.

I tried simulating manually via curl requests and it wasn’t working for me. Then, I decided to verify I’m passing everything correctly via the curl by dialing a phone and also ran into problems.

Guessing I’m misunderstanding how to pass the parameters via ARI?

AMI, the following does call my phone 1005 on the PJSIP endpoint 1005

Action: AGI
ActionID: C60
Channel: PJSIP/100-00000003
CommandID: C60
Command: EXEC Dial PJSIP/1005@1005,30

However, when I try this via curl/ARI it doesn’t work (yes, I have the call in Stasis)

curl -v -u user:password -X POST “http://myip:myport/ari/channels/1756934869.22/dial?channel=PJSIP/1005@1005&timeout=30”

For comparison, I can start playing music on hold using a similar request
curl -v -u user:password -X POST “http://myip:myport/ari/channels/1756934869.22/moh?mohClass=1”
3) Any suggestions on what I am doing incorrectly via the ARI request? Is it not possible to use ARI to dial a number?

From the API, it looks like it wants to dial an existing channel so I tried that and it also doesn’t work.
curl -v -u user:password -X POST “http://myip:myport/ari/channels/1756934869.22/dial?channel=1234567890.46&timeout=30”

Any thoughts/suggestions?

Dan

I’m checking the dial syntax but what kind of responses are you getting from the curl calls?

This doesn’t do what you think it does. It is not the equivalent of the Dial application. It is for dialing channels created using the create[1] route[2].

You can use that to place an outgoing call, or use a normal originate[3].

ARI gives you the fundamentals to do things, not the higher level concepts (like have a channel dial another channel and connect them together all in one call).

[1] Channels - Asterisk Documentation

[2] Asterisk 14 ARI: Create, Bridge, Dial. ⋆ Asterisk

[3] Channels - Asterisk Documentation

And it’s “caller=” not “channel=”

From a websocket perspective, this would be the flow…

  • Receive StasisStart for an incoming PJSIP channel.
  • Call channels/create for the WebSocket channel.
  • Call channels/<websocket_channel_id>/dial?caller=<pjsip_channel_id>
  • Watch for the Dial status ANSWER and bridge the two channels.

The [asterisk-websocket-examples](GitHub - asterisk/asterisk-websocket-examples: Examples for using Asterisk ARI and Media WebSockets) repo has examples.

Thank you

Thank you George. You did an awesome job on this feature.
This is exactly what I’m looking for.

(Clearly I need another cup of coffee to wakeup …caller instead of channel.)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.