SipManager
open classSipManager
kotlin.Any | |
↳ | 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:
- Create a
SipSession
to get ready for making calls or listen for incoming calls. SeecreateSipSession()
andgetSessionFor()
. - Initiate and receive generic SIP calls or audio-only SIP calls. Generic SIP calls may be video, audio, or other, and are initiated with #open. Audio-only SIP calls should be handled with a
SipAudioCall
, which you can acquire with #makeAudioCall andtakeAudioCall()
. - Register and unregister with a SIP service provider, with
register()
andunregister()
. - Verify session connectivity, with
isOpened()
andisRegistered()
.
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 android.Manifest.permission#INTERNET
and android.Manifest.permission#USE_SIP
permissions.
Summary
Constants | |
---|---|
static String |
Key to retrieve the call ID from an incoming call intent. |
static String |
Key to retrieve the offered session description from an incoming call intent. |
static Int |
The result code to be sent back with the incoming call |
Public methods | |
---|---|
open Unit |
Closes the specified profile to not make/receive calls. |
open SipSession! |
createSipSession(localProfile: SipProfile!, listener: SipSession.Listener!) Creates a |
open static String! |
Gets the call ID from the specified incoming call broadcast intent. |
open static String! |
getOfferSessionDescription(incomingCallIntent: Intent!) Gets the offer session description from the specified incoming call broadcast intent. |
open SipSession! |
getSessionFor(incomingCallIntent: Intent!) Gets the |
open static Boolean |
isApiSupported(context: Context!) Returns true if the SIP API is supported by the system. |
open static Boolean |
isIncomingCallIntent(intent: Intent!) Checks if the intent is an incoming call broadcast intent. |
open Boolean |
Checks if the specified profile is opened in the SIP service for making and/or receiving calls. |
open Boolean |
isRegistered(localProfileUri: String!) Checks if the SIP service has successfully registered the profile to the SIP provider (specified in the profile) for receiving calls. |
open static Boolean |
isSipWifiOnly(context: Context!) Returns true if SIP is only available on WIFI. |
open static Boolean |
isVoipSupported(context: Context!) Returns true if the system supports SIP-based VOIP API. |
open SipAudioCall! |
makeAudioCall(localProfile: SipProfile!, peerProfile: SipProfile!, listener: SipAudioCall.Listener!, timeout: Int) Creates a |
open SipAudioCall! |
makeAudioCall(localProfileUri: String!, peerProfileUri: String!, listener: SipAudioCall.Listener!, timeout: Int) Creates a |
open static SipManager! |
newInstance(context: Context!) Creates a manager instance. |
open Unit |
open(localProfile: SipProfile!) Opens the profile for making generic SIP calls. |
open Unit |
open(localProfile: SipProfile!, incomingCallPendingIntent: PendingIntent!, listener: SipRegistrationListener!) Opens the profile for making calls and/or receiving generic SIP calls. |
open Unit |
register(localProfile: SipProfile!, expiryTime: Int, listener: SipRegistrationListener!) Manually registers the profile to the corresponding SIP provider for receiving calls. |
open Unit |
setRegistrationListener(localProfileUri: String!, listener: SipRegistrationListener!) Sets the listener to listen to registration events. |
open SipAudioCall! |
takeAudioCall(incomingCallIntent: Intent!, listener: SipAudioCall.Listener!) Creates a |
open Unit |
unregister(localProfile: SipProfile!, listener: SipRegistrationListener!) Manually unregisters the profile from the corresponding SIP provider for stop receiving further calls. |
Constants
EXTRA_CALL_ID
static valEXTRA_CALL_ID: String
Deprecated: Deprecated in Java.
Key to retrieve the call ID from an incoming call intent.
Value: "android:sipCallID"
EXTRA_OFFER_SD
static valEXTRA_OFFER_SD: String
Deprecated: Deprecated in Java.
Key to retrieve the offered session description from an incoming call intent.
Value: "android:sipOfferSD"
INCOMING_CALL_RESULT_CODE
static valINCOMING_CALL_RESULT_CODE: Int
Deprecated: Deprecated in Java.
The result code to be sent back with the incoming call PendingIntent
.
Value: 101
Public methods
close
open funclose(localProfileUri: String!): Unit
Deprecated: Deprecated in Java.
Closes the specified profile to not make/receive calls. All the resources that were allocated to the profile are also released.
Parameters | |
---|---|
localProfileUri |
String!: the URI of the profile to close |
Exceptions | |
---|---|
android.net.sip.SipException |
if calling the SIP service results in an error |
createSipSession
open funcreateSipSession(
localProfile: SipProfile!,
listener: SipSession.Listener!
): SipSession!
Deprecated: Deprecated in Java.
Creates a SipSession
with the specified profile. Use other methods, if applicable, instead of interacting with SipSession
directly.
Parameters | |
---|---|
localProfile |
SipProfile!: the SIP profile the session is associated with |
listener |
SipSession.Listener!: to listen to SIP session events |
getCallId
open static fungetCallId(incomingCallIntent: Intent!): String!
Deprecated: Deprecated in Java.
Gets the call ID from the specified incoming call broadcast intent.
Parameters | |
---|---|
incomingCallIntent |
Intent!: the incoming call broadcast intent |
Return | |
---|---|
String! |
the call ID or null if the intent does not contain it |
getOfferSessionDescription
open static fungetOfferSessionDescription(incomingCallIntent: Intent!): String!
Deprecated: Deprecated in Java.
Gets the offer session description from the specified incoming call broadcast intent.
Parameters | |
---|---|
incomingCallIntent |
Intent!: the incoming call broadcast intent |
Return | |
---|---|
String! |
the offer session description or null if the intent does not have it |
getSessionFor
open fungetSessionFor(incomingCallIntent: Intent!): SipSession!
Deprecated: Deprecated in Java.
Gets the SipSession
that handles the incoming call. For audio calls, consider to use SipAudioCall
to handle the incoming call. See takeAudioCall
. Note that the method may be called only once for the same intent. For subsequent calls on the same intent, the method returns null.
Parameters | |
---|---|
incomingCallIntent |
Intent!: the incoming call broadcast intent |
Return | |
---|---|
SipSession! |
the session object that handles the incoming call |
isApiSupported
open static funisApiSupported(context: Context!): Boolean
Deprecated: Deprecated in Java.
Returns true if the SIP API is supported by the system.
isIncomingCallIntent
open static funisIncomingCallIntent(intent: Intent!): Boolean
Deprecated: Deprecated in Java.
Checks if the intent is an incoming call broadcast intent.
Parameters | |
---|---|
intent |
Intent!: the intent in question |
Return | |
---|---|
Boolean |
true if the intent is an incoming call broadcast intent |
isOpened
open funisOpened(localProfileUri: String!): Boolean
Deprecated: Deprecated in Java.
Checks if the specified profile is opened in the SIP service for making and/or receiving calls.
Parameters | |
---|---|
localProfileUri |
String!: the URI of the profile in question |
Return | |
---|---|
Boolean |
true if the profile is enabled to receive calls |
Exceptions | |
---|---|
android.net.sip.SipException |
if calling the SIP service results in an error |
isRegistered
open funisRegistered(localProfileUri: String!): Boolean
Deprecated: Deprecated in Java.
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
).
Parameters | |
---|---|
localProfileUri |
String!: the URI of the profile in question |
Return | |
---|---|
Boolean |
true if the profile is registered to the SIP provider; false if the profile has not been opened in the SIP service or the SIP service has not yet successfully registered the profile to the SIP provider |
Exceptions | |
---|---|
android.net.sip.SipException |
if calling the SIP service results in an error |
isSipWifiOnly
open static funisSipWifiOnly(context: Context!): Boolean
Deprecated: Deprecated in Java.
Returns true if SIP is only available on WIFI.
isVoipSupported
open static funisVoipSupported(context: Context!): Boolean
Deprecated: Deprecated in Java.
Returns true if the system supports SIP-based VOIP API.
makeAudioCall
open funmakeAudioCall(
localProfile: SipProfile!,
peerProfile: SipProfile!,
listener: SipAudioCall.Listener!,
timeout: Int
): SipAudioCall!
Deprecated: Deprecated in Java.
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.
Parameters | |
---|---|
localProfile |
SipProfile!: the SIP profile to make the call from |
peerProfile |
SipProfile!: the SIP profile to make the call to |
listener |
SipAudioCall.Listener!: to listen to the call events from SipAudioCall ; can be null |
timeout |
Int: the timeout value in seconds. Default value (defined by SIP protocol) is used if timeout is zero or negative. |
Return | |
---|---|
SipAudioCall! |
a SipAudioCall object |
Exceptions | |
---|---|
android.net.sip.SipException |
if calling the SIP service results in an error or VOIP API is not supported by the device |
makeAudioCall
open funmakeAudioCall(
localProfileUri: String!,
peerProfileUri: String!,
listener: SipAudioCall.Listener!,
timeout: Int
): SipAudioCall!
Deprecated: Deprecated in Java.
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.
Parameters | |
---|---|
localProfileUri |
String!: URI of the SIP profile to make the call from |
peerProfileUri |
String!: URI of the SIP profile to make the call to |
listener |
SipAudioCall.Listener!: to listen to the call events from SipAudioCall ; can be null |
timeout |
Int: the timeout value in seconds. Default value (defined by SIP protocol) is used if timeout is zero or negative. |
Return | |
---|---|
SipAudioCall! |
a SipAudioCall object |
Exceptions | |
---|---|
android.net.sip.SipException |
if calling the SIP service results in an error or VOIP API is not supported by the device |
newInstance
open static funnewInstance(context: Context!): SipManager!
Deprecated: Deprecated in Java.
Creates a manager instance. Returns null if SIP API is not supported.
Parameters | |
---|---|
context |
Context!: application context for creating the manager object |
Return | |
---|---|
SipManager! |
the manager instance or null if SIP API is not supported |
open
open funopen(localProfile: SipProfile!): Unit
Deprecated: Deprecated in Java.
Opens the profile for making generic SIP calls. The caller may make subsequent calls through #makeAudioCall. If one also wants to receive calls on the profile, use open(android.net.sip.SipProfile,android.app.PendingIntent,android.net.sip.SipRegistrationListener)
instead.
Parameters | |
---|---|
localProfile |
SipProfile!: the SIP profile to make calls from |
Exceptions | |
---|---|
android.net.sip.SipException |
if the profile contains incorrect settings or calling the SIP service results in an error |
open
open funopen(
localProfile: SipProfile!,
incomingCallPendingIntent: PendingIntent!,
listener: SipRegistrationListener!
): Unit
Deprecated: Deprecated in Java.
Opens the profile for making calls and/or receiving generic SIP calls. The caller may make subsequent calls through #makeAudioCall. 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
and getOfferSessionDescription
to retrieve those extras.
Parameters | |
---|---|
localProfile |
SipProfile!: the SIP profile to receive incoming calls for |
incomingCallPendingIntent |
PendingIntent!: When an incoming call is received, the SIP service will call PendingIntent.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 |
SipRegistrationListener!: to listen to registration events; can be null |
Exceptions | |
---|---|
java.lang.NullPointerException |
if incomingCallPendingIntent is null |
android.net.sip.SipException |
if the profile contains incorrect settings or calling the SIP service results in an error |
register
open funregister(
localProfile: SipProfile!,
expiryTime: Int,
listener: SipRegistrationListener!
): Unit
Deprecated: Deprecated in Java.
Manually registers the profile to the corresponding SIP provider for receiving calls. open(android.net.sip.SipProfile,android.app.PendingIntent,android.net.sip.SipRegistrationListener)
is still needed to be called at least once in order for the SIP service to notify the caller with the android.app.PendingIntent
when an incoming call is received.
Parameters | |
---|---|
localProfile |
SipProfile!: the SIP profile to register with |
expiryTime |
Int: registration expiration time (in seconds) |
listener |
SipRegistrationListener!: to listen to the registration events |
Exceptions | |
---|---|
android.net.sip.SipException |
if calling the SIP service results in an error |
setRegistrationListener
open funsetRegistrationListener(
localProfileUri: String!,
listener: SipRegistrationListener!
): Unit
Deprecated: Deprecated in Java.
Sets the listener to listen to registration events. No effect if the profile has not been opened to receive calls (see open(android.net.sip.SipProfile,android.app.PendingIntent,android.net.sip.SipRegistrationListener)
).
Parameters | |
---|---|
localProfileUri |
String!: the URI of the profile |
listener |
SipRegistrationListener!: to listen to registration events; can be null |
Exceptions | |
---|---|
android.net.sip.SipException |
if calling the SIP service results in an error |
takeAudioCall
open funtakeAudioCall(
incomingCallIntent: Intent!,
listener: SipAudioCall.Listener!
): SipAudioCall!
Deprecated: Deprecated in Java.
Creates a SipAudioCall
to take an incoming call. Before the call is returned, the listener will receive a SipAudioCall.Listener.onRinging
callback.
Parameters | |
---|---|
incomingCallIntent |
Intent!: the incoming call broadcast intent |
listener |
SipAudioCall.Listener!: to listen to the call events from SipAudioCall ; can be null |
Return | |
---|---|
SipAudioCall! |
a SipAudioCall object |
Exceptions | |
---|---|
android.net.sip.SipException |
if calling the SIP service results in an error |
unregister
open fununregister(
localProfile: SipProfile!,
listener: SipRegistrationListener!
): Unit
Deprecated: Deprecated in Java.
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.
Parameters | |
---|---|
localProfile |
SipProfile!: the SIP profile to register with |
listener |
SipRegistrationListener!: to listen to the registration events |
Exceptions | |
---|---|
android.net.sip.SipException |
if calling the SIP service results in an error |