From 2b0e6ddd1b0dba09d00f3421336f2e13d39acc67 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?=
 <rafael.carre@savoirfairelinux.com>
Date: Tue, 16 Aug 2011 13:38:09 -0400
Subject: [PATCH] set default credentials on account creation

---
 daemon/src/sip/sipaccount.cpp | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/daemon/src/sip/sipaccount.cpp b/daemon/src/sip/sipaccount.cpp
index 191728546e..89926099ea 100644
--- a/daemon/src/sip/sipaccount.cpp
+++ b/daemon/src/sip/sipaccount.cpp
@@ -432,6 +432,16 @@ void SIPAccount::setAccountDetails (std::map<std::string, std::string> details)
     setTlsRequireClientCertificate (details[TLS_REQUIRE_CLIENT_CERTIFICATE] == "true");
     setTlsNegotiationTimeoutSec (details[TLS_NEGOTIATION_TIMEOUT_SEC]);
     setTlsNegotiationTimeoutMsec (details[TLS_NEGOTIATION_TIMEOUT_MSEC]);
+
+    if (getCredentialCount() == 0) { // credentials not set, construct 1 entry
+        std::vector<std::map<std::string, std::string> > v;
+        std::map<std::string, std::string> map;
+        map[USERNAME] = getUsername();
+        map[PASSWORD] = details[PASSWORD];
+        map[REALM]    = "*";
+        v.push_back(map);
+        setCredentials(v);
+    }
 }
 
 std::map<std::string, std::string> SIPAccount::getAccountDetails() const
-- 
GitLab