java.lang.Object | |
↳ | android.net.sip.SipAudioCall |
Handles an Internet audio call over SIP. You can instantiate this class with SipManager
,
using makeAudioCall()
and takeAudioCall()
.
Note: Using this class require the
INTERNET
and
USE_SIP
permissions. In addition, startAudio()
requires the
RECORD_AUDIO
,
ACCESS_WIFI_STATE
, and
WAKE_LOCK
permissions; and setSpeakerMode()
requires the
MODIFY_AUDIO_SETTINGS
permission.
For more information about using SIP, read the Session Initiation Protocol developer guide.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
SipAudioCall.Listener | Listener for events relating to a SIP call, such as when a call is being recieved ("on ringing") or a call is outgoing ("on calling"). |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a call object with the local SIP profile.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Answers a call.
| |||||||||||
Attaches an incoming call to this call object.
| |||||||||||
Closes this object.
| |||||||||||
Continues a call that's on hold.
| |||||||||||
Ends a call.
| |||||||||||
Gets the local SIP profile.
| |||||||||||
Gets the peer's SIP profile.
| |||||||||||
Gets the state of the
SipSession that carries this call.
| |||||||||||
Puts a call on hold.
| |||||||||||
Checks if the call is established.
| |||||||||||
Checks if the call is muted.
| |||||||||||
Checks if the call is on hold.
| |||||||||||
Initiates an audio call to the specified profile.
| |||||||||||
Sends a DTMF code.
| |||||||||||
Sends a DTMF code.
| |||||||||||
Sets the listener to listen to the audio call events.
| |||||||||||
Sets the listener to listen to the audio call events.
| |||||||||||
Puts the device to speaker mode.
| |||||||||||
Starts the audio for the established call.
| |||||||||||
Toggles mute.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Creates a call object with the local SIP profile.
context | the context for accessing system services such as ringtone, audio, WIFI etc |
---|
Answers a call. The attempt will be timed out if the call is not
established within timeout
seconds and
onError(SipAudioCall, SipErrorCode.TIME_OUT, String)
will be called.
timeout | the timeout value in seconds. Default value (defined by
SIP protocol) is used if timeout is zero or negative. |
---|
SipException | if the SIP service fails to answer the call |
---|
Attaches an incoming call to this call object.
session | the session that receives the incoming call |
---|---|
sessionDescription | the session description of the incoming call |
SipException | if the SIP service fails to attach this object to the session or VOIP API is not supported by the device |
---|
Closes this object. This object is not usable after being closed.
Continues a call that's on hold. When succeeds,
onCallEstablished(SipAudioCall)
is called. The attempt will be timed
out if the call is not established within timeout
seconds and
onError(SipAudioCall, SipErrorCode.TIME_OUT, String)
will be called.
timeout | the timeout value in seconds. Default value (defined by
SIP protocol) is used if timeout is zero or negative. |
---|
SipException | if the SIP service fails to unhold the call |
---|
Ends a call.
SipException | if the SIP service fails to end the call |
---|
Gets the local SIP profile.
Gets the peer's SIP profile.
Gets the state of the SipSession
that carries this call.
The value returned must be one of the states in SipSession.State
.
Puts a call on hold. When succeeds, onCallHeld(SipAudioCall)
is
called. The attempt will be timed out if the call is not established
within timeout
seconds and
onError(SipAudioCall, SipErrorCode.TIME_OUT, String)
will be called.
timeout | the timeout value in seconds. Default value (defined by
SIP protocol) is used if timeout is zero or negative. |
---|
SipException | if the SIP service fails to hold the call |
---|
Checks if the call is established.
Checks if the call is muted.
Checks if the call is on hold.
Initiates an audio call to the specified profile. The attempt will be
timed out if the call is not established within timeout
seconds
and onError(SipAudioCall, SipErrorCode.TIME_OUT, String)
will be called.
peerProfile | the SIP profile to make the call to |
---|---|
sipSession | the SipSession for carrying out the call |
timeout | the timeout value in seconds. Default value (defined by
SIP protocol) is used if timeout is zero or negative. |
SipException | if the SIP service fails to create a session for the call or VOIP API is not supported by the device |
---|
Sends a DTMF code. According to RFC 2883, event 0--9 maps to decimal value 0--9, '*' to 10, '#' to 11, event 'A'--'D' to 12--15, and event flash to 16. Currently, event flash is not supported.
code | the DTMF code to send. Value 0 to 15 (inclusive) are valid inputs. |
---|---|
result | the result message to send when done |
Sends a DTMF code. According to RFC 2883, event 0--9 maps to decimal value 0--9, '*' to 10, '#' to 11, event 'A'--'D' to 12--15, and event flash to 16. Currently, event flash is not supported.
code | the DTMF code to send. Value 0 to 15 (inclusive) are valid inputs. |
---|
Sets the listener to listen to the audio call events. The method calls
setListener(listener, false)
.
listener | to listen to the audio call events of this object |
---|
Sets the listener to listen to the audio call events. A
SipAudioCall
can only hold one listener at a time. Subsequent
calls to this method override the previous listener.
listener | to listen to the audio call events of this object |
---|---|
callbackImmediately | set to true if the caller wants to be called back immediately on the current state |
Puts the device to speaker mode.
Note: Requires the
MODIFY_AUDIO_SETTINGS
permission.
speakerMode | set true to enable speaker mode; false to disable |
---|
Starts the audio for the established call. This method should be called
after onCallEstablished(SipAudioCall)
is called.
Note: Requires the
RECORD_AUDIO
,
ACCESS_WIFI_STATE
and
WAKE_LOCK
permissions.