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

Merge branch 'fix_account_crasher' of...

Merge branch 'fix_account_crasher' of git+ssh://git.sflphone.org/var/repos/sflphone/git/sflphone into fix_account_crasher
parents 6b22643a 6f3bffff
No related branches found
No related tags found
No related merge requests found
......@@ -37,6 +37,7 @@
#include "config.h"
#include "../manager.h"
#include "sip/sipvoiplink.h"
#include "sip/siptransport.h"
#include "account.h"
#include "sip/sipaccount.h"
......@@ -411,17 +412,17 @@ std::vector<std::map<std::string, std::string> > ConfigurationManager::getHistor
std::string
ConfigurationManager::getAddrFromInterfaceName(const std::string& interface)
{
return SIPVoIPLink::getInterfaceAddrFromName(interface);
return SipTransport::getInterfaceAddrFromName(interface);
}
std::vector<std::string> ConfigurationManager::getAllIpInterface()
{
return SIPVoIPLink::getAllIpInterface();
return SipTransport::getAllIpInterface();
}
std::vector<std::string> ConfigurationManager::getAllIpInterfaceByName()
{
return SIPVoIPLink::getAllIpInterfaceByName();
return SipTransport::getAllIpInterfaceByName();
}
std::map<std::string, std::string> ConfigurationManager::getShortcuts()
......
......@@ -2563,7 +2563,7 @@ void ManagerImpl::loadDefaultAccountMap()
{
// build a default IP2IP account with default parameters
accountMap_[SIPAccount::IP2IP_PROFILE] = new SIPAccount(SIPAccount::IP2IP_PROFILE);
SIPVoIPLink::instance()->createDefaultSipUdpTransport();
SIPVoIPLink::instance()->sipTransport.createDefaultSipUdpTransport();
accountMap_[SIPAccount::IP2IP_PROFILE]->registerVoIPLink();
}
......@@ -2627,7 +2627,7 @@ void ManagerImpl::loadAccountMap(Conf::YamlParser &parser)
// Initialize default UDP transport according to
// IP to IP settings (most likely using port 5060)
SIPVoIPLink::instance()->createDefaultSipUdpTransport();
SIPVoIPLink::instance()->sipTransport.createDefaultSipUdpTransport();
// Force IP2IP settings to be loaded to be loaded
// No registration in the sense of the REGISTER method is performed.
......
......@@ -9,12 +9,14 @@ libsiplink_la_SOURCES = \
sipaccount.cpp \
sipcall.cpp \
sipvoiplink.cpp \
siptransport.cpp \
pattern.h \
sdes_negotiator.h \
sdp.h \
sipaccount.h \
sipcall.h \
sipvoiplink.h \
siptransport.h \
sip_utils.cpp \
sip_utils.h
......
......@@ -407,7 +407,7 @@ void SIPAccount::setAccountDetails(std::map<std::string, std::string> details)
publishedPort_ = atoi(details[CONFIG_PUBLISHED_PORT].c_str());
if(stunServer_ != details[CONFIG_STUN_SERVER]) {
DEBUG("Stun server changed!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
link_->destroyStunResolver(stunServer_);
link_->sipTransport.destroyStunResolver(stunServer_);
// pj_stun_sock_destroy(pj_stun_sock *stun_sock);
}
stunServer_ = details[CONFIG_STUN_SERVER];
......@@ -816,7 +816,7 @@ std::string SIPAccount::getContactHeader() const
// Else we determine this infor based on transport information
std::string address, port;
link_->findLocalAddressFromTransport(transport_, transportType, address, port);
link_->sipTransport.findLocalAddressFromTransport(transport_, transportType, address, port);
// UDP does not require the transport specification
std::string scheme;
......
This diff is collapsed.
......@@ -49,6 +49,7 @@
#include "sipaccount.h"
#include "voiplink.h"
#include "siptransport.h"
class EventThread;
class SIPCall;
......@@ -211,49 +212,6 @@ class SIPVoIPLink : public VoIPLink {
*/
std::string getUseragentName(SIPAccount *) const;
/**
* List all the interfaces on the system and return
* a vector list containing their IPV4 address.
* @param void
* @return std::vector<std::string> A std::string vector
* of IPV4 address available on all of the interfaces on
* the system.
*/
static std::vector<std::string> getAllIpInterface();
/**
* List all the interfaces on the system and return
* a vector list containing their name (eth0, eth0:1 ...).
* @param void
* @return std::vector<std::string> A std::string vector
* of interface name available on all of the interfaces on
* the system.
*/
static std::vector<std::string> getAllIpInterfaceByName();
/**
* List all the interfaces on the system and return
* a vector list containing their name (eth0, eth0:1 ...).
* @param void
* @return std::vector<std::string> A std::string vector
* of interface name available on all of the interfaces on
* the system.
*/
static std::string getInterfaceAddrFromName(const std::string &ifaceName);
/**
* Initialize the transport selector
* @param transport A transport associated with an account
*
* @return A pointer to the transport selector structure
*/
pjsip_tpselector *initTransportSelector(pjsip_transport *, pj_pool_t *) const;
/**
* This function unset the transport for a given account.
*/
void shutdownSipTransport(SIPAccount *account);
/**
* Send a SIP message to a call identified by its callid
*
......@@ -270,26 +228,7 @@ class SIPVoIPLink : public VoIPLink {
*/
void createDefaultSipUdpTransport();
/**
* Get the correct address to use (ie advertised) from
* a uri. The corresponding transport that should be used
* with that uri will be discovered.
*
* @param uri The uri from which we want to discover the address to use
* @param transport The transport to use to discover the address
*/
void findLocalAddressFromTransport(pjsip_transport *transport, pjsip_transport_type_e transportType, std::string &address, std::string &port) const;
/**
* Create a new stun resolver. Store it inside the array. Resolve public address for this
* server name.
* @param serverName The name of the stun server
* @param port number
*/
pj_status_t createStunResolver(pj_str_t serverName, pj_uint16_t port);
pj_status_t destroyStunResolver(const std::string serverName);
SipTransport sipTransport;
private:
/**
* Start a SIP Call
......@@ -304,65 +243,6 @@ class SIPVoIPLink : public VoIPLink {
SIPVoIPLink();
/**
* General Sip transport creation method according to the
* transport type specified in account settings
* @param account The account for which a transport must be created.
*/
void createSipTransport(SIPAccount *account);
/**
* Create SIP UDP transport from account's setting
* @param account The account for which a transport must be created.
*/
pjsip_transport *createUdpTransport(std::string interface, unsigned int port);
/**
* Create The default TLS listener which is global to the application. This means that
* only one TLS connection can be established for the momment.
* @param the port number to create the TCP socket
* @param pjsip's tls settings for the transport to be created which contains:
* - path to ca certificate list file
* - path to certertificate file
* - path to private key file
* - the password for the file
* - the TLS method
* @param a pointer to store the listener created, in our case this is a static pointer
*/
void createTlsListener(pj_uint16_t, pjsip_tls_setting *, pjsip_tpfactory **);
/**
* Create a connection oriented TLS transport and register to the specified remote address.
* First, initialize the TLS listener sole instance. This means that, for the momment, only one TLS transport
* is allowed to be created in the application. Any subsequent account attempting to
* register a new using this transport even if new settings are specified.
* @param the remote address for this transport to be connected
* @param the local port to initialize the TCP socket
* @param pjsip's tls transport parameters
*/
pjsip_transport *
createTlsTransport(const std::string &remoteAddr,
pj_uint16_t tlsListenerPort,
pjsip_tls_setting *tlsSetting);
/**
* Create a UDP transport using stun server to resove public address
* @param account The account for which a transport must be created.
*/
pjsip_transport *createStunTransport(pj_str_t serverName, pj_uint16_t port);
/**
* UDP Transports are stored in this map in order to retreive them in case
* several accounts would share the same port number.
*/
std::map<pj_uint16_t, pjsip_transport*> transportMap_;
/**
* Stun resolver array
*/
std::map<std::string, pj_stun_sock *> stunSocketMap_;
/**
* Threading object
*/
......
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