1 /* 2 * Copyright (C) 2018 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.telephony.ims; 18 19 import android.annotation.SystemApi; 20 import android.os.Parcel; 21 import android.os.Parcelable; 22 23 /** 24 * This class enables an application to get details on why a method call failed. 25 * 26 * @hide 27 */ 28 @SystemApi 29 public final class ImsReasonInfo implements Parcelable { 30 31 /** 32 * Specific code of each types 33 */ 34 public static final int CODE_UNSPECIFIED = 0; 35 36 /** 37 * LOCAL 38 */ 39 // IMS -> Telephony 40 // The passed argument is an invalid 41 public static final int CODE_LOCAL_ILLEGAL_ARGUMENT = 101; 42 // The operation is invoked in invalid call state 43 public static final int CODE_LOCAL_ILLEGAL_STATE = 102; 44 // IMS service internal error 45 public static final int CODE_LOCAL_INTERNAL_ERROR = 103; 46 // IMS service goes down (service connection is lost) 47 public static final int CODE_LOCAL_IMS_SERVICE_DOWN = 106; 48 // No pending incoming call exists 49 public static final int CODE_LOCAL_NO_PENDING_CALL = 107; 50 // IMS Call ended during conference merge process 51 public static final int CODE_LOCAL_ENDED_BY_CONFERENCE_MERGE = 108; 52 53 // IMS -> Telephony 54 // Service unavailable; by power off 55 public static final int CODE_LOCAL_POWER_OFF = 111; 56 // Service unavailable; by low battery 57 public static final int CODE_LOCAL_LOW_BATTERY = 112; 58 // Service unavailable; by out of service (data service state) 59 public static final int CODE_LOCAL_NETWORK_NO_SERVICE = 121; 60 // Service unavailable; by no LTE coverage 61 // (VoLTE is not supported even though IMS is registered) 62 public static final int CODE_LOCAL_NETWORK_NO_LTE_COVERAGE = 122; 63 // Service unavailable; by located in roaming area 64 public static final int CODE_LOCAL_NETWORK_ROAMING = 123; 65 // Service unavailable; by IP changed 66 public static final int CODE_LOCAL_NETWORK_IP_CHANGED = 124; 67 // Service unavailable; other 68 public static final int CODE_LOCAL_SERVICE_UNAVAILABLE = 131; 69 // Service unavailable; IMS connection is lost (IMS is not registered) 70 public static final int CODE_LOCAL_NOT_REGISTERED = 132; 71 72 // IMS <-> Telephony 73 // Max call exceeded 74 public static final int CODE_LOCAL_CALL_EXCEEDED = 141; 75 // IMS <- Telephony 76 // Call busy 77 public static final int CODE_LOCAL_CALL_BUSY = 142; 78 // Call decline 79 public static final int CODE_LOCAL_CALL_DECLINE = 143; 80 // IMS -> Telephony 81 // SRVCC is in progress 82 public static final int CODE_LOCAL_CALL_VCC_ON_PROGRESSING = 144; 83 // Resource reservation is failed (QoS precondition) 84 public static final int CODE_LOCAL_CALL_RESOURCE_RESERVATION_FAILED = 145; 85 // Retry CS call; VoLTE service can't be provided by the network or remote end 86 // Resolve the extra code(EXTRA_CODE_CALL_RETRY_*) if the below code is set 87 public static final int CODE_LOCAL_CALL_CS_RETRY_REQUIRED = 146; 88 // Retry VoLTE call; VoLTE service can't be provided by the network temporarily 89 public static final int CODE_LOCAL_CALL_VOLTE_RETRY_REQUIRED = 147; 90 // IMS call is already terminated (in TERMINATED state) 91 public static final int CODE_LOCAL_CALL_TERMINATED = 148; 92 // Handover not feasible 93 public static final int CODE_LOCAL_HO_NOT_FEASIBLE = 149; 94 95 /** 96 * TIMEOUT (IMS -> Telephony) 97 */ 98 // 1xx waiting timer is expired after sending INVITE request (MO only) 99 public static final int CODE_TIMEOUT_1XX_WAITING = 201; 100 // User no answer during call setup operation (MO/MT) 101 // MO : 200 OK to INVITE request is not received, 102 // MT : No action from user after alerting the call 103 public static final int CODE_TIMEOUT_NO_ANSWER = 202; 104 // User no answer during call update operation (MO/MT) 105 // MO : 200 OK to re-INVITE request is not received, 106 // MT : No action from user after alerting the call 107 public static final int CODE_TIMEOUT_NO_ANSWER_CALL_UPDATE = 203; 108 109 //Call was blocked by call barring 110 public static final int CODE_CALL_BARRED = 240; 111 112 //Call failures for FDN 113 public static final int CODE_FDN_BLOCKED = 241; 114 115 // Network does not accept the emergency call request because IMEI was used as identification 116 // and this capability is not supported by the network. 117 public static final int CODE_IMEI_NOT_ACCEPTED = 243; 118 119 //STK CC errors 120 public static final int CODE_DIAL_MODIFIED_TO_USSD = 244; 121 public static final int CODE_DIAL_MODIFIED_TO_SS = 245; 122 public static final int CODE_DIAL_MODIFIED_TO_DIAL = 246; 123 public static final int CODE_DIAL_MODIFIED_TO_DIAL_VIDEO = 247; 124 public static final int CODE_DIAL_VIDEO_MODIFIED_TO_DIAL = 248; 125 public static final int CODE_DIAL_VIDEO_MODIFIED_TO_DIAL_VIDEO = 249; 126 public static final int CODE_DIAL_VIDEO_MODIFIED_TO_SS = 250; 127 public static final int CODE_DIAL_VIDEO_MODIFIED_TO_USSD = 251; 128 129 /** 130 * STATUSCODE (SIP response code) (IMS -> Telephony) 131 */ 132 // 3xx responses 133 // SIP request is redirected 134 public static final int CODE_SIP_REDIRECTED = 321; 135 // 4xx responses 136 // 400 : Bad Request 137 public static final int CODE_SIP_BAD_REQUEST = 331; 138 // 403 : Forbidden 139 public static final int CODE_SIP_FORBIDDEN = 332; 140 // 404 : Not Found 141 public static final int CODE_SIP_NOT_FOUND = 333; 142 // 415 : Unsupported Media Type 143 // 416 : Unsupported URI Scheme 144 // 420 : Bad Extension 145 public static final int CODE_SIP_NOT_SUPPORTED = 334; 146 // 408 : Request Timeout 147 public static final int CODE_SIP_REQUEST_TIMEOUT = 335; 148 // 480 : Temporarily Unavailable 149 public static final int CODE_SIP_TEMPRARILY_UNAVAILABLE = 336; 150 // 484 : Address Incomplete 151 public static final int CODE_SIP_BAD_ADDRESS = 337; 152 // 486 : Busy Here 153 // 600 : Busy Everywhere 154 public static final int CODE_SIP_BUSY = 338; 155 // 487 : Request Terminated 156 public static final int CODE_SIP_REQUEST_CANCELLED = 339; 157 // 406 : Not Acceptable 158 // 488 : Not Acceptable Here 159 // 606 : Not Acceptable 160 public static final int CODE_SIP_NOT_ACCEPTABLE = 340; 161 // 410 : Gone 162 // 604 : Does Not Exist Anywhere 163 public static final int CODE_SIP_NOT_REACHABLE = 341; 164 // Others 165 public static final int CODE_SIP_CLIENT_ERROR = 342; 166 // 5xx responses 167 // 501 : Server Internal Error 168 public static final int CODE_SIP_SERVER_INTERNAL_ERROR = 351; 169 // 503 : Service Unavailable 170 public static final int CODE_SIP_SERVICE_UNAVAILABLE = 352; 171 // 504 : Server Time-out 172 public static final int CODE_SIP_SERVER_TIMEOUT = 353; 173 // Others 174 public static final int CODE_SIP_SERVER_ERROR = 354; 175 // 6xx responses 176 // 603 : Decline 177 public static final int CODE_SIP_USER_REJECTED = 361; 178 // Others 179 public static final int CODE_SIP_GLOBAL_ERROR = 362; 180 // Emergency failure 181 public static final int CODE_EMERGENCY_TEMP_FAILURE = 363; 182 public static final int CODE_EMERGENCY_PERM_FAILURE = 364; 183 184 /** 185 * MEDIA (IMS -> Telephony) 186 */ 187 // Media resource initialization failed 188 public static final int CODE_MEDIA_INIT_FAILED = 401; 189 // RTP timeout (no audio / video traffic in the session) 190 public static final int CODE_MEDIA_NO_DATA = 402; 191 // Media is not supported; so dropped the call 192 public static final int CODE_MEDIA_NOT_ACCEPTABLE = 403; 193 // Unknown media related errors 194 public static final int CODE_MEDIA_UNSPECIFIED = 404; 195 196 /** 197 * USER 198 */ 199 // Telephony -> IMS 200 // User triggers the call end 201 public static final int CODE_USER_TERMINATED = 501; 202 // No action while an incoming call is ringing 203 public static final int CODE_USER_NOANSWER = 502; 204 // User ignores an incoming call 205 public static final int CODE_USER_IGNORE = 503; 206 // User declines an incoming call 207 public static final int CODE_USER_DECLINE = 504; 208 // Device declines/ends a call due to low battery 209 public static final int CODE_LOW_BATTERY = 505; 210 // Device declines call due to blacklisted call ID 211 public static final int CODE_BLACKLISTED_CALL_ID = 506; 212 // IMS -> Telephony 213 // The call is terminated by the network or remote user 214 public static final int CODE_USER_TERMINATED_BY_REMOTE = 510; 215 216 /** 217 * Extra codes for the specific code value 218 * This value can be referred when the code is CODE_LOCAL_CALL_CS_RETRY_REQUIRED. 219 */ 220 // Try to connect CS call; normal 221 public static final int EXTRA_CODE_CALL_RETRY_NORMAL = 1; 222 // Try to connect CS call without the notification to user 223 public static final int EXTRA_CODE_CALL_RETRY_SILENT_REDIAL = 2; 224 // Try to connect CS call by the settings of the menu 225 public static final int EXTRA_CODE_CALL_RETRY_BY_SETTINGS = 3; 226 227 /** 228 * UT 229 */ 230 public static final int CODE_UT_NOT_SUPPORTED = 801; 231 public static final int CODE_UT_SERVICE_UNAVAILABLE = 802; 232 public static final int CODE_UT_OPERATION_NOT_ALLOWED = 803; 233 public static final int CODE_UT_NETWORK_ERROR = 804; 234 public static final int CODE_UT_CB_PASSWORD_MISMATCH = 821; 235 //STK CC errors 236 public static final int CODE_UT_SS_MODIFIED_TO_DIAL = 822; 237 public static final int CODE_UT_SS_MODIFIED_TO_USSD = 823; 238 public static final int CODE_UT_SS_MODIFIED_TO_SS = 824; 239 public static final int CODE_UT_SS_MODIFIED_TO_DIAL_VIDEO = 825; 240 241 /** 242 * ECBM 243 */ 244 public static final int CODE_ECBM_NOT_SUPPORTED = 901; 245 246 /** 247 * Fail code used to indicate that Multi-endpoint is not supported by the Ims framework. 248 */ 249 public static final int CODE_MULTIENDPOINT_NOT_SUPPORTED = 902; 250 251 /** 252 * Ims Registration error code 253 */ 254 public static final int CODE_REGISTRATION_ERROR = 1000; 255 256 /** 257 * CALL DROP error codes (Call could drop because of many reasons like Network not available, 258 * handover, failed, etc) 259 */ 260 261 /** 262 * CALL DROP error code for the case when a device is ePDG capable and when the user is on an 263 * active wifi call and at the edge of coverage and there is no qualified LTE network available 264 * to handover the call to. We get a handover NOT_TRIGERRED message from the modem. This error 265 * code is received as part of the handover message. 266 */ 267 public static final int CODE_CALL_DROP_IWLAN_TO_LTE_UNAVAILABLE = 1100; 268 269 /** 270 * MT call has ended due to a release from the network 271 * because the call was answered elsewhere 272 */ 273 public static final int CODE_ANSWERED_ELSEWHERE = 1014; 274 275 /** 276 * For MultiEndpoint - Call Pull request has failed 277 */ 278 public static final int CODE_CALL_PULL_OUT_OF_SYNC = 1015; 279 280 /** 281 * For MultiEndpoint - Call has been pulled from primary to secondary 282 */ 283 public static final int CODE_CALL_END_CAUSE_CALL_PULL = 1016; 284 285 /** 286 * Supplementary services (HOLD/RESUME) failure error codes. 287 * Values for Supplemetary services failure - Failed, Cancelled and Re-Invite collision. 288 */ 289 public static final int CODE_SUPP_SVC_FAILED = 1201; 290 public static final int CODE_SUPP_SVC_CANCELLED = 1202; 291 public static final int CODE_SUPP_SVC_REINVITE_COLLISION = 1203; 292 293 /** 294 * DPD Procedure received no response or send failed 295 */ 296 public static final int CODE_IWLAN_DPD_FAILURE = 1300; 297 298 /** 299 * Establishment of the ePDG Tunnel Failed 300 */ 301 public static final int CODE_EPDG_TUNNEL_ESTABLISH_FAILURE = 1400; 302 303 /** 304 * Re-keying of the ePDG Tunnel Failed; may not always result in teardown 305 */ 306 public static final int CODE_EPDG_TUNNEL_REKEY_FAILURE = 1401; 307 308 /** 309 * Connection to the packet gateway is lost 310 */ 311 public static final int CODE_EPDG_TUNNEL_LOST_CONNECTION = 1402; 312 313 /** 314 * The maximum number of calls allowed has been reached. Used in a multi-endpoint scenario 315 * where the number of calls across all connected devices has reached the maximum. 316 */ 317 public static final int CODE_MAXIMUM_NUMBER_OF_CALLS_REACHED = 1403; 318 319 /** 320 * Similar to {@link #CODE_LOCAL_CALL_DECLINE}, except indicates that a remote device has 321 * declined the call. Used in a multi-endpoint scenario where a remote device declined an 322 * incoming call. 323 */ 324 public static final int CODE_REMOTE_CALL_DECLINE = 1404; 325 326 /** 327 * Indicates the call was disconnected due to the user reaching their data limit. 328 */ 329 public static final int CODE_DATA_LIMIT_REACHED = 1405; 330 331 /** 332 * Indicates the call was disconnected due to the user disabling cellular data. 333 */ 334 public static final int CODE_DATA_DISABLED = 1406; 335 336 /** 337 * Indicates a call was disconnected due to loss of wifi signal. 338 */ 339 public static final int CODE_WIFI_LOST = 1407; 340 341 /** 342 * Indicates the registration attempt on IWLAN failed due to IKEv2 authetication failure 343 * during tunnel establishment. 344 */ 345 public static final int CODE_IKEV2_AUTH_FAILURE = 1408; 346 347 /** The call cannot be established because RADIO is OFF */ 348 public static final int CODE_RADIO_OFF = 1500; 349 350 /** The call cannot be established because of no valid SIM */ 351 public static final int CODE_NO_VALID_SIM = 1501; 352 353 /** The failure is due internal error at modem */ 354 public static final int CODE_RADIO_INTERNAL_ERROR = 1502; 355 356 /** The failure is due to UE timer expired while waiting for a response from network */ 357 public static final int CODE_NETWORK_RESP_TIMEOUT = 1503; 358 359 /** The failure is due to explicit reject from network */ 360 public static final int CODE_NETWORK_REJECT = 1504; 361 362 /** The failure is due to radio access failure. ex. RACH failure */ 363 public static final int CODE_RADIO_ACCESS_FAILURE = 1505; 364 365 /** Call/IMS registration failed/dropped because of a RLF */ 366 public static final int CODE_RADIO_LINK_FAILURE = 1506; 367 368 /** Call/IMS registration failed/dropped because of radio link lost */ 369 public static final int CODE_RADIO_LINK_LOST = 1507; 370 371 /** The call Call/IMS registration failed because of a radio uplink issue */ 372 public static final int CODE_RADIO_UPLINK_FAILURE = 1508; 373 374 /** Call failed because of a RRC connection setup failure */ 375 public static final int CODE_RADIO_SETUP_FAILURE = 1509; 376 377 /** Call failed/dropped because of RRC connection release from NW */ 378 public static final int CODE_RADIO_RELEASE_NORMAL = 1510; 379 380 /** Call failed/dropped because of RRC abnormally released by modem/network */ 381 public static final int CODE_RADIO_RELEASE_ABNORMAL = 1511; 382 383 /** Call failed because of access class barring */ 384 public static final int CODE_ACCESS_CLASS_BLOCKED = 1512; 385 386 /** Call/IMS registration is failed/dropped because of a network detach */ 387 public static final int CODE_NETWORK_DETACH = 1513; 388 389 /** 390 * Call failed due to SIP code 380 (Alternative Service response) while dialing an "undetected 391 * emergency number". This scenario is important in some regions where the carrier network will 392 * identify other non-emergency help numbers (e.g. mountain rescue) when attempting to dial. 393 */ 394 public static final int CODE_SIP_ALTERNATE_EMERGENCY_CALL = 1514; 395 396 /** 397 * Call failed because of unobtainable number 398 * @hide 399 */ 400 public static final int CODE_UNOBTAINABLE_NUMBER = 1515; 401 402 /* OEM specific error codes. To be used by OEMs when they don't want to 403 reveal error code which would be replaced by ERROR_UNSPECIFIED */ 404 public static final int CODE_OEM_CAUSE_1 = 0xf001; 405 public static final int CODE_OEM_CAUSE_2 = 0xf002; 406 public static final int CODE_OEM_CAUSE_3 = 0xf003; 407 public static final int CODE_OEM_CAUSE_4 = 0xf004; 408 public static final int CODE_OEM_CAUSE_5 = 0xf005; 409 public static final int CODE_OEM_CAUSE_6 = 0xf006; 410 public static final int CODE_OEM_CAUSE_7 = 0xf007; 411 public static final int CODE_OEM_CAUSE_8 = 0xf008; 412 public static final int CODE_OEM_CAUSE_9 = 0xf009; 413 public static final int CODE_OEM_CAUSE_10 = 0xf00a; 414 public static final int CODE_OEM_CAUSE_11 = 0xf00b; 415 public static final int CODE_OEM_CAUSE_12 = 0xf00c; 416 public static final int CODE_OEM_CAUSE_13 = 0xf00d; 417 public static final int CODE_OEM_CAUSE_14 = 0xf00e; 418 public static final int CODE_OEM_CAUSE_15 = 0xf00f; 419 420 /** 421 * Network string error messages. 422 * mExtraMessage may have these values. 423 */ 424 public static final String EXTRA_MSG_SERVICE_NOT_AUTHORIZED 425 = "Forbidden. Not Authorized for Service"; 426 427 428 // For main reason code 429 /** @hide */ 430 public int mCode; 431 // For the extra code value; it depends on the code value. 432 /** @hide */ 433 public int mExtraCode; 434 // For the additional message of the reason info. 435 /** @hide */ 436 public String mExtraMessage; 437 438 /** @hide */ ImsReasonInfo()439 public ImsReasonInfo() { 440 mCode = CODE_UNSPECIFIED; 441 mExtraCode = CODE_UNSPECIFIED; 442 mExtraMessage = null; 443 } 444 ImsReasonInfo(Parcel in)445 private ImsReasonInfo(Parcel in) { 446 mCode = in.readInt(); 447 mExtraCode = in.readInt(); 448 mExtraMessage = in.readString(); 449 } 450 451 /** @hide */ ImsReasonInfo(int code, int extraCode)452 public ImsReasonInfo(int code, int extraCode) { 453 mCode = code; 454 mExtraCode = extraCode; 455 mExtraMessage = null; 456 } 457 ImsReasonInfo(int code, int extraCode, String extraMessage)458 public ImsReasonInfo(int code, int extraCode, String extraMessage) { 459 mCode = code; 460 mExtraCode = extraCode; 461 mExtraMessage = extraMessage; 462 } 463 464 /** 465 * 466 */ getCode()467 public int getCode() { 468 return mCode; 469 } 470 471 /** 472 * 473 */ getExtraCode()474 public int getExtraCode() { 475 return mExtraCode; 476 } 477 478 /** 479 * 480 */ getExtraMessage()481 public String getExtraMessage() { 482 return mExtraMessage; 483 } 484 485 /** 486 * Returns the string format of {@link ImsReasonInfo} 487 * 488 * @return the string format of {@link ImsReasonInfo} 489 */ toString()490 public String toString() { 491 return "ImsReasonInfo :: {" + mCode + ", " + mExtraCode + ", " + mExtraMessage + "}"; 492 } 493 494 @Override describeContents()495 public int describeContents() { 496 return 0; 497 } 498 499 @Override writeToParcel(Parcel out, int flags)500 public void writeToParcel(Parcel out, int flags) { 501 out.writeInt(mCode); 502 out.writeInt(mExtraCode); 503 out.writeString(mExtraMessage); 504 } 505 506 public static final Creator<ImsReasonInfo> CREATOR = new Creator<ImsReasonInfo>() { 507 @Override 508 public ImsReasonInfo createFromParcel(Parcel in) { 509 return new ImsReasonInfo(in); 510 } 511 512 @Override 513 public ImsReasonInfo[] newArray(int size) { 514 return new ImsReasonInfo[size]; 515 } 516 }; 517 } 518