diff --git a/voip/java/android/net/sip/SipAudioCall.java b/voip/java/android/net/sip/SipAudioCall.java index 0179748ce8853..f275e395d4ffb 100644 --- a/voip/java/android/net/sip/SipAudioCall.java +++ b/voip/java/android/net/sip/SipAudioCall.java @@ -37,20 +37,19 @@ import java.util.List; import java.util.Map; /** - * Class that handles an Internet audio call over SIP. {@link SipManager} - * facilitates instantiating a {@code SipAudioCall} object for making/receiving - * calls. See {@link SipManager#makeAudioCall} and - * {@link SipManager#takeAudioCall}. + * Handles an Internet audio call over SIP. You can instantiate this class with {@link SipManager}, + * using {@link SipManager#makeAudioCall makeAudioCall()} and {@link SipManager#takeAudioCall + * takeAudioCall()}. * - *
Requires permissions to use this class: + *
Note: Using this class require the
* {@link android.Manifest.permission#INTERNET} and
- * {@link android.Manifest.permission#USE_SIP}.
- *
Requires permissions to {@link #startAudio}:
+ * {@link android.Manifest.permission#USE_SIP} permissions.
In addition, {@link
+ * #startAudio} requires the
* {@link android.Manifest.permission#RECORD_AUDIO},
- * {@link android.Manifest.permission#ACCESS_WIFI_STATE} and
- * {@link android.Manifest.permission#WAKE_LOCK}.
- *
Requires permissions to {@link #setSpeakerMode}:
- * {@link android.Manifest.permission#MODIFY_AUDIO_SETTINGS}.
+ * {@link android.Manifest.permission#ACCESS_WIFI_STATE}, and
+ * {@link android.Manifest.permission#WAKE_LOCK} permissions; and {@link #setSpeakerMode
+ * setSpeakerMode()} requires the
+ * {@link android.Manifest.permission#MODIFY_AUDIO_SETTINGS} permission.
Many of these events are also received by {@link SipSession.Listener}.
+ */ public static class Listener { /** * Called when the call object is ready to make another call. @@ -199,7 +201,7 @@ public class SipAudioCall { /** * Sets the listener to listen to the audio call events. The method calls - * {@code setListener(listener, false)}. + * {@link #setListener setListener(listener, false)}. * * @param listener to listen to the audio call events of this object * @see #setListener(Listener, boolean) @@ -537,14 +539,14 @@ public class SipAudioCall { /** * Initiates an audio call to the specified profile. The attempt will be * timed out if the call is not established within {@code timeout} seconds - * and {@code Listener.onError(SipAudioCall, SipErrorCode.TIME_OUT, String)} + * and {@link Listener#onError onError(SipAudioCall, SipErrorCode.TIME_OUT, String)} * will be called. * * @param peerProfile the SIP profile to make the call to * @param sipSession the {@link SipSession} for carrying out the call * @param timeout the timeout value in seconds. Default value (defined by * SIP protocol) is used if {@code timeout} is zero or negative. - * @see Listener.onError + * @see Listener#onError * @throws SipException if the SIP service fails to create a session for the * call */ @@ -582,12 +584,12 @@ public class SipAudioCall { * Puts a call on hold. When succeeds, {@link Listener#onCallHeld} is * called. The attempt will be timed out if the call is not established * within {@code timeout} seconds and - * {@code Listener.onError(SipAudioCall, SipErrorCode.TIME_OUT, String)} + * {@link Listener#onError onError(SipAudioCall, SipErrorCode.TIME_OUT, String)} * will be called. * * @param timeout the timeout value in seconds. Default value (defined by * SIP protocol) is used if {@code timeout} is zero or negative. - * @see Listener.onError + * @see Listener#onError * @throws SipException if the SIP service fails to hold the call */ public void holdCall(int timeout) throws SipException { @@ -604,12 +606,12 @@ public class SipAudioCall { /** * Answers a call. The attempt will be timed out if the call is not * established within {@code timeout} seconds and - * {@code Listener.onError(SipAudioCall, SipErrorCode.TIME_OUT, String)} + * {@link Listener#onError onError(SipAudioCall, SipErrorCode.TIME_OUT, String)} * will be called. * * @param timeout the timeout value in seconds. Default value (defined by * SIP protocol) is used if {@code timeout} is zero or negative. - * @see Listener.onError + * @see Listener#onError * @throws SipException if the SIP service fails to answer the call */ public void answerCall(int timeout) throws SipException { @@ -628,12 +630,12 @@ public class SipAudioCall { * Continues a call that's on hold. When succeeds, * {@link Listener#onCallEstablished} is called. The attempt will be timed * out if the call is not established within {@code timeout} seconds and - * {@code Listener.onError(SipAudioCall, SipErrorCode.TIME_OUT, String)} + * {@link Listener#onError onError(SipAudioCall, SipErrorCode.TIME_OUT, String)} * will be called. * * @param timeout the timeout value in seconds. Default value (defined by * SIP protocol) is used if {@code timeout} is zero or negative. - * @see Listener.onError + * @see Listener#onError * @throws SipException if the SIP service fails to unhold the call */ public void continueCall(int timeout) throws SipException { @@ -788,8 +790,8 @@ public class SipAudioCall { /** * Puts the device to speaker mode. - *Requires permission: - * {@link android.Manifest.permission#MODIFY_AUDIO_SETTINGS}. + *
Note: Requires the + * {@link android.Manifest.permission#MODIFY_AUDIO_SETTINGS} permission.
*/ public void setSpeakerMode(boolean speakerMode) { synchronized (this) { @@ -799,20 +801,21 @@ public class SipAudioCall { } /** - * Sends a DTMF code. According to RFC2833, event 0--9 maps to decimal + * 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. * * @param code the DTMF code to send. Value 0 to 15 (inclusive) are valid * inputs. - * @see http://tools.ietf.org/html/rfc2833 */ public void sendDtmf(int code) { sendDtmf(code, null); } /** - * Sends a DTMF code. According to RFC2833, event 0--9 maps to decimal + * 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. * @@ -890,10 +893,10 @@ public class SipAudioCall { /** * Starts the audio for the established call. This method should be called * after {@link Listener#onCallEstablished} is called. - *Requires permission: + *
Note: Requires the * {@link android.Manifest.permission#RECORD_AUDIO}, * {@link android.Manifest.permission#ACCESS_WIFI_STATE} and - * {@link android.Manifest.permission#WAKE_LOCK}. + * {@link android.Manifest.permission#WAKE_LOCK} permissions.
*/ public void startAudio() { try { diff --git a/voip/java/android/net/sip/SipErrorCode.java b/voip/java/android/net/sip/SipErrorCode.java index 6aee5f1c3804e..509728feceb54 100644 --- a/voip/java/android/net/sip/SipErrorCode.java +++ b/voip/java/android/net/sip/SipErrorCode.java @@ -17,11 +17,11 @@ package android.net.sip; /** - * Defines error code returned in - * {@link SipRegistrationListener#onRegistrationFailed}, - * {@link SipSession.Listener#onError}, - * {@link SipSession.Listener#onCallChangeFailed} and - * {@link SipSession.Listener#onRegistrationFailed}. + * Defines error codes returned during SIP actions. For example, during + * {@link SipRegistrationListener#onRegistrationFailed onRegistrationFailed()}, + * {@link SipSession.Listener#onError onError()}, + * {@link SipSession.Listener#onCallChangeFailed onCallChangeFailed()} and + * {@link SipSession.Listener#onRegistrationFailed onRegistrationFailed()}. */ public class SipErrorCode { /** Not an error. */ diff --git a/voip/java/android/net/sip/SipException.java b/voip/java/android/net/sip/SipException.java index 225b94f885828..0339395c8832e 100644 --- a/voip/java/android/net/sip/SipException.java +++ b/voip/java/android/net/sip/SipException.java @@ -17,7 +17,7 @@ package android.net.sip; /** - * General SIP-related exception class. + * Indicates a general SIP-related exception. */ public class SipException extends Exception { public SipException() { diff --git a/voip/java/android/net/sip/SipManager.java b/voip/java/android/net/sip/SipManager.java index 38d2b0cb84cde..8aaa8059fc883 100644 --- a/voip/java/android/net/sip/SipManager.java +++ b/voip/java/android/net/sip/SipManager.java @@ -29,30 +29,29 @@ import android.util.Log; import java.text.ParseException; /** - * The class provides API for various SIP related tasks. Specifically, the API - * allows an application to: + * 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()}. + *The APIs in this class allows you to:
*Requires permissions to use this class: - * {@link android.Manifest.permission#INTERNET} and - * {@link android.Manifest.permission#USE_SIP}. + *
Note: 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.
You can create a {@link SipProfile} using {@link + * SipProfile.Builder}. You can also retrieve one from a {@link SipSession}, using {@link + * SipSession#getLocalProfile} and {@link SipSession#getPeerProfile}.
*/ public class SipProfile implements Parcelable, Serializable, Cloneable { private static final long serialVersionUID = 1L; @@ -59,7 +62,7 @@ public class SipProfile implements Parcelable, Serializable, Cloneable { }; /** - * Class to help create a {@code SipProfile}. + * Helper class for creating a {@link SipProfile}. */ public static class Builder { private AddressFactory mAddressFactory; diff --git a/voip/java/android/net/sip/SipRegistrationListener.java b/voip/java/android/net/sip/SipRegistrationListener.java index e1f35ad70fd5f..9968cc7b3335e 100644 --- a/voip/java/android/net/sip/SipRegistrationListener.java +++ b/voip/java/android/net/sip/SipRegistrationListener.java @@ -17,7 +17,7 @@ package android.net.sip; /** - * Listener class to listen to SIP registration events. + * Listener for SIP registration events. */ public interface SipRegistrationListener { /** diff --git a/voip/java/android/net/sip/SipSession.java b/voip/java/android/net/sip/SipSession.java index 9c08e46dd7b06..5629b3c56d504 100644 --- a/voip/java/android/net/sip/SipSession.java +++ b/voip/java/android/net/sip/SipSession.java @@ -20,14 +20,17 @@ import android.os.RemoteException; import android.util.Log; /** - * A SIP session that is associated with a SIP dialog or a standalone + * Represents a SIP session that is associated with a SIP dialog or a standalone * transaction not within a dialog. + *You can get a {@link SipSession} from {@link SipManager} with {@link + * SipManager#createSipSession createSipSession()} (when initiating calls) or {@link + * SipManager#getSessionFor getSessionFor()} (when receiving calls).
*/ public final class SipSession { private static final String TAG = "SipSession"; /** - * Defines {@link SipSession} states. + * Defines SIP session states, such as "registering", "outgoing call", and "in call". */ public static class State { /** When session is ready to initiate a call or transaction. */ @@ -98,7 +101,9 @@ public final class SipSession { } /** - * Listener class that listens to {@link SipSession} events. + * Listener for events relating to a SIP session, such as when a session is being registered + * ("on registering") or a call is outgoing ("on calling"). + *Many of these events are also received by {@link SipAudioCall.Listener}.
*/ public static class Listener { /** diff --git a/voip/java/android/net/sip/package.html b/voip/java/android/net/sip/package.html new file mode 100644 index 0000000000000..790656be3b4a2 --- /dev/null +++ b/voip/java/android/net/sip/package.html @@ -0,0 +1,39 @@ + + +Provides access to Session Initiation Protocol (SIP) functionality, such as +making and answering VOIP calls using SIP.
+ +To get started, you need to get an instance of the {@link android.net.sip.SipManager} by +calling {@link android.net.sip.SipManager#newInstance newInstance()}.
+ +With the {@link android.net.sip.SipManager}, you can initiate SIP audio calls with {@link +android.net.sip.SipManager#makeAudioCall makeAudioCall()} and {@link +android.net.sip.SipManager#takeAudioCall takeAudioCall()}. Both methods require +a {@link android.net.sip.SipAudioCall.Listener} that receives callbacks when the state of the +call changes, such as when the call is ringing, established, or ended.
+ +Both {@link android.net.sip.SipManager#makeAudioCall makeAudioCall()} also requires two +{@link android.net.sip.SipProfile} objects, representing the local device and the peer +device. You can create a {@link android.net.sip.SipProfile} using the {@link +android.net.sip.SipProfile.Builder} subclass.
+ +Once you have a {@link android.net.sip.SipAudioCall}, you can perform SIP audio call actions with +the instance, such as make a call, answer a call, mute a call, turn on speaker mode, send DTMF +tones, and more.
+ +If you want to create generic SIP connections (such as for video calls or other), you can +create a SIP connection from the {@link android.net.sip.SipManager}, using {@link +android.net.sip.SipManager#open open()}. If you only want to create audio SIP calls, though, you +should use the {@link android.net.sip.SipAudioCall} class, as described above.
+ +Note:
+Not all Android-powered devices support VOIP functionality with SIP. Before performing any SIP
+activity, you should 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 in order to use the SIP APIs.
+