Commit 248d0f18 authored by Tristan Matthews's avatar Tristan Matthews

* #9847: pass call by reference where possible

parent c7b08ada
......@@ -624,7 +624,7 @@ void IAXVoIPLink::iaxHandlePrecallEvent(iax_event* event)
// if peerNumber exist append it to the name string
call->initRecFilename(std::string(event->ies.calling_number));
Manager::instance().incomingCall(call, accountID_);
Manager::instance().incomingCall(*call, accountID_);
format = call->getFirstMatchingFormat(event->ies.format, accountID_);
......
......@@ -1348,38 +1348,37 @@ void ManagerImpl::removeWaitingCall(const std::string& id)
// Management of event peer IP-phone
////////////////////////////////////////////////////////////////////////////////
// SipEvent Thread
void ManagerImpl::incomingCall(Call* call, const std::string& accountId)
void ManagerImpl::incomingCall(Call &call, const std::string& accountId)
{
assert(call);
stopTone();
associateCallToAccount(call->getCallId(), accountId);
associateCallToAccount(call.getCallId(), accountId);
if (accountId.empty())
setIPToIPForCall(call->getCallId(), true);
setIPToIPForCall(call.getCallId(), true);
else {
// strip sip: which is not required and bring confusion with ip to ip calls
// when placing new call from history (if call is IAX, do nothing)
std::string peerNumber(call->getPeerNumber());
std::string peerNumber(call.getPeerNumber());
const char SIP_PREFIX[] = "sip:";
size_t startIndex = peerNumber.find(SIP_PREFIX);
if (startIndex != std::string::npos)
call->setPeerNumber(peerNumber.substr(startIndex + sizeof(SIP_PREFIX) - 1));
call.setPeerNumber(peerNumber.substr(startIndex + sizeof(SIP_PREFIX) - 1));
}
if (not hasCurrentCall()) {
call->setConnectionState(Call::RINGING);
call.setConnectionState(Call::RINGING);
ringtone(accountId);
}
addWaitingCall(call->getCallId());
addWaitingCall(call.getCallId());
std::string number(call->getPeerNumber());
std::string number(call.getPeerNumber());
std::string from("<" + number + ">");
dbus_.getCallManager()->incomingCall(accountId, call->getCallId(), call->getDisplayName() + " " + from);
dbus_.getCallManager()->incomingCall(accountId, call.getCallId(), call.getDisplayName() + " " + from);
}
......
......@@ -353,7 +353,7 @@ class ManagerImpl {
* @param call A call pointer
* @param accountId an account id
*/
void incomingCall(Call* call, const std::string& accountId);
void incomingCall(Call &call, const std::string& accountId);
/**
* Notify the user that the recipient of the call has answered and the put the
......
......@@ -349,7 +349,7 @@ pj_bool_t transaction_request_cb(pjsip_rx_data *rdata)
call->setConnectionState(Call::RINGING);
Manager::instance().incomingCall(call, account_id);
Manager::instance().incomingCall(*call, account_id);
Manager::instance().getAccountLink(account_id)->addCall(call);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment