summaryrefslogtreecommitdiffstats
path: root/voip
diff options
context:
space:
mode:
authorHung-ying Tyan <tyanh@google.com>2010-09-09 20:07:14 +0800
committerHung-ying Tyan <tyanh@google.com>2010-09-10 17:15:06 +0800
commit903e1031605d715e904811b0dd06cc6a518f0048 (patch)
tree410e5f2d1152cb9579f51598f04b705ecd420f31 /voip
parenta71d69947d4a74730b17021b4c809d054d66c741 (diff)
downloadframeworks_base-903e1031605d715e904811b0dd06cc6a518f0048.zip
frameworks_base-903e1031605d715e904811b0dd06cc6a518f0048.tar.gz
frameworks_base-903e1031605d715e904811b0dd06cc6a518f0048.tar.bz2
SIP: add SipErrorCode for error feedback.
Change-Id: I8b071d4933479b780a403d0bfa30511f4c23ca8f
Diffstat (limited to 'voip')
-rw-r--r--voip/java/android/net/sip/ISipSessionListener.aidl12
-rw-r--r--voip/java/android/net/sip/SipAudioCall.java6
-rw-r--r--voip/java/android/net/sip/SipAudioCallImpl.java17
-rw-r--r--voip/java/android/net/sip/SipErrorCode.java45
-rw-r--r--voip/java/android/net/sip/SipRegistrationListener.java4
-rw-r--r--voip/java/android/net/sip/SipSessionAdapter.java9
6 files changed, 68 insertions, 25 deletions
diff --git a/voip/java/android/net/sip/ISipSessionListener.aidl b/voip/java/android/net/sip/ISipSessionListener.aidl
index c552a57..0a6220b 100644
--- a/voip/java/android/net/sip/ISipSessionListener.aidl
+++ b/voip/java/android/net/sip/ISipSessionListener.aidl
@@ -76,20 +76,20 @@ interface ISipSessionListener {
* termination.
*
* @param session the session object that carries out the transaction
- * @param errorClass name of the exception class
+ * @param errorCode error code defined in {@link SipErrorCode}
* @param errorMessage error message
*/
- void onError(in ISipSession session, String errorClass,
+ void onError(in ISipSession session, String errorCode,
String errorMessage);
/**
* Called when an error occurs during session modification negotiation.
*
* @param session the session object that carries out the transaction
- * @param errorClass name of the exception class
+ * @param errorCode error code defined in {@link SipErrorCode}
* @param errorMessage error message
*/
- void onCallChangeFailed(in ISipSession session, String errorClass,
+ void onCallChangeFailed(in ISipSession session, String errorCode,
String errorMessage);
/**
@@ -111,10 +111,10 @@ interface ISipSessionListener {
* Called when the registration fails.
*
* @param session the session object that carries out the transaction
- * @param errorClass name of the exception class
+ * @param errorCode error code defined in {@link SipErrorCode}
* @param errorMessage error message
*/
- void onRegistrationFailed(in ISipSession session, String errorClass,
+ void onRegistrationFailed(in ISipSession session, String errorCode,
String errorMessage);
/**
diff --git a/voip/java/android/net/sip/SipAudioCall.java b/voip/java/android/net/sip/SipAudioCall.java
index 8254543..02f82b3 100644
--- a/voip/java/android/net/sip/SipAudioCall.java
+++ b/voip/java/android/net/sip/SipAudioCall.java
@@ -90,9 +90,10 @@ public interface SipAudioCall {
* Called when an error occurs.
*
* @param call the call object that carries out the audio call
+ * @param errorCode error code defined in {@link SipErrorCode}
* @param errorMessage error message
*/
- void onError(SipAudioCall call, String errorMessage);
+ void onError(SipAudioCall call, String errorCode, String errorMessage);
}
/**
@@ -126,7 +127,8 @@ public interface SipAudioCall {
public void onCallHeld(SipAudioCall call) {
onChanged(call);
}
- public void onError(SipAudioCall call, String errorMessage) {
+ public void onError(SipAudioCall call, String errorCode,
+ String errorMessage) {
onChanged(call);
}
}
diff --git a/voip/java/android/net/sip/SipAudioCallImpl.java b/voip/java/android/net/sip/SipAudioCallImpl.java
index a312f83..2e2ca5b 100644
--- a/voip/java/android/net/sip/SipAudioCallImpl.java
+++ b/voip/java/android/net/sip/SipAudioCallImpl.java
@@ -108,7 +108,8 @@ public class SipAudioCallImpl extends SipSessionAdapter
listener.onCalling(this);
break;
default:
- listener.onError(this, "wrong state to attach call: " + state);
+ listener.onError(this, SipErrorCode.CLIENT_ERROR.toString(),
+ "wrong state to attach call: " + state);
}
} catch (Throwable t) {
Log.e(TAG, "setListener()", t);
@@ -275,14 +276,13 @@ public class SipAudioCallImpl extends SipSessionAdapter
}
@Override
- public void onCallChangeFailed(ISipSession session,
- String className, String message) {
+ public void onCallChangeFailed(ISipSession session, String errorCode,
+ String message) {
Log.d(TAG, "sip call change failed: " + message);
Listener listener = mListener;
if (listener != null) {
try {
- listener.onError(SipAudioCallImpl.this,
- className + ": " + message);
+ listener.onError(SipAudioCallImpl.this, errorCode, message);
} catch (Throwable t) {
Log.e(TAG, "onCallBusy()", t);
}
@@ -290,17 +290,16 @@ public class SipAudioCallImpl extends SipSessionAdapter
}
@Override
- public void onError(ISipSession session, String className,
+ public void onError(ISipSession session, String errorCode,
String message) {
- Log.d(TAG, "sip session error: " + className + ": " + message);
+ Log.d(TAG, "sip session error: " + errorCode + ": " + message);
synchronized (this) {
if (!isInCall()) close(true);
}
Listener listener = mListener;
if (listener != null) {
try {
- listener.onError(SipAudioCallImpl.this,
- className + ": " + message);
+ listener.onError(SipAudioCallImpl.this, errorCode, message);
} catch (Throwable t) {
Log.e(TAG, "onError()", t);
}
diff --git a/voip/java/android/net/sip/SipErrorCode.java b/voip/java/android/net/sip/SipErrorCode.java
new file mode 100644
index 0000000..2eb67e8
--- /dev/null
+++ b/voip/java/android/net/sip/SipErrorCode.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.net.sip;
+
+/**
+ * Defines error code returned in
+ * {@link SipRegistrationListener#onRegistrationFailed(String, String, String)},
+ * {@link ISipSessionListener#onError(ISipSession, String, String)},
+ * {@link ISipSessionListener#onCallChangeFailed(ISipSession, String, String)} and
+ * {@link ISipSessionListener#onRegistrationFailed(ISipSession, String, String)}.
+ * @hide
+ */
+public enum SipErrorCode {
+ /** When some socket error occurs. */
+ SOCKET_ERROR,
+
+ /** When server responds with an error. */
+ SERVER_ERROR,
+
+ /** When some error occurs on the device, possibly due to a bug. */
+ CLIENT_ERROR,
+
+ /** When the transaction gets timed out. */
+ TIME_OUT,
+
+ /** When the remote URI is not valid. */
+ INVALID_REMOTE_URI,
+
+ /** When invalid credentials are provided. */
+ INVALID_CREDENTIALS;
+}
diff --git a/voip/java/android/net/sip/SipRegistrationListener.java b/voip/java/android/net/sip/SipRegistrationListener.java
index 63faaf8..22488d7 100644
--- a/voip/java/android/net/sip/SipRegistrationListener.java
+++ b/voip/java/android/net/sip/SipRegistrationListener.java
@@ -40,9 +40,9 @@ public interface SipRegistrationListener {
* Called when the registration fails.
*
* @param localProfileUri the URI string of the SIP profile to register with
- * @param errorClass name of the exception class
+ * @param errorCode error code defined in {@link SipErrorCode}
* @param errorMessage error message
*/
- void onRegistrationFailed(String localProfileUri, String errorClass,
+ void onRegistrationFailed(String localProfileUri, String errorCode,
String errorMessage);
}
diff --git a/voip/java/android/net/sip/SipSessionAdapter.java b/voip/java/android/net/sip/SipSessionAdapter.java
index 770d4eb..6020f2c 100644
--- a/voip/java/android/net/sip/SipSessionAdapter.java
+++ b/voip/java/android/net/sip/SipSessionAdapter.java
@@ -42,14 +42,11 @@ public class SipSessionAdapter extends ISipSessionListener.Stub {
public void onCallBusy(ISipSession session) {
}
- public void onCallChanged(ISipSession session, byte[] sessionDescription) {
- }
-
- public void onCallChangeFailed(ISipSession session, String className,
+ public void onCallChangeFailed(ISipSession session, String errorCode,
String message) {
}
- public void onError(ISipSession session, String className, String message) {
+ public void onError(ISipSession session, String errorCode, String message) {
}
public void onRegistering(ISipSession session) {
@@ -58,7 +55,7 @@ public class SipSessionAdapter extends ISipSessionListener.Stub {
public void onRegistrationDone(ISipSession session, int duration) {
}
- public void onRegistrationFailed(ISipSession session, String className,
+ public void onRegistrationFailed(ISipSession session, String errorCode,
String message) {
}