From a1d7b9178d90ef70c0ed0a6d298b3b97b605272b Mon Sep 17 00:00:00 2001
From: Alexandre Savard <alexandresavard@alexandresavard-desktop.(none)>
Date: Fri, 6 Nov 2009 14:05:16 -0500
Subject: [PATCH] [#2395] Fix account registration ( specifically with
 callcentric)

---
 sflphone-common/src/sip/sipvoiplink.cpp | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/sflphone-common/src/sip/sipvoiplink.cpp b/sflphone-common/src/sip/sipvoiplink.cpp
index 5bd2b41740..6fb1b24947 100644
--- a/sflphone-common/src/sip/sipvoiplink.cpp
+++ b/sflphone-common/src/sip/sipvoiplink.cpp
@@ -2888,12 +2888,18 @@ mod_on_rx_request (pjsip_rx_data *rdata)
     
     char* from_header = strstr(rdata->msg_info.msg_buf, "From: ");
     // _debug("------------------------------ thefromheader: %s\n", from_header);
-    std::string temp(from_header);
-    int begin_displayName = temp.find("\"") + 1;
-    int end_displayName = temp.rfind("\"");
-    // _debug("The display name start at %i, end at %i\n", begin_displayName, end_displayName);
-    
-    displayName = temp.substr(begin_displayName, end_displayName - begin_displayName);//display_name);
+
+    if(from_header) {
+
+        std::string temp(from_header);
+	int begin_displayName = temp.find("\"") + 1;
+	int end_displayName = temp.rfind("\"");
+	// _debug("The display name start at %i, end at %i\n", begin_displayName, end_displayName);
+	displayName = temp.substr(begin_displayName, end_displayName - begin_displayName);//display_name);
+    }
+    else {
+        displayName = std::string("");
+    }
 
     _debug ("UserAgent: The receiver is : %s@%s\n", userName.data(), server.data());
 
-- 
GitLab