Skip to content
Snippets Groups Projects
Commit b2289be3 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

#9831: Fix sip transport port number

parent 6a06c6fa
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
}
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment