prefixkit Ask an engineerAsk RU

SIP response codes

SIP 502 Bad Gateway

Bad Gateway: the server acting as a gateway got an invalid answer from the next hop.

502
Name
Bad Gateway
Class
5xx · Server error
Defined in
RFC 3261
Q.850 cause towards the PSTN
38 · Network out of order
Produced from Q.850 causes
27

When it happens

  • The carrier behind your provider rejected the call.
  • An upstream trunk is down or misconfigured.

What to check

  • Check the trunk status on the PBX; ask the provider which upstream route failed.

What the response looks like

SIP/2.0 502 Bad Gateway
Via: SIP/2.0/UDP 203.0.113.10:5060;branch=z9hG4bK776asdhds
From: <sip:101@pbx.example>;tag=1928301774
To: <sip:+15551234567@pbx.example>;tag=a6c85cf
Call-ID: a84b4c76e66710@203.0.113.10
CSeq: 2 INVITE
Reason: Q.850;cause=38;text="Network out of order"
Content-Length: 0