From 2d1ed6259020ee8f9f5f7ec27ff5c750b3889cb6 Mon Sep 17 00:00:00 2001
From: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
Date: Tue, 10 Mar 2009 14:50:29 -0400
Subject: [PATCH] Restore call failure use cases

---
 src/sipvoiplink.cpp | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/sipvoiplink.cpp b/src/sipvoiplink.cpp
index d9abc2b42d..6206a37d3b 100644
--- a/src/sipvoiplink.cpp
+++ b/src/sipvoiplink.cpp
@@ -1618,16 +1618,21 @@ std::string SIPVoIPLink::getSipTo(const std::string& to_url, std::string hostnam
                         }
                         break; 
 
-                    case PJSIP_SC_REQUEST_TIMEOUT:
-                        // The host was probably unreachable: bad address, bad port, ...
-                        break;
-                    case PJSIP_SC_NOT_ACCEPTABLE_HERE:
-                        // The SDP negociation failed
+                    /* The call connection failed */
+                    case PJSIP_SC_NOT_FOUND:            /* peer not found */
+                    case PJSIP_SC_REQUEST_TIMEOUT:      /* request timeout */
+                    case PJSIP_SC_NOT_ACCEPTABLE_HERE:  /* no compatible codecs */
+                    case PJSIP_SC_NOT_ACCEPTABLE_ANYWHERE:
+                    case PJSIP_SC_UNSUPPORTED_MEDIA_TYPE:
+                        accId = Manager::instance().getAccountFromCall(call->getCallId());
+                        link = dynamic_cast<SIPVoIPLink *> (Manager::instance().getAccountLink(accId));
+                        if (link) {
+                            link->SIPCallServerFailure(call);
+                        }
                         break;
+                    
                     default:
-                        
-                        // The call terminated successfully; normal behaviour
-                        // Core notification
+                        _debug ("sipvoiplink.cpp - line 1635 : Unhandled call state. This is probably a bug.\n");
                         break;
                 }
             }
-- 
GitLab