Call

public class Call : LinphoneObject

The Call object represents a call issued or received by the Core.

  • 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
  • LinphoneCallState enum represents the different states a call can reach into.

    See more

    Declaration

    Swift

    public enum State : Int
  • Undocumented

    Declaration

    Swift

    public func addDelegate(delegate: CallDelegate)
  • Undocumented

    Declaration

    Swift

    public func removeDelegate(delegate: CallDelegate)
  • Returns the ZRTP authentication token to verify.

    Declaration

    Swift

    public var authenticationToken: String { get }

    Return Value

    the authentication token to verify.

  • 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

    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 }
  • 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 true if camera pictures are allowed to be sent to the remote party.

    Declaration

    Swift

    public var cameraEnabled: Bool { get set }
  • Create a new chat room for 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 messaging can take place.

  • 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 currentCallbacks: 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 }
  • 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 }
  • Returns the diversion address associated to this call.

    Declaration

    Swift

    public var diversionAddress: Address? { get }
  • Returns call’s duration in seconds.

    Declaration

    Swift

    public var duration: Int { get }
  • Returns true if echo cancellation is enabled.

    Declaration

    Swift

    public var echoCancellationEnabled: Bool { get set }
  • Returns true if echo limiter is enabled.

    Declaration

    Swift

    public var echoLimiterEnabled: Bool { get set }
  • Returns full details about call errors or termination reasons.

    Declaration

    Swift

    public var errorInfo: ErrorInfo? { get }

    Return Value

    ErrorInfo object holding the reason error.

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

  • Get 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 }
  • 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 }
  • Returns the remote address associated to this call as a string. The result string must be freed by user using ms_free().

    Declaration

    Swift

    public var remoteAddressAsString: String { get }
  • Returns the far end’s sip contact as a string, if available.

    Declaration

    Swift

    public var remoteContact: String { get }
  • 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 }
  • Returns the far end’s user agent description string, if available.

    Declaration

    Swift

    public var remoteUserAgent: String { get }
  • 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 }
  • 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 }
  • Returns the number of stream for the given call. Currently there is only two (Audio, Video), but later there will be more.

    Declaration

    Swift

    public var streamCount: Int { get }

    Return Value

    2

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

    Declaration

    Swift

    public var toAddress: Address? { get }
  • 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 }
  • 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 }
  • 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

  • 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 LinphoneCallIncoming 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 LinphoneCallIncoming 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 linphone_call_send_dtmfs. 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: LinphoneReasonDeclined or LinphoneReasonBusy

    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

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

    Declaration

    Swift

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

    Parameters

    type

    the stream type

  • Returns the value of the header name.

    Declaration

    Swift

    public func getToHeader(name: String) -> String
  • Returns true 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
  • 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

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

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

    Declaration

    Swift

    public func redirect(redirectUri: String) throws

    Parameters

    redirectUri

    The URI 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.

  • Send a InfoMessage through an established call.

    Declaration

    Swift

    public func sendInfoMessage(info: InfoMessage) throws

    Parameters

    info

    the info message

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

    Declaration

    Swift

    public func sendVfuRequest()
  • Start 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()
  • Stop 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(file: String) throws

    Parameters

    file

    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(file: String) throws

    Parameters

    file

    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.

    Declaration

    Swift

    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

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

  • Perform a zoom of the video displayed during a call.

    • deprecated: use linphone_call_zoom instead cx and cy are updated in return in case their coordinates were too excentrated for the requested zoom factor. The zoom ensures that all the screen is fullfilled with the video.

    Declaration

    Swift

    public func zoomVideo(zoomFactor: Float, cx: UnsafeMutablePointer<Float>, cy: UnsafeMutablePointer<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.