/**@class android.net.sip.SipManager @extends java.lang.Object 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 {@link #newInstance newInstance()}.</p> <p>The APIs in this class allows you to:</p> <ul> <li>Create a {@link android.net.sip.SipSession} to get ready for making calls or listen for incoming calls. See {@link #createSipSession createSipSession()} and {@link #getSessionFor getSessionFor()}.</li> <li>Initiate and receive generic SIP calls or audio-only SIP calls. Generic SIP calls may be video, audio, or other, and are initiated with {@link #open open()}. Audio-only SIP calls should be handled with a {@link android.net.sip.SipAudioCall}, which you can acquire with {@link #makeAudioCall makeAudioCall()} and {@link #takeAudioCall takeAudioCall()}.</li> <li>Register and unregister with a SIP service provider, with {@link #register register()} and {@link #unregister unregister()}.</li> <li>Verify session connectivity, with {@link #isOpened isOpened()} and {@link #isRegistered isRegistered()}.</li> </ul> <p class="note"><strong>Note:</strong> Not all Android-powered devices support VOIP calls using SIP. You should always call {@link android.net.sip.SipManager#isVoipSupported isVoipSupported()} to verify that the device supports VOIP calling and {@link android.net.sip.SipManager#isApiSupported isApiSupported()} to verify that the device supports the SIP APIs. Your application must also request the {@link android.Manifest.permission#INTERNET} and {@link android.Manifest.permission#USE_SIP} permissions.</p> <div class="special reference"> <h3>Developer Guides</h3> <p>For more information about using SIP, read the <a href="{@docRoot}guide/topics/network/sip.html">Session Initiation Protocol</a> developer guide.</p> </div> */ var SipManager = { /** The result code to be sent back with the incoming call {@link PendingIntent}. @see #open(SipProfile, PendingIntent, SipRegistrationListener) */ INCOMING_CALL_RESULT_CODE : "101", /** Key to retrieve the call ID from an incoming call intent. @see #open(SipProfile, PendingIntent, SipRegistrationListener) */ EXTRA_CALL_ID : "android:sipCallID", /** Key to retrieve the offered session description from an incoming call intent. @see #open(SipProfile, PendingIntent, SipRegistrationListener) */ EXTRA_OFFER_SD : "android:sipOfferSD", /** Action to broadcast when SipService is up. Internal use only. @hide */ ACTION_SIP_SERVICE_UP : "android.net.sip.SIP_SERVICE_UP", /** Action string for the incoming call intent for the Phone app. Internal use only. @hide */ ACTION_SIP_INCOMING_CALL : "com.android.phone.SIP_INCOMING_CALL", /** Action string for the add-phone intent. Internal use only. @hide */ ACTION_SIP_ADD_PHONE : "com.android.phone.SIP_ADD_PHONE", /** Action string for the remove-phone intent. Internal use only. @hide */ ACTION_SIP_REMOVE_PHONE : "com.android.phone.SIP_REMOVE_PHONE", /** Action string for the SIP call option configuration changed intent. This is used to communicate change to the SIP call option, triggering re-registration of the SIP phone accounts. Internal use only. @hide */ ACTION_SIP_CALL_OPTION_CHANGED : "com.android.phone.SIP_CALL_OPTION_CHANGED", /** Part of the ACTION_SIP_ADD_PHONE and ACTION_SIP_REMOVE_PHONE intents. Internal use only. @hide */ EXTRA_LOCAL_URI : "android:localSipUri", /**Creates a manager instance. Returns null if SIP API is not supported. @param {Object {Context}} context application context for creating the manager object @return {Object {android.net.sip.SipManager}} the manager instance or null if SIP API is not supported */ newInstance : function( ) {}, /**Returns true if the SIP API is supported by the system. */ isApiSupported : function( ) {}, /**Returns true if the system supports SIP-based VOIP API. */ isVoipSupported : function( ) {}, /**Returns true if SIP is only available on WIFI. */ isSipWifiOnly : function( ) {}, /**Opens the profile for making generic SIP calls. The caller may make subsequent calls through {@link #makeAudioCall}. If one also wants to receive calls on the profile, use {@link #open(SipProfile, PendingIntent, android.net.sip.SipRegistrationListener)} instead. @param {Object {SipProfile}} localProfile the SIP profile to make calls from @throws SipException if the profile contains incorrect settings or calling the SIP service results in an error */ open : function( ) {}, /**Opens the profile for making calls and/or receiving generic SIP calls. The caller may make subsequent calls through {@link #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 {@link #getCallId} and {@link #getOfferSessionDescription} to retrieve those extras. @param {Object {SipProfile}} localProfile the SIP profile to receive incoming calls for @param {Object {PendingIntent}} incomingCallPendingIntent When an incoming call is received, the SIP service will call {@link PendingIntent#send(Context, int, Intent)} to send back the intent to the caller with {@link #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. @param {Object {SipRegistrationListener}} listener to listen to registration events; can be null @see #getCallId @see #getOfferSessionDescription @see #takeAudioCall @throws NullPointerException if {@code incomingCallPendingIntent} is null @throws SipException if the profile contains incorrect settings or calling the SIP service results in an error @see #isIncomingCallIntent @see #getCallId @see #getOfferSessionDescription */ open : function( ) {}, /**Sets the listener to listen to registration events. No effect if the profile has not been opened to receive calls (see {@link #open(SipProfile, PendingIntent, android.net.sip.SipRegistrationListener)}). @param {String} localProfileUri the URI of the profile @param {Object {SipRegistrationListener}} listener to listen to registration events; can be null @throws SipException if calling the SIP service results in an error */ setRegistrationListener : function( ) {}, /**Closes the specified profile to not make/receive calls. All the resources that were allocated to the profile are also released. @param {String} localProfileUri the URI of the profile to close @throws SipException if calling the SIP service results in an error */ close : function( ) {}, /**Checks if the specified profile is opened in the SIP service for making and/or receiving calls. @param {String} localProfileUri the URI of the profile in question @return {Boolean} true if the profile is enabled to receive calls @throws SipException if calling the SIP service results in an error */ isOpened : function( ) {}, /**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 ({@link #isOpened}). @param {String} localProfileUri 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 @throws SipException if calling the SIP service results in an error */ isRegistered : function( ) {}, /**Creates a {@link android.net.sip.SipAudioCall} to make a call. The attempt will be timed out if the call is not established within {@code timeout} seconds and {@link SipAudioCall.Listener#onError onError(SipAudioCall, android.net.sip.SipErrorCode.TIME_OUT, String)} will be called. @param {Object {SipProfile}} localProfile the SIP profile to make the call from @param {Object {SipProfile}} peerProfile the SIP profile to make the call to @param {Object {SipAudioCall.Listener}} listener to listen to the call events from {@link SipAudioCall}; can be null @param {Number} timeout the timeout value in seconds. Default value (defined by SIP protocol) is used if {@code timeout} is zero or negative. @return {Object {android.net.sip.SipAudioCall}} a {@link SipAudioCall} object @throws SipException if calling the SIP service results in an error or VOIP API is not supported by the device @see SipAudioCall.Listener#onError @see #isVoipSupported */ makeAudioCall : function( ) {}, /**Creates a {@link android.net.sip.SipAudioCall} to make an audio call. The attempt will be timed out if the call is not established within {@code timeout} seconds and {@link SipAudioCall.Listener#onError onError(SipAudioCall, android.net.sip.SipErrorCode.TIME_OUT, String)} will be called. @param {String} localProfileUri URI of the SIP profile to make the call from @param {String} peerProfileUri URI of the SIP profile to make the call to @param {Object {SipAudioCall.Listener}} listener to listen to the call events from {@link SipAudioCall}; can be null @param {Number} timeout the timeout value in seconds. Default value (defined by SIP protocol) is used if {@code timeout} is zero or negative. @return {Object {android.net.sip.SipAudioCall}} a {@link SipAudioCall} object @throws SipException if calling the SIP service results in an error or VOIP API is not supported by the device @see SipAudioCall.Listener#onError @see #isVoipSupported */ makeAudioCall : function( ) {}, /**Creates a {@link android.net.sip.SipAudioCall} to take an incoming call. Before the call is returned, the listener will receive a {@link android.net.sip.SipAudioCall.Listener#onRinging} callback. @param {Object {Intent}} incomingCallIntent the incoming call broadcast intent @param {Object {SipAudioCall.Listener}} listener to listen to the call events from {@link SipAudioCall}; can be null @return {Object {android.net.sip.SipAudioCall}} a {@link SipAudioCall} object @throws SipException if calling the SIP service results in an error */ takeAudioCall : function( ) {}, /**Checks if the intent is an incoming call broadcast intent. @param {Object {Intent}} intent the intent in question @return {Boolean} true if the intent is an incoming call broadcast intent */ isIncomingCallIntent : function( ) {}, /**Gets the call ID from the specified incoming call broadcast intent. @param {Object {Intent}} incomingCallIntent the incoming call broadcast intent @return {String} the call ID or null if the intent does not contain it */ getCallId : function( ) {}, /**Gets the offer session description from the specified incoming call broadcast intent. @param {Object {Intent}} incomingCallIntent the incoming call broadcast intent @return {String} the offer session description or null if the intent does not have it */ getOfferSessionDescription : function( ) {}, /**Creates an incoming call broadcast intent. @param {String} callId the call ID of the incoming call @param {String} sessionDescription the session description of the incoming call @return {Object {android.content.Intent}} the incoming call intent @hide */ createIncomingCallBroadcast : function( ) {}, /**Manually registers the profile to the corresponding SIP provider for receiving calls. {@link #open(SipProfile, 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 {@link android.app.PendingIntent} when an incoming call is received. @param {Object {SipProfile}} localProfile the SIP profile to register with @param {Number} expiryTime registration expiration time (in seconds) @param {Object {SipRegistrationListener}} listener to listen to the registration events @throws SipException if calling the SIP service results in an error */ register : function( ) {}, /**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. @param {Object {SipProfile}} localProfile the SIP profile to register with @param {Object {SipRegistrationListener}} listener to listen to the registration events @throws SipException if calling the SIP service results in an error */ unregister : function( ) {}, /**Gets the {@link android.net.sip.SipSession} that handles the incoming call. For audio calls, consider to use {@link android.net.sip.SipAudioCall} to handle the incoming call. See {@link #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. @param {Object {Intent}} incomingCallIntent the incoming call broadcast intent @return {Object {android.net.sip.SipSession}} the session object that handles the incoming call */ getSessionFor : function( ) {}, /**Creates a {@link android.net.sip.SipSession} with the specified profile. Use other methods, if applicable, instead of interacting with {@link android.net.sip.SipSession} directly. @param {Object {SipProfile}} localProfile the SIP profile the session is associated with @param {Object {SipSession.Listener}} listener to listen to SIP session events */ createSipSession : function( ) {}, /**Gets the list of profiles hosted by the SIP service. The user information (username, password and display name) are crossed out. @hide */ getListOfProfiles : function( ) {}, };