Skip to content
Snippets Groups Projects
Commit 2e3d4ca3 authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

[#2034] Fixes for TLS transport to initialize

parent 57910b71
No related branches found
No related tags found
No related merge requests found
...@@ -457,6 +457,8 @@ int SIPVoIPLink::sendRegister (AccountID id) ...@@ -457,6 +457,8 @@ int SIPVoIPLink::sendRegister (AccountID id)
} }
} }
else
{
// Launch a new UDP listener/transport, using the published address // Launch a new UDP listener/transport, using the published address
if (account->isStunEnabled ()) { if (account->isStunEnabled ()) {
pj_status_t status; pj_status_t status;
...@@ -477,7 +479,7 @@ int SIPVoIPLink::sendRegister (AccountID id) ...@@ -477,7 +479,7 @@ int SIPVoIPLink::sendRegister (AccountID id)
account->setAccountTransport (_localUDPTransport); account->setAccountTransport (_localUDPTransport);
} }
} }
}
_mutexSIP.enterMutex(); _mutexSIP.enterMutex();
...@@ -814,10 +816,8 @@ SIPVoIPLink::hangup (const CallID& id) ...@@ -814,10 +816,8 @@ SIPVoIPLink::hangup (const CallID& id)
if (status != PJ_SUCCESS) if (status != PJ_SUCCESS)
return false; return false;
call->getInvSession()->mod_data[getModId() ] = NULL; call->getInvSession()->mod_data[getModId() ] = NULL;
// Release RTP thread // Release RTP thread
if (Manager::instance().isCurrentCall (id)) { if (Manager::instance().isCurrentCall (id)) {
_debug ("* SIP Info: Stopping AudioRTP for hangup\n"); _debug ("* SIP Info: Stopping AudioRTP for hangup\n");
...@@ -1986,11 +1986,6 @@ std::string SIPVoIPLink::findLocalAddressFromUri(const std::string& uri, pjsip_t ...@@ -1986,11 +1986,6 @@ std::string SIPVoIPLink::findLocalAddressFromUri(const std::string& uri, pjsip_t
return machineName; return machineName;
} }
if (transport == NULL) {
_debug ("transport is NULL in findLocalAddressFromUri\n. Try the local UDP transport");
transport = _localUDPTransport;
}
pjsip_sip_uri * sip_uri = NULL; pjsip_sip_uri * sip_uri = NULL;
sip_uri = (pjsip_sip_uri*) pjsip_uri_get_uri (genericUri); sip_uri = (pjsip_sip_uri*) pjsip_uri_get_uri (genericUri);
...@@ -2003,6 +1998,10 @@ std::string SIPVoIPLink::findLocalAddressFromUri(const std::string& uri, pjsip_t ...@@ -2003,6 +1998,10 @@ std::string SIPVoIPLink::findLocalAddressFromUri(const std::string& uri, pjsip_t
if (PJSIP_URI_SCHEME_IS_SIPS (sip_uri)) { if (PJSIP_URI_SCHEME_IS_SIPS (sip_uri)) {
transportType = PJSIP_TRANSPORT_TLS; transportType = PJSIP_TRANSPORT_TLS;
} else { } else {
if (transport == NULL) {
_debug ("transport is NULL in findLocalAddressFromUri\n. Try the local UDP transport");
transport = _localUDPTransport;
}
transportType = PJSIP_TRANSPORT_UDP; transportType = PJSIP_TRANSPORT_UDP;
} }
...@@ -2022,17 +2021,19 @@ std::string SIPVoIPLink::findLocalAddressFromUri(const std::string& uri, pjsip_t ...@@ -2022,17 +2021,19 @@ std::string SIPVoIPLink::findLocalAddressFromUri(const std::string& uri, pjsip_t
int port; int port;
pj_status_t status; pj_status_t status;
/* Init the transport selector */ /* Init the transport selector */
//_debug ("Transport ID: %s\n", transport->obj_name); //_debug ("Transport ID: %s\n", transport->obj_name);
if (transportType == PJSIP_TRANSPORT_UDP)
{
status = init_transport_selector (transport, &tp_sel); status = init_transport_selector (transport, &tp_sel);
if (status == PJ_SUCCESS) if (status == PJ_SUCCESS)
status = pjsip_tpmgr_find_local_addr (tpmgr, _pool, transportType, tp_sel, &localAddress, &port); status = pjsip_tpmgr_find_local_addr (tpmgr, _pool, transportType, tp_sel, &localAddress, &port);
else else
status = pjsip_tpmgr_find_local_addr (tpmgr, _pool, transportType, NULL, &localAddress, &port); status = pjsip_tpmgr_find_local_addr (tpmgr, _pool, transportType, NULL, &localAddress, &port);
}
else
status = pjsip_tpmgr_find_local_addr (tpmgr, _pool, transportType, NULL, &localAddress, &port);
if (status != PJ_SUCCESS) { if (status != PJ_SUCCESS) {
_debug ("Failed to find local address from transport\n"); _debug ("Failed to find local address from transport\n");
...@@ -2078,11 +2079,6 @@ int SIPVoIPLink::findLocalPortFromUri (const std::string& uri, pjsip_transport * ...@@ -2078,11 +2079,6 @@ int SIPVoIPLink::findLocalPortFromUri (const std::string& uri, pjsip_transport *
return atoi (DEFAULT_SIP_PORT); return atoi (DEFAULT_SIP_PORT);
} }
if (transport == NULL) {
_debug ("transport is NULL in findLocalPortFromUri - Try the local UDP transport\n");
transport = _localUDPTransport;
}
pjsip_sip_uri * sip_uri = NULL; pjsip_sip_uri * sip_uri = NULL;
sip_uri = (pjsip_sip_uri*) pjsip_uri_get_uri (genericUri); sip_uri = (pjsip_sip_uri*) pjsip_uri_get_uri (genericUri);
...@@ -2096,6 +2092,11 @@ int SIPVoIPLink::findLocalPortFromUri (const std::string& uri, pjsip_transport * ...@@ -2096,6 +2092,11 @@ int SIPVoIPLink::findLocalPortFromUri (const std::string& uri, pjsip_transport *
transportType = PJSIP_TRANSPORT_TLS; transportType = PJSIP_TRANSPORT_TLS;
port = atoi (DEFAULT_SIP_TLS_PORT); port = atoi (DEFAULT_SIP_TLS_PORT);
} else { } else {
if (transport == NULL) {
_debug ("transport is NULL in findLocalPortFromUri - Try the local UDP transport\n");
transport = _localUDPTransport;
}
transportType = PJSIP_TRANSPORT_UDP; transportType = PJSIP_TRANSPORT_UDP;
port = atoi (DEFAULT_SIP_PORT); port = atoi (DEFAULT_SIP_PORT);
} }
...@@ -2115,8 +2116,10 @@ int SIPVoIPLink::findLocalPortFromUri (const std::string& uri, pjsip_transport * ...@@ -2115,8 +2116,10 @@ int SIPVoIPLink::findLocalPortFromUri (const std::string& uri, pjsip_transport *
// transports and the transport type // transports and the transport type
/* Init the transport selector */ /* Init the transport selector */
_debug ("Transport ID: %s\n", transport->obj_name);
pj_status_t status; pj_status_t status;
if (transportType == PJSIP_TRANSPORT_UDP)
{
_debug ("Transport ID: %s\n", transport->obj_name);
status = init_transport_selector (transport, &tp_sel); status = init_transport_selector (transport, &tp_sel);
...@@ -2124,6 +2127,10 @@ int SIPVoIPLink::findLocalPortFromUri (const std::string& uri, pjsip_transport * ...@@ -2124,6 +2127,10 @@ int SIPVoIPLink::findLocalPortFromUri (const std::string& uri, pjsip_transport *
status = pjsip_tpmgr_find_local_addr (tpmgr, _pool, transportType, tp_sel, &localAddress, &port); status = pjsip_tpmgr_find_local_addr (tpmgr, _pool, transportType, tp_sel, &localAddress, &port);
else else
status = pjsip_tpmgr_find_local_addr (tpmgr, _pool, transportType, NULL, &localAddress, &port); status = pjsip_tpmgr_find_local_addr (tpmgr, _pool, transportType, NULL, &localAddress, &port);
}
else
status = pjsip_tpmgr_find_local_addr (tpmgr, _pool, transportType, NULL, &localAddress, &port);
if (status != PJ_SUCCESS) { if (status != PJ_SUCCESS) {
_debug ("Failed to find local address from transport\n"); _debug ("Failed to find local address from transport\n");
...@@ -2888,10 +2895,10 @@ mod_on_rx_request (pjsip_rx_data *rdata) ...@@ -2888,10 +2895,10 @@ mod_on_rx_request (pjsip_rx_data *rdata)
char* from_header = strstr(rdata->msg_info.msg_buf, "From: "); char* from_header = strstr(rdata->msg_info.msg_buf, "From: ");
// _debug("------------------------------ thefromheader: %s\n", from_header); // _debug("------------------------------ thefromheader: %s\n", from_header);
char* display_name = strtok(from_header, "\""); //char* display_name = strtok(from_header, "\"");
display_name = strtok(NULL, "\""); //display_name = strtok(NULL, "\"");
_debug("UserAgent: The displayname for this call: %s\n", display_name); //_debug("UserAgent: The displayname for this call: %s\n", display_name);
displayName = string(display_name); displayName = string("");//display_name);
_debug ("UserAgent: The receiver is : %s@%s\n", userName.data(), server.data()); _debug ("UserAgent: The receiver is : %s@%s\n", userName.data(), server.data());
...@@ -2903,7 +2910,7 @@ mod_on_rx_request (pjsip_rx_data *rdata) ...@@ -2903,7 +2910,7 @@ mod_on_rx_request (pjsip_rx_data *rdata)
// display_name = rdata->msg_info.from->name; // display_name = rdata->msg_info.from->name;
std::string temp((char*)(&display_name)); std::string temp("");///(char*)(&display_name));
sip_uri = (pjsip_sip_uri *) pjsip_uri_get_uri (uri); sip_uri = (pjsip_sip_uri *) pjsip_uri_get_uri (uri);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment