Liblinphone: linphone::Account Class Reference

Liblinphone 5.3.0

Public Member Functions | Static Public Member Functions | List of all members
linphone::Account Class Reference

Object that represents a Linphone Account. More...

`#include <account.hh>`

Inheritance diagram for linphone::Account:

## Public Member Functions
LINPHONECXX_PUBLIC | Account (void *ptr, bool takeRef=true)
LINPHONECXX_PUBLIC _LinphoneAccount * | cPtr ()
LINPHONECXX_PUBLIC void | addListener (const std::shared_ptr< AccountListener > &listener)
| Add an application listener to the Account instance.
LINPHONECXX_PUBLIC void | removeListener (const std::shared_ptr< AccountListener > &listener)
| Remove a previously added listener from the Account instance.
LINPHONECXX_PUBLIC bool | avpfEnabled ()
| Indicates whether AVPF/SAVPF is being used for calls using this account.
LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::CallLog > > | getCallLogs () const
| Returns the list of call logs for a given account.
LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::ChatRoom > > | getChatRooms () const
| Returns the list of chat rooms for a given account.
LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::ConferenceInfo > > | getConferenceInformationList () const
| Returns the list of conference information for a given account.
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Address > | getContactAddress ()
| Return the contact address of the account.
LINPHONECXX_PUBLIC void | setContactAddress (const std::shared_ptr< const linphone::Address > &addr)
| Set the contact address for the account.
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Core > | getCore ()
| Get the Core object to which is associated the Account.
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Account > | getDependency ()
| Get the dependency of a Account.
LINPHONECXX_PUBLIC void | setDependency (const std::shared_ptr< linphone::Account > &dependsOn)
| Mark this account as being dependent on the given one.
LINPHONECXX_PUBLIC linphone::Reason | getError ()
| Get the reason why registration failed when the account state is LinphoneRegistrationFailed.
LINPHONECXX_PUBLIC std::shared_ptr< const linphone::ErrorInfo > | getErrorInfo ()
| Get detailed information why registration failed when the account state is LinphoneRegistrationFailed.
LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED bool | isAvpfEnabled ()
| Indicates whether AVPF/SAVPF is being used for calls using this account.
LINPHONECXX_PUBLIC int | getMissedCallsCount () const
| Returns the missed calls count for a given account.
LINPHONECXX_PUBLIC std::shared_ptr< const linphone::AccountParams > | getParams () const
| Get the AccountParams as read-only object.
LINPHONECXX_PUBLIC int | setParams (const std::shared_ptr< linphone::AccountParams > &params)
| Set the AccountParams used by this Account.
LINPHONECXX_PUBLIC linphone::RegistrationState | getState ()
| Get the registration state of the given account.
LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED linphone::TransportType | getTransport ()
| Get the transport from either service route, route or addr.
LINPHONECXX_PUBLIC int | getUnreadChatMessageCount () const
| Returns the unread chat message count for a given account.
LINPHONECXX_PUBLIC void | addCustomParam (const std::string &key, const std::string &value)
| Set one custom parameter to this Account.
LINPHONECXX_PUBLIC void | clearCallLogs () const
| Deletes all the call logs related to this account from the database.
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Account > | clone () const
| Instantiate a new account with values from source.
LINPHONECXX_PUBLIC std::shared_ptr< const linphone::AuthInfo > | findAuthInfo ()
| Find authentication info matching account, if any, similarly to linphone_core_find_auth_info.
LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::CallLog > > | getCallLogsForAddress (const std::shared_ptr< const linphone::Address > &remoteAddress) const
| Returns the list of call logs for a given account.
LINPHONECXX_PUBLIC std::string | getCustomHeader (const std::string &headerName)
| Obtain the value of a header sent by the server in last answer to REGISTER.
LINPHONECXX_PUBLIC std::string | getCustomParam (const std::string &key) const
| Get the custom parameter with key to this Account.
LINPHONECXX_PUBLIC bool | isPhoneNumber (const std::string &username) const
| Detect if the given input is a phone number or not.
LINPHONECXX_PUBLIC std::string | normalizePhoneNumber (const std::string &username) const
| Normalize a human readable phone number into a basic string.
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Address > | normalizeSipUri (const std::string &username)
| Normalize a human readable sip uri into a fully qualified Address.
LINPHONECXX_PUBLIC void | pauseRegister ()
| Prevent an account from refreshing its registration.
LINPHONECXX_PUBLIC void | refreshRegister ()
| Refresh a proxy registration.
LINPHONECXX_PUBLIC void | resetMissedCallsCount ()
| Re-sets the number of missed calls for this account to 0.
LINPHONECXX_PUBLIC void | setCustomHeader (const std::string &headerName, const std::string &headerValue)
| Set the value of a custom header sent to the server in REGISTERs request.

## Static Public Member Functions
static LINPHONECXX_PUBLIC std::shared_ptr< linphone::Account > | newWithConfig (const std::shared_ptr< linphone::Core > &lc, const std::shared_ptr< linphone::AccountParams > &params, const std::shared_ptr< linphone::ProxyConfig > &config)
| Create a new Account with a Proxy config backpointer.

## Detailed Description

Object that represents a Linphone Account.

This object replaces the deprecated ProxyConfig. Use a AccountParams object to configure it.

## Member Function Documentation

## ◆ addCustomParam()

LINPHONECXX_PUBLIC void linphone::Account::addCustomParam | ( | const std::string & | key,
|  | const std::string & | value )

Set one custom parameter to this Account.

Parameters

  key | key of the searched parameter.
  value | value of the searched parameter.

## ◆ addListener()

LINPHONECXX_PUBLIC void linphone::Account::addListener | ( | const std::shared_ptr< AccountListener > & | listener | ) |

Add an application listener to the Account instance.

Parameters

  listener | the application listener

## ◆ avpfEnabled()

LINPHONECXX_PUBLIC bool linphone::Account::avpfEnabled | ( |  | ) |

Indicates whether AVPF/SAVPF is being used for calls using this account.

Returns
  true if AVPF/SAVPF is enabled, false otherwise.

## ◆ clone()

LINPHONECXX_PUBLIC std::shared_ptr< linphone::Account > linphone::Account::clone | ( |  | ) | const

Instantiate a new account with values from source.

Returns
  The newly created Account object.

## ◆ findAuthInfo()

LINPHONECXX_PUBLIC std::shared_ptr< const linphone::AuthInfo > linphone::Account::findAuthInfo | ( |  | ) |

Find authentication info matching account, if any, similarly to linphone_core_find_auth_info.

Returns
  a AuthInfo matching account criteria if possible, nullptr if nothing can be found.

## ◆ getCallLogs()

LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::CallLog > > linphone::Account::getCallLogs | ( |  | ) | const

Returns the list of call logs for a given account.

This list must be freed after use.

Returns
  The list of call logs .

## ◆ getCallLogsForAddress()

LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::CallLog > > linphone::Account::getCallLogsForAddress | ( | const std::shared_ptr< const linphone::Address > & | remoteAddress | ) | const

Returns the list of call logs for a given account.

This list must be freed after use.

Parameters

  remoteAddress | the Address object to filter call logs.

Returns
  The list of filtered call logs .

## ◆ getChatRooms()

LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::ChatRoom > > linphone::Account::getChatRooms | ( |  | ) | const

Returns the list of chat rooms for a given account.

Returns
  The list of chat rooms .

## ◆ getConferenceInformationList()

LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::ConferenceInfo > > linphone::Account::getConferenceInformationList | ( |  | ) | const

Returns the list of conference information for a given account.

This list must be freed after use.

Returns
  The list of call logs .

## ◆ getContactAddress()

LINPHONECXX_PUBLIC std::shared_ptr< linphone::Address > linphone::Account::getContactAddress | ( |  | ) |

Return the contact address of the account.

Returns
  a Address correspong to the contact address of the account.

## ◆ getCore()

LINPHONECXX_PUBLIC std::shared_ptr< linphone::Core > linphone::Account::getCore | ( |  | ) |

Get the Core object to which is associated the Account.

Returns
  The Core object to which is associated the Account.

## ◆ getCustomHeader()

LINPHONECXX_PUBLIC std::string linphone::Account::getCustomHeader | ( | const std::string & | headerName | ) |

Obtain the value of a header sent by the server in last answer to REGISTER.

Parameters

  headerName | The header name for which to fetch corresponding value.

Returns
  The value of the queried header.

## ◆ getCustomParam()

LINPHONECXX_PUBLIC std::string linphone::Account::getCustomParam | ( | const std::string & | key | ) | const

Get the custom parameter with key to this Account.

Parameters

  key | key of the searched parameter.

Returns
  The value of the parameter with key if found or an empty string otherwise.

## ◆ getDependency()

LINPHONECXX_PUBLIC std::shared_ptr< linphone::Account > linphone::Account::getDependency | ( |  | ) |

Get the dependency of a Account.

Returns
  The account this one is dependent upon, or nullptr if not marked dependent.

## ◆ getError()

LINPHONECXX_PUBLIC linphone::Reason linphone::Account::getError | ( |  | ) |

Get the reason why registration failed when the account state is LinphoneRegistrationFailed.

Returns
  The Reason why registration failed for this account.

## ◆ getErrorInfo()

LINPHONECXX_PUBLIC std::shared_ptr< const linphone::ErrorInfo > linphone::Account::getErrorInfo | ( |  | ) |

Get detailed information why registration failed when the account state is LinphoneRegistrationFailed.

Returns
  The ErrorInfo explaining why registration failed for this account.

## ◆ getMissedCallsCount()

LINPHONECXX_PUBLIC int linphone::Account::getMissedCallsCount | ( |  | ) | const

Returns the missed calls count for a given account.

Returns
  The missed calls count.

## ◆ getParams()

LINPHONECXX_PUBLIC std::shared_ptr< const linphone::AccountParams > linphone::Account::getParams | ( |  | ) | const

Get the AccountParams as read-only object.

To make changes, clone the returned object using AccountParams::clone() method, make your changes on it and apply them using with setParams().

Returns
  The AccountParams attached to this account.

## ◆ getState()

LINPHONECXX_PUBLIC linphone::RegistrationState linphone::Account::getState | ( |  | ) |

Get the registration state of the given account.

Returns
  The RegistrationState of the account.

## ◆ getTransport()

LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED linphone::TransportType linphone::Account::getTransport | ( |  | ) |

Get the transport from either service route, route or addr.

Returns
  The transport as a string (I.E udp, tcp, tls, dtls).

Deprecated
  01/03/2021 Use Linphone_account_params_get_transport() instead.

## ◆ getUnreadChatMessageCount()

LINPHONECXX_PUBLIC int linphone::Account::getUnreadChatMessageCount | ( |  | ) | const

Returns the unread chat message count for a given account.

Returns
  The unread chat message count.

## ◆ isAvpfEnabled()

LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED bool linphone::Account::isAvpfEnabled | ( |  | ) |

Indicates whether AVPF/SAVPF is being used for calls using this account.

Returns
  true if AVPF/SAVPF is enabled, false otherwise.

Deprecated
  16/12/2021 Use avpfEnabled() instead.

## ◆ isPhoneNumber()

LINPHONECXX_PUBLIC bool linphone::Account::isPhoneNumber | ( | const std::string & | username | ) | const

Detect if the given input is a phone number or not.

Parameters

  username | The string to parse.

Returns
  true if input is a phone number, false otherwise.

## ◆ newWithConfig()

LINPHONECXX_PUBLIC std::shared_ptr< linphone::Account > linphone::Account::newWithConfig | ( | const std::shared_ptr< linphone::Core > & | lc,
|  | const std::shared_ptr< linphone::AccountParams > & | params,
|  | const std::shared_ptr< linphone::ProxyConfig > & | config )
| static

Create a new Account with a Proxy config backpointer.

This is only intended to be used while keeping a backward compatibility with proxy config.

Parameters

  lc | The Core object.
  params | The AccountParams object.
  config | The ProxyConfig object.

Returns
  The newly created Account object.

## ◆ normalizePhoneNumber()

LINPHONECXX_PUBLIC std::string linphone::Account::normalizePhoneNumber | ( | const std::string & | username | ) | const

Normalize a human readable phone number into a basic string.

888-444-222 becomes 888444222 or +33888444222 depending on the Account object. This function will always generate a normalized username if input is a phone number.

Parameters

  username | The string to parse.

Returns
  nullptr if input is an invalid phone number, normalized phone number from username input otherwise.

## ◆ normalizeSipUri()

LINPHONECXX_PUBLIC std::shared_ptr< linphone::Address > linphone::Account::normalizeSipUri | ( | const std::string & | username | ) |

Normalize a human readable sip uri into a fully qualified Address.

A sip address should look like DisplayName <sip:username@domain:port> . Basically this function performs the following tasks The result is a syntactically correct SIP address.

Parameters

  username | The string to parse.

Returns
  nullptr if invalid input, normalized sip address otherwise.

## ◆ pauseRegister()

LINPHONECXX_PUBLIC void linphone::Account::pauseRegister | ( |  | ) |

Prevent an account from refreshing its registration.

This is useful to let registrations to expire naturally (or) when the application wants to keep control on when refreshes are sent. However, linphone_core_set_network_reachable(lc,true) will always request the accounts to refresh their registrations. The refreshing operations can be resumed with refreshRegister().

## ◆ refreshRegister()

LINPHONECXX_PUBLIC void linphone::Account::refreshRegister | ( |  | ) |

Refresh a proxy registration.

This is useful if for example you resuming from suspend, thus IP address may have changed.

## ◆ removeListener()

LINPHONECXX_PUBLIC void linphone::Account::removeListener | ( | const std::shared_ptr< AccountListener > & | listener | ) |

Remove a previously added listener from the Account instance.

Parameters

  listener | the application listener

## ◆ setContactAddress()

LINPHONECXX_PUBLIC void linphone::Account::setContactAddress | ( | const std::shared_ptr< const linphone::Address > & | addr | ) |

Set the contact address for the account.

A client application should not use this function, as the Contact address is provided by the registrar in the 200 Ok. This function is mainly intended for server applications.

Parameters

  addr | a Address to use as contact.

## ◆ setCustomHeader()

LINPHONECXX_PUBLIC void linphone::Account::setCustomHeader | ( | const std::string & | headerName,
|  | const std::string & | headerValue )

Set the value of a custom header sent to the server in REGISTERs request.

Parameters

  headerName | The header name.
  headerValue | The header value.

## ◆ setDependency()

LINPHONECXX_PUBLIC void linphone::Account::setDependency | ( | const std::shared_ptr< linphone::Account > & | dependsOn | ) |

Mark this account as being dependent on the given one.

The dependency must refer to an account previously added to the core and which idkey property is defined.

See also
  AccountParams::setIdkey() The account marked as dependent will wait for successful registration on its dependency before triggering its own. Once registered, both accounts will share the same contact address (the 'dependency' one). This mecanism must be enabled before the account is added to the core

Parameters

  dependsOn | The Account this one shall be depending on.

## ◆ setParams()

LINPHONECXX_PUBLIC int linphone::Account::setParams | ( | const std::shared_ptr< linphone::AccountParams > & | params | ) |

Set the AccountParams used by this Account.

Parameters

  params | The AccountParams object.

The documentation for this class was generated from the following file:

- account.hh