Skip to content
Snippets Groups Projects
Commit c15fef2f authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #26295: sip: don't crash if transport could not be created

parent 8db484c8
Branches
Tags
No related merge requests found
...@@ -678,6 +678,7 @@ void SIPVoIPLink::sendRegister(Account *a) ...@@ -678,6 +678,7 @@ void SIPVoIPLink::sendRegister(Account *a)
std::string contact = account->getContactHeader(); std::string contact = account->getContactHeader();
pj_str_t pjContact = pj_str((char*) contact.c_str()); pj_str_t pjContact = pj_str((char*) contact.c_str());
if (account->transport_) {
if (account->isStunEnabled()) { if (account->isStunEnabled()) {
DEBUG("Setting VIA sent-by to %s:%u", account->transport_->local_name.host.ptr, account->transport_->local_name.port); DEBUG("Setting VIA sent-by to %s:%u", account->transport_->local_name.host.ptr, account->transport_->local_name.port);
if (pjsip_regc_set_via_sent_by(regc, &account->transport_->local_name, account->transport_) != PJ_SUCCESS) if (pjsip_regc_set_via_sent_by(regc, &account->transport_->local_name, account->transport_) != PJ_SUCCESS)
...@@ -687,6 +688,7 @@ void SIPVoIPLink::sendRegister(Account *a) ...@@ -687,6 +688,7 @@ void SIPVoIPLink::sendRegister(Account *a)
if (pjsip_regc_set_via_sent_by(regc, account->getViaAddr(), account->transport_) != PJ_SUCCESS) if (pjsip_regc_set_via_sent_by(regc, account->getViaAddr(), account->transport_) != PJ_SUCCESS)
throw VoipLinkException("Unable to set the \"sent-by\" field"); throw VoipLinkException("Unable to set the \"sent-by\" field");
} }
}
if (pjsip_regc_init(regc, &pjSrv, &pjFrom, &pjFrom, 1, &pjContact, account->getRegistrationExpire()) != PJ_SUCCESS) if (pjsip_regc_init(regc, &pjSrv, &pjFrom, &pjFrom, 1, &pjContact, account->getRegistrationExpire()) != PJ_SUCCESS)
throw VoipLinkException("Unable to initialize account registration structure"); throw VoipLinkException("Unable to initialize account registration structure");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment