diff --git a/src/account.h b/src/account.h index 331ad3cd48ac36382bc45dc1ef03d5543c70b15e..4b100db83193a4add581470c0b41c4fe2b828599 100644 --- a/src/account.h +++ b/src/account.h @@ -477,6 +477,13 @@ class Account : public Serializable, public std::enable_shared_from_this<Account void setAllCodecsActive(MediaType mediaType, bool active); }; +static inline std::ostream& +operator<< (std::ostream& os, const Account& acc) +{ + os << "[Account " << acc.getAccountID() << "] "; + return os; +} + } // namespace ring #endif diff --git a/src/manager.cpp b/src/manager.cpp index b4f30d7a5f81c60922cda08b2860b1913d685a40..618c2228ef21bcffa50574c624d286806190f43f 100644 --- a/src/manager.cpp +++ b/src/manager.cpp @@ -851,6 +851,9 @@ Manager::outgoingCall(const std::string& preferred_account_id, return {}; } + RING_DBG() << "try outgoing call to '" << to << "'" + << " with preferred account '" << preferred_account_id << "'"; + std::string current_call_id(getCurrentCallId()); std::string to_cleaned = hookPreference.getNumberAddPrefix() + trim(to); std::shared_ptr<Call> call; @@ -859,7 +862,6 @@ Manager::outgoingCall(const std::string& preferred_account_id, /* RING_WARN: after this call the account_id is obsolete * as the factory may decide to use another account (like IP2IP). */ - RING_DBG("New outgoing call to %s", to_cleaned.c_str()); call = newOutgoingCall(to_cleaned, preferred_account_id, volatileCallDetails); } catch (const std::exception &e) { RING_ERR("%s", e.what()); diff --git a/src/ringdht/ringaccount.cpp b/src/ringdht/ringaccount.cpp index 88a21418187aec212d32f1245a4cb6187b054b83..52dbce05c0829c0d5cb6daeabde24c3fe221e7b6 100644 --- a/src/ringdht/ringaccount.cpp +++ b/src/ringdht/ringaccount.cpp @@ -330,10 +330,11 @@ RingAccount::newIncomingCall(const std::string& from, const std::map<std::string template <> std::shared_ptr<SIPCall> -RingAccount::newOutgoingCall(const std::string& toUrl, const std::map<std::string, std::string>& volatileCallDetails) +RingAccount::newOutgoingCall(const std::string& toUrl, + const std::map<std::string, std::string>& volatileCallDetails) { - auto sufix = stripPrefix(toUrl); - RING_DBG("Calling DHT peer %s", sufix.c_str()); + auto suffix = stripPrefix(toUrl); + RING_DBG() << *this << "Calling DHT peer " << suffix; auto& manager = Manager::instance(); auto call = manager.callFactory.newCall<SIPCall, RingAccount>(*this, manager.getNewCallID(), Call::CallType::OUTGOING, @@ -344,12 +345,12 @@ RingAccount::newOutgoingCall(const std::string& toUrl, const std::map<std::strin call->initRecFilename(toUrl); try { - const std::string toUri = parseRingUri(sufix); + const std::string toUri = parseRingUri(suffix); startOutgoingCall(call, toUri); } catch (...) { #if HAVE_RINGNS std::weak_ptr<RingAccount> wthis_ = std::static_pointer_cast<RingAccount>(shared_from_this()); - NameDirectory::lookupUri(sufix, nameServer_, [wthis_,call](const std::string& result, + NameDirectory::lookupUri(suffix, nameServer_, [wthis_,call](const std::string& result, NameDirectory::Response response) { // we may run inside an unknown thread, but following code must be called in main thread runOnMainThread([=, &result]() { diff --git a/src/sip/sipaccount.cpp b/src/sip/sipaccount.cpp index b388337fa2ce328f53b28ac05c5f8db31721d242..c296abb0158f98b67704642e1821c97c8b260fec 100644 --- a/src/sip/sipaccount.cpp +++ b/src/sip/sipaccount.cpp @@ -170,11 +170,14 @@ SIPAccount::newIncomingCall(const std::string& from UNUSED, const std::map<std:: template <> std::shared_ptr<SIPCall> -SIPAccount::newOutgoingCall(const std::string& toUrl, const std::map<std::string, std::string>& volatileCallDetails) +SIPAccount::newOutgoingCall(const std::string& toUrl, + const std::map<std::string, std::string>& volatileCallDetails) { std::string to; int family; + RING_DBG() << *this << "Calling SIP peer " << toUrl; + auto& manager = Manager::instance(); auto call = manager.callFactory.newCall<SIPCall, SIPAccount>(*this, manager.getNewCallID(), Call::CallType::OUTGOING,