Commit 604a080f authored by Ming Rui Zhang's avatar Ming Rui Zhang Committed by Adrien Béraud

sip: fix the issue when the endpoint request fails, system crashes

Change-Id: I434ed02a0a019a254c547b52ff134939ffa7d65d
parent d2132142
......@@ -2137,14 +2137,12 @@ SIPAccount::sendTextMessage(const std::string& to, const std::map<std::string, s
im::fillPJSIPMessageBody(*tdata, payloads);
// Send message request with callback onComplete
auto token = t.release();
status = pjsip_endpt_send_request(link_->getEndpoint(), tdata, -1, token, &onComplete);
// Send message request with callback SendMessageOnComplete
status = pjsip_endpt_send_request(link_->getEndpoint(), tdata, -1, t.release(), &onComplete);
if (status != PJ_SUCCESS) {
JAMI_ERR("Unable to send request: %s", sip_utils::sip_strerror(status).c_str());
messageEngine_.onMessageSent(to, id, false);
delete token;
return;
}
}
......@@ -2179,13 +2177,11 @@ SIPAccount::onComplete(void *token, pjsip_event *event)
cseq_hdr->cseq += 1;
// Resend request
auto data = c.release();
status = pjsip_endpt_send_request(acc->link_->getEndpoint(), new_request, -1, data, &onComplete);
status = pjsip_endpt_send_request(acc->link_->getEndpoint(), new_request, -1, c.release(), &onComplete);
if (status != PJ_SUCCESS) {
JAMI_ERR("Unable to send request: %s", sip_utils::sip_strerror(status).c_str());
acc->messageEngine_.onMessageSent(c->to, c->id, false);
delete data;
}
return;
}
......
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