Bridgeside AI
← All posts
vicidialintegrationguideNov 10, 20267 min read

VICIdial SIP Trunk, Codecs and Ports When You Add an AI Agent

How VICIdial SIP trunks, carriers and codecs work, why an AI agent needs no new trunk, and what G.729, transcoding, bandwidth, NAT, firewall ports and caller ID mean for the AI media path.

When a VICIdial admin hears "AI voice agent", the first worry is usually the carrier side. Will it need a new VICIdial SIP trunk, a new provider, a different codec, a SIP registration to some cloud service? For the approach Bridgeside AI uses, the answer is no. Your trunks keep carrying the call to and from the customer, and the AI leg is a separate stream of audio between your Asterisk server and the AI service.

This article explains how trunks, carriers and codecs work in VICIdial, why an AI agent does not need a new trunk, and the practical details that do matter: transcoding when the trunk or a softphone uses G.729, bandwidth, NAT, firewall ports and caller ID.

How a VICIdial SIP trunk works

In VICIdial a trunk is defined as a carrier under Admin > Carriers. A carrier entry holds a few pieces of Asterisk configuration that VICIdial writes into the server's config files for you:

  • Account entry: the SIP peer for the provider, with its host, authentication and allowed codecs.
  • Registration string: only if the provider requires the server to register.
  • Globals string: a variable that names the trunk, so dialplan entries can refer to it.
  • Dialplan entry: the outbound pattern that sends calls to the trunk.

An illustrative carrier, with placeholder values:

; Account entry
[examplecarrier]
type=peer
host=sip.example-carrier.net
disallow=all
allow=ulaw
dtmfmode=rfc2833
context=trunkinbound

; Globals string
EXAMPLETRUNK = SIP/examplecarrier

; Dialplan entry
exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _91NXXNXXXXXX,n,Dial(${EXAMPLETRUNK}/${EXTEN:1},,tTo)
exten => _91NXXNXXXXXX,n,Hangup()

Outbound campaigns reach that pattern through the campaign's dial prefix (9 in this example). Inbound calls from the carrier arrive in the trunkinbound context, where VICIdial matches the DID and routes it as you configured under Admin > Inbound > DIDs. Your provider's own settings, such as IP authentication or registration, may differ, so follow their instructions for the account entry.

Why an AI agent needs no new VICIdial SIP trunk

The AI never sits on the trunk. When a call is routed to 85 plus a campaign's dial code, the dialplan asks Bridgeside AI for a UDP port for that one call over HTTPS, then dials Asterisk's UnicastRTP channel to that port:

same => n,Dial(UnicastRTP/<bridgeside media address>:${PORT}/c(ulaw),,b(voicebot-jb^s^1))

There is no SIP signalling on this leg, no registration and no provider account. The customer leg stays on your carrier exactly as before, and Asterisk bridges the two. Hangups and transfers are AMI commands on the customer's channel, so a transfer to a closer also stays on your dialer and your trunk. That is why the same setup works with any carrier you already use, and why your carrier and trunk charges stay with your carrier.

UnicastRTP comes from chan_rtp, which ships with Asterisk 15 and newer, so VICIdial's own Asterisk 16 and 18 builds have it.

Codecs: G.711 ulaw and alaw, and G.729

Three codecs cover most VICIdial installations:

CodecBit rate (audio only)Typical use
G.711 ulaw64 kbpsNorth American carriers and LANs
G.711 alaw64 kbpsMost carriers outside North America
G.7298 kbpsLow-bandwidth trunks and remote agents

The AI leg always uses G.711 ulaw; the /c(ulaw) in the Dial string fixes it. If the customer leg is also ulaw, Asterisk passes audio through without converting it. If the customer leg is alaw, Asterisk converts between the two G.711 variants, which costs very little CPU. If the customer leg is G.729, Asterisk has to decode and encode every packet, which costs more CPU and needs a G.729 codec module installed on the server.

Check what your server can translate from the Asterisk console:

asterisk -rx "core show codecs"
asterisk -rx "core show translation"

If core show translation shows no path between g729 and ulaw, calls on a G.729 trunk will fail to bridge to the AI leg until a codec module is installed.

One more point about speech recognition. G.729 is a compressed codec, and compression removes detail that transcoding back to G.711 cannot restore. Where you have a choice, keep calls that will reach the AI on G.711 from the carrier onward.

G.729 softphone to VICIdial

The other place G.729 shows up is on agents' softphones, often for remote agents on thin connections. A G.729 softphone can register to VICIdial like any other phone, as long as Asterisk can handle that codec. The phone's SIP settings, in the phone entry or the conf template it uses, decide which codecs are offered and in what order:

disallow=all
allow=g729
allow=ulaw

Asterisk then transcodes between the agent's G.729 leg and whatever codec the customer leg uses. For an AI agent this matters only at transfer time: when the AI redirects a call to a closer on a G.729 softphone, the closer's leg is transcoded exactly as it would be on any other call. The AI leg itself never touches the softphone.

Bandwidth for the AI media path

Each AI call is one RTP stream in each direction between your dialer and Bridgeside, in 20 millisecond ulaw packets. With IP, UDP and RTP headers that is about 80 kbps each way per call, a little more once Ethernet framing is counted. For comparison, a G.729 stream is about 24 kbps each way with the same headers.

As an example, 30 concurrent AI calls need roughly 2.4 Mbps each way for the AI legs, on top of the customer legs your trunks already carry. Plan for headroom, and keep the path between your dialer and the AI service short and clean, because jitter and packet loss are heard as choppy audio long before bandwidth runs out.

NAT and firewall ports for the AI media path

DirectionPortWhat it carries
Your dialer to BridgesideTCP 443The per-call port request, and the portal
Your dialer to BridgesideUDP 5001 to 5999Call audio, one port per call
Bridgeside to your dialerTCP 5038AMI, for hangup and transfer

Allow TCP 5038 only from Bridgeside's address, which the Dialers page shows; never open AMI to the internet. Outbound UDP and HTTPS are open on most dialers already. The audio Bridgeside sends back goes to the address and port your packets came from, so a stateful firewall or NAT that allows the outbound stream normally lets the return stream through. Asterisk picks its local RTP port from the range in rtp.conf, as for any other call.

If the dialer sits behind NAT, register the public address the NAT presents as the dialer's host, because that is the address Bridgeside sees and accepts audio from. When several dialers share one public address, add &dialer=<id> to the port request in the dialplan so each call is matched to the right dialer and its AMI connection. AMI still has to reach the dialer, so forward TCP 5038 from Bridgeside's address only. If your network has several layers of NAT, contact us before the first test call and we will check the path with you.

Caller ID

Adding the AI does not change what customers see. On outbound calls the caller ID comes from your campaign or list settings and your carrier, as before. On the AI leg, VICIdial's caller ID name on an auto-dialed call carries the lead id, and the generated dialplan passes it to Bridgeside so the disposition lands on the right lead. Leave CALLERID(name) alone on the way to the 85 extension. On inbound calls, the caller's number is passed as the phone number. When the AI transfers, the customer's own channel is redirected over AMI, so the closer receives the same call rather than a new one placed through the trunk.

Checklist

  • No new carrier or trunk.
  • Asterisk 15 or newer.
  • A codec path from your trunk's codec to ulaw.
  • Outbound UDP 5001 to 5999 and TCP 443 to Bridgeside.
  • Inbound TCP 5038 from Bridgeside only.
  • The dialer's public address registered on the Dialers page.

FAQ

Do I need a new VICIdial SIP trunk for an AI agent?

No. The AI leg is a direct RTP stream from your Asterisk server, set up by the dialplan. Your existing carriers carry the customer side as before.

Can I use a G.729 softphone with VICIdial?

Yes, if your Asterisk server has a G.729 codec module. Offer G.729 in the phone's SIP settings, and Asterisk transcodes between the softphone and the customer's leg. Run core show translation to confirm the path exists.

Which codec does the AI leg use?

G.711 ulaw, set by /c(ulaw) in the Dial string. Asterisk converts from alaw or G.729 when the customer leg uses those.

What firewall ports does the AI media path need?

Outbound TCP 443 and UDP 5001 to 5999 from the dialer to Bridgeside, and TCP 5038 inbound to the dialer from Bridgeside's address only.

Does the AI change my outbound caller ID?

No. Caller ID still comes from your campaign, list and carrier settings.

For the full routing picture read one dialplan entry, the VICIdial AI agent guide and the VICIdial AI integration options. The VICIdial integration page has the setup summary, and you can try it with 60 free minutes and no card at app.bridgeside.ai.

Put an AI agent on your dialer

60 free minutes, no card, one dialplan entry.