Ring Daemon 16.0.0
|
#include <sipaccountbase.h>
Public Member Functions | |
const SipAccountBaseConfig & | config () const |
void | connectivityChanged () override |
Inform the account that the network status has changed. | |
bool | CreateClientDialogAndInvite (const pj_str_t *from, const pj_str_t *contact, const pj_str_t *to, const pj_str_t *target, const pjmedia_sdp_session *local_sdp, pjsip_dialog **dlg, pjsip_inv_session **inv) |
Create UAC attached dialog and invite session. | |
std::vector< MediaAttribute > | createDefaultMediaList (bool addVideo, bool onHold=false) |
virtual void | flush () override |
This method is called to request removal of possible account traces on the system, like internal account setup files. | |
uint16_t | generateAudioPort () const |
Socket port generators for media Note: given ports are application wide, a port is unable to be given again by any account instances until it's released by the static method releasePort(). | |
virtual std::string | getDtmfType () const |
virtual dhtnet::IceTransportOptions | getIceOptions () const |
std::vector< libjami::Message > | getLastMessages (const uint64_t &base_timestamp) override |
const std::string & | getLocalInterface () const |
Get the local interface name on which this account is bound. | |
im::MessageStatus | getMessageStatus (uint64_t id) const override |
Return the status corresponding to the token. | |
std::string | getPublishedAddress () const |
Get the public IP address set by the user for this account. | |
virtual dhtnet::IpAddr | getPublishedIpAddress (uint16_t family=PF_UNSPEC) const |
bool | getPublishedSameasLocal () const |
Get a flag which determine the usage in sip headers of either the local IP address and port (localAddress and localPort) or to an address set manually (publishedAddress and publishedPort). | |
virtual bool | getSrtpFallback () const =0 |
virtual pj_uint16_t | getStunPort () const |
virtual std::string | getToUri (const std::string &username) const =0 |
virtual std::string | getUserUri () const =0 |
virtual bool | isSrtpEnabled () const =0 |
virtual bool | isStunEnabled () const |
virtual bool | isTlsEnabled () const |
Determine if TLS is enabled for this account. | |
void | loadConfig () override |
Load the settings in this account. | |
virtual MatchRank | matches (std::string_view username, std::string_view hostname) const =0 |
virtual std::shared_ptr< SIPCall > | newIncomingCall (const std::string &from, const std::vector< libjami::MediaMap > &mediaList, const std::shared_ptr< SipTransport > &sipTr={})=0 |
Create incoming SIPCall. | |
virtual void | onTextMessage (const std::string &id, const std::string &from, const std::shared_ptr< dht::crypto::Certificate > &peerCert, const std::map< std::string, std::string > &payloads) |
virtual void | sendMessage (const std::string &to, const std::string &deviceId, const std::map< std::string, std::string > &payloads, uint64_t id, bool retryOnTimeout=true, bool onlyConnected=false)=0 |
virtual uint64_t | sendTextMessage (const std::string &to, const std::string &deviceId, const std::map< std::string, std::string > &payloads, uint64_t refreshToken=0, bool onlyConnected=false) override |
If supported, send a text message from this account. | |
void | setPublishedAddress (const dhtnet::IpAddr &ip_addr) |
SIPAccountBase (const std::string &accountID) | |
Constructor. | |
virtual | ~SIPAccountBase () noexcept |
![]() | |
Account (const std::string &accountID) | |
void | addDefaultModerator (const std::string &peerURI) |
void | attach (const std::shared_ptr< Call > &call) |
void | attach (const std::shared_ptr< Conference > &conf) |
virtual std::unique_ptr< AccountConfig > | buildConfig () const =0 |
virtual bool | cancelMessage (uint64_t) |
const AccountConfig & | config () const |
bool | detach (const std::shared_ptr< Call > &call) |
virtual void | doRegister ()=0 |
Register the account. | |
virtual void | doUnregister (bool forceShutdownConnections=false)=0 |
Unregister the account. | |
void | editConfig (std::function< void(AccountConfig &config)> &&edit) |
void | enableAutoLoadConversations (bool enable) |
void | enableIceCompIdRfc5245Compliance (bool enable) |
void | enableIceForMedia (bool enable) |
void | enableVideo (bool enable) |
std::map< std::string, std::string > | getAccountDetails () const |
const std::string & | getAccountID () const |
Get the account ID. | |
virtual std::string_view | getAccountType () const =0 |
std::vector< std::shared_ptr< SystemCodecInfo > > | getActiveAccountCodecInfoList (MediaType mediaType) const |
std::vector< unsigned > | getActiveCodecs (MediaType mediaType=MEDIA_ALL) const |
const std::string & | getAlias () const |
std::shared_ptr< Call > | getCall (const std::string &callId) const |
std::vector< std::string > | getCallList () const |
std::shared_ptr< Conference > | getConference (const std::string &confId) const |
std::vector< std::string > | getConferenceList () const |
std::set< std::string > | getDefaultModerators () const |
std::string | getDisplayName () const |
virtual std::string | getFromUri () const =0 |
const std::string & | getHostname () const |
std::string | getMailBox () const |
virtual std::map< std::string, std::string > | getNearbyPeers () const |
const std::filesystem::path & | getPath () const |
std::map< std::string, std::string > | getProfileVcard () const |
RegistrationState | getRegistrationState () const |
bool | getRingtoneEnabled () const |
std::filesystem::path | getRingtonePath () const |
bool | getUPnPActive () const |
returns whether or not UPnP is enabled and active ie: if it is able to make port mappings | |
dhtnet::IpAddr | getUPnPIpAddress () const |
Get the UPnP IP (external router) address. | |
const std::string & | getUserAgentName () |
Get the user-agent. | |
const std::string & | getUsername () const |
virtual bool | handleMessage (const std::shared_ptr< dht::crypto::Certificate > &, const std::string &, const std::pair< std::string, std::string > &) |
void | hangupCalls () |
Free all ressources related to this account. | |
bool | hasActiveCodec (MediaType mediaType) const |
bool | isActive () const noexcept |
Tell if the account is activated (can currently be used). | |
bool | isAllModerators () const |
bool | isAutoAnswerEnabled () const |
bool | isComposingEnabled () const |
bool | isDenySecondCallEnabled () const |
bool | isEmptyOffersEnabled () const |
bool | isEnabled () const |
Tell if the account is enable or not. | |
bool | isIceCompIdRfc5245Compliant () const |
bool | isIceForMediaEnabled () const |
virtual bool | isIP2IP () const |
Returns true if this is the IP2IP account. | |
bool | isLocalModeratorsEnabled () const |
bool | isReadReceiptEnabled () const |
bool | isRendezVous () const |
bool | isUsable () const |
bool | isVideoEnabled () const |
void | loadDefaultCodecs () |
Helper function used to load the default codec order from the codec factory. | |
virtual std::shared_ptr< Call > | newOutgoingCall (std::string_view toUrl, const std::vector< libjami::MediaMap > &mediaList)=0 |
Create a new outgoing call. | |
bool | removeConference (const std::string &confId) |
void | removeDefaultModerator (const std::string &peerURI) |
virtual void | saveConfig () const |
std::shared_ptr< SystemCodecInfo > | searchCodecById (unsigned codecId, MediaType mediaType) |
std::shared_ptr< SystemCodecInfo > | searchCodecByPayload (unsigned payload, MediaType mediaType) |
void | setAccountDetails (const std::map< std::string, std::string > &details) |
void | setActive (bool active) noexcept |
virtual void | setActiveCodecs (const std::vector< unsigned > &list) |
Update both the codec order structure and the codec string used for SDP offer and configuration respectively. | |
void | setCodecActive (unsigned codecId) |
void | setCodecInactive (unsigned codecId) |
void | setConfig (std::unique_ptr< AccountConfig > &&config) |
void | setEnabled (bool enable) |
virtual void | setIsComposing (const std::string &, bool) |
virtual bool | setMessageDisplayed (const std::string &, const std::string &, int) |
virtual bool | setPushNotificationConfig (const std::map< std::string, std::string > &data) |
virtual bool | setPushNotificationToken (const std::string &pushDeviceToken="") |
virtual bool | setPushNotificationTopic (const std::string &topic="") |
virtual void | updateProfile (const std::string &, const std::string &, const std::string &, int32_t)=0 |
virtual | ~Account () |
Virtual destructor. | |
Static Public Member Functions | |
static void | releasePort (uint16_t port) noexcept |
![]() | |
static std::map< std::string, std::string > | getDefaultCodecDetails (const unsigned &codecId) |
static std::vector< unsigned > | getDefaultCodecsId () |
static bool | meetMinimumRequiredVersion (const std::vector< unsigned > &jamiVersion, const std::vector< unsigned > &minRequiredVersion) |
Static Public Attributes | |
static constexpr unsigned | HALF_MAX_PORT {MAX_PORT / 2} |
static constexpr unsigned | MAX_PORT {65536} |
Protected Member Functions | |
uint16_t | acquireRandomEvenPort (const std::pair< uint16_t, uint16_t > &range) const |
uint16_t | getRandomEvenPort (const std::pair< uint16_t, uint16_t > &range) const |
virtual std::map< std::string, std::string > | getVolatileAccountDetails () const override |
Retrieve volatile details such as recent registration errors. | |
virtual void | setRegistrationState (RegistrationState state, int code=0, const std::string &detail_str={}) override |
Set the registration state of the specified link. | |
![]() | |
std::vector< unsigned > | getAccountCodecInfoIdList (MediaType mediaType) const |
std::shared_ptr< SystemCodecInfo > | searchCodecByName (const std::string &name, MediaType mediaType) |
private account codec searching functions | |
void | setAllCodecsActive (MediaType mediaType, bool active) |
void | sortCodec () |
virtual void | updateUpnpController () |
Static Protected Member Functions | |
static uint16_t | acquirePort (uint16_t port) |
static std::array< bool, HALF_MAX_PORT > & | getPortsReservation () noexcept |
![]() | |
static std::string | getDefaultUserAgent () |
Build the user-agent string. | |
static std::string | mapStateNumberToString (RegistrationState state) |
Protected Attributes | |
std::deque< libjami::Message > | lastMessages_ |
SIPVoIPLink & | link_ |
Voice over IP Link contains a listener thread and calls. | |
im::MessageEngine | messageEngine_ |
std::mutex | mutexLastMessages_ |
The deamon can be launched without any client (or with a non ready client) Like call and file transfer, a client should be able to retrieve current messages. | |
dhtnet::IpAddr | publishedIp_ [2] {} |
Published IPv4/IPv6 addresses, used only if defined by the user in account configuration. | |
std::string | transportError_ {} |
pj_status_t | transportStatus_ {PJSIP_SC_TRYING} |
std::shared_ptr< dhtnet::TurnCache > | turnCache_ |
![]() | |
std::vector< std::shared_ptr< SystemCodecInfo > > | accountCodecInfoList_ |
Vector containing all account codecs (set of system codecs with custom parameters) | |
const std::string | accountID_ |
Account ID are assign in constructor and shall not changed. | |
bool | active_ {true} |
Tells if the account is active now. | |
bool | autoLoadConversations_ {true} |
Auto load conversations when creatinf convModule() | |
std::unique_ptr< AccountConfig > | config_ {} |
std::recursive_mutex | configurationMutex_ {} |
bool | iceCompIdRfc5245Compliant_ {false} |
bool | iceForMediaEnabled_ {true} |
std::filesystem::path | idPath_ {} |
path to account | |
RegistrationState | registrationState_ {RegistrationState::UNLOADED} |
std::filesystem::path | ringtonePath_ |
Ringtone .au file used for this account. | |
std::shared_ptr< SystemCodecContainer > | systemCodecContainer_ |
Vector containing all system codecs (with default parameters) | |
std::mutex | upnp_mtx {} |
UPnP IGD controller and the mutex to access it. | |
std::shared_ptr< dhtnet::upnp::Controller > | upnpCtrl_ |
Static Protected Attributes | |
static constexpr size_t | MAX_WAITING_MESSAGES_SIZE = 1000 |
![]() | |
static const std::string | DEFAULT_USER_AGENT = Account::getDefaultUserAgent() |
Additional Inherited Members | |
![]() | |
std::mt19937_64 | rand |
Random generator engine Logical account state shall never rely on the state of the random generator. | |
Definition at line 73 of file sipaccountbase.h.
jami::SIPAccountBase::SIPAccountBase | ( | const std::string & | accountID | ) |
Constructor.
accountID | The account identifier |
Definition at line 59 of file sipaccountbase.cpp.
|
virtualnoexcept |
Definition at line 65 of file sipaccountbase.cpp.
Definition at line 218 of file sipaccountbase.cpp.
References jami::emitSignal(), and getPortsReservation().
|
protected |
Definition at line 204 of file sipaccountbase.cpp.
References jami::emitSignal(), getPortsReservation(), and jami::Account::rand.
Referenced by generateAudioPort().
|
inline |
Definition at line 87 of file sipaccountbase.h.
References jami::Account::config().
Referenced by generateAudioPort(), getDtmfType(), getIceOptions(), getLocalInterface(), getPublishedAddress(), getPublishedSameasLocal(), and loadConfig().
|
inlineoverridevirtual |
Inform the account that the network status has changed.
Reimplemented from jami::Account.
Definition at line 210 of file sipaccountbase.h.
bool jami::SIPAccountBase::CreateClientDialogAndInvite | ( | const pj_str_t * | from, |
const pj_str_t * | contact, | ||
const pj_str_t * | to, | ||
const pj_str_t * | target, | ||
const pjmedia_sdp_session * | local_sdp, | ||
pjsip_dialog ** | dlg, | ||
pjsip_inv_session ** | inv | ||
) |
Create UAC attached dialog and invite session.
Definition at line 68 of file sipaccountbase.cpp.
References jami::sip_utils::CONST_PJ_STR(), jami::emitSignal(), JAMI_DBG, and JAMI_ERR.
std::vector< MediaAttribute > jami::SIPAccountBase::createDefaultMediaList | ( | bool | addVideo, |
bool | onHold = false |
||
) |
Definition at line 357 of file sipaccountbase.cpp.
References jami::sip_utils::DEFAULT_AUDIO_STREAMID, jami::sip_utils::DEFAULT_VIDEO_STREAMID, jami::emitSignal(), isSrtpEnabled(), jami::Account::isVideoEnabled(), jami::MEDIA_AUDIO, and jami::MEDIA_VIDEO.
Referenced by jami::JamiAccount::newOutgoingCall(), and jami::SIPAccount::newOutgoingCall().
|
overridevirtual |
This method is called to request removal of possible account traces on the system, like internal account setup files.
Reimplemented from jami::Account.
Reimplemented in jami::JamiAccount.
Definition at line 124 of file sipaccountbase.cpp.
References jami::Account::flush(), jami::fileutils::get_cache_dir(), and jami::Account::getAccountID().
Referenced by jami::JamiAccount::flush().
uint16_t jami::SIPAccountBase::generateAudioPort | ( | ) | const |
Socket port generators for media Note: given ports are application wide, a port is unable to be given again by any account instances until it's released by the static method releasePort().
Definition at line 231 of file sipaccountbase.cpp.
References acquireRandomEvenPort(), and config().
|
inlinevirtual |
Definition at line 110 of file sipaccountbase.h.
References config(), and jami::SipAccountBaseConfig::dtmfType.
|
virtual |
Reimplemented in jami::JamiAccount.
Definition at line 245 of file sipaccountbase.cpp.
References config(), jami::emitSignal(), jami::Manager::getIceTransportFactory(), jami::Account::getUPnPActive(), jami::Manager::instance(), turnCache_, and jami::Account::upnpCtrl_.
|
overridevirtual |
Reimplemented from jami::Account.
Definition at line 342 of file sipaccountbase.cpp.
References jami::emitSignal(), lastMessages_, and mutexLastMessages_.
|
inline |
Get the local interface name on which this account is bound.
Definition at line 134 of file sipaccountbase.h.
References config(), and jami::SipAccountBaseConfig::interface.
Referenced by jami::SIPAccount::newOutgoingCall().
|
inlineoverridevirtual |
Return the status corresponding to the token.
Reimplemented from jami::Account.
Definition at line 197 of file sipaccountbase.h.
References jami::im::MessageEngine::getStatus(), and messageEngine_.
|
staticprotectednoexcept |
Definition at line 185 of file sipaccountbase.cpp.
References jami::emitSignal(), and getPortsReservation().
Referenced by acquirePort(), acquireRandomEvenPort(), getPortsReservation(), and getRandomEvenPort().
|
inline |
Get the public IP address set by the user for this account.
If this setting is not provided, the local bound adddress will be used.
Definition at line 142 of file sipaccountbase.h.
References config(), and jami::SipAccountBaseConfig::publishedIp.
Referenced by jami::SIPAccount::newOutgoingCall().
|
virtual |
Reimplemented in jami::JamiAccount.
Definition at line 313 of file sipaccountbase.cpp.
References jami::emitSignal(), and publishedIp_.
Referenced by jami::SIPAccount::newOutgoingCall().
|
inline |
Get a flag which determine the usage in sip headers of either the local IP address and port (localAddress and localPort) or to an address set manually (publishedAddress and publishedPort).
Definition at line 153 of file sipaccountbase.h.
References config(), and jami::SipAccountBaseConfig::publishedSameasLocal.
Referenced by jami::SIPAccount::newOutgoingCall().
|
protected |
Definition at line 193 of file sipaccountbase.cpp.
References jami::emitSignal(), getPortsReservation(), and jami::Account::rand.
Implemented in jami::JamiAccount, and jami::SIPAccount.
|
inlinevirtual |
Reimplemented in jami::SIPAccount.
Definition at line 108 of file sipaccountbase.h.
|
pure virtual |
Implemented in jami::JamiAccount, and jami::SIPAccount.
|
pure virtual |
Implemented in jami::JamiAccount, and jami::SIPAccount.
|
overrideprotectedvirtual |
Retrieve volatile details such as recent registration errors.
Reimplemented from jami::Account.
Reimplemented in jami::JamiAccount, and jami::SIPAccount.
Definition at line 157 of file sipaccountbase.cpp.
References jami::Conf::CONFIG_ACCOUNT_REGISTRATION_STATUS, jami::Conf::CONFIG_TRANSPORT_STATE_CODE, jami::Conf::CONFIG_TRANSPORT_STATE_DESC, jami::emitSignal(), jami::Account::getVolatileAccountDetails(), jami::Account::isIP2IP(), transportError_, and transportStatus_.
Implemented in jami::JamiAccount, and jami::SIPAccount.
Referenced by createDefaultMediaList().
Reimplemented in jami::SIPAccount.
Definition at line 106 of file sipaccountbase.h.
Determine if TLS is enabled for this account.
TLS provides a secured channel for SIP signalization. It is independent of the media encryption (as provided by SRTP).
Reimplemented in jami::JamiAccount, and jami::SIPAccount.
Definition at line 116 of file sipaccountbase.h.
|
overridevirtual |
Load the settings in this account.
Reimplemented from jami::Account.
Definition at line 132 of file sipaccountbase.cpp.
References config(), jami::emitSignal(), jami::fileutils::get_cache_dir(), jami::Account::getAccountID(), jami::Manager::instance(), jami::Manager::ioContext(), jami::Account::loadConfig(), setPublishedAddress(), and turnCache_.
|
pure virtual |
Implemented in jami::JamiAccount, and jami::SIPAccount.
|
pure virtual |
Create incoming SIPCall.
[in] | from | The origin of the call |
mediaList | A list of media | |
sipTr | SIP Transport |
Implemented in jami::JamiAccount, and jami::SIPAccount.
|
virtual |
Reimplemented in jami::JamiAccount.
Definition at line 275 of file sipaccountbase.cpp.
References jami::Account::accountID_, jami::emitSignal(), libjami::Message::from, jami::Account::handleMessage(), jami::Manager::instance(), JAMI_LOG, JAMI_WARNING, lastMessages_, MAX_WAITING_MESSAGES_SIZE, mutexLastMessages_, libjami::Message::payloads, libjami::Message::received, and jami::utf8_validate().
Definition at line 225 of file sipaccountbase.cpp.
References jami::emitSignal().
Referenced by jami::Sdp::~Sdp().
|
pure virtual |
Implemented in jami::JamiAccount, and jami::SIPAccount.
Referenced by sendTextMessage().
|
inlineoverridevirtual |
If supported, send a text message from this account.
Reimplemented from jami::Account.
Reimplemented in jami::JamiAccount.
Definition at line 183 of file sipaccountbase.h.
References jami::emitSignal(), jami::JAMI_ID_MAX_VAL, messageEngine_, jami::Account::rand, sendMessage(), and jami::im::MessageEngine::sendMessage().
Definition at line 332 of file sipaccountbase.cpp.
References jami::emitSignal(), and publishedIp_.
Referenced by loadConfig().
|
overrideprotectedvirtual |
Set the registration state of the specified link.
state | The registration state of underlying VoIPLink |
Reimplemented from jami::Account.
Reimplemented in jami::SIPAccount, and jami::JamiAccount.
Definition at line 171 of file sipaccountbase.cpp.
References jami::emitSignal(), jami::im::MessageEngine::load(), messageEngine_, jami::REGISTERED, jami::Account::registrationState_, jami::im::MessageEngine::save(), and jami::Account::setRegistrationState().
Definition at line 77 of file sipaccountbase.h.
|
protected |
Definition at line 263 of file sipaccountbase.h.
Referenced by getLastMessages(), and onTextMessage().
|
protected |
Voice over IP Link contains a listener thread and calls.
Definition at line 238 of file sipaccountbase.h.
Referenced by jami::SIPAccount::newOutgoingCall().
Definition at line 76 of file sipaccountbase.h.
Definition at line 262 of file sipaccountbase.h.
Referenced by onTextMessage().
|
protected |
Definition at line 233 of file sipaccountbase.h.
Referenced by getMessageStatus(), sendTextMessage(), and setRegistrationState().
|
protected |
The deamon can be launched without any client (or with a non ready client) Like call and file transfer, a client should be able to retrieve current messages.
To avoid to explode the size in memory, this container should be limited. We don't want to see monsters in memory.
Definition at line 261 of file sipaccountbase.h.
Referenced by getLastMessages(), and onTextMessage().
|
protected |
Published IPv4/IPv6 addresses, used only if defined by the user in account configuration.
Definition at line 245 of file sipaccountbase.h.
Referenced by getPublishedIpAddress(), and setPublishedAddress().
|
protected |
Definition at line 248 of file sipaccountbase.h.
Referenced by getVolatileAccountDetails().
|
protected |
Definition at line 247 of file sipaccountbase.h.
Referenced by getVolatileAccountDetails().
|
protected |
Definition at line 265 of file sipaccountbase.h.
Referenced by getIceOptions(), and loadConfig().