Skip to content

Asterisk External Application Protocol (AEAP) Explained

AEAP explained for Asterisk: what it is, which versions include it, how to configure aeap.conf, and how to run a speech-to-text engine from the dialplan.

By · Updated · Published

Photo of laptop, coffee, notebook
Photo by freephotocc · Pixabay Content License · via Pixabay

What is AEAP in Asterisk, and what does it do?

AEAP, the Asterisk External Application Protocol, lets Asterisk exchange data with an outside program. The protocol documentation says it is used to communicate configuration, data, and other information using a simple request/response messaging system.

Keep the protocol and the module apart. AEAP is the set of message rules. The res_aeap module is the Asterisk module that carries those rules, and the speech feature is built on top of it. Much of this reference describes the rules first and the speech feature second.

An AEAP object connects to an external application, sends and receives data, and dispatches received data to registered handlers, as the res_aeap header describes. Put simply, Asterisk opens a connection, sends requests, and passes whatever arrives to the handlers registered for it.

Two choices shape the messages. The transport is WebSocket. The message format is JSON, which the protocol documentation names as the only supported message format at present. Audio is the exception. The reference notes say audio goes as binary frames, not as JSON.

Which Asterisk versions include AEAP?

The res_aeap module page lists the aeap.conf client options as available since Asterisk 18.12.0 and 19.4.0. The reference app README states the same requirement as Asterisk 18.12.0+ and 19.4.0+. Check your version against these numbers before you configure a client.

Two version numbers in this post mean different things. Asterisk 18.12.0 and 19.4.0 are Asterisk releases. The speech setup request's version value, 0.1.0, is the speech protocol version, and it is not an Asterisk version. Keep the two apart when you read the message examples below.

What does our AEAP reference cover?

We compiled this one-page reference on November 14, 2026, from primary sources owned by the Asterisk project. Nothing here was tested. Every fact comes from the module page, the aeap.conf sample, the res_aeap and res_speech_aeap source files, or the reference app README, and each link points to its source.

The docs site has only a short module page, so these facts are spread across several files. The table shows where each area sits.

AreaWhat the reference covers
ProtocolRequest/response messages, JSON format and error responses
aeap.confThe client section and its four options, plus @ parameters
Speech engineHow protocol=speech_to_text clients work with the Speech applications
Reference appRunning the Google speech-to-text example

Where the text cites a source, the link goes to that page or file. The sections that follow start with the aeap.conf client, then cover the messages, the dialplan and the example server.

How do I configure an AEAP client in aeap.conf, and what do type, url, protocol and codecs mean?

Photo of computer, business, typing
Photo by Free-Photos · Pixabay Content License · via Pixabay

In aeap.conf:

INI config
[my-speech-to-text]
type=client
codecs=!all,ulaw
url=ws://127.0.0.1:9099
protocol=speech_to_text

The section name is the client id. The options below are available since Asterisk 18.12.0 and 19.4.0. The url value is the sample from the reference app, which points to the same machine.

OptionMeaningValue in the example
typeMust be clientclient
urlThe server to connect to; must be a websocket URL that starts with ws or wssws://127.0.0.1:9099
protocolThe implementation-specific sub-protocolspeech_to_text
codecsComma-separated allowed and disallowed codec names!all,ulaw
@name=valueCustom value sent as params in the first setup request@language=en-US in the sample

Because type must be client, each section describes a connection that Asterisk makes out to a server. The url names that server, and it must be a websocket URL. res_aeap rejects a client whose url does not begin with ws or wss, and it logs that the URL must be ws or wss.

The protocol option names an implementation-specific sub-protocol. It decides what kind of client the section becomes. Only a client with protocol set to speech_to_text is registered as a speech engine, and the engine takes the name of the section.

The codecs option is a comma-separated list of allowed and disallowed codec names. The sample value, !all,ulaw,alaw,opus, shows that one list can hold both kinds of entry. If you leave codecs out, Asterisk uses the codecs configured on the endpoint, so the endpoint decides.

Lines that begin with @ are passed as params in the first setup request. The sample line @language=en-US sends a language value to the server with the setup. The name is the text after the @ sign, and the value is the text after the equals sign.

The client section lives in aeap.conf, and the speech applications run from the dialplan. The engine name joins the two, so the next sections use the same name in both places.

What does Asterisk send to the external application, and what must it send back?

Asterisk sends three kinds of request:

  • setup, which carries the version, the codecs as a list of names, and the params. For speech, the version is 0.1.0. That is the speech protocol version, not an Asterisk version.
  • get, which asks for named params, such as results.
  • set, which sets params, such as dtmf or results_type.

Every text message is JSON, so each field has a name. This reference lists only the field names the sources give: version, codecs, params, results, text, score, grammar, best, error_msg, and the request or response name and id. Nothing else is added.

Setup is the first message in the exchange. It is where the aeap.conf values reach the server, so the codec list and the @ params arrive together. The version field represents the current AEAP message version, and the docs examples use 0.1.0.

Get and set run after setup. Get names the params to read. Set pairs each param name with a value. The speech engine handles setup, get and set messages.

The external application must answer in these ways:

  • The setup response must include a codec whose name matches one of the names in the request's codec list. The server must echo the codec name back.
  • Responses carry the request or response name and the id. An error response adds one more field, error_msg, which is a text description of the error.
  • The server may send set with params.results. Each result has text, score, grammar and best.
  • Any other set from the server gets the error 'can only set results'.

The codec rule needs care. The codec the server returns must be on the list Asterisk sent, so a codec name outside that list breaks the rule. The sources do not explain the score scale or what grammar means, and they do not define best. This reference does not guess at them.

How do I use an AEAP speech-to-text engine from the dialplan?

Flow chart of the reference dialplan: SpeechCreate with my-speech-to-text, SpeechStart, SpeechBackground playing hello-world, Verbose with SPEECH_TEXT(0), SpeechDestroy, then Hangup.
Speech call steps in the dialplan

Each aeap.conf client with protocol=speech_to_text becomes a speech engine named after its section. With the section above, the engine name is my-speech-to-text. The SpeechCreate documentation says the engine name is the argument, and that the default engine is used if no name is given.

The name must match in both places, because the engine takes its name from the section. In the call's context, the line that creates the engine looks like this:

INI config
exten => 550,1,NoOp()
same => n,SpeechCreate(my-speech-to-text)

SpeechCreate() comes first because it creates the speech object that the other speech applications use. SpeechStart() then tells the engine to start trying to get results from the audio fed to it. SpeechBackground() plays a sound file and waits for the caller to speak. The reference example plays hello-world, and the timeout starts only after the file stops.

Verbose() sends text to verbose output. The reference example passes it SPEECH_TEXT(0), which gets the recognized text of result 0. SpeechDestroy() then destroys the information the speech applications used, and Hangup() ends the call. The full sequence is in the reference README.

Is there a working example server, and what does it need?

The asterisk/aeap-speech-to-text README describes a Node.js program that acts as a mediator between Asterisk and the Google speech provider. Asterisk talks to the example server over AEAP, and the example server talks to Google. It needs Google Speech API credentials in the GOOGLE_APPLICATION_CREDENTIALS environment variable.

The install steps are short. Run npm install, then start index.js. The server listens on port 9099 by default, and --port=<port number> changes that port. This reference keeps the install steps brief, because the protocol is its subject.

The example's aeap.conf section is [my-speech-to-text], with type=client, codecs=!all,ulaw, url=ws://127.0.0.1:9099 and protocol=speech_to_text. The port in the url must match the port the server uses. In the sample, that port is 9099. A call can only use this engine while the server is running.

When a call reaches the dialplan above, the example plays hello-world, sends the caller's speech, prints the recognized text on the Asterisk CLI, then disconnects and hangs up.

Advanced examples

These two examples use only the options and applications described above. Each one adds to the basic setup, so you can compare it with the blocks earlier in the post.

Example 1: a client with params and a codec list.

INI config
[my-speech-to-text]
type=client
protocol=speech_to_text
url=ws://127.0.0.1:9099
codecs=!all,ulaw,alaw,opus
@language=en-US

The codecs line uses the list from the aeap.conf sample. The @language line is sent as a param in the first setup request, so the server receives the language value along with the setup.

Example 2: log the result count before reading the text.

INI config
exten => 550,1,NoOp()
same => n,SpeechCreate(my-speech-to-text)
same => n,SpeechStart()
same => n,SpeechBackground(hello-world)
same => n,Verbose(0,Results: ${SPEECH(results)})
same => n,Verbose(0,${SPEECH_TEXT(0)})
same => n,SpeechDestroy()
same => n,Hangup()

SPEECH(results) returns the number of results recognized. This example writes that count to verbose output first, then writes the recognized text of result 0. Reading the count first shows whether the engine returned any results before the text line runs.

More guides in Open-Source PBX and SIP Servers.

Frequently asked questions

Which modules does AEAP need loaded?
res_aeap requires res_http_websocket. res_speech_aeap requires res_speech and res_aeap, so load all of them before you configure a speech engine.
How do I check AEAP clients from the Asterisk CLI?
Run aeap show clients to list every AEAP client configuration. Run aeap show client followed by the client id to show one client.

Sources

  1. AEAP communicates configuration, data and other information using a simple request/respons (docs.asterisk.org)
  2. The res_aeap aeap.conf client options (type, url, protocol, codecs) are available since As (docs.asterisk.org)
  3. An AEAP object connects to an external application, sends and receives data, and dispatche (github.com)
  4. The asterisk/aeap-speech-to-text example is a Node.js program that uses AEAP for external (github.com)
  5. SpeechCreate(engine_name) creates the speech object used by the other speech applications, (docs.asterisk.org)