SIP 502 Bad Gateway
A proxy passed your call on and got back something it could not use. It points at the link between your provider and the network beyond it, so DNS and trunk host configuration are the places to look.
What SIP 502 Bad Gateway actually means
The server, acting as a gateway or proxy, received an invalid response from the downstream server it consulted while trying to fulfil the request. It is reporting a problem one hop further along than itself, which is why the fault is rarely in the device that receives it.
What causes SIP 502 on a business phone system
- The trunk hostname resolves to a dead or wrong hostStale DNS, or a host record left behind after a provider migration, sends calls to something that cannot answer properly.
- The link between the platform and the carrier is brokenA provider whose upstream connection is failing returns 502s to its customers. Not something you can fix from your side.
- A downstream device is returning malformed messagesAn intermediary that mangles SIP, including a router with ALG enabled, can cause the response to be judged invalid.
How to fix SIP 502
- Check the trunk host and DNS recordsConfirm the SIP domain and outbound proxy match current provider documentation, and that they resolve to the addresses the provider expects.
- Disable SIP ALGWorth eliminating here as everywhere else, since a mangled response can be rejected as invalid.
- Raise it with your provider with a Call-IDA 502 usually describes a problem beyond your network edge, so it needs their logs.
Fixing the underlying problem
This page explains the code. These guides walk through the fix in detail.
Questions about SIP 502
What does SIP 502 Bad Gateway mean?
Call hangup causes that become SIP 502
If the call crossed a gateway between SIP and ISDN or SS7, this status may have started life as one of these Q.850 cause values. The mapping is defined in RFC 3398 section 7.2.4.1.
Related SIP response codes
Source. SIP 502 Bad Gateway is defined in RFC 3261 section 21.5.3 and registered in the IANA SIP Parameters — Response Codes. The causes and fixes above are drawn from our own experience supporting UK business phone systems.