Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 718e0033 authored by Hung-ying Tyan's avatar Hung-ying Tyan Committed by Android (Google) Code Review
Browse files

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

parents 1862af57 c6548fd9
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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 */
+3 −0
Original line number Diff line number Diff line
@@ -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;
+5 −0
Original line number Diff line number Diff line
@@ -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";
        }
+2 −2
Original line number Diff line number Diff line
@@ -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 {