From cdade5de47008a3664cf734a1026340a2eea222e Mon Sep 17 00:00:00 2001
From: philippegorley <philippe.gorley@savoirfairelinux.com>
Date: Mon, 11 Jun 2018 16:07:07 -0400
Subject: [PATCH] sipcall: set peer registered name on outgoing call

Change-Id: Ibac1ee25ce9c2df377e66918887ac43db6d4839a
Reviewed-by: Sebastien Blin <sebastien.blin@savoirfairelinux.com>
---
 src/ringdht/ringaccount.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/ringdht/ringaccount.cpp b/src/ringdht/ringaccount.cpp
index f3482b2c04..de3da55e40 100644
--- a/src/ringdht/ringaccount.cpp
+++ b/src/ringdht/ringaccount.cpp
@@ -393,6 +393,14 @@ RingAccount::startOutgoingCall(const std::shared_ptr<SIPCall>& call, const std::
     call->setState(Call::ConnectionState::TRYING);
     std::weak_ptr<SIPCall> wCall = call;
 
+#if HAVE_RINGNS
+    nameDir_.get().lookupAddress(toUri, [wCall](const std::string& result, const NameDirectory::Response& response){
+        if (response == NameDirectory::Response::found)
+            if (auto call = wCall.lock())
+                call->setPeerRegistredName(result);
+    });
+#endif
+
     // Find listening Ring devices for this account
     dht::InfoHash peer_account(toUri);
     forEachDevice(peer_account, [wCall, toUri, peer_account](const std::shared_ptr<RingAccount>& sthis, const dht::InfoHash& dev)
-- 
GitLab