am 718e0033: Merge "SIP: add SERVER_UNREACHABLE error code." into gingerbread

Merge commit '718e0033e69fa7d1db12242324ab9098ac430bf5' into gingerbread-plus-aosp

* commit '718e0033e69fa7d1db12242324ab9098ac430bf5':
  SIP: add SERVER_UNREACHABLE error code.
This commit is contained in:
Hung-ying Tyan
2010-10-04 23:07:43 -07:00
committed by Android Git Automerger
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 */
INVALID_NUMBER, /* invalid dial string */
NUMBER_UNREACHABLE, /* cannot reach the peer */
SERVER_UNREACHABLE, /* cannot reach the server */
INVALID_CREDENTIALS, /* invalid credentials */
OUT_OF_NETWORK, /* calling from out of network is not allowed */
SERVER_ERROR, /* server error */

View File

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

View File

@@ -61,6 +61,9 @@ public class SipErrorCode {
/** Cross-domain authentication required. */
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) {
switch (errorCode) {
case NO_ERROR:
@@ -87,6 +90,8 @@ public class SipErrorCode {
return "DATA_CONNECTION_LOST";
case CROSS_DOMAIN_AUTHENTICATION:
return "CROSS_DOMAIN_AUTHENTICATION";
case SERVER_UNREACHABLE:
return "SERVER_UNREACHABLE";
default:
return "UNKNOWN";
}

View File

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