Added in API level 9
Deprecated in API level 31

SipSession


class SipSession
kotlin.Any
   ↳ android.net.sip.SipSession

Represents a SIP session that is associated with a SIP dialog or a standalone transaction not within a dialog.

You can get a SipSession from SipManager with createSipSession() (when initiating calls) or getSessionFor() (when receiving calls).

Summary

Nested classes

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

Defines SIP session states, such as "registering", "outgoing call", and "in call".

Public methods
Unit
answerCall(sessionDescription: String!, timeout: Int)

Answers an incoming call with the specified session description.

Unit
changeCall(sessionDescription: String!, timeout: Int)

Changes the session description during a call.

Unit

Ends an established call, terminates an outgoing call or rejects an incoming call.

String!

Gets the call ID of the session.

String!

Gets the IP address of the local host on which this SIP session runs.

SipProfile!

Gets the SIP profile that this session is associated with.

SipProfile!

Gets the SIP profile that this session is connected to.

Int

Gets the session state.

Boolean

Checks if the session is in a call.

Unit
makeCall(callee: SipProfile!, sessionDescription: String!, timeout: Int)

Initiates a call to the specified profile.

Unit
register(duration: Int)

Performs registration to the server specified by the associated local profile.

Unit

Sets the listener to listen to the session events.

Unit

Performs unregistration to the server specified by the associated local profile.

Public methods

answerCall

Added in API level 9
fun answerCall(
    sessionDescription: String!,
    timeout: Int
): Unit

Deprecated: Deprecated in Java.

Answers an incoming call with the specified session description. The method is only valid to call when the session state is in State#INCOMING_CALL.

Parameters
sessionDescription String!: the session description to answer this call
timeout Int: the session will be timed out if the call is not established within timeout seconds. Default value (defined by SIP protocol) is used if timeout is zero or negative.

changeCall

Added in API level 9
fun changeCall(
    sessionDescription: String!,
    timeout: Int
): Unit

Deprecated: Deprecated in Java.

Changes the session description during a call. The method is only valid to call when the session state is in State#IN_CALL.

Parameters
sessionDescription String!: the new session description
timeout Int: the session will be timed out if the call is not established within timeout seconds. Default value (defined by SIP protocol) is used if timeout is zero or negative.

endCall

Added in API level 9
fun endCall(): Unit

Deprecated: Deprecated in Java.

Ends an established call, terminates an outgoing call or rejects an incoming call. The method is only valid to call when the session state is in State#IN_CALL, State#INCOMING_CALL, State#OUTGOING_CALL or State#OUTGOING_CALL_RING_BACK.

getCallId

Added in API level 9
fun getCallId(): String!

Deprecated: Deprecated in Java.

Gets the call ID of the session.

Return
String! the call ID

getLocalIp

Added in API level 9
fun getLocalIp(): String!

Deprecated: Deprecated in Java.

Gets the IP address of the local host on which this SIP session runs.

Return
String! the IP address of the local host

getLocalProfile

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

Deprecated: Deprecated in Java.

Gets the SIP profile that this session is associated with.

Return
SipProfile! the SIP profile that this session is associated with

getPeerProfile

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

Deprecated: Deprecated in Java.

Gets the SIP profile that this session is connected to. Only available when the session is associated with a SIP dialog.

Return
SipProfile! the SIP profile that this session is connected to

getState

Added in API level 9
fun getState(): Int

Deprecated: Deprecated in Java.

Gets the session state. The value returned must be one of the states in State.

Return
Int the session state

isInCall

Added in API level 9
fun isInCall(): Boolean

Deprecated: Deprecated in Java.

Checks if the session is in a call.

Return
Boolean true if the session is in a call

makeCall

Added in API level 9
fun makeCall(
    callee: SipProfile!,
    sessionDescription: String!,
    timeout: Int
): Unit

Deprecated: Deprecated in Java.

Initiates a call to the specified profile. The session listener is called back upon defined session events. The method is only valid to call when the session state is in State#READY_TO_CALL.

Parameters
callee SipProfile!: the SIP profile to make the call to
sessionDescription String!: the session description of this call
timeout Int: the session will be timed out if the call is not established within timeout seconds. Default value (defined by SIP protocol) is used if timeout is zero or negative.

register

Added in API level 9
fun register(duration: Int): Unit

Deprecated: Deprecated in Java.

Performs registration to the server specified by the associated local profile. The session listener is called back upon success or failure of registration. The method is only valid to call when the session state is in State#READY_TO_CALL.

Parameters
duration Int: duration in second before the registration expires

setListener

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

Deprecated: Deprecated in Java.

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

Parameters
listener SipSession.Listener!: to listen to the session events of this object

unregister

Added in API level 9
fun unregister(): Unit

Deprecated: Deprecated in Java.

Performs unregistration to the server specified by the associated local profile. Unregistration is technically the same as registration with zero expiration duration. The session listener is called back upon success or failure of unregistration. The method is only valid to call when the session state is in State#READY_TO_CALL.