Skip to content
Phone Guides

Asterisk IVR integration with external services

A transactional IVR collects input, checks or changes something outside the phone system, then tells the caller what happened. Define each of those steps and its failure treatment before adding an API call to the dialplan.

Source-reviewed, 18 October 2026. Prepared from the cited documentation. No external IVR transaction has been independently tested by Phone Guides. Scope: Asterisk 22 application design; no named business API or identity scheme is certified here.

Distinguish a menu from a transaction

An auto attendant selects a destination from a menu. An external-service IVR may retrieve private data or perform a write. A phone number or a caller-entered reference alone should not be treated as proof that the caller is authorised to perform the transaction.

Record the accepted task, required authentication/authorisation, input format, allowed data and intended business result. Use the external service's supported API and identity rules. Keep PBX routing permissions separate from the business service's access policy.

Choose an interface for the actual task

Need Candidate path to assess
A bounded lookup during dialplan execution AGI/FastAGI or a suitable documented function/application
Management/events around existing call routing AMI with restricted action/event permissions
Application-owned channel/bridge/media flow ARI and a deliberate Stasis lifecycle
Database-backed lookup A supported query interface with safe input handling

Use the official interface overview and our interface chooser. The interface name does not validate the external service contract or its response schema.

Define a bounded request

Before sending input, validate its permitted length and character set and associate it with the authorised task. Keep a connection/read time budget, a maximum retry count and a fallback that does not assume success. Separate no matching record from a service failure.

For a write, give the business operation a stable identity and follow the service's documented duplicate-handling mechanism. If the response is lost, repeating the request may repeat the transaction. A call reconnecting or a caller pressing a key again does not make a second write appropriate.

The AGI design guide covers synchronous dependencies; ARI lifecycle planning covers delayed work when channel state can change independently.

Speak only the result established

Validate the returned schema and map documented results to caller messages. Do not announce that a booking, payment or account change completed solely because the HTTP request reached a server. Conversely, a timeout does not prove the server made no change.

Define what to do if the caller hangs up before completion. Separate transaction settlement from channel cleanup, and ensure a later worker cannot play private data into an unrelated recycled call context.

Reader checks and private evidence

On your own authorised service path, check valid/invalid input, wrong identity, no match, a slow/unavailable dependency, malformed response and uncertain write outcome. Include caller hangup and repeated input. Confirm the fallback is bounded and does not disclose more information than the caller is allowed to receive.

Log task type, time, status and correlation identifiers instead of full private records, PINs or credentials. Retain the service contract and version with the dialplan/application version. Use monitoring to detect dependency failures and recovery planning for the data involved.

Return to Asterisk documentation.