What VICIrecGateway does: stereo recording on a separate box
VICIrecGateway is a standalone Asterisk AGI that routes calls through a dedicated recording server, capturing carrier and dialer audio on separate stereo channels via MixMonitor.
VICIrecGateway is designed to run on a stand-alone Asterisk server and record calls in Stereo recording. Instead of mixing both sides of a conversation into a single mono file, it writes carrier audio and dialer audio into separate channels — giving you clean, side-isolated recordings that are much easier to analyze, transcribe, or audit.
How the gateway intercepts calls
Calls are routed through the gateway box before reaching the dialer. The gateway runs agi-VICIrecGateway.agi, which sets two channel variables: CARRIER_FILENAME and DIALER_FILENAME. Those variables are then passed to MixMonitor with the r() and t() flags, which write the receive and transmit audio streams into separate file paths.
For inbound calls, the stereo-rec-inbound context in extensions.conf looks like this:
MixMonitor(,r(${CARRIER_FILENAME})t(${DIALER_FILENAME})S)
For outbound calls, the stereo-rec-outbound context swaps the r() and t() arguments so that CARRIER_FILENAME still captures the carrier (far) side and DIALER_FILENAME captures the dialer (near) side, keeping the channel mapping consistent regardless of call direction.
The header injection handler
To pass the recording ID back to the main dialer, the gateway uses a PJSIP header. A small handler context adds the X-VICIrecGatewayID header on outbound legs:
Set(PJSIP_HEADER(add,X-VICIrecGatewayID)=${VICIrecGatewayID})
This allows the dialer to associate the stereo recording files with the correct call record even though the recording happened on a different physical server.
Call flow through the gateway
sequenceDiagram
participant Car as Carrier trunk
participant GW as Gateway Asterisk
participant Dial as Main VICIdial server
Car->>GW: Call arrives on trunk
GW->>GW: AGI sets CARRIER_FILENAME and DIALER_FILENAME
GW->>GW: MixMonitor starts stereo capture
GW->>Dial: Dial PJSIP with X-VICIrecGatewayID header
Dial->>GW: Agent audio returns
GW->>GW: Write carrier and dialer audio to separate channels
GW->>GW: MixMonitor closes files on hangupWhat you get in the recording files
The CARRIER_FILENAME file holds what the carrier sent into the system — the customer's voice on inbound calls. The DIALER_FILENAME file holds what the dialer transmitted — the agent's voice. A transcription or Voice analytics tool that understands stereo can then process each channel independently, which eliminates the crosstalk that plagues mono recordings.
**Heads up:** The gateway box must be configured with PJSIP and a working trunk back to your main dialer. Because all call audio passes through this server, its network latency and CPU headroom directly affect call quality. Size it as you would a production Asterisk server, not a minimal VM.
For the full recording background, see VICIdial call recording explained. To understand when a gateway server makes sense for your operation, see when to move recording onto a dedicated gateway server.
VICIfast can provision gateway recording servers as part of your deployment. See VICIfast pricing to find the right plan.
About VICIfast LLC
VICIfast LLC operates a managed VICIdial hosting + BYOI service for outbound and inbound call centers. We run the dialers, the carriers, the recordings pipeline, and the compliance plumbing so operators don’t have to.
Citing this article
VICIfast Engineering. “What VICIrecGateway does: stereo recording on a separate box”. VICIfast LLC, June 24, 2026. Retrieved from https://vicifast.com/blog/vicidial-vicirecgateway-agi
Have questions?
Related posts
You might be interested in
VICIfast newsletter
Liked this? Get the next one in your inbox.
We ship the kind of stuff you just read — concrete, numbers-first, no drip. One email when a new post goes live. Unsubscribe in one click.
Comments
No comments yet — be the first.