# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Nested Classes | Methods | Inherited Methods

# 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 `SipManager#createSipSession` (when initiating calls) or `SipManager#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`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.

## Public methods

### answerCall

    public 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 `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

    public 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 `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

    public 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 `State#IN_CALL`, `State#INCOMING_CALL`, `State#OUTGOING_CALL` or `State#OUTGOING_CALL_RING_BACK`.

### getCallId

    public String getCallId ()

Gets the call ID of the session.

Returns
`String` | the call ID

### getLocalIp

    public 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

    public SipProfile getLocalProfile ()

Gets the SIP profile that this session is associated with.

Returns
`SipProfile` | the SIP profile that this session is associated with

### getPeerProfile

    public 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

    public int getState ()

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

Returns
`int` | the session state

### isInCall

    public boolean isInCall ()

Checks if the session is in a call.

Returns
`boolean` | true if the session is in a call

### makeCall

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

See also:

- `SipSession.Listener`

### register

    public 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 `State#READY_TO_CALL`.

Parameters
`duration` | `int`: duration in second before the registration expires

See also:

- `SipSession.Listener`

### setListener

    public 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

    public 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 `State#READY_TO_CALL`.

See also:

- `SipSession.Listener`

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*