Files
ai-operator/docs/ari-call-manager.md
T

2.1 KiB

ARI Call Manager

Purpose

The ARI Call Manager connects the Go service to Asterisk ARI events for application ai-operator. It is responsible for reading ARI WebSocket events, creating in-memory call sessions, and performing limited test-call control.

Modes

Observe-only

./bin/ai-operator run --env /etc/ai-operator/ai-operator.env --ari-events --observe-only

Observe-only registers the ARI app and reads events. It does not answer, hang up, create bridges, create media channels, or call OpenAI.

Call-control

./bin/ai-operator run --env /etc/ai-operator/ai-operator.env --ari-events --call-control --test-call-hangup-after 5s

Call-control is restricted to Stasis args containing test. It may answer a test channel and hang it up after the configured delay. Production routes are disabled by default.

Implemented in TZ-03

  • ARI events WebSocket listener.
  • Basic Auth and query api_key URL support.
  • Safe sanitized WebSocket URL builder.
  • Reconnect with bounded backoff.
  • ApplicationReplaced handling.
  • Lock file protection for one active listener.
  • StasisStart, StasisEnd, ChannelHangupRequest, ChannelDestroyed, and generic event parsing.
  • In-memory thread-safe session store.
  • ARI HTTP actions for answer, hangup, and get channel.

Not Implemented Yet

  • Media gateway.
  • Bridges.
  • chan_websocket media channel handling.
  • OpenAI provider.
  • Knowledge base / RAG.
  • Production route switching.

Safety Notes

  • Only one ARI listener should run at a time.
  • The default lock file is /tmp/ai-operator-ari-events.lock.
  • Production route handling is disabled.
  • Test route is 7199@from-softphones and enters Stasis(ai-operator,test).
  • Kazakhtelecom production routes are not switched.

TZ-04 media integration

Call-control mode can optionally enable media with --media. Media is restricted to the test route and uses the Asterisk WebSocket Media Gateway. Production routes remain disabled.

TZ-05 Voice Provider Integration

Call-control test mode can start a VoiceProvider session. This is restricted to the test route and production remains disabled.