1 /*
2  * Copyright (C) 2010 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.net.sip;
18 
19 /**
20  * Defines error codes returned during SIP actions. For example, during
21  * {@link SipRegistrationListener#onRegistrationFailed onRegistrationFailed()},
22  * {@link SipSession.Listener#onError onError()},
23  * {@link SipSession.Listener#onCallChangeFailed onCallChangeFailed()} and
24  * {@link SipSession.Listener#onRegistrationFailed onRegistrationFailed()}.
25  * @deprecated {@link android.net.sip.SipManager} and associated classes are no longer supported and
26  * should not be used as the basis of future VOIP apps.
27  */
28 public class SipErrorCode {
29     /** Not an error. */
30     public static final int NO_ERROR = 0;
31 
32     /** When some socket error occurs. */
33     public static final int SOCKET_ERROR = -1;
34 
35     /** When server responds with an error. */
36     public static final int SERVER_ERROR = -2;
37 
38     /** When transaction is terminated unexpectedly. */
39     public static final int TRANSACTION_TERMINTED = -3;
40 
41     /** When some error occurs on the device, possibly due to a bug. */
42     public static final int CLIENT_ERROR = -4;
43 
44     /** When the transaction gets timed out. */
45     public static final int TIME_OUT = -5;
46 
47     /** When the remote URI is not valid. */
48     public static final int INVALID_REMOTE_URI = -6;
49 
50     /** When the peer is not reachable. */
51     public static final int PEER_NOT_REACHABLE = -7;
52 
53     /** When invalid credentials are provided. */
54     public static final int INVALID_CREDENTIALS = -8;
55 
56     /** The client is in a transaction and cannot initiate a new one. */
57     public static final int IN_PROGRESS = -9;
58 
59     /** When data connection is lost. */
60     public static final int DATA_CONNECTION_LOST = -10;
61 
62     /** Cross-domain authentication required. */
63     public static final int CROSS_DOMAIN_AUTHENTICATION = -11;
64 
65     /** When the server is not reachable. */
66     public static final int SERVER_UNREACHABLE = -12;
67 
toString(int errorCode)68     public static String toString(int errorCode) {
69         switch (errorCode) {
70             case NO_ERROR:
71                 return "NO_ERROR";
72             case SOCKET_ERROR:
73                 return "SOCKET_ERROR";
74             case SERVER_ERROR:
75                 return "SERVER_ERROR";
76             case TRANSACTION_TERMINTED:
77                 return "TRANSACTION_TERMINTED";
78             case CLIENT_ERROR:
79                 return "CLIENT_ERROR";
80             case TIME_OUT:
81                 return "TIME_OUT";
82             case INVALID_REMOTE_URI:
83                 return "INVALID_REMOTE_URI";
84             case PEER_NOT_REACHABLE:
85                 return "PEER_NOT_REACHABLE";
86             case INVALID_CREDENTIALS:
87                 return "INVALID_CREDENTIALS";
88             case IN_PROGRESS:
89                 return "IN_PROGRESS";
90             case DATA_CONNECTION_LOST:
91                 return "DATA_CONNECTION_LOST";
92             case CROSS_DOMAIN_AUTHENTICATION:
93                 return "CROSS_DOMAIN_AUTHENTICATION";
94             case SERVER_UNREACHABLE:
95                 return "SERVER_UNREACHABLE";
96             default:
97                 return "UNKNOWN";
98         }
99     }
100 
SipErrorCode()101     private SipErrorCode() {
102     }
103 }
104