java.lang.Object | |
↳ | android.net.sip.SipManager |
Provides APIs for SIP tasks, such as initiating SIP connections, and provides access to related
SIP services. This class is the starting point for any SIP actions. You can acquire an instance
of it with newInstance()
.
The APIs in this class allows you to:
SipSession
to get ready for making calls or listen for incoming calls. See
createSipSession()
and getSessionFor()
.open()
. Audio-only SIP calls
should be handled with a SipAudioCall
, which you can acquire with makeAudioCall()
and takeAudioCall()
.register()
and unregister()
.isOpened()
and
isRegistered()
.Note: Not all Android-powered devices support VOIP calls using
SIP. You should always call isVoipSupported()
to verify that the device supports VOIP calling and isApiSupported()
to verify that the device supports
the SIP APIs. Your application must also request the INTERNET
and USE_SIP
permissions.
For more information about using SIP, read the Session Initiation Protocol developer guide.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | EXTRA_CALL_ID | Key to retrieve the call ID from an incoming call intent. | |||||||||
String | EXTRA_OFFER_SD | Key to retrieve the offered session description from an incoming call intent. | |||||||||
int | INCOMING_CALL_RESULT_CODE | The result code to be sent back with the incoming call
PendingIntent . |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Closes the specified profile to not make/receive calls.
| |||||||||||
Creates a
SipSession with the specified profile. | |||||||||||
Gets the call ID from the specified incoming call broadcast intent.
| |||||||||||
Gets the offer session description from the specified incoming call
broadcast intent.
| |||||||||||
Gets the
SipSession that handles the incoming call. | |||||||||||
Returns true if the SIP API is supported by the system.
| |||||||||||
Checks if the intent is an incoming call broadcast intent.
| |||||||||||
Checks if the specified profile is opened in the SIP service for
making and/or receiving calls.
| |||||||||||
Checks if the SIP service has successfully registered the profile to the
SIP provider (specified in the profile) for receiving calls.
| |||||||||||
Returns true if SIP is only available on WIFI.
| |||||||||||
Returns true if the system supports SIP-based VOIP API.
| |||||||||||
Creates a
SipAudioCall to make an audio call. | |||||||||||
Creates a
SipAudioCall to make a call. | |||||||||||
Creates a manager instance.
| |||||||||||
Opens the profile for making calls and/or receiving generic SIP calls.
| |||||||||||
Opens the profile for making generic SIP calls.
| |||||||||||
Manually registers the profile to the corresponding SIP provider for
receiving calls.
| |||||||||||
Sets the listener to listen to registration events.
| |||||||||||
Creates a
SipAudioCall to take an incoming call. | |||||||||||
Manually unregisters the profile from the corresponding SIP provider for
stop receiving further calls.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Key to retrieve the call ID from an incoming call intent.
Key to retrieve the offered session description from an incoming call intent.
The result code to be sent back with the incoming call
PendingIntent
.
Closes the specified profile to not make/receive calls. All the resources that were allocated to the profile are also released.
localProfileUri | the URI of the profile to close |
---|
SipException | if calling the SIP service results in an error |
---|
Creates a SipSession
with the specified profile. Use other
methods, if applicable, instead of interacting with SipSession
directly.
localProfile | the SIP profile the session is associated with |
---|---|
listener | to listen to SIP session events |
SipException |
---|
Gets the call ID from the specified incoming call broadcast intent.
incomingCallIntent | the incoming call broadcast intent |
---|
Gets the offer session description from the specified incoming call broadcast intent.
incomingCallIntent | the incoming call broadcast intent |
---|
Gets the SipSession
that handles the incoming call. For audio
calls, consider to use SipAudioCall
to handle the incoming call.
See takeAudioCall(Intent, SipAudioCall.Listener)
. Note that the method may be called only once
for the same intent. For subsequent calls on the same intent, the method
returns null.
incomingCallIntent | the incoming call broadcast intent |
---|
SipException |
---|
Returns true if the SIP API is supported by the system.
Checks if the intent is an incoming call broadcast intent.
intent | the intent in question |
---|
Checks if the specified profile is opened in the SIP service for making and/or receiving calls.
localProfileUri | the URI of the profile in question |
---|
SipException | if calling the SIP service results in an error |
---|
Checks if the SIP service has successfully registered the profile to the
SIP provider (specified in the profile) for receiving calls. Returning
true from this method also implies the profile is opened
(isOpened(String)
).
localProfileUri | the URI of the profile in question |
---|
SipException | if calling the SIP service results in an error |
---|
Returns true if SIP is only available on WIFI.
Returns true if the system supports SIP-based VOIP API.
Creates a SipAudioCall
to make an audio 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.
localProfileUri | URI of the SIP profile to make the call from |
---|---|
peerProfileUri | URI of the SIP profile to make the call to |
listener | to listen to the call events from SipAudioCall ;
can be null |
timeout | the timeout value in seconds. Default value (defined by
SIP protocol) is used if timeout is zero or negative. |
SipAudioCall
objectSipException | if calling the SIP service results in an error or VOIP API is not supported by the device |
---|
Creates a SipAudioCall
to make 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.
localProfile | the SIP profile to make the call from |
---|---|
peerProfile | the SIP profile to make the call to |
listener | to listen to the call events from SipAudioCall ;
can be null |
timeout | the timeout value in seconds. Default value (defined by
SIP protocol) is used if timeout is zero or negative. |
SipAudioCall
objectSipException | if calling the SIP service results in an error or VOIP API is not supported by the device |
---|
Creates a manager instance. Returns null if SIP API is not supported.
context | application context for creating the manager object |
---|
Opens the profile for making calls and/or receiving generic SIP calls. The caller may
make subsequent calls through makeAudioCall(SipProfile, SipProfile, SipAudioCall.Listener, int)
. If the
auto-registration option is enabled in the profile, the SIP service
will register the profile to the corresponding SIP provider periodically
in order to receive calls from the provider. When the SIP service
receives a new call, it will send out an intent with the provided action
string. The intent contains a call ID extra and an offer session
description string extra. Use getCallId(Intent)
and
getOfferSessionDescription(Intent)
to retrieve those extras.
localProfile | the SIP profile to receive incoming calls for |
---|---|
incomingCallPendingIntent | When an incoming call is received, the
SIP service will call
send(Context, int, Intent) to send back the
intent to the caller with INCOMING_CALL_RESULT_CODE as the
result code and the intent to fill in the call ID and session
description information. It cannot be null. |
listener | to listen to registration events; can be null |
NullPointerException | if incomingCallPendingIntent is null |
---|---|
SipException | if the profile contains incorrect settings or calling the SIP service results in an error |
Opens the profile for making generic SIP calls. The caller may make subsequent calls
through makeAudioCall(SipProfile, SipProfile, SipAudioCall.Listener, int)
. If one also wants to receive calls on the
profile, use
open(SipProfile, PendingIntent, SipRegistrationListener)
instead.
localProfile | the SIP profile to make calls from |
---|
SipException | if the profile contains incorrect settings or calling the SIP service results in an error |
---|
Manually registers the profile to the corresponding SIP provider for
receiving calls.
open(SipProfile, PendingIntent, SipRegistrationListener)
is
still needed to be called at least once in order for the SIP service to
notify the caller with the PendingIntent
when an incoming call is
received.
localProfile | the SIP profile to register with |
---|---|
expiryTime | registration expiration time (in seconds) |
listener | to listen to the registration events |
SipException | if calling the SIP service results in an error |
---|
Sets the listener to listen to registration events. No effect if the
profile has not been opened to receive calls (see
open(SipProfile, PendingIntent, SipRegistrationListener)
).
localProfileUri | the URI of the profile |
---|---|
listener | to listen to registration events; can be null |
SipException | if calling the SIP service results in an error |
---|
Creates a SipAudioCall
to take an incoming call. Before the call
is returned, the listener will receive a
onRinging(SipAudioCall, SipProfile)
callback.
incomingCallIntent | the incoming call broadcast intent |
---|---|
listener | to listen to the call events from SipAudioCall ;
can be null |
SipAudioCall
objectSipException | if calling the SIP service results in an error |
---|
Manually unregisters the profile from the corresponding SIP provider for stop receiving further calls. This may interference with the auto registration process in the SIP service if the auto-registration option in the profile is enabled.
localProfile | the SIP profile to register with |
---|---|
listener | to listen to the registration events |
SipException | if calling the SIP service results in an error |
---|