# Setting up a PJSIP carrier in VICIdial on Asterisk 22

> Four PJSIP carrier definitions we loaded on Asterisk 22.5.1 on Ubuntu 24.04, 13 Oct 2026, the field VICIdial ignores, and a 404 registration.

URL: https://trustane.com/guides/vicidial-pjsip-carrier-setup-asterisk-22
By Trustane. Published 2026-11-05.

> **To the point**
> On Asterisk 22.5.1 on Ubuntu 24.04, 13 Oct 2026, a VICIdial carrier had to be written as complete PJSIP objects, because VICIdial copies your text into Asterisk's generated files. A carrier saved with protocol `SIP` shows as active, and its peer never loads: Asterisk 22 has no chan_sip.
>
> - The account entry goes to a file chosen by the protocol field. A PJSIP carrier's registration string is written nowhere.
> - Four definitions loaded: IP-authenticated both ways, registered, outbound only, inbound only.
> - A registration that gets one fatal reply (404) stays `Rejected`. Asterisk does not retry it on a timer; it sends it again only when PJSIP is reloaded.
> - The dialplan entry and globals string lose characters on the way in.

## A carrier that saves but whose peer never loads

We saved a carrier the chan_sip way: protocol `SIP`, a `type=peer` block and a `register =>` line. VICIdial logged it as an added carrier, showed it active, and wrote it to `sip-vicidial.conf`. Its peer never appeared in Asterisk; its globals line and dialplan entry did. chan_sip was removed in Asterisk 21, so nothing on our test server (Asterisk 22.5.1 on Ubuntu 24.04, 13 Oct 2026) reads that file, and Asterisk logged no error about this carrier. We did not test this carrier on an Asterisk that has chan_sip.

## What VICIdial does with the fields

A carrier is a row in `vicidial_server_carriers`. A script runs every minute. After a carrier is saved, it rebuilds the generated files and copies the account and dialplan entries under a `; VICIDIAL Carrier:` comment.

![Flow: carrier fields are copied into the account file, the globals, the dialplan context and the registration file](https://trustane.com/media/91678b4644064c21-1600x683.webp "Where each carrier field ends up")

A registration string stored for a PJSIP carrier appears nowhere in `pjsip-vicidial.conf`. With protocol PJSIP, that field does nothing.

## The definitions

Addresses are placeholders and the password is removed. Names are our test IDs.

### 1. IP-authenticated, calls both ways

```
[ipboth]
type=aor
contact=sip:carrier.example.com:5060
qualify_frequency=15

[ipboth]
type=identify
endpoint=ipboth
match=203.0.113.10

[ipboth]
type=endpoint
context=trunkinbound
transport=transport-udp
disallow=all
allow=ulaw
aors=ipboth
direct_media=no
rtp_symmetric=yes
dtmf_mode=rfc4733
```

The aor is where outbound calls go. The identify attaches inbound traffic from that address to the endpoint. `trunkinbound` is VICIdial's inbound context, holding one `_X.` pattern that hands the call to the DID router.

### 2. Username, password and registration

This adds an `auth` object, an aor, an endpoint with `outbound_auth`, and a `registration` object:

```
[regup-reg]
type=registration
transport=transport-udp
outbound_auth=regup-auth
server_uri=sip:carrier.example.com:5060
client_uri=sip:ACCOUNT@carrier.example.com:5060
contact_user=ACCOUNT
retry_interval=30
expiration=120
line=yes
endpoint=regup
```

`line=yes` with `endpoint=` ties inbound calls to the trunk without an identify. After registering we saw `;line=` and a token on the far side's stored contact.

### 3 and 4. One direction only

Outbound only is an aor and an endpoint in a context that is not the inbound one (we used `trunk-no-inbound`), with no identify. Inbound only is an identify and an endpoint in `trunkinbound`, with no aor. Two `match` lines, one bare and one written `/32`, both loaded as `/32`.

All four loaded. One outbound call through the first, from one scratch server to the other, was answered. The second reached `Registered` after the fix below. The third and fourth point at addresses that answer nothing, so they prove only that the objects load. A fifth carrier with protocol `PJSIP_WIZ` and a `type=wizard` block also loaded. Codecs, DTMF and NAT settings are what we chose for the test; use your carrier's.

## The dialplan entry

```
; VICIDIAL Carrier: ipboth - IP both way
exten => _71X.,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _71X.,n,Dial(PJSIP/${EXTEN:2}@${IPBOTH},${CAMPDTO},To)
exten => _71X.,n,Hangup()
```

The globals string is `IPBOTH=ipboth`. The prefix is `71`, `${EXTEN:2}` strips it, and PJSIP wants the number first, then `@`, then the endpoint.

To find a free prefix, ask Asterisk:

```
asterisk -rx "dialplan show 715550100001@default"
```

"There is no existence of" that extension means the prefix is free. After we deleted our carrier on `75`, Asterisk answered exactly that for `755550100001`. Check inactive carriers' entries too: an inactive carrier is left out of the generated files.

## A registration that stopped at 404

Our first attempt was rejected: `Fatal response '404' received`, and `pjsip show registrations` said `Rejected`. Asterisk did not retry it on a timer; a rejected registration is sent again only when PJSIP is reloaded. The documentation says `fatal_retry_interval` defaults to 0, and with 0 Asterisk "will not retry after receiving a fatal (non-temporary 4xx, 5xx, 6xx) response".

The far side, as we configured it, also had an IP trunk, `froma`, whose identify matched our address and whose only aor was `froma`. An identify matches inbound requests from its address to its endpoint, and Asterisk's registrar then looks for an aor named after the registering user among that endpoint's aors. `froma` had none, so the answer was 404. We removed `froma` and ran:

```
asterisk -rx "pjsip send register regup-reg"
```

![Flow: REGISTER arrives, the IP trunk claims it, no aor accepts it, 404 and Rejected](https://trustane.com/media/46e952710ed28386-1600x510.webp "How the 404 happened")

After the fix it went to `Registered`. Two lessons. A carrier that has you configured by both address and account can fail in a way neither config shows. And one fatal reply leaves you unregistered until someone steps in or PJSIP is reloaded. Three things change that: `fatal_retry_interval` above zero (then Asterisk stops after `max_retries` attempts, 10 by default), a `Retry-After` header on the reply, and `forbidden_retry_interval` for a 403.

## What the fields do to your text

We saved one test carrier with brackets, quotes, semicolons, a backslash and line breaks in its fields:

| Field | Result |
|---|---|
| Account entry | stored unchanged, byte for byte |
| Dialplan entry | single quotes and backslashes removed; double quotes survive |
| Globals string | semicolons and line breaks removed, so two globals merge |
| Carrier name | brackets and semicolons removed |

An unescaped semicolon starts a comment, so Asterisk read `NoOp(a;b ...)` as `NoOp(a)`. Use one global per carrier.

> **The account entry becomes server configuration**
> Anyone who can edit carriers can write any PJSIP configuration on the server. Restrict that permission.

## How we tested

Two scratch test servers, 13 Oct 2026. Box A ran Ubuntu 24.04.5 LTS, Asterisk 22.5.1 and VICIdial admin build 2.14-967a, with Allowed SIP Stacks set to PJSIP; box B played the carrier. A newly activated carrier took 26.8 and 38.6 seconds to appear.

## Questions people ask

### Why did my SIP carrier never show up?

Asterisk 21 and later have no chan_sip, so protocol `SIP` writes to a file nothing reads.

### How long until a saved carrier is live?

The rebuild runs every minute. Ours loaded 26.8 and 38.6 seconds after saving.

### Why does my registration stay Rejected?

A fatal reply such as 404 stops it, and with `fatal_retry_interval` at its default of 0, Asterisk does not retry it on a timer; a PJSIP reload sends it again. Fix the cause, then run `pjsip send register`.

## Next steps

1. Run `asterisk -rx "core show version"` and `asterisk -rx "pjsip show endpoints"`.
2. Write every object for the definition that matches how the carrier authenticates you.
3. Save, activate, wait, check `pjsip show registrations`, then place one manual call.

From our [VICIdial pricing page](https://trustane.com/vicidial-pricing): "On Dedicated plans: free migration and dialer tuning, carrier setup, least-cost routing and AMD tuning." To start, see [the order page](https://trustane.com/order) or [migration](https://trustane.com/migrate).

VICIdial is a trademark of its owner. Trustane is an independent hosting provider.
