VoIP.info Guide

Asterisk AMI UserEvent custom telemetry

Design application-owned UserEvent names, headers and correlation keys while keeping AMI action responses, dialplan emission, event delivery and downstream outcomes independently observable.

Reviewed 2026-10-16Current Asterisk branch-23-generated AMI UserEvent action, UserEvent event and UserEvent dialplan-application references, matching branch-22 references, plus the official AMI event-filtering, command-syntax and Manager TCP/IP material reviewed October 16, 2026; installed branch, module, dialplan, manager permissions, session mask, filters, transport, parser, retry policy, schema and application outcome remain deployment specific; no PBX, module, dialplan, manager session, event stream, channel, bridge, endpoint, packet, media stream, business system or live call was inspected or testedAdvancedDocumentation based · not lab tested

Treat UserEvent as an application contract

UserEvent carries application-defined telemetry; Asterisk does not assign business meaning to the chosen event name or custom headers. Publish an owner, schema version, event-name convention, required fields, permitted values and retention boundary before consumers depend on it. Keep names stable and add fields compatibly rather than silently reusing one name for a different state.

The documented AMI event belongs to class USER. A receiving manager user therefore needs the relevant read permission, while the current session mask and event filters still control delivery. Event production and delivery remain separate results.

Distinguish the two producers

The AMI UserEvent action sends an arbitrary event to manager sessions. Its ActionID belongs to the action transaction and is returned with the response. Do not assume that value appears in the resulting event unless the application deliberately includes a separate custom correlation header.

The dialplan UserEvent(eventname,[body]) application raises an event for interested channel parties, including AMI users and relevant res_stasis applications. Its optional body is a comma-delimited list of key:value pairs; for AMI, each additional argument becomes a new event line.

Preserve documented and custom fields

The documented AMI event can include channel snapshot fields such as Channel, Uniqueid and Linkedid, plus the application-defined UserEvent name and arbitrary parameters. Those snapshot fields are context, not an immutable call record; channel state can change immediately after emission.

Use a dedicated application correlation key for a workflow or attempt, and record the producer, schema version and event time in the consumer. Do not overwrite standard AMI header names or rely on unspecified header order.

Design for delivery gaps and duplicate processing

A produced event must still pass manager read permissions, the session event mask, configured and dynamic filters, transport, parsing and storage. A reconnect is not a documented replay mechanism. When the telemetry matters, reconcile from an authoritative application state or bounded Asterisk snapshot instead of assuming missed custom events will return.

Make downstream writes idempotent with the application correlation key and event meaning. Duplicate rows can be created by retrying a producer, running two consumers, reconnect overlap or non-idempotent storage; the event alone does not identify which occurred.

Minimize and protect the payload

Custom headers can reach every authorized manager consumer whose masks and filters admit the event. Do not place passwords, tokens, payment data, recordings, unnecessary caller information or unrestricted free text in the payload. Use opaque references where possible and enforce least privilege, protected transport, bounded logs and retention.

Filtering can reduce noise but is not a substitute for authorization or data minimization. Record the effective manager user, USER read access, session mask and filters with each integration release.

Do not promote telemetry into outcome proof

An accepted UserEvent action shows that Asterisk accepted that action transaction; a received custom event shows that a permitted consumer received a message matching the application contract. Neither result by itself proves remote answer, bridge membership, transfer completion, recording persistence, two-way media or a completed business workflow.

Validate the business outcome at its owning system and retain the join keys needed to compare it with the custom event. No PBX, module, dialplan, manager session, event stream, channel, bridge, endpoint, packet, media stream, business system or live call was inspected or tested for this guide.

Sources & applicability

Primary references for the technical details above. Operational examples and planning checklists are VoIP.info editorial guidance.

Examples require adaptation to your topology. No live PBX or hardware testing is claimed.