Liblinphone: linphone::Factory Class Reference

Liblinphone 5.0.0

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

The factory is a singleton object devoted to the creation of all the objects of Liblinphone that cannot be created by Core itself. More...

`#include <factory.hh>`

Inheritance diagram for linphone::Factory:

## Public Member Functions
| Factory (void *ptr, bool takeRef=true)
LINPHONECXX_PUBLIC _LinphoneFactory * | cPtr ()
LINPHONECXX_PUBLIC std::string | getDataResourcesDir ()
| Get the directory where the data resources are located. More...
LINPHONECXX_PUBLIC void | setDataResourcesDir (const std::string &path)
| Set the directory where the data resources are located. More...
LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::DialPlan > > | getDialPlans () const
| Returns a bctbx_list_t of all DialPlans. More...
LINPHONECXX_PUBLIC std::string | getImageResourcesDir ()
| Get the directory where the image resources are located. More...
LINPHONECXX_PUBLIC void | setImageResourcesDir (const std::string &path)
| Set the directory where the image resources are located. More...
LINPHONECXX_PUBLIC bool | isDatabaseStorageAvailable ()
| Indicates if the storage in database is available. More...
LINPHONECXX_PUBLIC bool | isImdnAvailable ()
| Indicates if IMDN are available. More...
LINPHONECXX_PUBLIC void | setLogCollectionPath (const std::string &path)
| Sets the log collection path. More...
LINPHONECXX_PUBLIC std::string | getMspluginsDir ()
| Get the directory where the mediastreamer2 plugins are located. More...
LINPHONECXX_PUBLIC void | setMspluginsDir (const std::string &path)
| Set the directory where the mediastreamer2 plugins are located. More...
LINPHONECXX_PUBLIC std::string | getRingResourcesDir ()
| Get the directory where the ring resources are located. More...
LINPHONECXX_PUBLIC void | setRingResourcesDir (const std::string &path)
| Set the directory where the ring resources are located. More...
LINPHONECXX_PUBLIC std::string | getSoundResourcesDir ()
| Get the directory where the sound resources are located. More...
LINPHONECXX_PUBLIC void | setSoundResourcesDir (const std::string &path)
| Set the directory where the sound resources are located. More...
LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::VideoDefinition > > | getSupportedVideoDefinitions () const
| Get the list of standard video definitions supported by Linphone. More...
LINPHONECXX_PUBLIC std::string | getTopResourcesDir () const
| Get the top directory where the resources are located. More...
LINPHONECXX_PUBLIC void | setTopResourcesDir (const std::string &path)
| Set the top directory where the resources are located. More...
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Address > | createAddress (const std::string &addr) const
| Parse a string holding a SIP URI and create the according Address object. More...
LINPHONECXX_PUBLIC std::shared_ptr< linphone::AuthInfo > | createAuthInfo (const std::string &username, const std::string &userid, const std::string &passwd, const std::string &ha1, const std::string &realm, const std::string &domain) const
| Creates a AuthInfo object. More...
LINPHONECXX_PUBLIC std::shared_ptr< linphone::AuthInfo > | createAuthInfo (const std::string &username, const std::string &userid, const std::string &passwd, const std::string &ha1, const std::string &realm, const std::string &domain, const std::string &algorithm) const
| Creates a AuthInfo object. More...
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Buffer > | createBuffer ()
| Creates an object Buffer. More...
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Buffer > | createBufferFromData (const uint8_t *data, size_t size)
| Creates an object Buffer. More...
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Buffer > | createBufferFromString (const std::string &data)
| Creates an object Buffer. More...
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Config > | createConfig (const std::string &path)
| Creates an object Config. More...
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Config > | createConfigFromString (const std::string &data)
| Creates an object Config. More...
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Config > | createConfigWithFactory (const std::string &path, const std::string &factoryPath)
| Creates an object Config. More...
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Content > | createContent ()
| Creates an object Content. More...
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Core > | createCore (const std::string &configPath, const std::string &factoryConfigPath, void *systemContext) const
| Instantiate a Core object. More...
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Core > | createCoreWithConfig (const std::shared_ptr< linphone::Config > &config, void *systemContext) const
| Instantiate a Core object with a given LinphoneConfig. More...
LINPHONECXX_PUBLIC std::shared_ptr< linphone::ErrorInfo > | createErrorInfo ()
| Creates an object LinphoneErrorInfo. More...
LINPHONECXX_PUBLIC std::shared_ptr< linphone::ParticipantDeviceIdentity > | createParticipantDeviceIdentity (const std::shared_ptr< const linphone::Address > &address, const std::string &name) const
| Create a ParticipantDeviceIdentity object. More...
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Range > | createRange ()
| Creates an object LinphoneRange. More...
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Transports > | createTransports ()
| Creates an object LinphoneTransports. More...
LINPHONECXX_PUBLIC std::shared_ptr< linphone::TunnelConfig > | createTunnelConfig ()
| Creates an object TunnelConfig. More...
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Vcard > | createVcard ()
| Create an empty Vcard. More...
LINPHONECXX_PUBLIC std::shared_ptr< linphone::VideoActivationPolicy > | createVideoActivationPolicy ()
| Creates an object LinphoneVideoActivationPolicy. More...
LINPHONECXX_PUBLIC std::shared_ptr< linphone::VideoDefinition > | createVideoDefinition (unsigned int width, unsigned int height) const
| Create a VideoDefinition from a given width and height. More...
LINPHONECXX_PUBLIC std::shared_ptr< linphone::VideoDefinition > | createVideoDefinitionFromName (const std::string &name) const
| Create a VideoDefinition from a given standard definition name. More...
LINPHONECXX_PUBLIC void | enableLogCollection (linphone::LogCollectionState state)
| Enables or disables log collection. More...
LINPHONECXX_PUBLIC std::string | getConfigDir (void *context)
| Get the config path. More...
LINPHONECXX_PUBLIC std::string | getDataDir (void *context)
| Get the data path. More...
LINPHONECXX_PUBLIC std::string | getDownloadDir (void *context)
| Get the download path. More...
LINPHONECXX_PUBLIC bool | isChatroomBackendAvailable (linphone::ChatRoomBackend chatroomBackend)
| Indicates if the given LinphoneChatRoomBackend is available. More...
LINPHONECXX_PUBLIC void | setVfsEncryption (const uint16_t encryptionModule, const uint8_t *secret, const size_t secretSize)
| Select encryption module and set secret material to encrypt the files. More...

## Static Public Member Functions
static LINPHONECXX_PUBLIC void | clean ()
| Clean the factory. More...
static LINPHONECXX_PUBLIC std::shared_ptr< linphone::Factory > | get ()
| Create the Factory if that has not been done and return a pointer on it. More...

## Detailed Description

The factory is a singleton object devoted to the creation of all the objects of Liblinphone that cannot be created by Core itself.

It is also used to configure a few behaviors before creating the Core, like the logs verbosity or collection.

## Member Function Documentation

## ◆ clean()

static LINPHONECXX_PUBLIC void linphone::Factory::clean | ( |  | ) |
| static

Clean the factory.

This function is generally useless as the factory is unique per process, however calling this function at the end avoid getting reports from belle-sip leak detector about memory leaked in get().

## ◆ createAddress()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::Address> linphone::Factory::createAddress | ( | const std::string & | addr | ) | const

Parse a string holding a SIP URI and create the according Address object.

Parameters

  addr | A string holding the SIP URI to parse.

Returns
  A new Address.

## ◆ createAuthInfo() [1/2]

LINPHONECXX_PUBLIC std::shared_ptr<linphone::AuthInfo> linphone::Factory::createAuthInfo | ( | const std::string & | username,
|  | const std::string & | userid,
|  | const std::string & | passwd,
|  | const std::string & | ha1,
|  | const std::string & | realm,
|  | const std::string & | domain
| ) |  | const

Creates a AuthInfo object.

The object can be created empty, that is with all arguments set to nullptr. Username, userid, password, realm and domain can be set later using specific methods. At the end, username and passwd (or ha1) are required.

Parameters

  domain | The SIP domain for which this authentication information is valid, if it has to be restricted for a single SIP domain.

Returns
  A AuthInfo object. linphone_auth_info_destroy must be used to destroy it when no longer needed. The Core makes a copy of AuthInfo passed through Core::addAuthInfo().

## ◆ createAuthInfo() [2/2]

LINPHONECXX_PUBLIC std::shared_ptr<linphone::AuthInfo> linphone::Factory::createAuthInfo | ( | const std::string & | username,
|  | const std::string & | userid,
|  | const std::string & | passwd,
|  | const std::string & | ha1,
|  | const std::string & | realm,
|  | const std::string & | domain,
|  | const std::string & | algorithm
| ) |  | const

Creates a AuthInfo object.

The object can be created empty, that is with all arguments set to nullptr. Username, userid, password, realm and domain can be set later using specific methods. At the end, username and passwd (or ha1) are required.

Parameters

  algorithm | The algorithm for encrypting password.

Returns
  A AuthInfo object. linphone_auth_info_destroy must be used to destroy it when no longer needed. The Core makes a copy of AuthInfo passed through Core::addAuthInfo().

## ◆ createBuffer()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::Buffer> linphone::Factory::createBuffer | ( |  | ) |

Creates an object Buffer.

Returns
  a Buffer

## ◆ createBufferFromData()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::Buffer> linphone::Factory::createBufferFromData | ( | const uint8_t * | data,
|  | size_t | size
| ) |  |

Creates an object Buffer.

Parameters

  size | the size of the data

Returns
  a Buffer

## ◆ createBufferFromString()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::Buffer> linphone::Factory::createBufferFromString | ( | const std::string & | data | ) |

Creates an object Buffer.

Parameters

  data | the data to set in the buffer

Returns
  a Buffer

## ◆ createConfig()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::Config> linphone::Factory::createConfig | ( | const std::string & | path | ) |

Creates an object Config.

Parameters

  path | the path of the config

Returns
  a Config

## ◆ createConfigFromString()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::Config> linphone::Factory::createConfigFromString | ( | const std::string & | data | ) |

Creates an object Config.

Parameters

  data | the config data

Returns
  a Config

## ◆ createConfigWithFactory()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::Config> linphone::Factory::createConfigWithFactory | ( | const std::string & | path,
|  | const std::string & | factoryPath
| ) |  |

Creates an object Config.

Parameters

  factoryPath | the path of the factory

Returns
  a Config

## ◆ createContent()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::Content> linphone::Factory::createContent | ( |  | ) |

Creates an object Content.

Returns
  a Content

## ◆ createCore()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::Core> linphone::Factory::createCore | ( | const std::string & | configPath,
|  | const std::string & | factoryConfigPath,
|  | void * | systemContext
| ) |  | const

Instantiate a Core object.

The Core object is the primary handle for doing all phone actions. It should be unique within your application. The Core object is not started automatically, you need to call Core::start() to that effect. The returned Core will be in GlobalState Ready. Core ressources can be released using Core::stop() which is strongly encouraged on garbage collected languages.

Parameters

  systemContext | A pointer to a system object required by the core to operate. Currently it is required to pass an android Context on android, pass nullptr on other platforms.

Returns
  a Core object

See also
  linphone_core_new_with_config_3()

## ◆ createCoreWithConfig()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::Core> linphone::Factory::createCoreWithConfig | ( | const std::shared_ptr< linphone::Config > & | config,
|  | void * | systemContext
| ) |  | const

Instantiate a Core object with a given LinphoneConfig.

The Core object is the primary handle for doing all phone actions. It should be unique within your application. The Core object is not started automatically, you need to call Core::start() to that effect. The returned Core will be in GlobalState Ready. Core ressources can be released using Core::stop() which is strongly encouraged on garbage collected languages.

Parameters

  systemContext | A pointer to a system object required by the core to operate. Currently it is required to pass an android Context on android, pass nullptr on other platforms.

Returns
  a Core object

See also
  createCore()

## ◆ createErrorInfo()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::ErrorInfo> linphone::Factory::createErrorInfo | ( |  | ) |

Creates an object LinphoneErrorInfo.

Returns
  a ErrorInfo object.

## ◆ createParticipantDeviceIdentity()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::ParticipantDeviceIdentity> linphone::Factory::createParticipantDeviceIdentity | ( | const std::shared_ptr< const linphone::Address > & | address,
|  | const std::string & | name
| ) |  | const

Create a ParticipantDeviceIdentity object.

Parameters

  name | the name given to the device.

Returns
  A new ParticipantDeviceIdentity.

## ◆ createRange()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::Range> linphone::Factory::createRange | ( |  | ) |

Creates an object LinphoneRange.

Returns
  a Range object.

## ◆ createTransports()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::Transports> linphone::Factory::createTransports | ( |  | ) |

Creates an object LinphoneTransports.

Returns
  a Transports object.

## ◆ createTunnelConfig()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::TunnelConfig> linphone::Factory::createTunnelConfig | ( |  | ) |

Creates an object TunnelConfig.

Returns
  a TunnelConfig

## ◆ createVcard()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::Vcard> linphone::Factory::createVcard | ( |  | ) |

Create an empty Vcard.

Returns
  a new Vcard.

## ◆ createVideoActivationPolicy()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::VideoActivationPolicy> linphone::Factory::createVideoActivationPolicy | ( |  | ) |

Creates an object LinphoneVideoActivationPolicy.

Returns
  VideoActivationPolicy object.

## ◆ createVideoDefinition()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::VideoDefinition> linphone::Factory::createVideoDefinition | ( | unsigned int | width,
|  | unsigned int | height
| ) |  | const

Create a VideoDefinition from a given width and height.

Parameters

  height | The height of the created video definition

Returns
  A new VideoDefinition object

## ◆ createVideoDefinitionFromName()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::VideoDefinition> linphone::Factory::createVideoDefinitionFromName | ( | const std::string & | name | ) | const

Create a VideoDefinition from a given standard definition name.

Parameters

  name | The standard definition name of the video definition to create

Returns
  A new VideoDefinition object

## ◆ enableLogCollection()

LINPHONECXX_PUBLIC void linphone::Factory::enableLogCollection | ( | linphone::LogCollectionState | state | ) |

Enables or disables log collection.

Parameters

  state | the LogCollectionState for log collection

## ◆ get()

static LINPHONECXX_PUBLIC std::shared_ptr<linphone::Factory> linphone::Factory::get | ( |  | ) |
| static

Create the Factory if that has not been done and return a pointer on it.

Returns
  A pointer on the Factory

## ◆ getConfigDir()

LINPHONECXX_PUBLIC std::string linphone::Factory::getConfigDir | ( | void * | context | ) |

Get the config path.

Parameters

  context | used to compute path. Can be nullptr. JavaPlatformHelper on Android and char *appGroupId on iOS with shared core.

Returns
  The config path

## ◆ getDataDir()

LINPHONECXX_PUBLIC std::string linphone::Factory::getDataDir | ( | void * | context | ) |

Get the data path.

Parameters

  context | used to compute path. Can be nullptr. JavaPlatformHelper on Android and char *appGroupId on iOS with shared core.

Returns
  The data path

## ◆ getDataResourcesDir()

LINPHONECXX_PUBLIC std::string linphone::Factory::getDataResourcesDir | ( |  | ) |

Get the directory where the data resources are located.

Returns
  The path to the directory where the data resources are located

## ◆ getDialPlans()

LINPHONECXX_PUBLIC std::list<std::shared_ptr<linphone::DialPlan> > linphone::Factory::getDialPlans | ( |  | ) | const

Returns a bctbx_list_t of all DialPlans.

Returns
  A list of DialPlan

## ◆ getDownloadDir()

LINPHONECXX_PUBLIC std::string linphone::Factory::getDownloadDir | ( | void * | context | ) |

Get the download path.

Parameters

  context | used to compute path. Can be nullptr. JavaPlatformHelper on Android and char *appGroupId on iOS with shared core.

Returns
  The download path

## ◆ getImageResourcesDir()

LINPHONECXX_PUBLIC std::string linphone::Factory::getImageResourcesDir | ( |  | ) |

Get the directory where the image resources are located.

Returns
  The path to the directory where the image resources are located

## ◆ getMspluginsDir()

LINPHONECXX_PUBLIC std::string linphone::Factory::getMspluginsDir | ( |  | ) |

Get the directory where the mediastreamer2 plugins are located.

Returns
  The path to the directory where the mediastreamer2 plugins are located, or nullptr if it has not been set.

## ◆ getRingResourcesDir()

LINPHONECXX_PUBLIC std::string linphone::Factory::getRingResourcesDir | ( |  | ) |

Get the directory where the ring resources are located.

Returns
  The path to the directory where the ring resources are located

## ◆ getSoundResourcesDir()

LINPHONECXX_PUBLIC std::string linphone::Factory::getSoundResourcesDir | ( |  | ) |

Get the directory where the sound resources are located.

Returns
  The path to the directory where the sound resources are located

## ◆ getSupportedVideoDefinitions()

LINPHONECXX_PUBLIC std::list<std::shared_ptr<linphone::VideoDefinition> > linphone::Factory::getSupportedVideoDefinitions | ( |  | ) | const

Get the list of standard video definitions supported by Linphone.

Returns
  A list of video definitions.

## ◆ getTopResourcesDir()

LINPHONECXX_PUBLIC std::string linphone::Factory::getTopResourcesDir | ( |  | ) | const

Get the top directory where the resources are located.

Returns
  The path to the top directory where the resources are located

## ◆ isChatroomBackendAvailable()

LINPHONECXX_PUBLIC bool linphone::Factory::isChatroomBackendAvailable | ( | linphone::ChatRoomBackend | chatroomBackend | ) |

Indicates if the given LinphoneChatRoomBackend is available.

Parameters

  chatroomBackend | the ChatRoomBackend

Returns
  true if the chatroom backend is available, false otherwise

## ◆ isDatabaseStorageAvailable()

LINPHONECXX_PUBLIC bool linphone::Factory::isDatabaseStorageAvailable | ( |  | ) |

Indicates if the storage in database is available.

Returns
  true if the database storage is available, false otherwise

## ◆ isImdnAvailable()

LINPHONECXX_PUBLIC bool linphone::Factory::isImdnAvailable | ( |  | ) |

Indicates if IMDN are available.

Returns
  true if IDMN are available

## ◆ setDataResourcesDir()

LINPHONECXX_PUBLIC void linphone::Factory::setDataResourcesDir | ( | const std::string & | path | ) |

Set the directory where the data resources are located.

Parameters

  path | The path where the data resources are located

## ◆ setImageResourcesDir()

LINPHONECXX_PUBLIC void linphone::Factory::setImageResourcesDir | ( | const std::string & | path | ) |

Set the directory where the image resources are located.

Parameters

  path | The path where the image resources are located

## ◆ setLogCollectionPath()

LINPHONECXX_PUBLIC void linphone::Factory::setLogCollectionPath | ( | const std::string & | path | ) |

Sets the log collection path.

Parameters

  path | the path of the logs

## ◆ setMspluginsDir()

LINPHONECXX_PUBLIC void linphone::Factory::setMspluginsDir | ( | const std::string & | path | ) |

Set the directory where the mediastreamer2 plugins are located.

Parameters

  path | The path to the directory where the mediastreamer2 plugins are located

## ◆ setRingResourcesDir()

LINPHONECXX_PUBLIC void linphone::Factory::setRingResourcesDir | ( | const std::string & | path | ) |

Set the directory where the ring resources are located.

Parameters

  path | The path where the ring resources are located

## ◆ setSoundResourcesDir()

LINPHONECXX_PUBLIC void linphone::Factory::setSoundResourcesDir | ( | const std::string & | path | ) |

Set the directory where the sound resources are located.

Parameters

  path | The path where the sound resources are located

## ◆ setTopResourcesDir()

LINPHONECXX_PUBLIC void linphone::Factory::setTopResourcesDir | ( | const std::string & | path | ) |

Set the top directory where the resources are located.

If you only define this top directory, the other resources directory will automatically be derived form this one.

Parameters

  path | The path to the top directory where the resources are located

## ◆ setVfsEncryption()

LINPHONECXX_PUBLIC void linphone::Factory::setVfsEncryption | ( | const uint16_t | encryptionModule,
|  | const uint8_t * | secret,
|  | const size_t | secretSize
| ) |  |

Select encryption module and set secret material to encrypt the files.

Parameters

  secretSize | size of the secret

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

- factory.hh