Merge "SIP: add SERVER_UNREACHABLE error code." into gingerbread

This commit is contained in:
Hung-ying Tyan
2010-10-04 23:03:26 -07:00
committed by Android (Google) Code Review
4 changed files with 11 additions and 2 deletions

View File

@@ -40,6 +40,7 @@ public abstract class Connection {
MMI, /* not presently used; dial() returns null */ MMI, /* not presently used; dial() returns null */
INVALID_NUMBER, /* invalid dial string */ INVALID_NUMBER, /* invalid dial string */
NUMBER_UNREACHABLE, /* cannot reach the peer */ NUMBER_UNREACHABLE, /* cannot reach the peer */
SERVER_UNREACHABLE, /* cannot reach the server */
INVALID_CREDENTIALS, /* invalid credentials */ INVALID_CREDENTIALS, /* invalid credentials */
OUT_OF_NETWORK, /* calling from out of network is not allowed */ OUT_OF_NETWORK, /* calling from out of network is not allowed */
SERVER_ERROR, /* server error */ SERVER_ERROR, /* server error */

View File

@@ -875,6 +875,9 @@ public class SipPhone extends SipPhoneBase {
public void onError(SipAudioCall call, int errorCode, public void onError(SipAudioCall call, int errorCode,
String errorMessage) { String errorMessage) {
switch (errorCode) { switch (errorCode) {
case SipErrorCode.SERVER_UNREACHABLE:
onError(Connection.DisconnectCause.SERVER_UNREACHABLE);
break;
case SipErrorCode.PEER_NOT_REACHABLE: case SipErrorCode.PEER_NOT_REACHABLE:
onError(Connection.DisconnectCause.NUMBER_UNREACHABLE); onError(Connection.DisconnectCause.NUMBER_UNREACHABLE);
break; break;

View File

@@ -61,6 +61,9 @@ public class SipErrorCode {
/** Cross-domain authentication required. */ /** Cross-domain authentication required. */
public static final int CROSS_DOMAIN_AUTHENTICATION = -11; public static final int CROSS_DOMAIN_AUTHENTICATION = -11;
/** When the server is not reachable. */
public static final int SERVER_UNREACHABLE = -12;
public static String toString(int errorCode) { public static String toString(int errorCode) {
switch (errorCode) { switch (errorCode) {
case NO_ERROR: case NO_ERROR:
@@ -87,6 +90,8 @@ public class SipErrorCode {
return "DATA_CONNECTION_LOST"; return "DATA_CONNECTION_LOST";
case CROSS_DOMAIN_AUTHENTICATION: case CROSS_DOMAIN_AUTHENTICATION:
return "CROSS_DOMAIN_AUTHENTICATION"; return "CROSS_DOMAIN_AUTHENTICATION";
case SERVER_UNREACHABLE:
return "SERVER_UNREACHABLE";
default: default:
return "UNKNOWN"; return "UNKNOWN";
} }

View File

@@ -480,7 +480,7 @@ class SipSessionGroup implements SipListener {
public void run() { public void run() {
try { try {
processCommand(command); processCommand(command);
} catch (SipException e) { } catch (Throwable e) {
Log.w(TAG, "command error: " + command, e); Log.w(TAG, "command error: " + command, e);
onError(e); onError(e);
} }
@@ -1218,7 +1218,7 @@ class SipSessionGroup implements SipListener {
private int getErrorCode(Throwable exception) { private int getErrorCode(Throwable exception) {
String message = exception.getMessage(); String message = exception.getMessage();
if (exception instanceof UnknownHostException) { if (exception instanceof UnknownHostException) {
return SipErrorCode.INVALID_REMOTE_URI; return SipErrorCode.SERVER_UNREACHABLE;
} else if (exception instanceof IOException) { } else if (exception instanceof IOException) {
return SipErrorCode.SOCKET_ERROR; return SipErrorCode.SOCKET_ERROR;
} else { } else {