Skip to content

Most visited

Recently visited

navigation
Added in API level 9

SipSession

public final class SipSession
extends Object

java.lang.Object
   ↳ 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

class SipSession.Listener

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"). 

class SipSession.State

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

Public methods

void answerCall(String sessionDescription, int timeout)

Answers an incoming call with the specified session description.

void changeCall(String sessionDescription, int timeout)

Changes the session description during a call.

void endCall()

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

String getCallId()

Gets the call ID of the session.

String getLocalIp()

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

SipProfile getLocalProfile()

Gets the SIP profile that this session is associated with.

SipProfile getPeerProfile()

Gets the SIP profile that this session is connected to.

int getState()

Gets the session state.

boolean isInCall()

Checks if the session is in a call.

void makeCall(SipProfile callee, String sessionDescription, int timeout)

Initiates a call to the specified profile.

void register(int duration)

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

void setListener(SipSession.Listener listener)

Sets the listener to listen to the session events.

void unregister()

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

Inherited methods

From class java.lang.Object

Public methods

answerCall

Added in API level 9
void answerCall (String sessionDescription, 
                int timeout)

Answers an incoming call with the specified session description. The method is only valid to call when the session state is in 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
void changeCall (String sessionDescription, 
                int timeout)

Changes the session description during a call. The method is only valid to call when the session state is in 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
void endCall ()

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 IN_CALL, INCOMING_CALL, OUTGOING_CALL or OUTGOING_CALL_RING_BACK.

getCallId

Added in API level 9
String getCallId ()

Gets the call ID of the session.

Returns
String the call ID

getLocalIp

Added in API level 9
String getLocalIp ()

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

Returns
String the IP address of the local host

getLocalProfile

Added in API level 9
SipProfile getLocalProfile ()

Gets the SIP profile that this session is associated with.

Returns
SipProfile the SIP profile that this session is associated with

getPeerProfile

Added in API level 9
SipProfile getPeerProfile ()

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

Returns
SipProfile the SIP profile that this session is connected to

getState

Added in API level 9
int getState ()

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

Returns
int the session state

isInCall

Added in API level 9
boolean isInCall ()

Checks if the session is in a call.

Returns
boolean true if the session is in a call

makeCall

Added in API level 9
void makeCall (SipProfile callee, 
                String sessionDescription, 
                int timeout)

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

See also:

register

Added in API level 9
void register (int duration)

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

Parameters
duration int: duration in second before the registration expires

See also:

setListener

Added in API level 9
void setListener (SipSession.Listener listener)

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
void unregister ()

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

See also:

This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.