Add Stasis application in dialplan (to use Asterisk ARI with FreePBX)

Using the distro and Asterisk 13, you just need to install the ws_node package “npm install -g wscat”. Steps 1 and 2 are done entirely within the GUI in advanced settings and Asterisk REST Interface users. Install the FreePBX “Asterisk REST Interface Users” module if necessary. In advanced settings, enable “pretty print json” to see similar output as the tutorial

Step 3 - edit /etc/asterisk/extensions_custom.conf:

[from-internal-custom]
; make sure 1000 doesn't conflict with an extension already on the system
exten => 1000,1,NoOp(entering ${CONTEXT} as defined in extensions_custom.conf)
 same => n,Answer()
 same => n,Stasis(hello-world)
 same => n,Hangup()

After this, follow the tutorial as shown. I got it working by opening up two SSH sessions to the PBX, one for the ws node socket output, and another one to issue the curl commands from the linux CLI. Initially it was not clear to me that the curl command was intended to be used at the Linux command line not the socket. Also be sure to substitute the actual channel id in place of that shown in the tutorial:

curl -v -u asterisk:asterisk -X POST "http://localhost:8088/ari/channels/<<channel_id>>/play?media=sound:hello-world"
3 Likes