Infrastructure

FastAGI

FastAGI is a network-based variant of the Asterisk Gateway Interface that connects to an external AGI server over TCP instead of launching a new process for each call. Rather than forking a separate script for every call, FastAGI communicates with a persistent daemon process that handles multiple calls concurrently — dramatically reducing the overhead of AGI processing on high-volume VICIdial systems.

How It Works in VICIdial

With standard AGI, Asterisk forks a new Perl process for each call, loads the script into memory, executes it, and then terminates the process when the call ends. With FastAGI, Asterisk connects to a pre-running daemon (typically on localhost port 4577) via TCP. The daemon receives the AGI protocol messages over the network socket and processes them using a persistent, pre-initialized execution environment.

VICIdial’s FastAGI implementation uses a Perl-based daemon that pre-loads database connections, configuration data, and shared resources. Since the daemon persists between calls, it avoids the startup overhead of establishing database connections, loading modules, and parsing configuration files for every single call.

In the dialplan, FastAGI is invoked with AGI(agi://localhost:4577/script_name) instead of AGI(/var/lib/asterisk/agi-bin/script.agi). The protocol communication is identical to standard AGI — only the transport mechanism changes.

Why It Matters

FastAGI is essential for VICIdial servers handling more than 100-150 concurrent calls. At that scale, the process forking overhead of standard AGI can consume significant CPU and memory — each AGI process uses 10-30 MB of memory, and spawning hundreds simultaneously creates substantial system load. FastAGI’s persistent daemon handles the same call volume with a fraction of the resources.

VICIdial installations serving large clusters or high-volume campaigns should use FastAGI as a performance optimization. The migration from standard AGI to FastAGI is straightforward — it requires installing the FastAGI daemon and updating the dialplan references. See the VICIdial cluster guide for FastAGI deployment in scaled environments.

Related VICIdial Settings

start_call_url View setting → dead_trigger View setting → amd_agent_route View setting →

Related Terms

Asterisk Gateway Interface (AGI) View definition → Asterisk View definition → Dialplan View definition →

Related Articles

VICIdial Optimization

VICIdial New Features: Everything You Need to Know

· 22 min read
VICIdial Optimization

VICIdial AMD Configuration: The Only Guide That Doesn't Waste Your Time

· 22 min read
Technical Guides

VICIdial Asterisk Configuration: SIP, Codecs & NAT

· 18 min read

Part of the VICIdial Performance Optimization Guide

Need Help With Your VICIdial Setup?

Get a free performance audit from our team of VICIdial experts. We'll identify quick wins and long-term improvements.

Get Your Free Audit →