Call

public class Call : LinphoneObject

This object represents a call issued or received by the Core. You may have multiple calls at the same time, but only one will be in StreamsRunning at any time unless they are merged into a Conference, others will be paused. You can get the State of the call using getState(), it’s current CallParams with getCurrentParams() and the latest statistics by calling getAudioStats() or getVideoStats().

  • Undocumented

    Declaration

    Swift

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

    Declaration

    Swift

    public var getCobject: OpaquePointer? { get }
  • Enum representing the status of a call.

    See more

    Declaration

    Swift

    public enum Status : Int
  • Dir

    Enum representing the direction of a call.

    See more

    Declaration

    Swift

    public enum Dir : Int
  • State enum represents the different states a call can reach into.

    See more

    Declaration

    Swift

    public enum State : Int
  • This object represents a call issued or received by the Core. You may have multiple calls at the same time, but only one will be in StreamsRunning at any time unless they are merged into a Conference, others will be paused. You can get the State of the call using getState(), it’s current CallParams with getCurrentParams() and the latest statistics by calling getAudioStats() or getVideoStats().

    Declaration

    Swift

    public func addDelegate(delegate: CallDelegate)
  • This object represents a call issued or received by the Core. You may have multiple calls at the same time, but only one will be in StreamsRunning at any time unless they are merged into a Conference, others will be paused. You can get the State of the call using getState(), it’s current CallParams with getCurrentParams() and the latest statistics by calling getAudioStats() or getVideoStats().

    Declaration

    Swift

    public func removeDelegate(delegate: CallDelegate)
  • Returns a copy of the call statistics for the audio stream.

    Declaration

    Swift

    public var audioStats: CallStats? { get }

    Return Value

    a CallStats object for the audio stream or nil if it isn’t available.

  • Returns the ZRTP authentication token to verify.

    Declaration

    Swift

    public var authenticationToken: String { get }

    Return Value

    the authentication token to verify or nil if ZRTP isn’t enabled.

  • Returns whether ZRTP authentication token is verified. If not, it must be verified by users as described in ZRTP procedure. Once done, the application must inform of the results with setAuthenticationTokenVerified().

    Declaration

    Swift

    public var authenticationTokenVerified: Bool { get set }

    Return Value

    true if authentication token is verifed, false otherwise.

  • Returns call quality averaged over all the duration of the call. See getCurrentQuality() for more details about quality measurement.

    Declaration

    Swift

    public var averageQuality: Float { get }

    Return Value

    the call average quality since tbe beginning of the call.

  • Gets the call log associated to this call.

    Declaration

    Swift

    public var callLog: CallLog? { get }

    Return Value

    The CallLog associated with the specified Call.

  • Returns if camera pictures are allowed to be sent to the remote party.

    Declaration

    Swift

    public var cameraEnabled: Bool { get set }

    Return Value

    true if local video stream is being sent, false otherwise.

  • Create a new chat room for real time messaging from a call if not already existing, else return existing one. No reference is given to the caller: the chat room will be deleted when the call is ended.

    Declaration

    Swift

    public var chatRoom: ChatRoom? { get }

    Return Value

    ChatRoom where real time messaging can take place or nil if chat room couldn’t be created.

  • Return the associated conference object.

    Declaration

    Swift

    public var conference: Conference? { get }

    Return Value

    A pointer on Conference or nil if the call is not part of any conference.

  • Get the core that has created the specified call.

    Declaration

    Swift

    public var core: Core? { get }

    Return Value

    The Core object that has created the specified call.

  • Gets the current LinphoneCallCbs. This is meant only to be called from a callback to be able to get the user_data associated with the LinphoneCallCbs that is calling the callback.

    Declaration

    Swift

    public var currentDelegate: CallDelegate? { get }

    Return Value

    The LinphoneCallCbs that has called the last callback

  • Returns current parameters associated to the call.

    Declaration

    Swift

    public var currentParams: CallParams? { get }

    Return Value

    the current CallParams of this call.

  • Obtain real-time quality rating of the call. Based on local RTP statistics and RTCP feedback, a quality rating is computed and updated during all the duration of the call. This function returns its value at the time of the function call. It is expected that the rating is updated at least every 5 seconds or so. The rating is a floating point number comprised between 0 and 5. 4-5 = good quality 3-4 = average quality 2-3 = poor quality 1-2 = very poor quality 0-1 = can’t be worse, mostly unusable

    Declaration

    Swift

    public var currentQuality: Float { get }

    Return Value

    The function returns -1 if no quality measurement is available, for example if no active audio stream exist. Otherwise it returns the quality rating.

  • dir

    Returns direction of the call (incoming or outgoing).

    Declaration

    Swift

    public var dir: Call.Dir { get }

    Return Value

    the Dir

  • Returns the diversion address associated to this call.

    Declaration

    Swift

    public var diversionAddress: Address? { get }

    Return Value

    the diversion address as Address or nil.

  • Returns call’s duration in seconds.

    Declaration

    Swift

    public var duration: Int { get }

    Return Value

    the call’s duration in seconds.

  • Returns if echo cancellation is enabled.

    Declaration

    Swift

    public var echoCancellationEnabled: Bool { get set }

    Return Value

    true if echo cancellation is enabled, false otherwise.

  • Returns if echo limiter is enabled.

    Declaration

    Swift

    public var echoLimiterEnabled: Bool { get set }

    Return Value

    true if echo limiter is enabled, false otherwise.

  • Returns full details about call errors or termination reasons.

    Declaration

    Swift

    public var errorInfo: ErrorInfo? { get }

    Return Value

    ErrorInfo object holding the reason error.

  • Gets the current input device for this call.

    Declaration

    Swift

    public var inputAudioDevice: AudioDevice? { get set }

    Return Value

    the AudioDevice used by this call as input or nil if there is currently no soundcard configured (depending on the state of the call)

  • Returns whether or not the call is currently being recorded.

    Declaration

    Swift

    public var isRecording: Bool { get }

    Return Value

    true if recording is in progress, false otherwise

  • Get microphone muted state.

    Declaration

    Swift

    public var microphoneMuted: Bool { get set }

    Return Value

    The microphone muted state.

  • Get microphone volume gain. If the sound backend supports it, the returned gain is equal to the gain set with the system mixer.

    Declaration

    Swift

    public var microphoneVolumeGain: Float { get set }

    Return Value

    double Percentage of the max supported volume gain. Valid values are in [ 0.0 : 1.0 ]. In case of failure, a negative value is returned

  • Get the native window handle of the video window, casted as an unsigned long.

    Declaration

    Swift

    public var nativeVideoWindowId: UnsafeMutableRawPointer? { get set }

    Return Value

    the native video window id (type may vary depending on platform).

  • Gets the current output device for this call.

    Declaration

    Swift

    public var outputAudioDevice: AudioDevice? { get set }

    Return Value

    the AudioDevice used by this call as output or nil if there is currently no soundcard configured (depending on the state of the call)

  • Returns local parameters associated with the call. This is typically the parameters passed at call initiation to Core.inviteAddressWithParams() or acceptWithParams(), or some default parameters if no CallParams was explicitely passed during call initiation.

    Declaration

    Swift

    public var params: CallParams? { get set }

    Return Value

    the call’s local parameters.

  • Get the mesured playback volume level (received from remote) in dbm0.

    Declaration

    Swift

    public var playVolume: Float { get }

    Return Value

    float Volume level in percentage.

  • Gets a player associated with the call to play a local file and stream it to the remote peer.

    Declaration

    Swift

    public var player: Player? { get }

    Return Value

    A Player object

  • Returns the reason for a call termination (either error or normal termination)

    Declaration

    Swift

    public var reason: Reason { get }

    Return Value

    the Reason of the call termination.

  • Get the mesured record volume level (sent to remote) in dbm0.

    Declaration

    Swift

    public var recordVolume: Float { get }

    Return Value

    float Volume level in percentage.

  • Gets the refer-to uri (if the call was transfered).

    Declaration

    Swift

    public var referTo: String { get }

    Return Value

    The refer-to uri of the call (if it was transfered).

  • Returns the remote address associated to this call.

    Declaration

    Swift

    public var remoteAddress: Address? { get }

    Return Value

    The Address of the remote end of the call.

  • Returns the remote address associated to this call as a string. The result string must be freed by user using ms_free().

    • deprecated: 06/07/2020 use getRemoteAddress() instead.

    Declaration

    Swift

    @available(*, deprecated)
    public var remoteAddressAsString: String { get }

    Return Value

    the remote address as a string.

  • Returns the far end’s sip contact as a string, if available.

    Declaration

    Swift

    public var remoteContact: String { get }

    Return Value

    the remote contact or nil.

  • Returns call parameters proposed by remote. This is useful when receiving an incoming call, to know whether the remote party supports video, encryption or whatever.

    Declaration

    Swift

    public var remoteParams: CallParams? { get }

    Return Value

    the CallParams suggested by the remote or nil.

  • Returns the far end’s user agent description string, if available.

    Declaration

    Swift

    public var remoteUserAgent: String { get }

    Return Value

    the remote user agent or nil.

  • Returns the call object this call is replacing, if any. Call replacement can occur during call transfers. By default, the core automatically terminates the replaced call and accept the new one. This function allows the application to know whether a new incoming call is a one that replaces another one.

    Declaration

    Swift

    public var replacedCall: Call? { get }

    Return Value

    the Call object this call is replacing or nil.

  • Get speaker muted state.

    Declaration

    Swift

    public var speakerMuted: Bool { get set }

    Return Value

    The speaker muted state.

  • Get speaker volume gain. If the sound backend supports it, the returned gain is equal to the gain set with the system mixer.

    Declaration

    Swift

    public var speakerVolumeGain: Float { get set }

    Return Value

    Percentage of the max supported volume gain. Valid values are in [ 0.0 : 1.0 ]. In case of failure, a negative value is returned

  • Retrieves the call’s current state.

    Declaration

    Swift

    public var state: Call.State { get }

    Return Value

    the current State of this call.

  • Returns the number of stream for the given call.

    Declaration

    Swift

    public var streamCount: Int { get }

    Return Value

    the amount of streams for this call.

  • Returns a copy of the call statistics for the text stream.

    Declaration

    Swift

    public var textStats: CallStats? { get }

    Return Value

    a CallStats object for the text stream or nil if it isn’t available.

  • Returns the to address with its headers associated to this call.

    Declaration

    Swift

    public var toAddress: Address? { get }

    Return Value

    the #LinphoneAdress matching the TO of the call.

  • Returns the current transfer state, if a transfer has been initiated from this call.

    See

    See also: linphone_core_transfer_call , linphone_core_transfer_call_to_another

    Declaration

    Swift

    public var transferState: Call.State { get }

    Return Value

    the State.

  • When this call has received a transfer request, returns the new call that was automatically created as a result of the transfer.

    Declaration

    Swift

    public var transferTargetCall: Call? { get }

    Return Value

    the transfer Call created.

  • Gets the transferer if this call was started automatically as a result of an incoming transfer request. The call in which the transfer request was received is returned in this case.

    Declaration

    Swift

    public var transfererCall: Call? { get }

    Return Value

    The transferer Call if the specified call was started automatically as a result of an incoming transfer request, nil otherwise.

  • Retrieve the user pointer associated with the call.

    Declaration

    Swift

    public var userData: UnsafeMutableRawPointer? { get set }

    Return Value

    The user pointer associated with the call.

  • Returns a copy of the call statistics for the video stream.

    Declaration

    Swift

    public var videoStats: CallStats? { get }

    Return Value

    a CallStats object for the video stream or nil if it isn’t available.

  • Accept an incoming call. Basically the application is notified of incoming calls within the call_state_changed callback of the LinphoneCoreVTable structure, where it will receive a Incoming event with the associated Call object. The application can later accept the call using this method.

    Declaration

    Swift

    public func accept() throws

    Return Value

    0 on success, -1 on failure

  • Accept an early media session for an incoming call. This is identical as calling acceptEarlyMediaWithParams() with nil parameters.

    See

    See also: acceptEarlyMediaWithParams()

    Declaration

    Swift

    public func acceptEarlyMedia() throws

    Return Value

    0 if successful, -1 otherwise

  • When receiving an incoming, accept to start a media session as early-media. This means the call is not accepted but audio & video streams can be established if the remote party supports early media. However, unlike after call acceptance, mic and camera input are not sent during early-media, though received audio & video are played normally. The call can then later be fully accepted using accept() or acceptWithParams().

    Declaration

    Swift

    public func acceptEarlyMediaWithParams(params: CallParams?) throws

    Parameters

    params

    The call parameters to use (can be nil).

    Return Value

    0 if successful, -1 otherwise

  • Accept call modifications initiated by other end. This call may be performed in response to a #LinphoneCallUpdatedByRemote state notification. When such notification arrives, the application can decide to call deferUpdate() so that it can have the time to prompt the user. getRemoteParams() can be used to get information about the call parameters requested by the other party, such as whether a video stream is requested. When the user accepts or refuse the change, acceptUpdate() can be done to answer to the other party. If params is nil, then the same call parameters established before the update request will continue to be used (no change). If params is not nil, then the update will be accepted according to the parameters passed. Typical example is when a user accepts to start video, then params should indicate that video stream should be used (see CallParams.enableVideo()).

    Declaration

    Swift

    public func acceptUpdate(params: CallParams?) throws

    Parameters

    params

    A CallParams object describing the call parameters to accept.

    Return Value

    0 if successful, -1 otherwise (actually when this function call is performed outside ot #LinphoneCallUpdatedByRemote state)

  • Accept an incoming call, with parameters. Basically the application is notified of incoming calls within the call_state_changed callback of the LinphoneCoreVTable structure, where it will receive a Incoming event with the associated Call object. The application can later accept the call using this method.

    Declaration

    Swift

    public func acceptWithParams(params: CallParams?) throws

    Parameters

    params

    The specific parameters for this call, for example whether video is accepted or not. Use nil to use default parameters.

    Return Value

    0 on success, -1 on failure

  • Tell whether a call has been asked to autoanswer.

    Declaration

    Swift

    public func askedToAutoanswer() -> Bool

    Return Value

    A boolean value telling whether the call has been asked to autoanswer

  • Stop current DTMF sequence sending. Please note that some DTMF could be already sent, depending on when this function call is delayed from sendDtmfs(). This function will be automatically called if call state change to anything but LinphoneCallStreamsRunning.

    Declaration

    Swift

    public func cancelDtmfs()
  • Decline a pending incoming call, with a reason.

    Declaration

    Swift

    public func decline(reason: Reason) throws

    Parameters

    reason

    The reason for rejecting the call: Declined or Busy

    Return Value

    0 on success, -1 on failure

  • Decline a pending incoming call, with a ErrorInfo object.

    Declaration

    Swift

    public func declineWithErrorInfo(ei: ErrorInfo?) -> Int

    Parameters

    ei

    ErrorInfo containing more information on the call rejection.

    Return Value

    0 on success, -1 on failure

  • When receiving a #LinphoneCallUpdatedByRemote state notification, prevent Core from performing an automatic answer. When receiving a #LinphoneCallUpdatedByRemote state notification (ie an incoming reINVITE), the default behaviour of Core is defined by the “defer_update_default” option of the “sip” section of the config. If this option is 0 (the default) then the Core automatically answers the reINIVTE with call parameters unchanged. However when for example when the remote party updated the call to propose a video stream, it can be useful to prompt the user before answering. This can be achieved by calling linphone_core_defer_call_update during the call state notification, to deactivate the automatic answer that would just confirm the audio but reject the video. Then, when the user responds to dialog prompt, it becomes possible to call acceptUpdate() to answer the reINVITE, with eventually video enabled in the CallParams argument. The #LinphoneCallUpdatedByRemote notification can also arrive when receiving an INVITE without SDP. In such case, an unchanged offer is made in the 200Ok, and when the ACK containing the SDP answer is received,

    LinphoneCallUpdatedByRemote is triggered to notify the application of possible

    changes in the media session. However in such case defering the update has no meaning since we just generating an offer.

    Declaration

    Swift

    public func deferUpdate() throws

    Return Value

    0 if successful, -1 if the deferUpdate() was done outside a valid #LinphoneCallUpdatedByRemote notification

  • Returns a copy of the call statistics for a particular stream type.

    Declaration

    Swift

    public func getStats(type: StreamType) -> CallStats?

    Parameters

    type

    Return Value

    a CallStats object for the given stream or nil if stream isn’t available.

  • Returns the value of the header name.

    • deprecated: 27/10/2020. Use CallParams.getCustomHeader() on getRemoteParams() instead.

    Declaration

    Swift

    @available(*, deprecated)
    public func getToHeader(headerName: String) -> String

    Parameters

    headerName

    the name of the header to check.

    Return Value

    the value of the header if exists.

  • Returns if this calls has received a transfer that has not been executed yet. Pending transfers are executed when this call is being paused or closed, locally or by remote endpoint. If the call is already paused while receiving the transfer request, the transfer immediately occurs.

    Declaration

    Swift

    public func hasTransferPending() -> Bool

    Return Value

    true if transfer is pending, false otherwise.

  • Indicates whether an operation is in progress at the media side. It can be a bad idea to initiate signaling operations (adding video, pausing the call, removing video, changing video parameters) while the media is busy in establishing the connection (typically ICE connectivity checks). It can result in failures generating loss of time in future operations in the call. Applications are invited to check this function after each call state change to decide whether certain operations are permitted or not.

    Declaration

    Swift

    public func mediaInProgress() -> Bool

    Return Value

    true if media is busy in establishing the connection, false otherwise.

  • Calls generic OpenGL render for a given call.

    Declaration

    Swift

    public func oglRender()
  • Pauses the call. If a music file has been setup using Core.setPlayFile(), this file will be played to the remote user. The only way to resume a paused call is to call resume().

    See

    See also: resume()

    Declaration

    Swift

    public func pause() throws

    Return Value

    0 on success, -1 on failure

  • Redirect the specified call to the given redirect URI.

    • deprecated: 27/10/2020. Use redirectTo() instead.

    Declaration

    Swift

    @available(*, deprecated)
    public func redirect(redirectUri: String) throws

    Parameters

    redirectUri

    The URI to redirect the call to

    Return Value

    0 if successful, -1 on error.

  • Redirect the specified call to the given redirect Address.

    Declaration

    Swift

    public func redirectTo(redirectAddress: Address) throws

    Parameters

    redirectAddress

    The Address to redirect the call to

    Return Value

    0 if successful, -1 on error.

  • Request the callback passed to linphone_call_cbs_set_next_video_frame_decoded to be called the next time the video decoder properly decodes a video frame.

    Declaration

    Swift

    public func requestNotifyNextVideoFrameDecoded()
  • Resumes a call. The call needs to have been paused previously with pause().

    See

    See also: pause()

    Declaration

    Swift

    public func resume() throws

    Return Value

    0 on success, -1 on failure

  • Send the specified dtmf. The dtmf is automatically played to the user.

    Declaration

    Swift

    public func sendDtmf(dtmf: CChar) throws

    Parameters

    dtmf

    The dtmf name specified as a char, such as ‘0’, ‘#’ etc…

    Return Value

    0 if successful, -1 on error.

  • Send a list of dtmf. The dtmfs are automatically sent to remote, separated by some needed customizable delay. Sending is canceled if the call state changes to something not LinphoneCallStreamsRunning.

    Declaration

    Swift

    public func sendDtmfs(dtmfs: String) throws

    Parameters

    dtmfs

    A dtmf sequence such as ‘123#123123’

    Return Value

    -2 if there is already a DTMF sequence, -1 if call is not ready, 0 otherwise.

  • Sends an info message through an established call.

    Declaration

    Swift

    public func sendInfoMessage(info: InfoMessage) throws

    Parameters

    info

    the InfoMessage to send

  • Request remote side to send us a Video Fast Update.

    Declaration

    Swift

    public func sendVfuRequest()
  • Starts call recording. Video record is only available if this function is called in state StreamRunning. The output file where audio is recorded must be previously specified with CallParams.setRecordFile().

    Declaration

    Swift

    public func startRecording()
  • Stops call recording.

    Declaration

    Swift

    public func stopRecording()
  • Take a photo of currently captured video and write it into a jpeg file. Note that the snapshot is asynchronous, an application shall not assume that the file is created when the function returns.

    Declaration

    Swift

    public func takePreviewSnapshot(filePath: String) throws

    Parameters

    filePath

    a path where to write the jpeg content.

    Return Value

    0 if successfull, -1 otherwise (typically if jpeg format is not supported).

  • Take a photo of currently received video and write it into a jpeg file. Note that the snapshot is asynchronous, an application shall not assume that the file is created when the function returns.

    Declaration

    Swift

    public func takeVideoSnapshot(filePath: String) throws

    Parameters

    filePath

    a path where to write the jpeg content.

    Return Value

    0 if successfull, -1 otherwise (typically if jpeg format is not supported).

  • Terminates a call.

    Declaration

    Swift

    public func terminate() throws

    Return Value

    0 on success, -1 on failure

  • Terminates a call.

    Declaration

    Swift

    public func terminateWithErrorInfo(ei: ErrorInfo?) throws

    Parameters

    ei

    Return Value

    0 on success, -1 on failure

  • Performs a simple call transfer to the specified destination. The remote endpoint is expected to issue a new call to the specified destination. The current call remains active and thus can be later paused or terminated. It is possible to follow the progress of the transfer provided that transferee sends notification about it. In this case, the transfer_state_changed callback of the LinphoneCoreVTable is invoked to notify of the state of the new call at the other party. The notified states are

    LinphoneCallOutgoingInit , #LinphoneCallOutgoingProgress,

    LinphoneCallOutgoingRinging and #LinphoneCallConnected.

    • deprecated: 27/10/2020. Use transferTo() instead.

    Declaration

    Swift

    @available(*, deprecated)
    public func transfer(referTo: String) throws

    Parameters

    referTo

    The destination the call is to be refered to.

    Return Value

    0 on success, -1 on failure

  • Performs a simple call transfer to the specified destination. The remote endpoint is expected to issue a new call to the specified destination. The current call remains active and thus can be later paused or terminated. It is possible to follow the progress of the transfer provided that transferee sends notification about it. In this case, the transfer_state_changed callback of the LinphoneCoreVTable is invoked to notify of the state of the new call at the other party. The notified states are

    LinphoneCallOutgoingInit , #LinphoneCallOutgoingProgress,

    LinphoneCallOutgoingRinging and #LinphoneCallConnected.

    Declaration

    Swift

    public func transferTo(referTo: Address) throws

    Parameters

    referTo

    The Address the call is to be refered to.

    Return Value

    0 on success, -1 on failure

  • Transfers a call to destination of another running call. This is used for “attended transfer” scenarios. The transfered call is supposed to be in paused state, so that it is able to accept the transfer immediately. The destination call is a call previously established to introduce the transfered person. This method will send a transfer request to the transfered person. The phone of the transfered is then expected to automatically call to the destination of the transfer. The receiver of the transfer will then automatically close the call with us (the ‘dest’ call). It is possible to follow the progress of the transfer provided that transferee sends notification about it. In this case, the transfer_state_changed callback of the LinphoneCoreVTable is invoked to notify of the state of the new call at the other party. The notified states are #LinphoneCallOutgoingInit ,

    LinphoneCallOutgoingProgress, #LinphoneCallOutgoingRinging and

    LinphoneCallConnected.

    Declaration

    Swift

    public func transferToAnother(dest: Call) throws

    Parameters

    dest

    A running call whose remote person will receive the transfer

    Return Value

    0 on success, -1 on failure

  • Updates a running call according to supplied call parameters or parameters changed in the LinphoneCore. It triggers a SIP reINVITE in order to perform a new offer/answer of media capabilities. Changing the size of the transmitted video after calling linphone_core_set_preferred_video_size can be used by passing nil as params argument. In case no changes are requested through the CallParams argument, then this argument can be omitted and set to nil. WARNING: Updating a call in the #LinphoneCallPaused state will still result in a paused call even if the media directions set in the params are sendrecv. To resume a paused call, you need to call resume().

    Declaration

    Swift

    public func update(params: CallParams?) throws

    Parameters

    params

    The new call parameters to use (may be nil).

    Return Value

    0 if successful, -1 otherwise.

  • Perform a zoom of the video displayed during a call. The zoom ensures that all the screen is fullfilled with the video.

    Declaration

    Swift

    public func zoom(zoomFactor: Float, cx: Float, cy: Float)

    Parameters

    zoomFactor

    a floating point number describing the zoom factor. A value 1.0 corresponds to no zoom applied.

    cx

    a floating point number pointing the horizontal center of the zoom to be applied. This value should be between 0.0 and 1.0.

    cy

    a floating point number pointing the vertical center of the zoom to be applied. This value should be between 0.0 and 1.0.