Factory

public class Factory : LinphoneObject

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.

  • Undocumented

    Declaration

    Swift

    public static func getSwiftObject(cObject: OpaquePointer) -> Factory
  • Undocumented

    Declaration

    Swift

    public var getCobject: OpaquePointer? { get }
  • 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().

    Declaration

    Swift

    public static func clean()
  • Create the Factory if that has not been done and return a pointer on it.

    Declaration

    Swift

    public static var Instance: Factory { get }

    Return Value

    A pointer on the Factory

  • Get the directory where the data resources are located.

    Declaration

    Swift

    public var dataResourcesDir: String { get set }

    Return Value

    The path to the directory where the data resources are located

  • Returns a bctbx_list_t of all DialPlans.

    Declaration

    Swift

    public var dialPlans: [DialPlan] { get }

    Return Value

    A list of DialPlan

  • Get the directory where the image resources are located.

    Declaration

    Swift

    public var imageResourcesDir: String { get set }

    Return Value

    The path to the directory where the image resources are located

  • Indicates if the storage in database is available.

    Declaration

    Swift

    public var isDatabaseStorageAvailable: Bool { get }

    Return Value

    true if the database storage is available, false otherwise

  • Indicates if IMDN are available.

    Declaration

    Swift

    public var isImdnAvailable: Bool { get }

    Return Value

    true if IDMN are available

  • Sets the log collection path.

    Declaration

    Swift

    public var logCollectionPath: String { get set }

    Parameters

    path

    the path of the logs

  • Get the directory where the mediastreamer2 plugins are located.

    Declaration

    Swift

    public var mspluginsDir: String { get set }

    Return Value

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

  • Get the directory where the ring resources are located.

    Declaration

    Swift

    public var ringResourcesDir: String { get set }

    Return Value

    The path to the directory where the ring resources are located

  • Get the directory where the sound resources are located.

    Declaration

    Swift

    public var soundResourcesDir: String { get set }

    Return Value

    The path to the directory where the sound resources are located

  • Get the list of standard video definitions supported by Linphone.

    Declaration

    Swift

    public var supportedVideoDefinitions: [VideoDefinition] { get }

    Return Value

    A list of video definitions.

  • Get the top directory where the resources are located.

    Declaration

    Swift

    public var topResourcesDir: String { get set }

    Return Value

    The path to the top directory where the resources are located

  • Gets the user data in the Factory object.

    Declaration

    Swift

    public var userData: UnsafeMutableRawPointer? { get set }

    Return Value

    the user data.

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

    Declaration

    Swift

    public func createAddress(addr: String) throws -> Address

    Parameters

    addr

    A string holding the SIP URI to parse.

    Return Value

    A new Address.

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

    Declaration

    Swift

    public func createAuthInfo(username: String, userid: String?, passwd: String?, ha1: String?, realm: String?, domain: String?) throws -> AuthInfo

    Parameters

    username

    The username that needs to be authenticated

    userid

    The userid used for authenticating (use nil if you don’t know what it is)

    passwd

    The password in clear text

    ha1

    The ha1-encrypted password if password is not given in clear text.

    realm

    The authentication domain (which can be larger than the sip domain. Unfortunately many SIP servers don’t use this parameter.

    domain

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

    Return Value

    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().

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

    Declaration

    Swift

    public func createAuthInfo(username: String, userid: String?, passwd: String?, ha1: String?, realm: String?, domain: String?, algorithm: String?) throws -> AuthInfo

    Parameters

    username

    The username that needs to be authenticated

    userid

    The userid used for authenticating (use nil if you don’t know what it is)

    passwd

    The password in clear text

    ha1

    The ha1-encrypted password if password is not given in clear text.

    realm

    The authentication domain (which can be larger than the sip domain. Unfortunately many SIP servers don’t use this parameter.

    domain

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

    algorithm

    The algorithm for encrypting password.

    Return Value

    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().

  • Creates an object Buffer.

    Declaration

    Swift

    public func createBuffer() throws -> Buffer

    Return Value

    a Buffer

  • Creates an object Buffer.

    Declaration

    Swift

    public func createBufferFromData(data: UnsafePointer<UInt8>, size: Int) throws -> Buffer

    Parameters

    data

    the data to set in the buffer

    size

    the size of the data

    Return Value

    a Buffer

  • Creates an object Buffer.

    Declaration

    Swift

    public func createBufferFromString(data: String) throws -> Buffer

    Parameters

    data

    the data to set in the buffer

    Return Value

    a Buffer

  • Creates an object Config.

    Declaration

    Swift

    public func createConfig(path: String?) throws -> Config

    Parameters

    path

    the path of the config

    Return Value

    a Config

  • Creates an object Config.

    Declaration

    Swift

    public func createConfigFromString(data: String) throws -> Config

    Parameters

    data

    the config data

    Return Value

    a Config

  • Creates an object Config.

    Declaration

    Swift

    public func createConfigWithFactory(path: String?, factoryPath: String?) throws -> Config

    Parameters

    path

    the path of the config

    factoryPath

    the path of the factory

    Return Value

    a Config

  • Creates an object Content.

    Declaration

    Swift

    public func createContent() throws -> Content

    Return Value

    a Content

  • 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.

    See

    See also: linphone_core_new_with_config_3()

    Declaration

    Swift

    public func createCore(configPath: String?, factoryConfigPath: String?, systemContext: UnsafeMutableRawPointer?) throws -> Core

    Parameters

    configPath

    A path to a config file. If it does not exists it will be created. The config file is used to store all settings, proxies… so that all these settings become persistent over the life of the Core object. It is allowed to set a nil config file. In that case Core will not store any settings.

    factoryConfigPath

    A path to a read-only config file that can be used to store hard-coded preferences such as proxy settings or internal preferences. The settings in this factory file always override the ones in the normal config file. It is optional, use nil if unneeded.

    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 nil on other platforms.

    Return Value

    a Core object

  • 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.

    See

    See also: createCore()

    Declaration

    Swift

    public func createCoreWithConfig(config: Config, systemContext: UnsafeMutableRawPointer?) throws -> Core

    Parameters

    config

    A Config object holding the configuration for the Core to be instantiated.

    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 nil on other platforms.

    Return Value

    a Core object

  • Creates an object LinphoneErrorInfo.

    Declaration

    Swift

    public func createErrorInfo() throws -> ErrorInfo

    Return Value

    a ErrorInfo object.

  • Create a ParticipantDeviceIdentity object.

    Declaration

    Swift

    public func createParticipantDeviceIdentity(address: Address, name: String?) throws -> ParticipantDeviceIdentity

    Parameters

    address

    Address object.

    name

    the name given to the device.

    Return Value

    A new ParticipantDeviceIdentity.

  • Creates an object LinphoneRange.

    Declaration

    Swift

    public func createRange() throws -> Range

    Return Value

    a Range object.

  • Instantiate a shared Core object. The shared Core allow you to create several Core with the same config. Two Core can’t run at the same time. A shared Core can be a “Main Core” or an “Executor Core”. A “Main Core” automatically stops a running “Executor Core” when calling Core.start() An “Executor Core” can’t start unless no other Core is started. It can be stopped by a “Main Core” and switch to GlobalState Off at any time. Shared Executor Core are used in iOS UNNotificationServiceExtension to receive new messages from push notifications. When the application is in background, its Shared Main Core is stopped. 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.

    See

    See also: createSharedCoreWithConfig()

    Declaration

    Swift

    public func createSharedCore(configFilename: String?, factoryConfigPath: String?, systemContext: UnsafeMutableRawPointer?, appGroupId: String, mainCore: Bool) throws -> Core

    Parameters

    configFilename

    The name of the config file. If it does not exists it will be created. Its path is computed using the app_group_id. The config file is used to store all settings, proxies… so that all these settings become persistent over the life of the Core object. It is allowed to set a nil config file. In that case Core will not store any settings.

    factoryConfigPath

    A path to a read-only config file that can be used to store hard-coded preferences such as proxy settings or internal preferences. The settings in this factory file always override the ones in the normal config file. It is optional, use nil if unneeded.

    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 nil on other platforms.

    appGroupId

    Name of iOS App Group that lead to the file system that is shared between an app and its app extensions.

    mainCore

    Indicate if we want to create a “Main Core” or an “Executor Core”.

    Return Value

    a Core object

  • Instantiate a shared Core object. The shared Core allow you to create several Core with the same config. Two Core can’t run at the same time. A shared Core can be a “Main Core” or an “Executor Core”. A “Main Core” automatically stops a running “Executor Core” when calling Core.start() An “Executor Core” can’t start unless no other Core is started. It can be stopped by a “Main Core” and switch to GlobalState Off at any time. Shared Executor Core are used in iOS UNNotificationServiceExtension to receive new messages from push notifications. When the application is in background, its Shared Main Core is stopped. 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.

    See

    See also: createSharedCore()

    Declaration

    Swift

    public func createSharedCoreWithConfig(config: Config, systemContext: UnsafeMutableRawPointer?, appGroupId: String, mainCore: Bool) throws -> Core

    Parameters

    config

    A Config object holding the configuration for the Core to be instantiated.

    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 nil on other platforms.

    appGroupId

    Name of iOS App Group that lead to the file system that is shared between an app and its app extensions.

    mainCore

    Indicate if we want to create a “Main Core” or an “Executor Core”.

    Return Value

    a Core object

  • Creates an object LinphoneTransports.

    Declaration

    Swift

    public func createTransports() throws -> Transports

    Return Value

    a Transports object.

  • Creates an object TunnelConfig.

    Declaration

    Swift

    public func createTunnelConfig() throws -> TunnelConfig

    Return Value

    a TunnelConfig

  • Create an empty Vcard.

    Declaration

    Swift

    public func createVcard() throws -> Vcard

    Return Value

    a new Vcard.

  • Creates an object LinphoneVideoActivationPolicy.

    Declaration

    Swift

    public func createVideoActivationPolicy() throws -> VideoActivationPolicy

    Return Value

    VideoActivationPolicy object.

  • Create a VideoDefinition from a given width and height.

    Declaration

    Swift

    public func createVideoDefinition(width: UInt, height: UInt) throws -> VideoDefinition

    Parameters

    width

    The width of the created video definition

    height

    The height of the created video definition

    Return Value

    A new VideoDefinition object

  • Create a VideoDefinition from a given standard definition name.

    Declaration

    Swift

    public func createVideoDefinitionFromName(name: String) throws -> VideoDefinition

    Parameters

    name

    The standard definition name of the video definition to create

    Return Value

    A new VideoDefinition object

  • Enables or disables log collection.

    Declaration

    Swift

    public func enableLogCollection(state: LogCollectionState)

    Parameters

    state

    the LogCollectionState for log collection

  • Get the config path.

    Declaration

    Swift

    public func getConfigDir(context: UnsafeMutableRawPointer?) -> String

    Parameters

    context

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

    Return Value

    The config path

  • Get the data path.

    Declaration

    Swift

    public func getDataDir(context: UnsafeMutableRawPointer?) -> String

    Parameters

    context

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

    Return Value

    The data path

  • Get the download path.

    Declaration

    Swift

    public func getDownloadDir(context: UnsafeMutableRawPointer?) -> String

    Parameters

    context

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

    Return Value

    The download path

  • Indicates if the given LinphoneChatRoomBackend is available.

    Declaration

    Swift

    public func isChatroomBackendAvailable(chatroomBackend: ChatRoomBackend) -> Bool

    Parameters

    chatroomBackend

    Return Value

    true if the chatroom backend is available, false otherwise

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

    Declaration

    Swift

    public func setVfsEncryption(encryptionModule: UInt16, secret: UnsafePointer<UInt8>?, secretSize: Int)

    Parameters

    encryptionModule

    One of the available encryption module for VFS, pick in the LINPHONE_VFS_ENCRYPTION_* list if set to _UNSET, default bctoolbox VFS is switch to Standard one

    secret

    the secret material used to encrypt the files, can be nil for the _PLAIN module

    secretSize

    size of the secret