Summary:ASTERISK-11889: "502 Bad Gateway" is translated as "NO ANSWER" instead of "FAILED", why?
Reporter:Iñaki Baz Castillo (ibc)Labels:
Date Opened:2008-04-22 05:48:11Date Closed:2008-04-22 19:13:45
Versions:Frequency of
Environment:Attachments:( 0) 20080422__bug12491.diff.txt
Description:Hi, IMHO it's clear that receiving a "502" from a SIP server means that some kind of error has occurred:

 21.5.3 502 Bad Gateway
  The server, while acting as a gateway or proxy, received an invalid
  response from the downstream server it accessed in attempting to
  fulfill the request.

But Asterisk translates it into "NO ANSWER" instead of "FAILED":

 -- Got SIP response 502 "Bad Gateway" back from XXX.XXX.XXX.XXX
 == Everyone is busy/congested at this time (1:0/0/1)

And this originates a "disposition=NO ANSWER" entry in CDR.

I think HANGUPCAUSE 27 ("502 Bad Gateway") should be mapped to "FAILED" call disposition instead of "NO ANSWER".

Comments:By: Tilghman Lesher (tilghman) 2008-04-22 08:23:35

Because a CDR disposition of FAILED generally means that no call legs were established.  One was established... from your SIP phone to Asterisk.  The fact that the second leg did not go through translates to a NO ANSWER.

By: Iñaki Baz Castillo (ibc) 2008-04-22 08:37:19

Sorry but I don't understand.

- If Asterisk calls to a SIP server and receives a "503 Service Unavailable" from that server this is translated into "FAILED" in Asterisk CDR.

- If Asterisk calls to a SIP server and receives a "502 Bad Gateway" from that server this is translated into "NO ANSWER" in Asterisk CDR.

There is no difference at all between the above two cases related to call legs, in both cases there are the same so I don't understnad what you mean.

By: Tilghman Lesher (tilghman) 2008-04-22 10:32:12

Try this patch, and see if it behaves the way you'd like.

By: Iñaki Baz Castillo (ibc) 2008-04-22 10:56:00

Yes, it works :)

By: Tilghman Lesher (tilghman) 2008-04-22 19:13:45

Committed to SVN branch 1.4.