Added in API level 9
Deprecated in API level 31

SipAudioCall


open class SipAudioCall
kotlin.Any
   ↳ android.net.sip.SipAudioCall

Handles an Internet audio call over SIP. You can instantiate this class with SipManager, using android.net.sip.SipManager#makeAudioCall and takeAudioCall().

Note: Using this class require the android.Manifest.permission#INTERNET and android.Manifest.permission#USE_SIP permissions. In addition, startAudio requires the android.Manifest.permission#RECORD_AUDIO, android.Manifest.permission#ACCESS_WIFI_STATE, and android.Manifest.permission#WAKE_LOCK permissions; and setSpeakerMode() requires the android.Manifest.permission#MODIFY_AUDIO_SETTINGS permission.

Summary

Nested classes
open

Listener for events relating to a SIP call, such as when a call is being received ("on ringing") or a call is outgoing ("on calling").

Public constructors
SipAudioCall(context: Context!, localProfile: SipProfile!)

Creates a call object with the local SIP profile.

Public methods
open Unit
answerCall(timeout: Int)

Answers a call.

open Unit
attachCall(session: SipSession!, sessionDescription: String!)

Attaches an incoming call to this call object.

open Unit

Closes this object.

open Unit
continueCall(timeout: Int)

Continues a call that's on hold.

open Unit

Ends a call.

open SipProfile!

Gets the local SIP profile.

open SipProfile!

Gets the peer's SIP profile.

open Int

Gets the state of the SipSession that carries this call.

open Unit
holdCall(timeout: Int)

Puts a call on hold.

open Boolean

Checks if the call is established.

open Boolean

Checks if the call is muted.

open Boolean

Checks if the call is on hold.

open Unit
makeCall(peerProfile: SipProfile!, sipSession: SipSession!, timeout: Int)

Initiates an audio call to the specified profile.

open Unit
sendDtmf(code: Int)

Sends a DTMF code.

open Unit
sendDtmf(code: Int, result: Message!)

Sends a DTMF code.

open Unit

Sets the listener to listen to the audio call events.

open Unit
setListener(listener: SipAudioCall.Listener!, callbackImmediately: Boolean)

Sets the listener to listen to the audio call events.

open Unit
setSpeakerMode(speakerMode: Boolean)

Puts the device to speaker mode.

open Unit

Starts the audio for the established call.

open Unit

Toggles mute.

Public constructors

SipAudioCall

Added in API level 9
SipAudioCall(
    context: Context!,
    localProfile: SipProfile!)

Creates a call object with the local SIP profile.

Parameters
context Context!: the context for accessing system services such as ringtone, audio, WIFI etc

Public methods

answerCall

Added in API level 9
open fun answerCall(timeout: Int): Unit

Deprecated: Deprecated in Java.

Answers a call. The attempt will be timed out if the call is not established within timeout seconds and onError(SipAudioCall, SipErrorCode.TIME_OUT, String) will be called.

Parameters
timeout Int: the timeout value in seconds. Default value (defined by SIP protocol) is used if timeout is zero or negative.
Exceptions
android.net.sip.SipException if the SIP service fails to answer the call

attachCall

Added in API level 9
open fun attachCall(
    session: SipSession!,
    sessionDescription: String!
): Unit

Deprecated: Deprecated in Java.

Attaches an incoming call to this call object.

Parameters
session SipSession!: the session that receives the incoming call
sessionDescription String!: the session description of the incoming call
Exceptions
android.net.sip.SipException if the SIP service fails to attach this object to the session or VOIP API is not supported by the device

close

Added in API level 9
open fun close(): Unit

Deprecated: Deprecated in Java.

Closes this object. This object is not usable after being closed.

continueCall

Added in API level 9
open fun continueCall(timeout: Int): Unit

Deprecated: Deprecated in Java.

Continues a call that's on hold. When succeeds, Listener#onCallEstablished is called. The attempt will be timed out if the call is not established within timeout seconds and onError(SipAudioCall, SipErrorCode.TIME_OUT, String) will be called.

Parameters
timeout Int: the timeout value in seconds. Default value (defined by SIP protocol) is used if timeout is zero or negative.
Exceptions
android.net.sip.SipException if the SIP service fails to unhold the call

endCall

Added in API level 9
open fun endCall(): Unit

Deprecated: Deprecated in Java.

Ends a call.

Exceptions
android.net.sip.SipException if the SIP service fails to end the call

getLocalProfile

Added in API level 9
open fun getLocalProfile(): SipProfile!

Deprecated: Deprecated in Java.

Gets the local SIP profile.

Return
SipProfile! the local SIP profile

getPeerProfile

Added in API level 9
open fun getPeerProfile(): SipProfile!

Deprecated: Deprecated in Java.

Gets the peer's SIP profile.

Return
SipProfile! the peer's SIP profile

getState

Added in API level 9
open fun getState(): Int

Deprecated: Deprecated in Java.

Gets the state of the SipSession that carries this call. The value returned must be one of the states in SipSession.State.

Return
Int the session state

holdCall

Added in API level 9
open fun holdCall(timeout: Int): Unit

Deprecated: Deprecated in Java.

Puts a call on hold. When succeeds, Listener#onCallHeld is called. The attempt will be timed out if the call is not established within timeout seconds and onError(SipAudioCall, SipErrorCode.TIME_OUT, String) will be called.

Parameters
timeout Int: the timeout value in seconds. Default value (defined by SIP protocol) is used if timeout is zero or negative.
Exceptions
android.net.sip.SipException if the SIP service fails to hold the call

isInCall

Added in API level 9
open fun isInCall(): Boolean

Deprecated: Deprecated in Java.

Checks if the call is established.

Return
Boolean true if the call is established

isMuted

Added in API level 9
open fun isMuted(): Boolean

Deprecated: Deprecated in Java.

Checks if the call is muted.

Return
Boolean true if the call is muted

isOnHold

Added in API level 9
open fun isOnHold(): Boolean

Deprecated: Deprecated in Java.

Checks if the call is on hold.

Return
Boolean true if the call is on hold

makeCall

Added in API level 9
open fun makeCall(
    peerProfile: SipProfile!,
    sipSession: SipSession!,
    timeout: Int
): Unit

Deprecated: Deprecated in Java.

Initiates an audio call to the specified profile. The attempt will be timed out if the call is not established within timeout seconds and onError(SipAudioCall, SipErrorCode.TIME_OUT, String) will be called.

Parameters
peerProfile SipProfile!: the SIP profile to make the call to
sipSession SipSession!: the SipSession for carrying out the call
timeout Int: the timeout value in seconds. Default value (defined by SIP protocol) is used if timeout is zero or negative.
Exceptions
android.net.sip.SipException if the SIP service fails to create a session for the call or VOIP API is not supported by the device

sendDtmf

Added in API level 9
open fun sendDtmf(code: Int): Unit

Deprecated: Deprecated in Java.

Sends a DTMF code. According to RFC 2883, event 0--9 maps to decimal value 0--9, '*' to 10, '#' to 11, event 'A'--'D' to 12--15, and event flash to 16. Currently, event flash is not supported.

Parameters
code Int: the DTMF code to send. Value 0 to 15 (inclusive) are valid inputs.

sendDtmf

Added in API level 9
open fun sendDtmf(
    code: Int,
    result: Message!
): Unit

Deprecated: Deprecated in Java.

Sends a DTMF code. According to RFC 2883, event 0--9 maps to decimal value 0--9, '*' to 10, '#' to 11, event 'A'--'D' to 12--15, and event flash to 16. Currently, event flash is not supported.

Parameters
code Int: the DTMF code to send. Value 0 to 15 (inclusive) are valid inputs.
result Message!: the result message to send when done

setListener

Added in API level 9
open fun setListener(listener: SipAudioCall.Listener!): Unit

Deprecated: Deprecated in Java.

Sets the listener to listen to the audio call events. The method calls #setListener.

Parameters
listener SipAudioCall.Listener!: to listen to the audio call events of this object

setListener

Added in API level 9
open fun setListener(
    listener: SipAudioCall.Listener!,
    callbackImmediately: Boolean
): Unit

Deprecated: Deprecated in Java.

Sets the listener to listen to the audio call events. A SipAudioCall can only hold one listener at a time. Subsequent calls to this method override the previous listener.

Parameters
listener SipAudioCall.Listener!: to listen to the audio call events of this object
callbackImmediately Boolean: set to true if the caller wants to be called back immediately on the current state

setSpeakerMode

Added in API level 9
open fun setSpeakerMode(speakerMode: Boolean): Unit

Deprecated: Deprecated in Java.

Puts the device to speaker mode.

Note: Requires the android.Manifest.permission#MODIFY_AUDIO_SETTINGS permission.

Parameters
speakerMode Boolean: set true to enable speaker mode; false to disable

startAudio

Added in API level 9
open fun startAudio(): Unit

Deprecated: Deprecated in Java.

Starts the audio for the established call. This method should be called after Listener#onCallEstablished is called.

Note: Requires the android.Manifest.permission#RECORD_AUDIO, android.Manifest.permission#ACCESS_WIFI_STATE and android.Manifest.permission#WAKE_LOCK permissions.

toggleMute

Added in API level 9
open fun toggleMute(): Unit

Deprecated: Deprecated in Java.

Toggles mute.