Tip: type a SIP code like 488, or a problem like one-way audio. Use ↑ ↓ and Enter.

400 4xx Client error RFC 3261

SIP 400 Bad Request

The request could not be understood because of malformed syntax. The reason phrase often names the faulty header.

Class4xx Client error
TypeFinal response
Defined inRFC 3261
Typical Q.850 cause41: Temporary failure

400 Bad Request means the receiving SIP stack could not parse or accept the syntax of the message. It is not about permissions, numbers or codecs; the server is saying the request itself is malformed. Strict stacks such as PJSIP (inside Asterisk) and many carrier SBCs reject things that forgiving devices accept, so a phone that works on one platform can fail on another.

The sender is usually the next hop: your PBX, an SBC, or the carrier's edge. The caller sees an immediate failure, typically a fast busy or a "call failed" message, with no ringing. A registration rejected with 400 leaves the phone offline without any password prompt.

Two habits make 400s much easier to solve. Read the reason phrase and any Warning header, because many servers name the offending header. Then compare the message as it left the sender with what arrived at the receiver: if they differ, something in the path, often a SIP ALG, rewrote it.

What it looks like in a SIP trace

PBX     -> Carrier : INVITE sip:+27215550123#@sip.example.net SIP/2.0
Carrier -> PBX     : SIP/2.0 400 Bad Request - Invalid Request-URI

SIP/2.0 400 Bad Request - Invalid Request-URI
Via: SIP/2.0/UDP 203.0.113.10:5060;branch=z9hG4bK9d21ab
From: "Accounts" <sip:+27115550199@pbx.example.com>;tag=5a7c11
To: <sip:+27215550123#@sip.example.net>;tag=sbc-77f0
Call-ID: 1c2e9a7b55@203.0.113.10
CSeq: 1 INVITE
Warning: 399 sip.example.net "Unescaped character in user part"
Content-Length: 0

Example values only. Your headers, addresses and numbers will differ.

Common causes

  • Malformed or missing mandatory headers (Via, From, To, Call-ID, CSeq).
  • Broken SDP, or bad characters in a display name.
  • A SIP ALG on a router rewriting packets incorrectly.
  • UDP fragmentation that cuts large messages.

How to diagnose it

  1. Read the full status line and any Warning header. Reason phrases such as Missing Contact or Invalid Request-URI point straight at the problem.
  2. Capture the request where it leaves the sender and, if you can, where it arrives. If the copies differ, a router SIP ALG or middlebox is rewriting it; the SIP ALG guide explains how to turn it off.
  3. Check the Request-URI and the From and To user parts for characters that must be escaped. # must be sent as %23 and spaces are not allowed, which often catches feature codes and digits dialled into the URI.
  4. Check the display name: quotes, backslashes or badly encoded characters copied from a CRM can break the From header on strict parsers.
  5. Confirm the mandatory headers are present: Via, From, To, Call-ID, CSeq and Max-Forwards on every request, a Contact on any request that creates a dialog, and a Content-Length that matches the body.
  6. Look for IP fragments when the INVITE is larger than about 1,300 bytes on UDP. A firewall that drops fragments causes silence, while a middlebox that truncates them causes parse errors. Moving the trunk to TCP is a quick test.

How to fix it

  1. Capture the packet (sngrep or Wireshark) and validate the headers named in the reason phrase.
  2. Disable SIP ALG on firewalls and routers.
  3. Switch large messages to TCP, or trim unnecessary headers and codecs so the INVITE fits under the MTU.
Seeing 400 only on calls through a particular router or firewall? Check that SIP ALG is disabled. Here's why it causes problems.

Platform notes

Asterisk / FreePBX

PJSIP often drops a message it cannot parse instead of answering 400, and logs an error containing PJSIP syntax error exception when parsing with the header name and line. Search /var/log/asterisk/full for that text and use pjsip set logger on to see the raw message.

OpenSIPS / Kamailio

Kamailio's sanity module and OpenSIPS's sipmsg_validate() (sipmsgops module) catch malformed requests early, and the script usually answers with a 400 whose reason phrase names the check. Search your config for the exact reason phrase to find which check fired.

Phones and softphones

Check whether the phone's dial plan sends # as part of the number instead of treating it as the send key, especially after a firmware update.

SIP 400 FAQ

Is 400 Bad Request caused by my phone or the server?

Usually by whatever built or rewrote the message: the phone, the PBX or a SIP ALG in between. The server that sent the 400 is only the one that noticed, so compare captures at each hop.

Why do I get 400 on some calls but not others?

Look at what differs: a caller name with unusual characters, a number containing #, or a larger INVITE with more codecs that fragments over UDP. Each affects only some calls.

What is the difference between 400 and 488?

400 means the SIP message syntax is broken. 488 means the message was valid but the media offer in the SDP was not acceptable.

Related guides

← Back to all SIP response codes