summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorOlle Johansson <oej@edvina.net>2009-05-27 20:14:00 +0000
committerOlle Johansson <oej@edvina.net>2009-05-27 20:14:00 +0000
commitb6d95bef99d9b0972ae88fabeb6b012c580433c3 (patch)
treece7f1c76b358b115d3cb7ef2ca782350b7dc8e3e /channels
parent6a527ecc3d2a410a0ad9e95939e27b0ada791d55 (diff)
Adding some generic handling of error codes sent to us in replys to requests.
Previously they always set hangupcause 0, which is generally wrong. With this change, we're setting some generic hangup causes. For 5xx errors, which indicate some sort of problem with the remote server, we're now setting CONGESTION. EDVX002 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@197266 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 20e47a47b..07b2330d6 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -5698,6 +5698,16 @@ static int hangup_sip2cause(int cause)
case 606: /* Not acceptable */
return AST_CAUSE_BEARERCAPABILITY_NOTAVAIL;
default:
+ if (cause < 500 && cause >= 400) {
+ /* 4xx class error that is unknown - someting wrong with our request */
+ return AST_CAUSE_INTERWORKING;
+ } else if (cause < 600 && cause >= 500) {
+ /* 5xx class error - problem in the remote end */
+ return AST_CAUSE_CONGESTION;
+ } else if (cause < 700 && cause >= 600) {
+ /* 6xx - global errors in the 4xx class */
+ return AST_CAUSE_INTERWORKING;
+ }
return AST_CAUSE_NORMAL;
}
/* Never reached */