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