Asterisk ARI Integration
Fone AI supports direct integration with Asterisk via ARI (Asterisk REST Interface), using the official streaming middleware to route audio from your Asterisk server to the AI system over WebSocket.
Requirements​
- Asterisk version 16.6 or above
- ARI enabled and configured
- Active internet connection
- Linux environment with sufficient compute resources
- Middleware app downloaded from the console
How It Works​
- The streaming middleware is a standalone executable that runs alongside your Asterisk server.
- It acts as a bridge between Asterisk (via ARI) and the Fone AI server to stream real-time audio.
- You'll configure:
- Asterisk ARI credentials
- HTTP binding port
- AI WebSocket endpoint
Once configured, the middleware connects to the ARI WebSocket and starts streaming audio from ongoing calls.
Step 1: Configure ari.conf
​
[general]
enabled = yes
[<ARI_USERNAME>]
type = user
read_only = no
password = <ARI_PASSWORD>
password_format = plain
💡 Replace
<ARI_USERNAME>
and<ARI_PASSWORD>
with your desired ARI credentials.
Step 2: Configure http.conf
​
[general]
enabled = yes
bindaddr = 0.0.0.0
bindport = <HTTP_BIND_PORT> ; <-- Replace with an available HTTP port (e.g., 8088)
Step 3: Configure the Middleware (config.json
)​
After downloading and unzipping the middleware zip, you’ll find:
- The executable binary
- A sample
config.json
file
Edit the config.json
as below:
{
"ari": {
"url": "http://127.0.0.1:<HTTP_BIND_PORT>",
"username": "<ARI_USERNAME>",
"password": "<ARI_PASSWORD>",
"appName": "<APP_NAME>"
},
"rtpServer": {
"port": "7777",
"format": "slin16",
"host": "127.0.0.1",
"swap16": true,
"socketType": "udp4"
},
"asterisk": {
"packetTimestampIncrement": 160,
"rtpPayloadType": 11
},
"ai": {
"serverUrl": "ws://asterisk-streaming.fone.ai"
},
"log": {
"logLevel": "info"
}
}
🔧 Replace placeholders like
<HTTP_BIND_PORT>
,<ARI_USERNAME>
,<ARI_PASSWORD>
, and<APP_NAME>
with your actual values.
Step 4: Configure the Dialplan (extensions.conf
)​
exten => _X.,1,NoOp()
same => n, Answer()
same => n, Set(campaign=${EXTEN})
same => n, Set(apiKey=<API_KEY>) ; <-- Replace with your API key from the console
;same => n, Set(custom={"key1": "value1"}) ; Optional: pass custom JSON payload
same => n, Stasis(<APP_NAME>) ; <-- Replace with the appName in config.json
same => n, Hangup()
Step 5: Run the Middleware​
Once everything is configured and Asterisk is reloaded:
./asterisk-ari-client ./config.json
If successful, the app will log:
Successfully connected to the ARI websocket
Result​
You can now route calls directly to Fone AI from any Asterisk extension by dialing into a context that invokes the Stasis(<APP_NAME>)
application. The audio will be streamed in real time to the Fone AI platform for processing.
✅ You can now use this setup to trigger AI-based bot conversations without SIP.