From 1c8b3e480b1ded8582960c119f9f120adbbd313a Mon Sep 17 00:00:00 2001 From: Tristan Matthews <le.businessman@gmail.com> Date: Sat, 28 Apr 2012 17:07:29 -0400 Subject: [PATCH] * #9832: Fix logging in Manager --- daemon/src/managerimpl.cpp | 252 ++++++++++++++++++------------------- daemon/src/voiplink.cpp | 2 +- 2 files changed, 127 insertions(+), 127 deletions(-) diff --git a/daemon/src/managerimpl.cpp b/daemon/src/managerimpl.cpp index 8213c022f6..c2188d473f 100644 --- a/daemon/src/managerimpl.cpp +++ b/daemon/src/managerimpl.cpp @@ -91,7 +91,7 @@ ManagerImpl::ManagerImpl() : void ManagerImpl::init(const std::string &config_file) { path_ = config_file.empty() ? createConfigFile() : config_file; - DEBUG("Manager: configuration file path: %s", path_.c_str()); + DEBUG("Configuration file path: %s", path_.c_str()); try { Conf::YamlParser parser(path_.c_str()); @@ -100,7 +100,7 @@ void ManagerImpl::init(const std::string &config_file) parser.constructNativeData(); loadAccountMap(parser); } catch (const Conf::YamlParserException &e) { - ERROR("Manager: %s", e.what()); + ERROR("%s", e.what()); fflush(stderr); loadDefaultAccountMap(); } @@ -122,7 +122,7 @@ void ManagerImpl::init(const std::string &config_file) void ManagerImpl::terminate() { std::vector<std::string> callList(getCallList()); - DEBUG("Manager: Hangup %zu remaining call", callList.size()); + DEBUG("Hangup %zu remaining call", callList.size()); for (std::vector<std::string>::iterator iter = callList.begin(); iter != callList.end(); ++iter) @@ -177,17 +177,17 @@ bool ManagerImpl::outgoingCall(const std::string& account_id, const std::string& conf_id) { if (call_id.empty()) { - DEBUG("Manager: New outgoing call abort, missing callid"); + DEBUG("New outgoing call abort, missing callid"); return false; } // Call ID must be unique if (not getAccountFromCall(call_id).empty()) { - ERROR("Manager: Error: Call id already exists in outgoing call"); + ERROR("Call id already exists in outgoing call"); return false; } - DEBUG("Manager: New outgoing call %s to %s", call_id.c_str(), to.c_str()); + DEBUG("New outgoing call %s to %s", call_id.c_str(), to.c_str()); stopTone(); @@ -199,7 +199,7 @@ bool ManagerImpl::outgoingCall(const std::string& account_id, // in any cases we have to detach from current communication if (hasCurrentCall()) { - DEBUG("Manager: Has current call (%s) put it onhold", current_call_id.c_str()); + DEBUG("Has current call (%s) put it onhold", current_call_id.c_str()); // if this is not a conferenceand this and is not a conference participant if (not isConference(current_call_id) and not isConferenceParticipant(current_call_id)) @@ -208,12 +208,12 @@ bool ManagerImpl::outgoingCall(const std::string& account_id, detachParticipant(MainBuffer::DEFAULT_ID, current_call_id); } - DEBUG("Manager: Selecting account %s", account_id.c_str()); + DEBUG("Selecting account %s", account_id.c_str()); // fallback using the default sip account if the specied doesn't exist std::string use_account_id = ""; if (!accountExists(account_id)) { - WARN("Manager: Account does not exist, trying with default SIP account"); + WARN("Account does not exist, trying with default SIP account"); use_account_id = SIPAccount::IP2IP_PROFILE; } else { @@ -222,7 +222,7 @@ bool ManagerImpl::outgoingCall(const std::string& account_id, // Is this account exist if (!associateCallToAccount(call_id, use_account_id)) - WARN("Manager: Warning: Could not associate call id %s to account id %s", call_id.c_str(), use_account_id.c_str()); + WARN("Could not associate call id %s to account id %s", call_id.c_str(), use_account_id.c_str()); try { Call *call = getAccountLink(account_id)->newOutgoingCall(call_id, to_cleaned); @@ -230,7 +230,7 @@ bool ManagerImpl::outgoingCall(const std::string& account_id, call->setConfId(conf_id); } catch (const VoipLinkException &e) { callFailure(call_id); - ERROR("Manager: %s", e.what()); + ERROR("%s", e.what()); return false; } @@ -242,7 +242,7 @@ bool ManagerImpl::outgoingCall(const std::string& account_id, //THREAD=Main : for outgoing Call bool ManagerImpl::answerCall(const std::string& call_id) { - DEBUG("Manager: Answer call %s", call_id.c_str()); + DEBUG("Answer call %s", call_id.c_str()); // If sflphone is ringing stopTone(); @@ -255,20 +255,20 @@ bool ManagerImpl::answerCall(const std::string& call_id) Call *call = getAccountLink(account_id)->getCall(call_id); if (call == NULL) { - ERROR("Manager: Error: Call is null"); + ERROR("Call is NULL"); } // in any cases we have to detach from current communication if (hasCurrentCall()) { - DEBUG("Manager: Currently conversing with %s", current_call_id.c_str()); + DEBUG("Currently conversing with %s", current_call_id.c_str()); if (not isConference(current_call_id) and not isConferenceParticipant(current_call_id)) { - DEBUG("Manager: Answer call: Put the current call (%s) on hold", current_call_id.c_str()); + DEBUG("Answer call: Put the current call (%s) on hold", current_call_id.c_str()); onHoldCall(current_call_id); } else if (isConference(current_call_id) and not isConferenceParticipant(call_id)) { // if we are talking to a conference and we are answering an incoming call - DEBUG("Manager: Detach main participant from conference"); + DEBUG("Detach main participant from conference"); detachParticipant(MainBuffer::DEFAULT_ID, current_call_id); } } @@ -276,7 +276,7 @@ bool ManagerImpl::answerCall(const std::string& call_id) try { getAccountLink(account_id)->answer(call); } catch (const std::runtime_error &e) { - ERROR("Manager: Error: %s", e.what()); + ERROR("%s", e.what()); } // if it was waiting, it's waiting no more @@ -309,7 +309,7 @@ bool ManagerImpl::answerCall(const std::string& call_id) //THREAD=Main void ManagerImpl::hangupCall(const std::string& callId) { - DEBUG("Manager: Hangup call %s", callId.c_str()); + DEBUG("Hangup call %s", callId.c_str()); // store the current call id std::string currentCallId(getCurrentCallId()); @@ -317,11 +317,11 @@ void ManagerImpl::hangupCall(const std::string& callId) stopTone(); /* Broadcast a signal over DBus */ - DEBUG("Manager: Send DBUS call state change (HUNGUP) for id %s", callId.c_str()); + DEBUG("Send DBUS call state change (HUNGUP) for id %s", callId.c_str()); dbus_.getCallManager()->callStateChanged(callId, "HUNGUP"); if (not isValidCall(callId) and not isIPToIP(callId)) { - ERROR("Manager: Error: Could not hang up call, call not valid"); + ERROR("Could not hang up call, call not valid"); return; } @@ -365,7 +365,7 @@ void ManagerImpl::hangupCall(const std::string& callId) bool ManagerImpl::hangupConference(const std::string& id) { - DEBUG("Manager: Hangup conference %s", id.c_str()); + DEBUG("Hangup conference %s", id.c_str()); ConferenceMap::iterator iter_conf = conferenceMap_.find(id); @@ -379,7 +379,7 @@ bool ManagerImpl::hangupConference(const std::string& id) iter != participants.end(); ++iter) hangupCall(*iter); } else { - ERROR("Manager: No such conference %s", id.c_str()); + ERROR("No such conference %s", id.c_str()); return false; } } @@ -395,7 +395,7 @@ bool ManagerImpl::hangupConference(const std::string& id) //THREAD=Main void ManagerImpl::onHoldCall(const std::string& callId) { - DEBUG("Manager: Put call %s on hold", callId.c_str()); + DEBUG("Put call %s on hold", callId.c_str()); stopTone(); @@ -409,14 +409,14 @@ void ManagerImpl::onHoldCall(const std::string& callId) std::string account_id(getAccountFromCall(callId)); if (account_id.empty()) { - DEBUG("Manager: Account ID %s or callid %s doesn't exists in call onHold", account_id.c_str(), callId.c_str()); + DEBUG("Account ID %s or callid %s doesn't exists in call onHold", account_id.c_str(), callId.c_str()); return; } getAccountLink(account_id)->onhold(callId); } } catch (const VoipLinkException &e) { - ERROR("Manager: Error: %s", e.what()); + ERROR("%s", e.what()); } // Unbind calls in main buffer @@ -441,7 +441,7 @@ void ManagerImpl::offHoldCall(const std::string& callId) std::string accountId; std::string codecName; - DEBUG("Manager: Put call %s off hold", callId.c_str()); + DEBUG("Put call %s off hold", callId.c_str()); stopTone(); @@ -452,7 +452,7 @@ void ManagerImpl::offHoldCall(const std::string& callId) if (hasCurrentCall()) { if (not isConference(currentCallId) and not isConferenceParticipant(currentCallId)) { - DEBUG("Manager: Has current call (%s), put on hold", currentCallId.c_str()); + DEBUG("Has current call (%s), put on hold", currentCallId.c_str()); onHoldCall(currentCallId); } else if (isConference(currentCallId) and not isConferenceParticipant(callId)) detachParticipant(MainBuffer::DEFAULT_ID, currentCallId); @@ -466,7 +466,7 @@ void ManagerImpl::offHoldCall(const std::string& callId) /* Classic call, attached to an account */ accountId = getAccountFromCall(callId); - DEBUG("Manager: Setting offhold, Account %s, callid %s", accountId.c_str(), callId.c_str()); + DEBUG("Setting offhold, Account %s, callid %s", accountId.c_str(), callId.c_str()); Call * call = getAccountLink(accountId)->getCall(callId); @@ -586,7 +586,7 @@ void ManagerImpl::refuseCall(const std::string& id) Conference* ManagerImpl::createConference(const std::string& id1, const std::string& id2) { - DEBUG("Manager: Create conference with call %s and %s", id1.c_str(), id2.c_str()); + DEBUG("Create conference with call %s and %s", id1.c_str(), id2.c_str()); Conference* conf = new Conference; @@ -604,8 +604,8 @@ ManagerImpl::createConference(const std::string& id1, const std::string& id2) void ManagerImpl::removeConference(const std::string& conference_id) { - DEBUG("Manager: Remove conference %s", conference_id.c_str()); - DEBUG("Manager: number of participants: %u", conferenceMap_.size()); + DEBUG("Remove conference %s", conference_id.c_str()); + DEBUG("number of participants: %u", conferenceMap_.size()); ConferenceMap::iterator iter = conferenceMap_.find(conference_id); Conference* conf = 0; @@ -614,7 +614,7 @@ void ManagerImpl::removeConference(const std::string& conference_id) conf = iter->second; if (conf == NULL) { - ERROR("Manager: Error: Conference not found"); + ERROR("Conference not found"); return; } @@ -636,9 +636,9 @@ void ManagerImpl::removeConference(const std::string& conference_id) // Then remove the conference from the conference map if (conferenceMap_.erase(conference_id) == 1) - DEBUG("Manager: Conference %s removed successfully", conference_id.c_str()); + DEBUG("Conference %s removed successfully", conference_id.c_str()); else - ERROR("Manager: Error: Cannot remove conference: %s", conference_id.c_str()); + ERROR("Cannot remove conference: %s", conference_id.c_str()); delete conf; } @@ -723,11 +723,11 @@ bool ManagerImpl::isConferenceParticipant(const std::string& call_id) void ManagerImpl::addParticipant(const std::string& callId, const std::string& conferenceId) { - DEBUG("Manager: Add participant %s to %s", callId.c_str(), conferenceId.c_str()); + DEBUG("Add participant %s to %s", callId.c_str(), conferenceId.c_str()); ConferenceMap::iterator iter = conferenceMap_.find(conferenceId); if (iter == conferenceMap_.end()) { - ERROR("Manager: Error: Conference id is not valid"); + ERROR("Conference id is not valid"); return; } @@ -735,7 +735,7 @@ void ManagerImpl::addParticipant(const std::string& callId, const std::string& c Call *call = getAccountLink(currentAccountId)->getCall(callId); if (call == NULL) { - ERROR("Manager: Error: Call id is not valid"); + ERROR("Call id is not valid"); return; } @@ -783,7 +783,7 @@ void ManagerImpl::addParticipant(const std::string& callId, const std::string& c ParticipantSet participants(conf->getParticipantList()); if (participants.empty()) - ERROR("Manager: Error: Participant list is empty for this conference"); + ERROR("Participant list is empty for this conference"); // reset ring buffer for all conference participant // flush conference participants only @@ -832,7 +832,7 @@ void ManagerImpl::addMainParticipant(const std::string& conference_id) else if (conf->getState() == Conference::ACTIVE_DETACHED_REC) conf->setState(Conference::ACTIVE_ATTACHED_REC); else - WARN("Manager: Warning: Invalid conference state while adding main participant"); + WARN("Invalid conference state while adding main participant"); dbus_.getCallManager()->conferenceChanged(conference_id, conf->getStateStr()); } @@ -843,13 +843,13 @@ void ManagerImpl::addMainParticipant(const std::string& conference_id) void ManagerImpl::joinParticipant(const std::string& callId1, const std::string& callId2) { - DEBUG("Manager: Join participants %s, %s", callId1.c_str(), callId2.c_str()); + DEBUG("Join participants %s, %s", callId1.c_str(), callId2.c_str()); std::map<std::string, std::string> call1Details(getCallDetails(callId1)); std::map<std::string, std::string> call2Details(getCallDetails(callId2)); std::string current_call_id(getCurrentCallId()); - DEBUG("Manager: Current Call ID %s", current_call_id.c_str()); + DEBUG("Current Call ID %s", current_call_id.c_str()); // detach from the conference and switch to this conference if ((current_call_id != callId1) and (current_call_id != callId2)) { @@ -867,7 +867,7 @@ void ManagerImpl::joinParticipant(const std::string& callId1, const std::string& Call *call1 = getAccountLink(currentAccountId1)->getCall(callId1); if (call1 == NULL) { - ERROR("Manager: Could not find call %s", callId1.c_str()); + ERROR("Could not find call %s", callId1.c_str()); return; } @@ -879,7 +879,7 @@ void ManagerImpl::joinParticipant(const std::string& callId1, const std::string& Call *call2 = getAccountLink(currentAccountId2)->getCall(callId2); if (call2 == NULL) { - ERROR("Manager: Could not find call %s", callId2.c_str()); + ERROR("Could not find call %s", callId2.c_str()); return; } @@ -888,7 +888,7 @@ void ManagerImpl::joinParticipant(const std::string& callId1, const std::string& // Process call1 according to its state std::string call1_state_str(call1Details.find("CALL_STATE")->second); - DEBUG("Manager: Process call %s state: %s", callId1.c_str(), call1_state_str.c_str()); + DEBUG("Process call %s state: %s", callId1.c_str(), call1_state_str.c_str()); if (call1_state_str == "HOLD") { conf->bindParticipant(callId1); @@ -904,11 +904,11 @@ void ManagerImpl::joinParticipant(const std::string& callId1, const std::string& conf->bindParticipant(callId1); answerCall(callId1); } else - WARN("Manager: Call state not recognized"); + WARN("Call state not recognized"); // Process call2 according to its state std::string call2_state_str(call2Details.find("CALL_STATE")->second); - DEBUG("Manager: Process call %s state: %s", callId2.c_str(), call2_state_str.c_str()); + DEBUG("Process call %s state: %s", callId2.c_str(), call2_state_str.c_str()); if (call2_state_str == "HOLD") { conf->bindParticipant(callId2); @@ -924,7 +924,7 @@ void ManagerImpl::joinParticipant(const std::string& callId1, const std::string& conf->bindParticipant(callId2); answerCall(callId2); } else - WARN("Manager: Call state not recognized"); + WARN("Call state not recognized"); // Switch current call id to this conference switchCall(conf->getConfID()); @@ -944,7 +944,7 @@ void ManagerImpl::createConfFromParticipantList(const std::vector< std::string > { // we must at least have 2 participant for a conference if (participantList.size() <= 1) { - ERROR("Manager: Error: Participant number must be higher or equal to 2"); + ERROR("Participant number must be higher or equal to 2"); return; } @@ -997,7 +997,7 @@ void ManagerImpl::createConfFromParticipantList(const std::vector< std::string > void ManagerImpl::detachParticipant(const std::string& call_id, const std::string& current_id) { - DEBUG("Manager: Detach participant %s (current id: %s)", call_id.c_str(), + DEBUG("Detach participant %s (current id: %s)", call_id.c_str(), current_id.c_str()); std::string current_call_id(getCurrentCallId()); @@ -1006,14 +1006,14 @@ void ManagerImpl::detachParticipant(const std::string& call_id, Call *call = getAccountLink(currentAccountId)->getCall(call_id); if (call == NULL) { - ERROR("Manager: Error: Could not find call %s", call_id.c_str()); + ERROR("Could not find call %s", call_id.c_str()); return; } Conference *conf = getConferenceFromCallID(call_id); if (conf == NULL) { - ERROR("Manager: Error: Call is not conferencing, cannot detach"); + ERROR("Call is not conferencing, cannot detach"); return; } @@ -1021,7 +1021,7 @@ void ManagerImpl::detachParticipant(const std::string& call_id, std::map<std::string, std::string>::iterator iter_details(call_details.find("CALL_STATE")); if (iter_details == call_details.end()) { - ERROR("Manager: Error: Could not find CALL_STATE"); + ERROR("Could not find CALL_STATE"); return; } @@ -1033,25 +1033,25 @@ void ManagerImpl::detachParticipant(const std::string& call_id, // Conference may have been deleted and set to 0 above processRemainingParticipants(current_call_id, conf); if (conf == 0) { - ERROR("Manager: Error: Call is not conferencing, cannot detach"); + ERROR("Call is not conferencing, cannot detach"); return; } } dbus_.getCallManager()->conferenceChanged(conf->getConfID(), conf->getStateStr()); } else { - DEBUG("Manager: Unbind main participant from conference %d"); + DEBUG("Unbind main participant from conference %d"); getMainBuffer()->unBindAll(MainBuffer::DEFAULT_ID); if (not isConference(current_call_id)) { - ERROR("Manager: Warning: Current call id (%s) is not a conference", current_call_id.c_str()); + ERROR("Current call id (%s) is not a conference", current_call_id.c_str()); return; } ConferenceMap::iterator iter = conferenceMap_.find(current_call_id); if (iter == conferenceMap_.end() or iter->second == 0) { - DEBUG("Manager: Error: Conference is NULL"); + DEBUG("Conference is NULL"); return; } Conference *conf = iter->second; @@ -1061,7 +1061,7 @@ void ManagerImpl::detachParticipant(const std::string& call_id, else if (conf->getState() == Conference::ACTIVE_ATTACHED_REC) conf->setState(Conference::ACTIVE_DETACHED_REC); else - WARN("Manager: Warning: Undefined behavior, invalid conference state in detach participant"); + WARN("Undefined behavior, invalid conference state in detach participant"); dbus_.getCallManager()->conferenceChanged(conf->getConfID(), conf->getStateStr()); @@ -1072,7 +1072,7 @@ void ManagerImpl::detachParticipant(const std::string& call_id, void ManagerImpl::removeParticipant(const std::string& call_id) { - DEBUG("Manager: Remove participant %s", call_id.c_str()); + DEBUG("Remove participant %s", call_id.c_str()); // this call is no more a conference participant const std::string currentAccountId(getAccountFromCall(call_id)); @@ -1082,12 +1082,12 @@ void ManagerImpl::removeParticipant(const std::string& call_id) ConferenceMap::const_iterator iter = conf_map.find(call->getConfId()); if (iter == conf_map.end() or iter->second == 0) { - ERROR("Manager: Error: No conference with id %s, cannot remove participant", call->getConfId().c_str()); + ERROR("No conference with id %s, cannot remove participant", call->getConfId().c_str()); return; } Conference *conf = iter->second; - DEBUG("Manager: Remove participant %s", call_id.c_str()); + DEBUG("Remove participant %s", call_id.c_str()); conf->remove(call_id); call->setConfId(""); @@ -1100,7 +1100,7 @@ void ManagerImpl::processRemainingParticipants(const std::string ¤t_call_i { ParticipantSet participants(conf->getParticipantList()); size_t n = participants.size(); - DEBUG("Manager: Process remaining %d participant(s) from conference %s", + DEBUG("Process remaining %d participant(s) from conference %s", n, conf->getConfID().c_str()); if (n > 1) { @@ -1131,7 +1131,7 @@ void ManagerImpl::processRemainingParticipants(const std::string ¤t_call_i removeConference(conf->getConfID()); conf = 0; } else { - DEBUG("Manager: No remaining participants, remove conference"); + DEBUG("No remaining participants, remove conference"); removeConference(conf->getConfID()); conf = 0; switchCall(""); @@ -1144,12 +1144,12 @@ void ManagerImpl::joinConference(const std::string& conf_id1, ConferenceMap::iterator iter(conferenceMap_.find(conf_id1)); if (iter == conferenceMap_.end()) { - ERROR("Manager: Error: Not a valid conference ID: %s", conf_id1.c_str()); + ERROR("Not a valid conference ID: %s", conf_id1.c_str()); return; } if (conferenceMap_.find(conf_id2) != conferenceMap_.end()) { - ERROR("Manager: Error: Not a valid conference ID: %s", conf_id2.c_str()); + ERROR("Not a valid conference ID: %s", conf_id2.c_str()); return; } @@ -1167,13 +1167,13 @@ void ManagerImpl::joinConference(const std::string& conf_id1, void ManagerImpl::addStream(const std::string& call_id) { - DEBUG("Manager: Add audio stream %s", call_id.c_str()); + DEBUG("Add audio stream %s", call_id.c_str()); std::string currentAccountId(getAccountFromCall(call_id)); Call *call = getAccountLink(currentAccountId)->getCall(call_id); if (call and isConferenceParticipant(call_id)) { - DEBUG("Manager: Add stream to conference"); + DEBUG("Add stream to conference"); // bind to conference participant ConferenceMap::iterator iter = conferenceMap_.find(call->getConfId()); @@ -1194,7 +1194,7 @@ void ManagerImpl::addStream(const std::string& call_id) } } else { - DEBUG("Manager: Add stream to call"); + DEBUG("Add stream to call"); // bind to main getMainBuffer()->bindCallID(call_id, MainBuffer::DEFAULT_ID); @@ -1209,7 +1209,7 @@ void ManagerImpl::addStream(const std::string& call_id) void ManagerImpl::removeStream(const std::string& call_id) { - DEBUG("Manager: Remove audio stream %s", call_id.c_str()); + DEBUG("Remove audio stream %s", call_id.c_str()); getMainBuffer()->unBindAll(call_id); getMainBuffer()->stateInfo(); } @@ -1217,7 +1217,7 @@ void ManagerImpl::removeStream(const std::string& call_id) //THREAD=Main void ManagerImpl::saveConfig() { - DEBUG("Manager: Saving Configuration to XDG directory %s", path_.c_str()); + DEBUG("Saving Configuration to XDG directory %s", path_.c_str()); AudioLayer *audiolayer = getAudioDriver(); if (audiolayer != NULL) { audioPreference.setVolumemic(audiolayer->getCaptureGain()); @@ -1257,7 +1257,7 @@ void ManagerImpl::playDtmf(char code) stopTone(); if (not voipPreferences.getPlayDtmf()) { - DEBUG("Manager: playDtmf: Do not have to play a tone..."); + DEBUG("Do not have to play a tone..."); return; } @@ -1265,7 +1265,7 @@ void ManagerImpl::playDtmf(char code) int pulselen = voipPreferences.getPulseLength(); if (pulselen == 0) { - DEBUG("Manager: playDtmf: Pulse length is not set..."); + DEBUG("Pulse length is not set..."); return; } @@ -1276,7 +1276,7 @@ void ManagerImpl::playDtmf(char code) // fast return, no sound, so no dtmf if (audiodriver_ == NULL || dtmfKey_.get() == 0) { - DEBUG("Manager: playDtmf: Error no audio layer..."); + DEBUG("No audio layer..."); return; } @@ -1385,12 +1385,12 @@ void ManagerImpl::incomingMessage(const std::string& callID, std::string accountId(getAccountFromCall(*iter_p)); - DEBUG("Manager: Send message to %s, (%s)", (*iter_p).c_str(), accountId.c_str()); + DEBUG("Send message to %s, (%s)", (*iter_p).c_str(), accountId.c_str()); Account *account = getAccount(accountId); if (!account) { - ERROR("Manager: Failed to get account while sending instant message"); + ERROR("Failed to get account while sending instant message"); return; } @@ -1409,7 +1409,7 @@ void ManagerImpl::incomingMessage(const std::string& callID, bool ManagerImpl::sendTextMessage(const std::string& callID, const std::string& message, const std::string& from) { if (isConference(callID)) { - DEBUG("Manager: Is a conference, send instant message to everyone"); + DEBUG("Is a conference, send instant message to everyone"); ConferenceMap::iterator it = conferenceMap_.find(callID); if (it == conferenceMap_.end()) @@ -1430,7 +1430,7 @@ bool ManagerImpl::sendTextMessage(const std::string& callID, const std::string& Account *account = getAccount(accountId); if (!account) { - DEBUG("Manager: Failed to get account while sending instant message"); + DEBUG("Failed to get account while sending instant message"); return false; } @@ -1441,7 +1441,7 @@ bool ManagerImpl::sendTextMessage(const std::string& callID, const std::string& } if (isConferenceParticipant(callID)) { - DEBUG("Manager: Call is participant in a conference, send instant message to everyone"); + DEBUG("Call is participant in a conference, send instant message to everyone"); Conference *conf = getConferenceFromCallID(callID); if (!conf) @@ -1457,7 +1457,7 @@ bool ManagerImpl::sendTextMessage(const std::string& callID, const std::string& Account *account = getAccount(accountId); if (!account) { - DEBUG("Manager: Failed to get account while sending instant message"); + DEBUG("Failed to get account while sending instant message"); return false; } @@ -1467,7 +1467,7 @@ bool ManagerImpl::sendTextMessage(const std::string& callID, const std::string& Account *account = getAccount(getAccountFromCall(callID)); if (!account) { - DEBUG("Manager: Failed to get account while sending instant message"); + DEBUG("Failed to get account while sending instant message"); return false; } @@ -1480,7 +1480,7 @@ bool ManagerImpl::sendTextMessage(const std::string& callID, const std::string& //THREAD=VoIP CALL=Outgoing void ManagerImpl::peerAnsweredCall(const std::string& id) { - DEBUG("Manager: Peer answered call %s", id.c_str()); + DEBUG("Peer answered call %s", id.c_str()); // The if statement is usefull only if we sent two calls at the same time. if (isCurrentCall(id)) @@ -1505,7 +1505,7 @@ void ManagerImpl::peerAnsweredCall(const std::string& id) //THREAD=VoIP Call=Outgoing void ManagerImpl::peerRingingCall(const std::string& id) { - DEBUG("Manager: Peer call %s ringing", id.c_str()); + DEBUG("Peer call %s ringing", id.c_str()); if (isCurrentCall(id)) ringback(); @@ -1516,7 +1516,7 @@ void ManagerImpl::peerRingingCall(const std::string& id) //THREAD=VoIP Call=Outgoing/Ingoing void ManagerImpl::peerHungupCall(const std::string& call_id) { - DEBUG("Manager: Peer hungup call %s", call_id.c_str()); + DEBUG("Peer hungup call %s", call_id.c_str()); if (isConferenceParticipant(call_id)) { Conference *conf = getConferenceFromCallID(call_id); @@ -1554,7 +1554,7 @@ void ManagerImpl::peerHungupCall(const std::string& call_id) removeStream(call_id); if (getCallList().empty()) { - DEBUG("Manager: Stop audio stream, there are no calls remaining"); + DEBUG("Stop audio stream, there are no calls remaining"); ost::MutexLock lock(audioLayerMutex_); audiodriver_->stopStream(); } @@ -1563,7 +1563,7 @@ void ManagerImpl::peerHungupCall(const std::string& call_id) //THREAD=VoIP void ManagerImpl::callBusy(const std::string& id) { - DEBUG("Manager: Call %s busy", id.c_str()); + DEBUG("Call %s busy", id.c_str()); dbus_.getCallManager()->callStateChanged(id, "BUSY"); if (isCurrentCall(id)) { @@ -1586,11 +1586,11 @@ void ManagerImpl::callFailure(const std::string& call_id) } if (isConferenceParticipant(call_id)) { - DEBUG("Manager: Call %s participating in a conference failed", call_id.c_str()); + DEBUG("Call %s participating in a conference failed", call_id.c_str()); Conference *conf = getConferenceFromCallID(call_id); if (conf == NULL) { - ERROR("Manager: Could not retreive conference from call id %s", call_id.c_str()); + ERROR("Could not retreive conference from call id %s", call_id.c_str()); return; } @@ -1622,7 +1622,7 @@ void ManagerImpl::playATone(Tone::TONEID toneId) ost::MutexLock lock(audioLayerMutex_); if (audiodriver_ == NULL) { - ERROR("Manager: Error: Audio layer not initialized"); + ERROR("Audio layer not initialized"); return; } @@ -1696,7 +1696,7 @@ void ManagerImpl::ringtone(const std::string& accountID) Account *account = getAccount(accountID); if (!account) { - WARN("Manager: Warning: invalid account in ringtone"); + WARN("Invalid account in ringtone"); return; } @@ -1719,7 +1719,7 @@ void ManagerImpl::ringtone(const std::string& accountID) ost::MutexLock lock(audioLayerMutex_); if (!audiodriver_) { - ERROR("Manager: Error: no audio layer in ringtone"); + ERROR("no audio layer in ringtone"); return; } @@ -1747,7 +1747,7 @@ void ManagerImpl::ringtone(const std::string& accountID) audiofile_.reset(new RawFile(ringchoice, static_cast<sfl::AudioCodec *>(codec), samplerate)); } } catch (const AudioFileException &e) { - ERROR("Manager: Exception: %s", e.what()); + ERROR("Exception: %s", e.what()); } } // leave mutex @@ -1966,7 +1966,7 @@ int ManagerImpl::isRingtoneEnabled(const std::string& id) Account *account = getAccount(id); if (!account) { - WARN("Manager: Warning: invalid account in ringtone enabled"); + WARN("Invalid account in ringtone enabled"); return 0; } @@ -1978,7 +1978,7 @@ void ManagerImpl::ringtoneEnabled(const std::string& id) Account *account = getAccount(id); if (!account) { - WARN("Manager: Warning: invalid account in ringtone enabled"); + WARN("Invalid account in ringtone enabled"); return; } @@ -1992,7 +1992,7 @@ std::string ManagerImpl::getRecordPath() const void ManagerImpl::setRecordPath(const std::string& recPath) { - DEBUG("Manager: Set record path %s", recPath.c_str()); + DEBUG("Set record path %s", recPath.c_str()); audioPreference.setRecordpath(recPath); } @@ -2012,11 +2012,11 @@ void ManagerImpl::setRecordingCall(const std::string& id) ConferenceMap::const_iterator it(conferenceMap_.find(id)); if (it == conferenceMap_.end()) { - DEBUG("Manager: Set recording for call %s", id.c_str()); + DEBUG("Set recording for call %s", id.c_str()); std::string accountid(getAccountFromCall(id)); rec = getAccountLink(accountid)->getCall(id); } else { - DEBUG("Manager: Set recording for conference %s", id.c_str()); + DEBUG("Set recording for conference %s", id.c_str()); Conference *conf = it->second; if (conf) { @@ -2029,7 +2029,7 @@ void ManagerImpl::setRecordingCall(const std::string& id) } if (rec == NULL) { - ERROR("Manager: Error: Could not find recordable instance %s", id.c_str()); + ERROR("Could not find recordable instance %s", id.c_str()); return; } @@ -2046,14 +2046,14 @@ bool ManagerImpl::isRecording(const std::string& id) bool ManagerImpl::startRecordedFilePlayback(const std::string& filepath) { - DEBUG("Manager: Start recorded file playback %s", filepath.c_str()); + DEBUG("Start recorded file playback %s", filepath.c_str()); int sampleRate; { ost::MutexLock lock(audioLayerMutex_); if (!audiodriver_) { - ERROR("Manager: Error: No audio layer in start recorded file playback"); + ERROR("No audio layer in start recorded file playback"); return false; } @@ -2071,7 +2071,7 @@ bool ManagerImpl::startRecordedFilePlayback(const std::string& filepath) try { audiofile_.reset(new WaveFile(filepath, sampleRate)); } catch (const AudioFileException &e) { - ERROR("Manager: Exception: %s", e.what()); + ERROR("Exception: %s", e.what()); } } // release toneMutex @@ -2084,7 +2084,7 @@ bool ManagerImpl::startRecordedFilePlayback(const std::string& filepath) void ManagerImpl::stopRecordedFilePlayback(const std::string& filepath) { - DEBUG("Manager: Stop recorded file playback %s", filepath.c_str()); + DEBUG("Stop recorded file playback %s", filepath.c_str()); { ost::MutexLock lock(audioLayerMutex_); @@ -2099,7 +2099,7 @@ void ManagerImpl::stopRecordedFilePlayback(const std::string& filepath) void ManagerImpl::setHistoryLimit(int days) { - DEBUG("Manager: Set history limit"); + DEBUG("Set history limit"); preferences.setHistoryLimit(days); saveConfig(); } @@ -2116,7 +2116,7 @@ int32_t ManagerImpl::getMailNotify() const void ManagerImpl::setMailNotify() { - DEBUG("Manager: Set mail notify"); + DEBUG("Set mail notify"); preferences.getNotifyMails() ? preferences.setNotifyMails(true) : preferences.setNotifyMails(false); saveConfig(); } @@ -2130,7 +2130,7 @@ void ManagerImpl::setAudioManager(const std::string &api) return; if (api == audioPreference.getAudioApi()) { - DEBUG("Manager: Audio manager chosen already in use. No changes made. "); + DEBUG("Audio manager chosen already in use. No changes made. "); return; } } @@ -2153,7 +2153,7 @@ int ManagerImpl::getAudioDeviceIndex(const std::string &name) ost::MutexLock lock(audioLayerMutex_); if (audiodriver_ == NULL) { - ERROR("Manager: Error: Audio layer not initialized"); + ERROR("Audio layer not initialized"); return soundCardIndex; } @@ -2237,7 +2237,7 @@ void ManagerImpl::audioSamplingRateChanged(int samplerate) ost::MutexLock lock(audioLayerMutex_); if (!audiodriver_) { - DEBUG("Manager: No Audio driver initialized"); + DEBUG("No Audio driver initialized"); return; } @@ -2245,10 +2245,10 @@ void ManagerImpl::audioSamplingRateChanged(int samplerate) int currentSamplerate = mainBuffer_.getInternalSamplingRate(); if (currentSamplerate >= samplerate) { - DEBUG("Manager: No need to update audio layer sampling rate"); + DEBUG("No need to update audio layer sampling rate"); return; } else - DEBUG("Manager: Audio sampling rate changed: %d -> %d", currentSamplerate, samplerate); + DEBUG("Audio sampling rate changed: %d -> %d", currentSamplerate, samplerate); bool wasActive = audiodriver_->isStarted(); @@ -2291,7 +2291,7 @@ void ManagerImpl::setConfig(const std::string& section, void ManagerImpl::setAccountsOrder(const std::string& order) { - DEBUG("Manager: Set accounts order : %s", order.c_str()); + DEBUG("Set accounts order : %s", order.c_str()); // Set the new config preferences.setAccountOrder(order); @@ -2313,7 +2313,7 @@ std::vector<std::string> ManagerImpl::getAccountList() const if (ip2ip_iter->second) v.push_back(ip2ip_iter->second->getAccountID()); else - ERROR("Manager: could not find IP2IP profile in getAccount list"); + ERROR("could not find IP2IP profile in getAccount list"); // If no order has been set, load the default one ie according to the creation date. if (account_order.empty()) { @@ -2347,7 +2347,7 @@ std::map<std::string, std::string> ManagerImpl::getAccountDetails( static const SIPAccount DEFAULT_ACCOUNT("default"); if (accountID.empty()) { - DEBUG("Manager: Returning default account settings"); + DEBUG("Returning default account settings"); return DEFAULT_ACCOUNT.getAccountDetails(); } @@ -2360,7 +2360,7 @@ std::map<std::string, std::string> ManagerImpl::getAccountDetails( if (account) return account->getAccountDetails(); else { - DEBUG("Manager: Get account details on a non-existing accountID %s. Returning default", accountID.c_str()); + DEBUG("Get account details on a non-existing accountID %s. Returning default", accountID.c_str()); return DEFAULT_ACCOUNT.getAccountDetails(); } } @@ -2371,12 +2371,12 @@ std::map<std::string, std::string> ManagerImpl::getAccountDetails( void ManagerImpl::setAccountDetails(const std::string& accountID, const std::map<std::string, std::string>& details) { - DEBUG("Manager: Set account details for %s", accountID.c_str()); + DEBUG("Set account details for %s", accountID.c_str()); Account* account = getAccount(accountID); if (account == NULL) { - ERROR("Manager: Error: Could not find account %s", accountID.c_str()); + ERROR("Could not find account %s", accountID.c_str()); return; } @@ -2394,7 +2394,8 @@ void ManagerImpl::setAccountDetails(const std::string& accountID, dbus_.getConfigurationManager()->accountsChanged(); } -std::string ManagerImpl::addAccount(const std::map<std::string, std::string>& details) +std::string +ManagerImpl::addAccount(const std::map<std::string, std::string>& details) { /** @todo Deal with both the accountMap_ and the Configuration */ std::stringstream accountID; @@ -2405,7 +2406,7 @@ std::string ManagerImpl::addAccount(const std::map<std::string, std::string>& de // Get the type std::string accountType((*details.find(CONFIG_ACCOUNT_TYPE)).second); - DEBUG("Manager: Adding account %s", newAccountID.c_str()); + DEBUG("Adding account %s", newAccountID.c_str()); /** @todo Verify the uniqueness, in case a program adds accounts, two in a row. */ @@ -2440,7 +2441,7 @@ std::string ManagerImpl::addAccount(const std::map<std::string, std::string>& de preferences.setAccountOrder(accountList); } - DEBUG("AccountMap: %s", accountList.c_str()); + DEBUG("Getting accounts: %s", accountList.c_str()); newAccount->registerVoIPLink(); @@ -2480,7 +2481,7 @@ bool ManagerImpl::associateCallToAccount(const std::string& callID, // account id exist in AccountMap ost::MutexLock m(callAccountMapMutex_); callAccountMap_[callID] = accountID; - DEBUG("Manager: Associate Call %s with Account %s", callID.data(), accountID.data()); + DEBUG("Associate Call %s with Account %s", callID.data(), accountID.data()); return true; } @@ -2675,14 +2676,14 @@ ManagerImpl::getAccount(const std::string& accountID) std::string ManagerImpl::getAccountIdFromNameAndServer(const std::string& userName, const std::string& server) const { - DEBUG("Manager : username = %s, server = %s", userName.c_str(), server.c_str()); + DEBUG("username = %s, server = %s", userName.c_str(), server.c_str()); // Try to find the account id from username and server name by full match for (AccountMap::const_iterator iter = accountMap_.begin(); iter != accountMap_.end(); ++iter) { SIPAccount *account = dynamic_cast<SIPAccount *>(iter->second); if (account and account->isEnabled() and account->fullMatch(userName, server)) { - DEBUG("Manager: Matching account id in request is a fullmatch %s@%s", userName.c_str(), server.c_str()); + DEBUG("Matching account id in request is a fullmatch %s@%s", userName.c_str(), server.c_str()); return iter->first; } } @@ -2692,7 +2693,7 @@ std::string ManagerImpl::getAccountIdFromNameAndServer(const std::string& userNa SIPAccount *account = dynamic_cast<SIPAccount *>(iter->second); if (account and account->isEnabled() and account->hostnameMatch(server)) { - DEBUG("Manager: Matching account id in request with hostname %s", server.c_str()); + DEBUG("Matching account id in request with hostname %s", server.c_str()); return iter->first; } } @@ -2702,13 +2703,12 @@ std::string ManagerImpl::getAccountIdFromNameAndServer(const std::string& userNa SIPAccount *account = dynamic_cast<SIPAccount *>(iter->second); if (account and account->isEnabled() and account->userMatch(userName)) { - DEBUG("Manager: Matching account id in request with username %s", userName.c_str()); + DEBUG("Matching account id in request with username %s", userName.c_str()); return iter->first; } } - DEBUG("Manager: Username %s or server %s doesn't match any account, using IP2IP", userName.c_str(), server.c_str()); - + DEBUG("Username %s or server %s doesn't match any account, using IP2IP", userName.c_str(), server.c_str()); return ""; } @@ -2789,7 +2789,7 @@ std::map<std::string, std::string> ManagerImpl::getCallDetails(const std::string call_details["CALL_STATE"] = call->getStateStr(); call_details["CALL_TYPE"] = type.str(); } else { - ERROR("Manager: Error: getCallDetails()"); + ERROR("Call is NULL"); call_details["ACCOUNTID"] = ""; call_details["PEER_NUMBER"] = "Unknown"; call_details["PEER_NAME"] = "Unknown"; @@ -2852,7 +2852,7 @@ std::vector<std::string> ManagerImpl::getParticipantList(const std::string& conf const ParticipantSet participants(iter_conf->second->getParticipantList()); std::copy(participants.begin(), participants.end(), std::back_inserter(v));; } else - WARN("Manager: Warning: Did not find conference %s", confID.c_str()); + WARN("Did not find conference %s", confID.c_str()); return v; } @@ -2860,7 +2860,7 @@ std::vector<std::string> ManagerImpl::getParticipantList(const std::string& conf void ManagerImpl::saveHistory() { if (!history_.save()) - ERROR("Manager: could not save history!"); + ERROR("Could not save history!"); } void ManagerImpl::clearHistory() diff --git a/daemon/src/voiplink.cpp b/daemon/src/voiplink.cpp index d46954f14a..0fb2432a64 100644 --- a/daemon/src/voiplink.cpp +++ b/daemon/src/voiplink.cpp @@ -61,7 +61,7 @@ void VoIPLink::removeCall(const std::string& id) { ost::MutexLock m(callMapMutex_); - DEBUG("VoipLink: removing call %s from list", id.c_str()); + DEBUG("Removing call %s from list", id.c_str()); delete callMap_[id]; callMap_.erase(id); -- GitLab