blob: 99faba69640a67ed66f5cfe0236e0ef2134c4134 [file] [log] [blame]
Wink Savillef8458ff2014-06-25 16:08:02 -07001/*
2 * Copyright (c) 2013 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
17package com.android.ims;
18
19import android.os.Parcel;
20import android.os.Parcelable;
21
22/**
23 * This class enables an application to get details on why a method call failed.
24 *
25 * @hide
26 */
27public class ImsReasonInfo implements Parcelable {
28
29 /**
30 * Reason types, defines the error category.
31 * UNSPECIFIED - unknown error reason
32 * LOCAL - indicates the local/device error reason
33 * LOCAL_TIMEOUT - indicates the local error reason when a specific timer is expired
34 * STATUSCODE - indicates the interworking error reason by SIP status code received
35 * from the network
36 * MEDIA - indicates the media error reason (local resource, SDP parameter, etc.)
37 * USER - indicates the error reason by the local or remote user
38 * UT - indicates the error reason for the supplementary service configuration
39 */
40 public static final int TYPE_UNSPECIFIED = 0;
41 public static final int TYPE_LOCAL = 1;
42 public static final int TYPE_TIMEOUT = 2;
43 public static final int TYPE_STATUSCODE = 3;
44 public static final int TYPE_MEDIA = 4;
45 public static final int TYPE_USER = 5;
46 public static final int TYPE_UT = 8;
47
48 /**
49 * Specific code of each types
50 */
51 public static final int CODE_UNSPECIFIED = 0;
52
53 /**
54 * LOCAL
55 */
56 // IMS -> Telephony
57 // The passed argument is an invalid
58 public static final int CODE_LOCAL_ILLEGAL_ARGUMENT = 101;
59 // The operation is invoked in invalid call state
60 public static final int CODE_LOCAL_ILLEGAL_STATE = 102;
61 // IMS service internal error
62 public static final int CODE_LOCAL_INTERNAL_ERROR = 103;
63 // IMS service goes down (service connection is lost)
64 public static final int CODE_LOCAL_IMS_SERVICE_DOWN = 106;
65 // No pending incoming call exists
66 public static final int CODE_LOCAL_NO_PENDING_CALL = 107;
67
68 // IMS -> Telephony
69 // Service unavailable; by power off
70 public static final int CODE_LOCAL_POWER_OFF = 111;
71 // Service unavailable; by low battery
72 public static final int CODE_LOCAL_LOW_BATTERY = 112;
73 // Service unavailable; by out of service (data service state)
74 public static final int CODE_LOCAL_NETWORK_NO_SERVICE = 121;
75 // Service unavailable; by no LTE coverage
76 // (VoLTE is not supported even though IMS is registered)
77 public static final int CODE_LOCAL_NETWORK_NO_LTE_COVERAGE = 122;
78 // Service unavailable; by located in roaming area
79 public static final int CODE_LOCAL_NETWORK_ROAMING = 123;
80 // Service unavailable; by IP changed
81 public static final int CODE_LOCAL_NETWORK_IP_CHANGED = 124;
82 // Service unavailable; other
83 public static final int CODE_LOCAL_SERVICE_UNAVAILABLE = 131;
84 // Service unavailable; IMS connection is lost (IMS is not registered)
85 public static final int CODE_LOCAL_NOT_REGISTERED = 132;
86
87 // IMS <-> Telephony
88 // Max call exceeded
89 public static final int CODE_LOCAL_CALL_EXCEEDED = 141;
90 // IMS <- Telephony
91 // Call busy
92 public static final int CODE_LOCAL_CALL_BUSY = 142;
93 // Call decline
94 public static final int CODE_LOCAL_CALL_DECLINE = 143;
95 // IMS -> Telephony
96 // SRVCC is in progress
97 public static final int CODE_LOCAL_CALL_VCC_ON_PROGRESSING = 144;
98 // Resource reservation is failed (QoS precondition)
99 public static final int CODE_LOCAL_CALL_RESOURCE_RESERVATION_FAILED = 145;
100 // Retry CS call; VoLTE service can't be provided by the network or remote end
101 // Resolve the extra code(EXTRA_CODE_CALL_RETRY_*) if the below code is set
102 public static final int CODE_LOCAL_CALL_CS_RETRY_REQUIRED = 146;
103 // Retry VoLTE call; VoLTE service can't be provided by the network temporarily
104 public static final int CODE_LOCAL_CALL_VOLTE_RETRY_REQUIRED = 147;
105 // IMS call is already terminated (in TERMINATED state)
106 public static final int CODE_LOCAL_CALL_TERMINATED = 148;
107
108 /**
109 * TIMEOUT (IMS -> Telephony)
110 */
111 // 1xx waiting timer is expired after sending INVITE request (MO only)
112 public static final int CODE_TIMEOUT_1XX_WAITING = 201;
113 // User no answer during call setup operation (MO/MT)
114 // MO : 200 OK to INVITE request is not received,
115 // MT : No action from user after alerting the call
116 public static final int CODE_TIMEOUT_NO_ANSWER = 202;
117 // User no answer during call update operation (MO/MT)
118 // MO : 200 OK to re-INVITE request is not received,
119 // MT : No action from user after alerting the call
120 public static final int CODE_TIMEOUT_NO_ANSWER_CALL_UPDATE = 203;
121
122 /**
123 * STATUSCODE (SIP response code) (IMS -> Telephony)
124 */
125 // 3xx responses
126 // SIP request is redirected
127 public static final int CODE_SIP_REDIRECTED = 321;
128 // 4xx responses
129 // 400 : Bad Request
130 public static final int CODE_SIP_BAD_REQUEST = 331;
131 // 403 : Forbidden
132 public static final int CODE_SIP_FORBIDDEN = 332;
133 // 404 : Not Found
134 public static final int CODE_SIP_NOT_FOUND = 333;
135 // 415 : Unsupported Media Type
136 // 416 : Unsupported URI Scheme
137 // 420 : Bad Extension
138 public static final int CODE_SIP_NOT_SUPPORTED = 334;
139 // 408 : Request Timeout
140 public static final int CODE_SIP_REQUEST_TIMEOUT = 335;
141 // 480 : Temporarily Unavailable
142 public static final int CODE_SIP_TEMPRARILY_UNAVAILABLE = 336;
143 // 484 : Address Incomplete
144 public static final int CODE_SIP_BAD_ADDRESS = 337;
145 // 486 : Busy Here
146 // 600 : Busy Everywhere
147 public static final int CODE_SIP_BUSY = 338;
148 // 487 : Request Terminated
149 public static final int CODE_SIP_REQUEST_CANCELLED = 339;
150 // 406 : Not Acceptable
151 // 488 : Not Acceptable Here
152 // 606 : Not Acceptable
153 public static final int CODE_SIP_NOT_ACCEPTABLE = 340;
154 // 410 : Gone
155 // 604 : Does Not Exist Anywhere
156 public static final int CODE_SIP_NOT_REACHABLE = 341;
157 // Others
158 public static final int CODE_SIP_CLIENT_ERROR = 342;
159 // 5xx responses
160 // 501 : Server Internal Error
161 public static final int CODE_SIP_SERVER_INTERNAL_ERROR = 351;
162 // 503 : Service Unavailable
163 public static final int CODE_SIP_SERVICE_UNAVAILABLE = 352;
164 // 504 : Server Time-out
165 public static final int CODE_SIP_SERVER_TIMEOUT = 353;
166 // Others
167 public static final int CODE_SIP_SERVER_ERROR = 354;
168 // 6xx responses
169 // 603 : Decline
170 public static final int CODE_SIP_USER_REJECTED = 361;
171 // Others
172 public static final int CODE_SIP_GLOBAL_ERROR = 362;
173
174 /**
175 * MEDIA (IMS -> Telephony)
176 */
177 // Media resource initialization failed
178 public static final int CODE_MEDIA_INIT_FAILED = 401;
179 // RTP timeout (no audio / video traffic in the session)
180 public static final int CODE_MEDIA_NO_DATA = 402;
181 // Media is not supported; so dropped the call
182 public static final int CODE_MEDIA_NOT_ACCEPTABLE = 403;
183 // Unknown media related errors
184 public static final int CODE_MEDIA_UNSPECIFIED = 404;
185
186 /**
187 * USER
188 */
189 // Telephony -> IMS
190 // User triggers the call end
191 public static final int CODE_USER_TERMINATED = 501;
192 // No action while an incoming call is ringing
193 public static final int CODE_USER_NOANSWER = 502;
194 // User ignores an incoming call
195 public static final int CODE_USER_IGNORE = 503;
196 // User declines an incoming call
197 public static final int CODE_USER_DECLINE = 504;
198 // IMS -> Telephony
199 // The call is terminated by the network or remote user
200 public static final int CODE_USER_TERMINATED_BY_REMOTE = 510;
201
202 /**
203 * Extra codes for the specific code value
204 * This value can be referred when the code is CODE_LOCAL_CALL_CS_RETRY_REQUIRED.
205 */
206 // Try to connect CS call; normal
207 public static final int EXTRA_CODE_CALL_RETRY_NORMAL = 1;
208 // Try to connect CS call without the notification to user
209 public static final int EXTRA_CODE_CALL_RETRY_SILENT_REDIAL = 2;
210 // Try to connect CS call by the settings of the menu
211 public static final int EXTRA_CODE_CALL_RETRY_BY_SETTINGS = 3;
212
213 /**
214 * UT
215 */
216 public static final int CODE_UT_NOT_SUPPORTED = 801;
217 public static final int CODE_UT_SERVICE_UNAVAILABLE = 802;
218 public static final int CODE_UT_OPERATION_NOT_ALLOWED = 803;
219 public static final int CODE_UT_CB_PASSWORD_MISMATCH = 821;
220
221
222
223 // For reason type
224 public int mReasonType;
225 // For main reason code
226 public int mCode;
227 // For the extra code value; it depends on the code value.
228 public int mExtraCode;
229 // For the additional message of the reason info.
230 public String mExtraMessage;
231
232 public ImsReasonInfo() {
233 mReasonType = TYPE_UNSPECIFIED;
234 mCode = CODE_UNSPECIFIED;
235 mExtraCode = CODE_UNSPECIFIED;
236 mExtraMessage = null;
237 }
238
239 public ImsReasonInfo(Parcel in) {
240 readFromParcel(in);
241 }
242
243 public ImsReasonInfo(int code, int extraCode) {
244 mReasonType = (int) (code / 100);
245 mCode = code;
246 mExtraCode = extraCode;
247 mExtraMessage = null;
248 }
249
250 public ImsReasonInfo(int code, int extraCode, String extraMessage) {
251 mReasonType = (int) (code / 100);
252 mCode = code;
253 mExtraCode = extraCode;
254 mExtraMessage = extraMessage;
255 }
256
257 /**
258 *
259 */
260 public int getCode() {
261 return mCode;
262 }
263
264 /**
265 *
266 */
267 public int getExtraCode() {
268 return mExtraCode;
269 }
270
271 /**
272 *
273 */
274 public String getExtraMessage() {
275 return mExtraMessage;
276 }
277
278 /**
279 *
280 */
281 public int getReasonType() {
282 return mReasonType;
283 }
284
285 /**
286 * Returns the string format of {@link ImsReasonInfo}
287 *
288 * @return the string format of {@link ImsReasonInfo}
289 */
290 public String toString() {
291 return "ImsReasonInfo :: {" + mReasonType + ", "
292 + mCode + ", " + mExtraCode + ", " + mExtraMessage + "}";
293 }
294
295 @Override
296 public int describeContents() {
297 return 0;
298 }
299
300 @Override
301 public void writeToParcel(Parcel out, int flags) {
302 out.writeInt(mReasonType);
303 out.writeInt(mCode);
304 out.writeInt(mExtraCode);
305 out.writeString(mExtraMessage);
306 }
307
308 private void readFromParcel(Parcel in) {
309 mReasonType = in.readInt();
310 mCode = in.readInt();
311 mExtraCode = in.readInt();
312 mExtraMessage = in.readString();
313 }
314
315 public static final Creator<ImsReasonInfo> CREATOR = new Creator<ImsReasonInfo>() {
316 @Override
317 public ImsReasonInfo createFromParcel(Parcel in) {
318 return new ImsReasonInfo(in);
319 }
320
321 @Override
322 public ImsReasonInfo[] newArray(int size) {
323 return new ImsReasonInfo[size];
324 }
325 };
326}