Commit 8f6e9ac3 authored by Alexandre Savard's avatar Alexandre Savard

#9910: fix sending call with new transport

parent 904f7882
......@@ -793,7 +793,7 @@ void SIPAccount::setContactHeader(std::string address, std::string port)
std::string SIPAccount::getContactHeader() const
{
if (transport_ == NULL)
ERROR("Transport not created yet");
ERROR("SipAccount: Transport not created yet");
// The transport type must be specified, in our case START_OTHER refers to stun transport
pjsip_transport_type_e transportType = transportType_;
......
......@@ -457,7 +457,7 @@ SipTransport::createUdpTransport(const std::string &interface, unsigned int port
{
// init socket to bind this transport to
pj_uint16_t listeningPort = (pj_uint16_t) port;
pjsip_transport *transport;
pjsip_transport *transport = NULL;
DEBUG("SipTransport: Update UDP transport on %s:%d with public addr %s:%d", interface.c_str(), port, publicAddr.c_str(), publicPort);
......
......@@ -524,6 +524,9 @@ void SIPVoIPLink::sendRegister(Account *a)
account->setReceivedParameter("");
// Explicitely set the bound address port to 0 so that pjsip determine a random port by itself
account->transport_= sipTransport.createUdpTransport(account->getLocalInterface(), 0, received, account->getLocalPort());
if(account->transport_ == NULL) {
ERROR("UserAgent: Could not create new udp transport with public address: %s:%d", received.c_str(), account->getLocalPort());
}
}
if (pjsip_regc_init(regc, &pjSrv, &pjFrom, &pjFrom, 1, &pjContact, account->getRegistrationExpire()) != PJ_SUCCESS)
......@@ -1617,7 +1620,6 @@ void registration_cb(pjsip_regc_cbparam *param)
if (param->status != PJ_SUCCESS) {
account->setRegistrationState(ErrorAuth);
account->setRegister(false);
SIPVoIPLink::instance()->sipTransport.shutdownSipTransport(*account);
return;
}
......@@ -1633,29 +1635,33 @@ void registration_cb(pjsip_regc_cbparam *param)
case PJSIP_SC_SERVICE_UNAVAILABLE:
case PJSIP_SC_REQUEST_TIMEOUT:
account->setRegistrationState(ErrorHost);
account->setRegister(false);
SIPVoIPLink::instance()->sipTransport.shutdownSipTransport(*account);
break;
case PJSIP_SC_UNAUTHORIZED:
case PJSIP_SC_FORBIDDEN:
case PJSIP_SC_NOT_FOUND:
account->setRegistrationState(ErrorAuth);
account->setRegister(false);
SIPVoIPLink::instance()->sipTransport.shutdownSipTransport(*account);
break;
case PJSIP_SC_INTERVAL_TOO_BRIEF:
// Expiration Interval Too Brief
account->doubleRegistrationExpire();
account->registerVoIPLink();
account->setRegister(false);
SIPVoIPLink::instance()->sipTransport.shutdownSipTransport(*account);
break;
default:
account->setRegistrationState(Error);
account->setRegister(false);
SIPVoIPLink::instance()->sipTransport.shutdownSipTransport(*account);
break;
}
account->setRegister(false);
SIPVoIPLink::instance()->sipTransport.shutdownSipTransport(*account);
} else {
if (account->isRegistered())
account->setRegistrationState(Registered);
......
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