public final class SipSession extends Object
You can get a SipSession
from SipManager
with createSipSession()
(when initiating calls) or getSessionFor()
(when receiving calls).
Modifier and Type | Class and Description |
---|---|
static 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").
|
static class |
SipSession.State
Defines SIP session states, such as "registering", "outgoing call", and "in call".
|
Modifier and Type | Method and Description |
---|---|
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.
|
public String getLocalIp()
public SipProfile getLocalProfile()
public SipProfile getPeerProfile()
public int getState()
SipSession.State
.public boolean isInCall()
public String getCallId()
public void setListener(SipSession.Listener listener)
SipSession
can only hold one listener at a time. Subsequent calls to this method
override the previous listener.listener
- to listen to the session events of this objectpublic void register(int duration)
SipSession.State.READY_TO_CALL
.duration
- duration in second before the registration expiresSipSession.Listener
public void unregister()
SipSession.State.READY_TO_CALL
.SipSession.Listener
public void makeCall(SipProfile callee, String sessionDescription, int timeout)
SipSession.State.READY_TO_CALL
.callee
- the SIP profile to make the call tosessionDescription
- the session description of this calltimeout
- 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.SipSession.Listener
public void answerCall(String sessionDescription, int timeout)
SipSession.State.INCOMING_CALL
.sessionDescription
- the session description to answer this calltimeout
- 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.public void endCall()
SipSession.State.IN_CALL
,
SipSession.State.INCOMING_CALL
,
SipSession.State.OUTGOING_CALL
or
SipSession.State.OUTGOING_CALL_RING_BACK
.public void changeCall(String sessionDescription, int timeout)
SipSession.State.IN_CALL
.sessionDescription
- the new session descriptiontimeout
- 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.