SIP 403 Forbidden: What It Means and How to Fix It
A SIP 403 Forbidden response means the server understood your request and is refusing it. RFC 3261, the core SIP standard, defines it in section 21.4.4: “The server understood the request, but is refusing to fulfill it. Authorization will not help, and the request SHOULD NOT be repeated.”
That last sentence is what separates 403 from its neighbours. A 401 Unauthorized or 407 Proxy Authentication Required is a challenge: send credentials and try again. A 403 is a refusal. Retrying the same request will get the same answer, so the fix is always a change on one side or the other.
The difficulty is that “Forbidden” covers a lot of ground: a wrong password at one provider, an unapproved caller ID at another, a full registration slot on your own PBX. The quickest way to narrow it down is to look at where in the message flow the 403 arrives. For what every other code means, see the SIP response codes lookup; for the 488 error that browser calls to Asterisk often hit, see our Q&A with Conrad de Wet.
Where the 403 arrives tells you the cause
Capture the exchange first (see “Capturing the 403” below), then find the 403 in this table.
| What was sent | Who sent the 403 | Most likely cause |
|---|---|---|
| REGISTER, no challenge first | Your SIP provider | Account or IP not recognised, account suspended, or registering from an address the provider does not accept |
| REGISTER, after a 401/407 challenge | Your SIP provider | Wrong authentication username or password |
| REGISTER | Your own Asterisk (PJSIP) | Not a password problem: the endpoint has no AOR, the AOR has max_contacts=0, or the AOR is full |
| INVITE, no challenge first | Your SIP provider | Source IP not on the provider’s access list |
| INVITE, after a 407 challenge | Your SIP provider | Wrong trunk credentials |
| INVITE, authenticated and accepted | Your SIP provider | Policy: caller ID not authorised, destination not enabled, no credit, number blocked |
| INVITE | Your own Asterisk | The dialplan rejected the call with cause 21 |
WebSocket connection to wss:// |
The web server | Not SIP at all: the WebSocket handshake was refused |
The sections below take each case in turn.
403 to REGISTER from your SIP provider
When your PBX or phone registers to a provider and gets a 403, the provider has decided it will not accept this registration at all. With digest authentication, a 403 that follows the 401 or 407 challenge usually means the credentials were checked and rejected. Check:
- The authentication username, not just the extension or number. Many providers use a separate auth username. Asterisk users on the forums have spent hours on a “wrong password” that was in fact a wrong username.
- The password, retyped rather than pasted, in case of hidden characters.
- The registrar host. Some providers have several servers and only accept an account on its assigned one.
- The account itself: suspended, unpaid or not yet activated accounts are commonly refused with 403.
An Asterisk detail that catches people out: Asterisk treats a 403 to its outbound registration as fatal. The forbidden_retry_interval option defaults to 0, which means Asterisk does not retry after a 403 at all. Once you have fixed the cause at the provider, the trunk stays unregistered until you reload or restart. If short provider outages sometimes produce 403s, set forbidden_retry_interval to a sensible value, for example 300 seconds, so the trunk recovers by itself.
403 to REGISTER from your own Asterisk
This is the case where the usual advice is wrong. On current Asterisk, a wrong password from a phone does not produce a 403.
Since Asterisk 21, chan_sip has been removed, leaving PJSIP as the only SIP channel driver. When a phone sends a REGISTER with bad credentials, PJSIP answers with another 401 challenge, not a 403. Asterisk’s source code (pjsip_distributor.c) sends 401 for both the first challenge and a failed authentication, and logs “Failed to authenticate”. The old chan_sip driver did answer a wrong password with 403, which is why so much older advice links the two.
In PJSIP, a 403 to a REGISTER comes from the registrar (res_pjsip_registrar.c), in exactly three cases. Each has its own log line:
- The endpoint has no AOR. Log:
Endpoint '...' has no configured AORs. Fix: addaors=to the endpoint. - The AOR does not accept registrations. Log:
AOR '...' has no configured max_contacts.max_contactsdefaults to 0, which disables registration. Fix: setmax_contactsto 1 or more. - The AOR is full. Log:
Registration attempt from endpoint '...' to AOR '...' will exceed max contacts of N. This is by far the most common of the three.
The third case is the one browser phones run into. Every browser tab that registers is a separate contact. A user who opens the phone in a second tab, or whose laptop sleeps and wakes with a new address, can fill the AOR. Asterisk then refuses the newest registration with 403, while the stale contacts it is protecting may no longer answer at all.
Three AOR options decide what happens:
max_contacts: how many devices may register to the extension at once.remove_existing: when set toyes, a new registration displaces the contact that is soonest to expire instead of being refused. Asterisk’s own guidance is thatmax_contacts=1withremove_existing=yesreproduces the old chan_sip behaviour of “last device to register wins”.remove_unavailable: when set toyes, contacts that have stopped answering qualify checks are removed first, so dead contacts cannot block live ones.
On FreePBX, the extension’s Max Contacts setting defaults to 1, and FreePBX writes remove_existing=yes at that value. Raise Max Contacts above 1 so a user can have a desk phone and a browser phone, and FreePBX sets remove_existing=no, as FreePBX users have documented. From then on, one device too many gets a 403 instead of displacing an old contact. If you raise Max Contacts, add remove_unavailable=yes for that AOR (in pjsip.aor_custom_post.conf) so dead contacts clear themselves.
To see what is filling the AOR, run pjsip show aor 1001 (with your extension number). Stale contacts show as Unavailable.
403 to INVITE from your SIP provider
This is the most common 403 of all: the trunk registers, inbound calls work, and outbound calls fail with “Forbidden”. Again, position in the flow is the clue. Twilio’s troubleshooting guide puts it simply: a 403 to the first INVITE, with no challenge, points to the IP access list; a 403 to the INVITE you resent with credentials after a 407 points to the credentials.
No challenge first: your IP is not on the access list. Providers that authenticate by IP refuse INVITEs from addresses they do not know. This happens after moving the PBX, changing broadband or adding a second internet line. Look at the received= parameter on the Via header of the 403: it shows the address the provider actually saw. Add that address to the provider’s access list, or route the traffic through the address already on it.
After a 407: wrong trunk credentials. Twilio, for example, adds X-Twilio-Error: 32202 Authentication failure - bad user credentials to the 403 in this case.
Authenticated and accepted, then refused: a policy decision. The provider knows who you are and has decided this call is not allowed. The usual causes, in rough order of likelihood:
- Caller ID not authorised. The number in the From or P-Asserted-Identity header is not one of yours on that account. This is the classic cause when forwarding an inbound call back out, because the PBX passes the original caller’s number. VoIP.ms states that an unverified caller ID makes outgoing calls fail, and Twilio returns
403 Invalid Caller ID. Set an outbound caller ID that belongs to the trunk, in the format the provider expects (often full E.164 with the leading +). - Destination not enabled. Many accounts block international or premium destinations by default. Twilio returns
403 No International Authorizationuntil the country is enabled under Voice Geographic Permissions. - No credit. Pre-paid accounts with a zero or negative balance often refuse calls with 403; Telnyx lists a negative balance among its 403 causes.
- Number format. Dialling
0207...to a provider that expects+44207...can be refused as Forbidden rather than Not Found. - Concurrency limits. Some providers answer a call over your channel limit with 403.
Read the whole 403, not just the status line. Providers often explain the refusal in a Warning, Reason or vendor-specific header (Twilio’s X-Twilio-Error, Microsoft Teams Direct Routing’s numbered 403 codes), and that header usually names the cause outright.
403 to INVITE from your own Asterisk
When Asterisk itself answers an incoming call with 403, look at the dialplan. Asterisk’s PJSIP channel driver maps hangup cause 21 (Call Rejected) to SIP 403, so a Hangup(21) in the dialplan, or a dialplan application that rejects the call with that cause, reaches the caller as 403 Forbidden.
The same mapping works in reverse across gateways. When a call crosses from SIP into the old telephone network, a SIP 403 commonly corresponds to Q.850 cause 21 (Call Rejected), and causes 55, 57 and 87 (barring and closed user group restrictions) also come back as 403. So a 403 relayed from a carrier can originate several networks away.
403 in the browser console: a WebSocket refusal, not SIP
If a browser phone shows WebSocket connection to 'wss://...' failed: 403 in the developer console, no SIP has happened yet. That 403 is an HTTP response: the web server or SIP proxy refused the WebSocket upgrade before a single SIP message was sent. Check that the wss:// URL and path match what the server listens on, and whether the server only accepts connections from approved origins (the web page’s domain). Only once the WebSocket opens does SIP registration begin. If you then see 401s and 403s in the SIP trace, the sections above apply. Our FreePBX WebRTC guide covers the WSS and certificate set-up.
Capturing the 403
You need the full message, not just the code shown on a phone’s screen.
- On Asterisk: run
pjsip set logger onat the CLI, reproduce the failure, thenpjsip set logger off. Read the request immediately before the 403, and check/var/log/asterisk/fullfor the registrar and distributor log lines quoted above. - On any Linux PBX or proxy: sngrep shows the call flow as a ladder diagram, which makes it obvious whether the 403 came before or after a challenge.
- On a browser phone: the developer console (F12) shows the WebSocket connection, and most SIP libraries can log every SIP message there.
If you are unsure which server sent the 403, check the Via and Server or User-Agent headers on the response. A SIP proxy between you and the provider may have generated the 403 itself.
Using Siperb? A 403 Failed to get a destination SBC is specific to the Siperb platform and means no Connection matches the dialled number. Siperb’s knowledge base explains how to fix the Connection pattern.
Frequently asked questions
Is SIP 403 Forbidden a wrong password?
Sometimes, but not on current Asterisk. Many SIP providers answer bad credentials with 403. Asterisk’s PJSIP answers a bad password from a phone with another 401, and sends 403 to a REGISTER only for AOR problems, most often a full AOR (max_contacts).
What is the difference between SIP 401 and 403?
A 401 (or 407) is a challenge: the server wants credentials and the request can succeed once they are supplied. A 403 is a refusal: the server understood the request and will not carry it out, and repeating it unchanged will not help.
Why does my trunk register but outbound calls get 403?
Registration and outbound calls are checked separately. The commonest causes are a caller ID the provider has not authorised, a destination not enabled on the account, no credit, or calls arriving from an IP address that is not on the provider’s access list.
Next in this series: SIP 401 Unauthorized and 407 Proxy Authentication Required.