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.
-
Declaration
Swift
public static func getSwiftObject(cObject: OpaquePointer) -> Factory -
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
Factoryif 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 -
Set the directory where the application local cache is located. If the path is empty (default value), the path will be computed when calling getDataDir()
Declaration
Swift
public var cacheDir: String { get set }Parameters
pathThe path to the directory where the application local cache is located
-
Set the directory where the configurations are located. If the path is empty (default value), the path will be computed when calling getConfigDir()
Declaration
Swift
public var configDir: String { get set }Parameters
pathThe path to the directory where the configurations are located
-
Set the directory where the application local data are located. If the path is empty (default value), the path will be computed when calling getDataDir()
Declaration
Swift
public var dataDir: String { get set }Parameters
pathThe path to the directory where the application local data are located
-
Set 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
-
Set the directory where downloads are located. If the path is empty (default value), the path will be computed when calling getDownloadDir()
Declaration
Swift
public var downloadDir: String { get set }Parameters
pathThe path to the directory where downloads are located
-
Set 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
-
Test if cache dir has been set.
Declaration
Swift
public var isCacheDirSet: Bool { get }Return Value
true if cache dir has been set.
-
Test if config dir has been set.
Declaration
Swift
public var isConfigDirSet: Bool { get }Return Value
true if config dir has been set.
-
Test if data dir has been set.
Declaration
Swift
public var isDataDirSet: Bool { get }Return Value
true if data dir has been set.
-
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
-
Test if download dir has been set.
Declaration
Swift
public var isDownloadDirSet: Bool { get }Return Value
true if download dir has been set.
-
Indicates if IMDN are available.
Declaration
Swift
public var isImdnAvailable: Bool { get }Return Value
true if IDMN are available
-
Indicates if the QRCode feature is available.
Declaration
Swift
public var isQrcodeAvailable: Bool { get }Return Value
true if QRCodes can be used
-
Sets the log collection path.
Declaration
Swift
public var logCollectionPath: String { get set }Parameters
paththe path of the logs
-
Set 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 recommended list of standard video definitions. This list is suitable for a widest set of hardware for all video codec implementations, and thus excludes some very high definition formats that are unlikely to work unless specific hardware or codecs are used.
Declaration
Swift
public var recommendedVideoDefinitions: [VideoDefinition] { get }Return Value
A list of video definitions.
-
Set 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
-
Set 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.
-
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.
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
-
Sets the user data in the
Factoryobject.Declaration
Swift
public var userData: UnsafeMutableRawPointer? { get set }Return Value
the user data.
-
Computes the hashed version of the password given the user ID and the realm, using given algorithm.
Declaration
Swift
public func computeHa1ForAlgorithm(userid: String, password: String, realm: String, algorithm: String) -> StringParameters
useridthe username or user ID to use.
passwordthe password to hash.
realmthe real to use.
algorithmthe algorithm to use (MD5 or SHA-256).
Return Value
the generated hash if it succeeded, nil otherwise.
-
Creates a
AuthInfoobject. 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 -> AuthInfoParameters
usernameThe username that needs to be authenticated
useridThe userid used for authenticating (use nil if you don’t know what it is)
passwdThe password in clear text
ha1The ha1-encrypted password if password is not given in clear text.
realmThe authentication domain (which can be larger than the sip domain. Unfortunately many SIP servers don’t use this parameter.
domainThe SIP domain for which this authentication information is valid, if it has to be restricted for a single SIP domain.
-
Creates a
AuthInfoobject. 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 -> AuthInfoParameters
usernameThe username that needs to be authenticated
useridThe userid used for authenticating (use nil if you don’t know what it is)
passwdThe password in clear text
ha1The ha1-encrypted password if password is not given in clear text.
realmThe authentication domain (which can be larger than the sip domain. Unfortunately many SIP servers don’t use this parameter.
domainThe SIP domain for which this authentication information is valid, if it has to be restricted for a single SIP domain.
algorithmThe algorithm for encrypting password.
-
Creates an object
ConferenceInfo.Declaration
Swift
public func createConferenceInfo() throws -> ConferenceInfoReturn Value
-
Creates an object
ConferenceInfofrom an IcalendarContent.Declaration
Swift
public func createConferenceInfoFromIcalendarContent(content: Content) throws -> ConferenceInfoParameters
contentthe Icalendar
ContentReturn Value
a
ConferenceInfocreated from an IcalendarContent -
Instantiate a
Coreobject. TheCoreobject is the primary handle for doing all phone actions. It should be unique within your application. TheCoreobject is not started automatically, you need to call Core.start() to that effect. The returnedCorewill be inGlobalStateReady. 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 -> CoreParameters
configPathfactoryConfigPathA 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.
systemContextA 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
Coreobject -
Instantiate a
Coreobject with a given LinphoneConfig. TheCoreobject is the primary handle for doing all phone actions. It should be unique within your application. TheCoreobject is not started automatically, you need to call Core.start() to that effect. The returnedCorewill be inGlobalStateReady. Core ressources can be released using Core.stop() which is strongly encouraged on garbage collected languages.See
See also: createCore()Declaration
Parameters
configsystemContextA 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
Coreobject -
Create a
DigestAuthenticationPolicyobject. TheDigestAuthenticationPolicyobject which is used to configure a policy for digest authentication, such as allowing MD5 or mode without qop=auth.Declaration
Swift
public func createDigestAuthenticationPolicy() throws -> DigestAuthenticationPolicyReturn Value
a new
DigestAuthenticationPolicy. -
Creates a new
FriendPhoneNumberobjects.Declaration
Swift
public func createFriendPhoneNumber(phoneNumber: String, label: String?) throws -> FriendPhoneNumberParameters
phoneNumberThe phone number.
labelthe type of phone number, for example “home”, “cell”, etc. Use nil or empty for no label.
Return Value
The newly created
FriendPhoneNumberobject. -
Create a
ParticipantDeviceIdentityobject.Declaration
Swift
public func createParticipantDeviceIdentity(address: Address, name: String?) throws -> ParticipantDeviceIdentityParameters
addressAddressobject.namethe name given to the device.
Return Value
A new
ParticipantDeviceIdentity. -
Creates a Bitmap QRCode and return it into an object
Content.Declaration
Swift
public func createQrcode(code: String, width: UInt, height: UInt, margin: UInt) throws -> ContentParameters
codeThe code to be generated into an image. It must not be empty.
widthThe requested width of the QRCode image. It will be 100 if
heightThe requested height of the QRCode image. It will be 100 if
marginThe requested margin of the QRCode image.
Return Value
a
Content -
Instantiate a shared
Coreobject. The sharedCoreallow you to create severalCorewith the same config. TwoCorecan’t run at the same time. A sharedCorecan 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 otherCoreis started. It can be stopped by a “Main Core” and switch toGlobalStateOff 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. TheCoreobject is not started automatically, you need to call Core.start() to that effect. The returnedCorewill be inGlobalStateReady. 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 -> CoreParameters
configFilenameThe 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
Coreobject. It is allowed to set a nil config file. In that caseCorewill not store any settings.factoryConfigPathA 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.
systemContextA 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.
appGroupIdName of iOS App Group that lead to the file system that is shared between an app and its app extensions.
mainCoreIndicate if we want to create a “Main Core” or an “Executor Core”.
Return Value
a
Coreobject -
Instantiate a shared
Coreobject. The sharedCoreallow you to create severalCorewith the same config. TwoCorecan’t run at the same time. A sharedCorecan 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 otherCoreis started. It can be stopped by a “Main Core” and switch toGlobalStateOff 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. TheCoreobject is not started automatically, you need to call Core.start() to that effect. The returnedCorewill be inGlobalStateReady. Core ressources can be released using Core.stop() which is strongly encouraged on garbage collected languages.See
See also: createSharedCore()Declaration
Parameters
configsystemContextA 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.
appGroupIdName of iOS App Group that lead to the file system that is shared between an app and its app extensions.
mainCoreIndicate if we want to create a “Main Core” or an “Executor Core”.
Return Value
a
Coreobject -
Creates an object LinphoneTransports.
Declaration
Swift
public func createTransports() throws -> TransportsReturn Value
a
Transportsobject. -
Creates an object
TunnelConfig.Declaration
Swift
public func createTunnelConfig() throws -> TunnelConfigReturn Value
-
Creates an object LinphoneVideoActivationPolicy.
Declaration
Swift
public func createVideoActivationPolicy() throws -> VideoActivationPolicyReturn Value
VideoActivationPolicyobject. -
Create a
VideoDefinitionfrom a given width and height.Declaration
Swift
public func createVideoDefinition(width: UInt, height: UInt) throws -> VideoDefinitionParameters
widthThe width of the created video definition
heightThe height of the created video definition
Return Value
A new
VideoDefinitionobject -
Create a
VideoDefinitionfrom a given standard definition name.Declaration
Swift
public func createVideoDefinitionFromName(name: String) throws -> VideoDefinitionParameters
nameThe standard definition name of the video definition to create
Return Value
A new
VideoDefinitionobject -
Creates an object
VideoSourceDescriptor.Declaration
Swift
public func createVideoSourceDescriptor() throws -> VideoSourceDescriptorReturn Value
-
Enables or disables log collection.
Declaration
Swift
public func enableLogCollection(state: LogCollectionState)Parameters
statethe
LogCollectionStatefor log collection -
Get the cache path.
Declaration
Swift
public func getCacheDir(context: UnsafeMutableRawPointer?) -> StringParameters
contextused to compute path. Can be nil. JavaPlatformHelper on Android and char *appGroupId on iOS with shared core.
Return Value
The cache path
-
Get the config path.
Declaration
Swift
public func getConfigDir(context: UnsafeMutableRawPointer?) -> StringParameters
contextused 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?) -> StringParameters
contextused 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?) -> StringParameters
contextused 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) -> BoolParameters
chatroomBackendthe
ChatRoomBackendReturn 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
encryptionModuleOne 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
secretthe secret material used to encrypt the files, can be nil for the _PLAIN module
secretSizesize of the secret
-
Creates a QRCode and write it into a JPEG file specified by file_path (only if build with JPEG).
Declaration
Swift
public func writeQrcodeFile(filePath: String, code: String, width: UInt, height: UInt, margin: UInt) -> IntParameters
filePathThe file where to write the QRCode JPEG image.
codeThe code to be generated into an image. It must not be empty.
widthThe requested width of the QRCode image. It will be 100 if
heightThe requested height of the QRCode image. It will be 100 if
marginThe requested margin of the QRCode image.
Return Value
0 if successful, -2 if JPEG is not supported, -1 otherwise
Factory Class Reference