public class Call
extends java.lang.Object
The Call layer (class) provides a simplified interface to the functionalities implemented by the InviteDialog layer (class).
It handles both outgoing or incoming calls.
Both offer/answer models are supported, that is:
i) offer/answer in invite/2xx, or
ii) offer/answer in 2xx/ack
Modifier and Type | Class and Description |
---|---|
protected class |
Call.ThisInviteDialogListener
This InviteDialogListener.
|
Modifier and Type | Field and Description |
---|---|
protected CallState |
call_state
Call state
|
protected NameAddress |
contact_naddr
The user contact url
|
protected InviteDialog |
dialog
The invite dialog (sip.dialog.InviteDialog)
|
protected NameAddress |
from_naddr
The user url (AOR)
|
protected java.lang.String |
local_sdp
The local sdp
|
protected java.lang.String |
remote_sdp
The remote sdp
|
protected SipProvider |
sip_provider
The SipProvider used for the call
|
Constructor and Description |
---|
Call(SipProvider sip_provider,
SipMessage invite,
CallListener call_listener)
Creates a new Call for a callee, based on an already received INVITE request.
|
Call(SipProvider sip_provider,
SipMessage invite,
SipUser callee,
CallListener call_listener)
Creates a new Call for a callee, based on an already received INVITE request.
|
Call(SipProvider sip_provider,
SipUser caller,
CallListener call_listener)
Creates a new Call for a caller.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(java.lang.String sdp)
Accepts the incoming call.
|
void |
acceptUpdate(java.lang.String sdp)
Accepts an update request.
|
void |
call(NameAddress callee)
Starts a new call, inviting a remote user (callee).
|
void |
call(NameAddress callee,
NameAddress caller,
java.lang.String sdp)
Starts a new call, inviting a remote user (callee).
|
void |
call(NameAddress callee,
java.lang.String sdp)
Starts a new call, inviting a remote user (callee).
|
void |
call(SipMessage invite)
Starts a new call, with the given INVITE request.
|
protected void |
changeState(int state)
Changes the call state.
|
void |
confirm1xx(SipMessage prack)
Confirms a 1xx reliable response.
|
void |
confirm1xx(SipMessage resp_1xx,
java.lang.String content_type,
byte[] content)
Confirms a 1xx reliable response.
|
void |
confirm2xxWithAnswer(java.lang.String sdp)
Confirms the 2xx with an answer.
|
java.lang.String |
getCallId()
Gets the current call-id.
|
protected NameAddress |
getContactAddress(boolean secure)
Gets a local SIP or SIPS contact address.
|
java.lang.String |
getLocalSessionDescriptor()
Gets the current local session descriptor.
|
java.lang.String |
getRemoteSessionDescriptor()
Gets the current remote session descriptor.
|
CallState |
getState()
Gets the current call state.
|
void |
hangup()
Closes an ongoing or incoming call.
|
void |
listen()
Waits for an incoming call.
|
protected void |
log(LogLevel level,
java.lang.String str)
Adds a new string to the default log.
|
void |
modify(java.lang.String sdp)
Modifies the current call.
|
void |
progress(SipMessage resp_183)
Respond to a incoming call (invite) with 183 progress.
|
void |
progress(java.lang.String content_type,
byte[] body)
Respond to a incoming call (invite) with 183 progress.
|
void |
redirect(NameAddress redirect_url)
Redirects the incoming call.
|
void |
refuse()
Refuses the incoming call.
|
void |
refuseUpdate()
Refuses an update request.
|
void |
ring()
Rings back for the incoming call.
|
void |
setLocalSessionDescriptor(java.lang.String sdp)
Sets a new local session descriptor.
|
protected SipProvider sip_provider
protected InviteDialog dialog
protected NameAddress from_naddr
protected NameAddress contact_naddr
protected java.lang.String local_sdp
protected java.lang.String remote_sdp
protected CallState call_state
public Call(SipProvider sip_provider, SipUser caller, CallListener call_listener)
sip_provider
- the SIP providercaller
- the local calling usercall_listener
- the call listenerpublic Call(SipProvider sip_provider, SipMessage invite, CallListener call_listener)
sip_provider
- the SIP providerinvite
- the received INVITE messagecall_listener
- the call listenerpublic Call(SipProvider sip_provider, SipMessage invite, SipUser callee, CallListener call_listener)
sip_provider
- the SIP providerinvite
- the received INVITE messagecallee
- the local called usercall_listener
- the call listenerpublic void listen()
public CallState getState()
protected void changeState(int state)
state
- the new state valuepublic java.lang.String getCallId()
public java.lang.String getLocalSessionDescriptor()
public void setLocalSessionDescriptor(java.lang.String sdp)
sdp
- the session descriptorpublic java.lang.String getRemoteSessionDescriptor()
public void call(NameAddress callee)
callee
- the calleepublic void call(NameAddress callee, java.lang.String sdp)
callee
- the callee addresssdp
- the session descriptorpublic void call(NameAddress callee, NameAddress caller, java.lang.String sdp)
callee
- the callee addresscaller
- the caller addresssdp
- the session descriptorpublic void call(SipMessage invite)
invite
- the INVITE request messagepublic void confirm2xxWithAnswer(java.lang.String sdp)
sdp
- the session descriptor answerpublic void confirm1xx(SipMessage resp_1xx, java.lang.String content_type, byte[] content)
resp_1xx
- the reliable 1xx response the has to be confirmed with PRACKcontent_type
- the type of the content to be included within the PRACK (or null in case of no message body)content
- the message body to be included within the PRACK, or null. In an offer/answer model, this body represents the answer to the offer contained in the 1xx response messagepublic void confirm1xx(SipMessage prack)
prack
- the PRACK confirmation messagepublic void ring()
public void progress(java.lang.String content_type, byte[] body)
content_type
- the type of the content to be included within the response (or null in case of no message body)body
- the message body to be included within the response, or null. In an offer/answer model, this body represents the answer to the offer contained in the 1xx response messagepublic void progress(SipMessage resp_183)
resp_183
- the 183 responsepublic void accept(java.lang.String sdp)
sdp
- the session descriptor answerpublic void redirect(NameAddress redirect_url)
redirect_url
- the new address where the call is redirected topublic void refuse()
public void modify(java.lang.String sdp)
sdp
- the new session descriptor offerpublic void acceptUpdate(java.lang.String sdp)
public void refuseUpdate()
public void hangup()
protected NameAddress getContactAddress(boolean secure)
secure
- whether returning a SIPS or SIP URI (true=SIPS, false=SIP).protected void log(LogLevel level, java.lang.String str)