Skip to content
Phone Guides

Asterisk AI integration architecture

Choose the call and audio path before selecting an AI service. A recorded-call workflow, a provider-direct SIP call and an Asterisk media bridge place call control, audio and customer data in different systems.

Source-reviewed, 20 October 2026. Prepared from the cited Asterisk, Sangoma and provider documentation. Phone Guides has not connected an Asterisk or FreePBX system to a live AI service. This guide maps the documented boundaries; it does not certify compatibility between Asterisk, a carrier and an AI provider.

For the dated provider model/API and SDK versions, audio limits, lifecycle, pricing and data terms used across these examples, see the Asterisk AI provider contract checklist.

Compare the three paths

Path Audio route Who controls the call? Fits when Main boundary
Post-call analysis A recording or voicemail file is sent to a transcription, summary or search service after it exists. Asterisk or FreePBX handles the original call. The analysis service processes a separate audio job. Search, transcription, summaries, quality review or follow-up after a call. A file-analysis feature does not answer callers or control a live call. Check recording policy, transfer destination, retention and transcript access.
Provider-direct SIP The carrier or SIP trunk sends the call to the AI provider's SIP service. Media then flows between the provider and the caller's phone path. The provider handles the media session; your application may still accept or reject calls, set session instructions, call backend tools, transfer or hang up through the provider API. The provider documents SIP support and the existing phone service can route the call there. Asterisk may not see the media or own the active call after routing. Provider support for generic SIP does not establish an Asterisk or FreePBX integration.
Asterisk media bridge Asterisk puts an external media channel into a call bridge. An application receives and sends media between Asterisk and the AI service. Asterisk and the ARI application coordinate channel and bridge lifecycle; the application also manages the provider session. The PBX must retain routing control, or the application needs to combine PBX state with generated speech. The application must translate audio formats and provider events, control playback and interruption, and clean up both legs when either side ends.

The paths can be combined, but each added leg creates another owner for call state, audio and recovery. Draw the carrier, PBX, application, AI service and human destination before building a route.

Post-call analysis is separate from a live agent

Sangoma's Scribe guide describes transcription and related results for existing voicemail and call recordings. It also describes GraphQL access to Scribe data for other applications. Those are useful starting points for post-call reporting or CRM work; the cited guide does not describe a live agent exchanging audio with a caller. See FreePBX AI integrations: Scribe and call recordings.

For a custom batch workflow, document where the recording is selected, which job sends it, what format and size the service accepts, and where transcripts or summaries are stored. Decide whether a failed job is retried, who can read its result and how source audio and derived data are removed. Keep this processing path out of the live dialplan unless there is a separate call-control requirement.

Provider-direct SIP

OpenAI's current GPT-Live telephony guide describes two distinct choices: a direct SIP connection and an application audio bridge. On the direct SIP path, a SIP trunk routes calls to the project's SIP endpoint. TLS protects SIP signalling, and SRTP is required for call audio. A backend handles the provider's incoming-call webhook and makes the accept or reject decision; an attached sideband connection can observe session events and send supported commands. The guide documents transfer and hangup operations through its API.

ElevenLabs also documents a provider-managed SIP trunk for ElevenAgents. It accepts or places calls through a generic SIP-compatible telephony system and uses G.711 PCMU/PCMA at 8 kHz or G.722 at 16 kHz. The feature is Enterprise-only or available in an Enterprise trial; its setup page does not name Asterisk or FreePBX. Treat it as a possible provider-direct SIP route whose exact PBX routing, TLS/SRTP negotiation, call transfer and carrier behavior still need confirmation, not as proof of a supported Asterisk connector. See the dated provider contract checklist for its current plan, lifecycle, pricing and retention notes.

This route can keep audio out of Asterisk after the call is sent to the provider. Decide whether the PBX still needs to apply caller authentication, business-hour routing, queue or emergency behavior, recording, transfer policy or local fallback. If it must, confirm the provider and carrier routing design preserves those functions. OpenAI's current partner list names Twilio, Telnyx, Bandwidth, LiveKit and Daily/Pipecat; it does not list Asterisk or FreePBX. Treat the Asterisk-to-provider path as Unknown until the exact trunk arrangement is documented or tested.

Asterisk media bridge

Asterisk offers several media interfaces, and they do not share one wire protocol:

Interface Documented boundary Work left for the application
ARI ExternalMedia over RTP An ARI application creates an external media channel and adds it to a bridge. The documented initial transport is RTP. Parse and time RTP, convert the media to the service's required format, correlate audio with the call, and manage bridge/channel events.
AudioSocket Asterisk's AudioSocket() application transmits and receives PCM audio over TCP; its standard dialplan use sends signed 16-bit, 8 kHz mono audio and DTMF frames. Implement AudioSocket framing, connection security appropriate to the network, codec conversion and provider-specific message/session control.
chan_websocket The Asterisk guide says this channel driver is available from 22.6.0. It carries raw audio in binary WebSocket frames and control messages in text frames. JSON control format begins in Asterisk 22.8.0. Implement the Asterisk control/event protocol separately from the AI provider protocol. Handle flow-control signals and codec-specific framing; Opus, Speex and G.729 are passthrough cases in the current guide.

The ARI ExternalMedia guide demonstrates a proxy that can forward bridge media to a speech-recognition provider. It also notes that the application must re-encapsulate audio for the chosen service. The AudioSocket application reference and AudioSocket protocol guide describe a different TCP framing protocol. The WebSocket channel guide describes its own binary media and text control frames, codec handling and flow control.

An AI provider's WebSocket endpoint does not speak Asterisk's chan_websocket protocol just because both use WebSocket. The adapter must translate connection setup, event names, audio formats, turn boundaries, interruption, DTMF and hangup. For GPT-Live, OpenAI documents WebSocket as an application bridge transport and raw G.711 μ-law or A-law at 8 kHz in its server-audio examples. That provider format and Asterisk channel format must still match in the chosen design; the integration contract is not a ready-made Asterisk connector.

Choose by required call ownership

Use these questions to narrow the path:

  1. Does the AI need an existing recording, or must it hear and answer a caller while the call is active?
  2. Must FreePBX or Asterisk remain responsible for queues, local extensions, transfers or failover after the AI answers?
  3. Can the carrier route the call directly to the provider, and is that exact provider, account and region documented for your call path?
  4. If the application bridges media, which component decides that the caller has finished speaking, cancels old speech after an interruption, and prevents duplicate tool actions?
  5. What happens when the AI endpoint, application, carrier or PBX loses connectivity? Name a reachable human or a clear caller message and define who initiates the fallback.
  6. Which recordings, transcripts, prompts and tool results leave the PBX, where are they processed, and which account setting controls retention and model improvement?

Before a live trial, record the exact Asterisk branch and patch, enabled channel modules, FreePBX release if used, carrier/trunk path, AI model/API and adapter revision. Test answer, two-way audio, interruption, DTMF, transfer, hangup, silence, provider failure and fallback with non-sensitive calls. Mark results as tested only for that recorded environment.

Keep credentials in the application backend, restrict ARI and media listeners to the required network peers, and avoid putting caller audio or transcripts in routine logs. Review provider privacy, retention, regional processing and billing terms for the account that will receive the call. Do not infer a data region from a phone number or a SIP trunk location.

Sources and limits

These sources document interfaces and provider offerings. They do not establish an Asterisk or FreePBX live-agent recipe, a carrier's exact routing support, a successful end-to-end call, or the processing and retention configuration of a specific account.