diff --git a/daemon/src/sip/siptransport.cpp b/daemon/src/sip/siptransport.cpp index 38a908656ba8bec237f7ae9d10f957ca8c82929d..e3340f4c2bedfdff8506d429fb11b431e1e86b58 100644 --- a/daemon/src/sip/siptransport.cpp +++ b/daemon/src/sip/siptransport.cpp @@ -330,7 +330,11 @@ void SipTransport::createSipTransport(SIPAccount *account) account->transport_ = transport; } + + if (!account->transport_) { + DEBUG("SipTransport: Looking into previously created transport map for %s:%d", + account->getLocalInterface().c_str(), account->getLocalPort()); // Could not create new transport, this transport may already exists account->transport_ = transportMap_[account->getLocalPort()]; @@ -341,6 +345,10 @@ void SipTransport::createSipTransport(SIPAccount *account) account->setLocalPort(localUDPTransport_->local_name.port); } } + + if(account->transport_ == NULL) + ERROR("SipTransport: Could not create transport on %s:%d", + account->getLocalInterface().c_str(), account->getLocalPort()); } void SipTransport::createDefaultSipUdpTransport() @@ -408,15 +416,15 @@ SipTransport::createUdpTransport(const std::string &interface, unsigned int port pj_status_t status; pjsip_transport *transport = NULL; if (boundAddr.addr.sa_family == pj_AF_INET()) { + boundAddr.ipv4.sin_port = listeningPort; status = pjsip_udp_transport_start(endpt_, &boundAddr.ipv4, NULL, 1, &transport); if (status != PJ_SUCCESS) { - ERROR("Failed to create IPv4 UDP transport"); return NULL; } } else if (boundAddr.addr.sa_family == pj_AF_INET6()) { + boundAddr.ipv6.sin6_port = listeningPort; status = pjsip_udp_transport_start6(endpt_, &boundAddr.ipv6, NULL, 1, &transport); if (status != PJ_SUCCESS) { - ERROR("Failed to create IPv6 UDP transport"); return NULL; } } diff --git a/daemon/src/sip/sipvoiplink.cpp b/daemon/src/sip/sipvoiplink.cpp index fcf77f5d1f61dd0e734134ae0f203e525c9dbce1..1a934665ef50e056e584b7b168825e8870da32d9 100644 --- a/daemon/src/sip/sipvoiplink.cpp +++ b/daemon/src/sip/sipvoiplink.cpp @@ -195,42 +195,6 @@ pj_bool_t transaction_response_cb(pjsip_rx_data *rdata) return PJ_SUCCESS; } -/* -std::string parseDisplayName(const char * buffer) -{ - const char* from_header = strstr(buffer, "From: "); - - if (!from_header) - return ""; - - std::string temp(from_header); - size_t begin_displayName = temp.find("\"") + 1; - size_t end_displayName = temp.rfind("\""); - std::string displayName(temp.substr(begin_displayName, end_displayName - begin_displayName)); - - static const size_t MAX_DISPLAY_NAME_SIZE = 25; - if (displayName.size() > MAX_DISPLAY_NAME_SIZE) - return ""; - - return displayName; -} - -void stripSipUriPrefix(std::string& sipUri) -{ - // Remove sip: prefix - static const char SIP_PREFIX[] = "sip:"; - size_t found = sipUri.find(SIP_PREFIX); - - if (found != std::string::npos) - sipUri.erase(found, found + (sizeof SIP_PREFIX) - 1); - - found = sipUri.find("@"); - - if (found != std::string::npos) - sipUri.erase(found); -} -*/ - pj_bool_t transaction_request_cb(pjsip_rx_data *rdata) { pjsip_method *method = &rdata->msg_info.msg->line.req.method;