Package org.linphone.core

# Interface Account

public interface Account
Object that represents a Linphone Account.
This object replaces the deprecated `ProxyConfig`. Use a `AccountParams`
object to configure it.

## Method Summary

Modifier and Type
Method
Description
`void`
`addCustomParam(String key, String value)`
Set one custom parameter to this `Account`.
`void`
`addListener(AccountListener listener)`
`void`
`clearCallLogs()`
Deletes all the call logs related to this account from the database.
`Account`
`clone()`
Instantiate a new account with values from source.
`ChatRoom[]`
`filterChatRooms(String filter)`
Returns a filtered list of chat rooms for a given account.
`AuthInfo`
`findAuthInfo()`
Find authentication info matching account, if any, similarly to
linphone_core_find_auth_info.
`CallLog[]`
`getCallLogs()`
Returns the list of call logs for a given account.
`CallLog[]`
`getCallLogsForAddress(Address remoteAddress)`
Returns the list of call logs for a given account.
`ChatRoom[]`
`getChatRooms()`
Returns the list of chat rooms for a given account.
`ConferenceInfo[]`
`getConferenceInformationList()`
Returns the list of conference information stored locally for a given account.
`ConsolidatedPresence`
`getConsolidatedPresence()`
Gets consolidated presence for a `Account`.
`Address`
`getContactAddress()`
Return the contact address of the account.
`Core`
`getCore()`
Get the `Core` object to which is associated the `Account`.
`String`
`getCustomHeader(String headerName)`
Obtain the value of a header sent by the server in last answer to REGISTER.
`String`
`getCustomParam(String key)`
Get the custom parameter with key to this `Account`.
`Account`
`getDependency()`
Get the dependency of a `Account`.
`Reason`
`getError()`
Get the reason why registration failed when the account state is
LinphoneRegistrationFailed.
`ErrorInfo`
`getErrorInfo()`
Get detailed information why registration failed when the account state is
LinphoneRegistrationFailed.
`MessageWaitingIndication`
`getLatestReceivedMessageWaitingIndication()`
Returns the latest Message Waiting Indication (MWI) received payload, if any.
`int`
`getMissedCallsCount()`
Returns the missed calls count for a given account.
`long`
`getNativePointer()`
Gets the native pointer used by this class to make native method calls.
`AccountParams`
`getParams()`
Get the `AccountParams` as read-only object.
`PresenceModel`
`getPresenceModel()`
Get the presence model linked to a given account.
`RegistrationState`
`getState()`
Get the registration state of the given account.
`TransportType`
`getTransport()`
Deprecated.
`int`
`getUnreadChatMessageCount()`
Returns the unread chat message count for a given account.
`Object`
`getUserData()`
Gets the object stored in this object user's data
`boolean`
`isAvpfEnabled()`
Indicates whether AVPF/SAVPF is being used for calls using this account.
`boolean`
`isPhoneNumber(String username)`
Detect if the given input is a phone number or not.
`Account`
`newWithConfig(Core lc, AccountParams params, ProxyConfig config)`
Create a new `Account` with a Proxy config backpointer.
`String`
`normalizePhoneNumber(String username)`
Normalize a human readable phone number into a basic string.
`Address`
`normalizeSipUri(String username)`
Normalize a human readable sip uri into a fully qualified LinphoneAddress.
`void`
`pauseRegister()`
Prevent an account from refreshing its registration.
`void`
`refreshRegister()`
Refresh a proxy registration.
`void`
`removeListener(AccountListener listener)`
`void`
`resetMissedCallsCount()`
Re-sets the number of missed calls for this account to 0.
`void`
`setConsolidatedPresence(ConsolidatedPresence presence)`
Sets consolidated presence for a `Account`.
`void`
`setContactAddress(Address addr)`
Set the contact address for the account.
`void`
`setCustomHeader(String headerName, String headerValue)`
Set the value of a custom header sent to the server in REGISTERs request.
`void`
`setDependency(Account dependsOn)`
Mark this account as being dependent on the given one.
`int`
`setParams(AccountParams params)`
Set the `AccountParams` used by this `Account`.
`void`
`setPresenceModel(PresenceModel presenceModel)`
Set the presence model linked to a given account and send a PUBLISH message to
the presence server.
`void`
`setUserData(Object data)`
Sets the object to store in this object user's data
`String`
`toString()`

## Method Details

### isAvpfEnabled

boolean isAvpfEnabled()
Indicates whether AVPF/SAVPF is being used for calls using this account.

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

### getCallLogs

CallLog[] getCallLogs()
Returns the list of call logs for a given account.
This list must be freed after use.

Returns:
  The list of call logs A list of `CallLog` objects. .

### getChatRooms

ChatRoom[] getChatRooms()
Returns the list of chat rooms for a given account.

Returns:
  The list of chat rooms A list of `ChatRoom` objects. .

### getConferenceInformationList

ConferenceInfo[] getConferenceInformationList()
Returns the list of conference information stored locally for a given account.
This list must be freed after use.

Returns:
  The list of call logs A list of `ConferenceInfo` objects. .
  warning: This method also start the synchronization with the CCMP server,
  should it be defined in the `AccountParams`. The application may want to
  wait for the callback conference_information_updated to get an up-to-date list
  of conferences

### getConsolidatedPresence

ConsolidatedPresence getConsolidatedPresence()
Gets consolidated presence for a `Account`.

Returns:
  A `ConsolidatedPresence` presence

### setConsolidatedPresence

void setConsolidatedPresence(ConsolidatedPresence presence)
Sets consolidated presence for a `Account`.

Parameters:
  `presence` - `ConsolidatedPresence` value

### getContactAddress

Address getContactAddress()
Return the contact address of the account.

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

### setContactAddress

void setContactAddress(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.

### getCore

Core getCore()
Get the `Core` object to which is associated the `Account`.

Returns:
  The `Core` object to which is associated the `Account`.

### getDependency

Account getDependency()
Get the dependency of a `Account`.

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

### setDependency

void setDependency(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: `AccountParams.setIdkey(java.lang.String)`
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.

### getError

Reason getError()
Get the reason why registration failed when the account state is
LinphoneRegistrationFailed.

Returns:
  The `Reason` why registration failed for this account.

### getErrorInfo

ErrorInfo getErrorInfo()
Get detailed information why registration failed when the account state is
LinphoneRegistrationFailed.

Returns:
  The `ErrorInfo` explaining why registration failed for this
  account.

### getLatestReceivedMessageWaitingIndication

MessageWaitingIndication getLatestReceivedMessageWaitingIndication()
Returns the latest Message Waiting Indication (MWI) received payload, if any.

Returns:
  The latest `MessageWaitingIndication` or null.

### getMissedCallsCount

int getMissedCallsCount()
Returns the missed calls count for a given account.

Returns:
  The missed calls count.

### getParams

AccountParams getParams()
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(org.linphone.core.AccountParams)`.

Returns:
  The `AccountParams` attached to this account.

### setParams

int setParams(AccountParams params)
Set the `AccountParams` used by this `Account`.

Parameters:
  `params` - The `AccountParams` object.

### getPresenceModel

PresenceModel getPresenceModel()
Get the presence model linked to a given account.

Returns:
  the presence model, if assigned, null otherwise.

### setPresenceModel

void setPresenceModel(PresenceModel presenceModel)
Set the presence model linked to a given account and send a PUBLISH message to
the presence server.

Parameters:
  `presenceModel` - The presence model to assign.

### getState

RegistrationState getState()
Get the registration state of the given account.

Returns:
  The `RegistrationState` of the account.

### getTransport

@Deprecated TransportType getTransport()
Deprecated.
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

int getUnreadChatMessageCount()
Returns the unread chat message count for a given account.

Returns:
  The unread chat message count.

### addCustomParam

void addCustomParam(String key, String value)
Set one custom parameter to this `Account`.

Parameters:
  `key` - key of the searched parameter.
  `value` - value of the searched parameter.

### clearCallLogs

void clearCallLogs()
Deletes all the call logs related to this account from the database.

### clone

Account clone()
Instantiate a new account with values from source.

Returns:
  The newly created `Account` object.

### filterChatRooms

ChatRoom[] filterChatRooms(String filter)
Returns a filtered list of chat rooms for a given account.

Parameters:
  `filter` - the criteria a chat room must meet somehow (subject, participant
  address, friend's name).
Returns:
  The list of chat rooms A list of `ChatRoom` objects. .

### findAuthInfo

AuthInfo findAuthInfo()
Find authentication info matching account, if any, similarly to
linphone_core_find_auth_info.

Returns:
  a `AuthInfo` matching account criteria if possible, null if
  nothing can be found.

### getCallLogsForAddress

CallLog[] getCallLogsForAddress(Address remoteAddress)
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 A list of `CallLog` objects. .

### getCustomHeader

String getCustomHeader(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

String getCustomParam(String key)
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, null otherwise.

### isPhoneNumber

boolean isPhoneNumber(String username)
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.

### normalizePhoneNumber

String normalizePhoneNumber(String username)
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:
  null if input is an invalid phone number, normalized phone number from
  username input otherwise.

### normalizeSipUri

Address normalizeSipUri(String username)
Normalize a human readable sip uri into a fully qualified LinphoneAddress.
A sip address should look like DisplayName invalid input: '<'sip:username@domain:port> .
Basically this function performs the following tasks
-if a phone number is entered, prepend country prefix and eventually escape the
'+' by 00 of the proxy config.
-if no domain part is supplied, append the domain name of the proxy config.
Returns null if no proxy is provided at this point.
-if no sip: is present, prepend it.
The result is a syntactically correct SIP address.

Parameters:
  `username` - The string to parse.
Returns:
  null if invalid input, normalized sip address otherwise.

### pauseRegister

void 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

void refreshRegister()
Refresh a proxy registration.
This is useful if for example you resuming from suspend, thus IP address may
have changed.

### resetMissedCallsCount

void resetMissedCallsCount()
Re-sets the number of missed calls for this account to 0.

### setCustomHeader

void setCustomHeader(String headerName, 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.

### newWithConfig

Account newWithConfig(Core lc, AccountParams params, ProxyConfig config)
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.

### addListener

void addListener(AccountListener listener)

### removeListener

void removeListener(AccountListener listener)

### setUserData

void setUserData(Object data)
Sets the object to store in this object user's data

Parameters:
  `data` - the object to store

### getUserData

Object getUserData()
Gets the object stored in this object user's data

Returns:
  the object store if any, null otherwise

### getNativePointer

long getNativePointer()
Gets the native pointer used by this class to make native method calls.

Returns:
  the nativer pointer, as long

### toString

String toString()

Overrides:
  `toString` in class `Object`