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      * Specific code of each types
     30      */
     31     public static final int CODE_UNSPECIFIED = 0;
     32 
     33     /**
     34      * LOCAL
     35      */
     36     // IMS -> Telephony
     37     // The passed argument is an invalid
     38     public static final int CODE_LOCAL_ILLEGAL_ARGUMENT = 101;
     39     // The operation is invoked in invalid call state
     40     public static final int CODE_LOCAL_ILLEGAL_STATE = 102;
     41     // IMS service internal error
     42     public static final int CODE_LOCAL_INTERNAL_ERROR = 103;
     43     // IMS service goes down (service connection is lost)
     44     public static final int CODE_LOCAL_IMS_SERVICE_DOWN = 106;
     45     // No pending incoming call exists
     46     public static final int CODE_LOCAL_NO_PENDING_CALL = 107;
     47 
     48     // IMS -> Telephony
     49     // Service unavailable; by power off
     50     public static final int CODE_LOCAL_POWER_OFF = 111;
     51     // Service unavailable; by low battery
     52     public static final int CODE_LOCAL_LOW_BATTERY = 112;
     53     // Service unavailable; by out of service (data service state)
     54     public static final int CODE_LOCAL_NETWORK_NO_SERVICE = 121;
     55     // Service unavailable; by no LTE coverage
     56     // (VoLTE is not supported even though IMS is registered)
     57     public static final int CODE_LOCAL_NETWORK_NO_LTE_COVERAGE = 122;
     58     // Service unavailable; by located in roaming area
     59     public static final int CODE_LOCAL_NETWORK_ROAMING = 123;
     60     // Service unavailable; by IP changed
     61     public static final int CODE_LOCAL_NETWORK_IP_CHANGED = 124;
     62     // Service unavailable; other
     63     public static final int CODE_LOCAL_SERVICE_UNAVAILABLE = 131;
     64     // Service unavailable; IMS connection is lost (IMS is not registered)
     65     public static final int CODE_LOCAL_NOT_REGISTERED = 132;
     66 
     67     // IMS <-> Telephony
     68     // Max call exceeded
     69     public static final int CODE_LOCAL_CALL_EXCEEDED = 141;
     70     // IMS <- Telephony
     71     // Call busy
     72     public static final int CODE_LOCAL_CALL_BUSY = 142;
     73     // Call decline
     74     public static final int CODE_LOCAL_CALL_DECLINE = 143;
     75     // IMS -> Telephony
     76     // SRVCC is in progress
     77     public static final int CODE_LOCAL_CALL_VCC_ON_PROGRESSING = 144;
     78     // Resource reservation is failed (QoS precondition)
     79     public static final int CODE_LOCAL_CALL_RESOURCE_RESERVATION_FAILED = 145;
     80     // Retry CS call; VoLTE service can't be provided by the network or remote end
     81     // Resolve the extra code(EXTRA_CODE_CALL_RETRY_*) if the below code is set
     82     public static final int CODE_LOCAL_CALL_CS_RETRY_REQUIRED = 146;
     83     // Retry VoLTE call; VoLTE service can't be provided by the network temporarily
     84     public static final int CODE_LOCAL_CALL_VOLTE_RETRY_REQUIRED = 147;
     85     // IMS call is already terminated (in TERMINATED state)
     86     public static final int CODE_LOCAL_CALL_TERMINATED = 148;
     87     // Handover not feasible
     88     public static final int CODE_LOCAL_HO_NOT_FEASIBLE = 149;
     89 
     90     /**
     91      * TIMEOUT (IMS -> Telephony)
     92      */
     93     // 1xx waiting timer is expired after sending INVITE request (MO only)
     94     public static final int CODE_TIMEOUT_1XX_WAITING = 201;
     95     // User no answer during call setup operation (MO/MT)
     96     // MO : 200 OK to INVITE request is not received,
     97     // MT : No action from user after alerting the call
     98     public static final int CODE_TIMEOUT_NO_ANSWER = 202;
     99     // User no answer during call update operation (MO/MT)
    100     // MO : 200 OK to re-INVITE request is not received,
    101     // MT : No action from user after alerting the call
    102     public static final int CODE_TIMEOUT_NO_ANSWER_CALL_UPDATE = 203;
    103 
    104     //Call failures for FDN
    105     public static final int CODE_FDN_BLOCKED = 241;
    106 
    107     /**
    108      * STATUSCODE (SIP response code) (IMS -> Telephony)
    109      */
    110     // 3xx responses
    111     // SIP request is redirected
    112     public static final int CODE_SIP_REDIRECTED = 321;
    113     // 4xx responses
    114     // 400 : Bad Request
    115     public static final int CODE_SIP_BAD_REQUEST = 331;
    116     // 403 : Forbidden
    117     public static final int CODE_SIP_FORBIDDEN = 332;
    118     // 404 : Not Found
    119     public static final int CODE_SIP_NOT_FOUND = 333;
    120     // 415 : Unsupported Media Type
    121     // 416 : Unsupported URI Scheme
    122     // 420 : Bad Extension
    123     public static final int CODE_SIP_NOT_SUPPORTED = 334;
    124     // 408 : Request Timeout
    125     public static final int CODE_SIP_REQUEST_TIMEOUT = 335;
    126     // 480 : Temporarily Unavailable
    127     public static final int CODE_SIP_TEMPRARILY_UNAVAILABLE = 336;
    128     // 484 : Address Incomplete
    129     public static final int CODE_SIP_BAD_ADDRESS = 337;
    130     // 486 : Busy Here
    131     // 600 : Busy Everywhere
    132     public static final int CODE_SIP_BUSY = 338;
    133     // 487 : Request Terminated
    134     public static final int CODE_SIP_REQUEST_CANCELLED = 339;
    135     // 406 : Not Acceptable
    136     // 488 : Not Acceptable Here
    137     // 606 : Not Acceptable
    138     public static final int CODE_SIP_NOT_ACCEPTABLE = 340;
    139     // 410 : Gone
    140     // 604 : Does Not Exist Anywhere
    141     public static final int CODE_SIP_NOT_REACHABLE = 341;
    142     // Others
    143     public static final int CODE_SIP_CLIENT_ERROR = 342;
    144     // 5xx responses
    145     // 501 : Server Internal Error
    146     public static final int CODE_SIP_SERVER_INTERNAL_ERROR = 351;
    147     // 503 : Service Unavailable
    148     public static final int CODE_SIP_SERVICE_UNAVAILABLE = 352;
    149     // 504 : Server Time-out
    150     public static final int CODE_SIP_SERVER_TIMEOUT = 353;
    151     // Others
    152     public static final int CODE_SIP_SERVER_ERROR = 354;
    153     // 6xx responses
    154     // 603 : Decline
    155     public static final int CODE_SIP_USER_REJECTED = 361;
    156     // Others
    157     public static final int CODE_SIP_GLOBAL_ERROR = 362;
    158     // Emergency failure
    159     public static final int CODE_EMERGENCY_TEMP_FAILURE = 363;
    160     public static final int CODE_EMERGENCY_PERM_FAILURE = 364;
    161 
    162     /**
    163      * MEDIA (IMS -> Telephony)
    164      */
    165     // Media resource initialization failed
    166     public static final int CODE_MEDIA_INIT_FAILED = 401;
    167     // RTP timeout (no audio / video traffic in the session)
    168     public static final int CODE_MEDIA_NO_DATA = 402;
    169     // Media is not supported; so dropped the call
    170     public static final int CODE_MEDIA_NOT_ACCEPTABLE = 403;
    171     // Unknown media related errors
    172     public static final int CODE_MEDIA_UNSPECIFIED = 404;
    173 
    174     /**
    175      * USER
    176      */
    177     // Telephony -> IMS
    178     // User triggers the call end
    179     public static final int CODE_USER_TERMINATED = 501;
    180     // No action while an incoming call is ringing
    181     public static final int CODE_USER_NOANSWER = 502;
    182     // User ignores an incoming call
    183     public static final int CODE_USER_IGNORE = 503;
    184     // User declines an incoming call
    185     public static final int CODE_USER_DECLINE = 504;
    186     // Device declines/ends a call due to low battery
    187     public static final int CODE_LOW_BATTERY = 505;
    188     // Device declines call due to blacklisted call ID
    189     public static final int CODE_BLACKLISTED_CALL_ID = 506;
    190     // IMS -> Telephony
    191     // The call is terminated by the network or remote user
    192     public static final int CODE_USER_TERMINATED_BY_REMOTE = 510;
    193 
    194     /**
    195      * Extra codes for the specific code value
    196      * This value can be referred when the code is CODE_LOCAL_CALL_CS_RETRY_REQUIRED.
    197      */
    198     // Try to connect CS call; normal
    199     public static final int EXTRA_CODE_CALL_RETRY_NORMAL = 1;
    200     // Try to connect CS call without the notification to user
    201     public static final int EXTRA_CODE_CALL_RETRY_SILENT_REDIAL = 2;
    202     // Try to connect CS call by the settings of the menu
    203     public static final int EXTRA_CODE_CALL_RETRY_BY_SETTINGS = 3;
    204 
    205     /**
    206      * UT
    207      */
    208     public static final int CODE_UT_NOT_SUPPORTED = 801;
    209     public static final int CODE_UT_SERVICE_UNAVAILABLE = 802;
    210     public static final int CODE_UT_OPERATION_NOT_ALLOWED = 803;
    211     public static final int CODE_UT_NETWORK_ERROR = 804;
    212     public static final int CODE_UT_CB_PASSWORD_MISMATCH = 821;
    213 
    214     /**
    215      * ECBM
    216      */
    217     public static final int CODE_ECBM_NOT_SUPPORTED = 901;
    218 
    219     /**
    220      * Fail code used to indicate that Multi-endpoint is not supported by the Ims framework.
    221      */
    222     public static final int CODE_MULTIENDPOINT_NOT_SUPPORTED = 902;
    223 
    224     /**
    225      * Ims Registration error code
    226      */
    227     public static final int CODE_REGISTRATION_ERROR = 1000;
    228 
    229     /**
    230      * CALL DROP error codes (Call could drop because of many reasons like Network not available,
    231      *  handover, failed, etc)
    232      */
    233 
    234     /**
    235      * CALL DROP error code for the case when a device is ePDG capable and when the user is on an
    236      * active wifi call and at the edge of coverage and there is no qualified LTE network available
    237      * to handover the call to. We get a handover NOT_TRIGERRED message from the modem. This error
    238      * code is received as part of the handover message.
    239      */
    240     public static final int CODE_CALL_DROP_IWLAN_TO_LTE_UNAVAILABLE = 1100;
    241 
    242     /**
    243      * MT call has ended due to a release from the network
    244      * because the call was answered elsewhere
    245      */
    246     public static final int CODE_ANSWERED_ELSEWHERE = 1014;
    247 
    248     /**
    249      * For MultiEndpoint - Call Pull request has failed
    250      */
    251     public static final int CODE_CALL_PULL_OUT_OF_SYNC = 1015;
    252 
    253     /**
    254      * For MultiEndpoint - Call has been pulled from primary to secondary
    255      */
    256     public static final int CODE_CALL_END_CAUSE_CALL_PULL = 1016;
    257 
    258     /**
    259      * Supplementary services (HOLD/RESUME) failure error codes.
    260      * Values for Supplemetary services failure - Failed, Cancelled and Re-Invite collision.
    261      */
    262     public static final int CODE_SUPP_SVC_FAILED = 1201;
    263     public static final int CODE_SUPP_SVC_CANCELLED = 1202;
    264     public static final int CODE_SUPP_SVC_REINVITE_COLLISION = 1203;
    265 
    266     /**
    267      * DPD Procedure received no response or send failed
    268      */
    269     public static final int CODE_IWLAN_DPD_FAILURE = 1300;
    270 
    271     /**
    272      * Establishment of the ePDG Tunnel Failed
    273      */
    274     public static final int CODE_EPDG_TUNNEL_ESTABLISH_FAILURE = 1400;
    275 
    276     /**
    277      * Re-keying of the ePDG Tunnel Failed; may not always result in teardown
    278      */
    279     public static final int CODE_EPDG_TUNNEL_REKEY_FAILURE = 1401;
    280 
    281     /**
    282      * Connection to the packet gateway is lost
    283      */
    284     public static final int CODE_EPDG_TUNNEL_LOST_CONNECTION = 1402;
    285 
    286     /**
    287      * Network string error messages.
    288      * mExtraMessage may have these values.
    289      */
    290     public static final String EXTRA_MSG_SERVICE_NOT_AUTHORIZED
    291             = "Forbidden. Not Authorized for Service";
    292 
    293 
    294     // For main reason code
    295     public int mCode;
    296     // For the extra code value; it depends on the code value.
    297     public int mExtraCode;
    298     // For the additional message of the reason info.
    299     public String mExtraMessage;
    300     public ImsReasonInfo() {
    301         mCode = CODE_UNSPECIFIED;
    302         mExtraCode = CODE_UNSPECIFIED;
    303         mExtraMessage = null;
    304     }
    305 
    306     public ImsReasonInfo(Parcel in) {
    307         readFromParcel(in);
    308     }
    309 
    310     public ImsReasonInfo(int code, int extraCode) {
    311         mCode = code;
    312         mExtraCode = extraCode;
    313         mExtraMessage = null;
    314     }
    315 
    316     public ImsReasonInfo(int code, int extraCode, String extraMessage) {
    317         mCode = code;
    318         mExtraCode = extraCode;
    319         mExtraMessage = extraMessage;
    320     }
    321 
    322     /**
    323      *
    324      */
    325     public int getCode() {
    326         return mCode;
    327     }
    328 
    329     /**
    330      *
    331      */
    332     public int getExtraCode() {
    333         return mExtraCode;
    334     }
    335 
    336     /**
    337      *
    338      */
    339     public String getExtraMessage() {
    340         return mExtraMessage;
    341     }
    342 
    343     /**
    344      * Returns the string format of {@link ImsReasonInfo}
    345      *
    346      * @return the string format of {@link ImsReasonInfo}
    347      */
    348     public String toString() {
    349         return "ImsReasonInfo :: {" + mCode + ", " + mExtraCode + ", " + mExtraMessage + "}";
    350     }
    351 
    352     @Override
    353     public int describeContents() {
    354         return 0;
    355     }
    356 
    357     @Override
    358     public void writeToParcel(Parcel out, int flags) {
    359         out.writeInt(mCode);
    360         out.writeInt(mExtraCode);
    361         out.writeString(mExtraMessage);
    362     }
    363 
    364     private void readFromParcel(Parcel in) {
    365         mCode = in.readInt();
    366         mExtraCode = in.readInt();
    367         mExtraMessage = in.readString();
    368     }
    369 
    370     public static final Creator<ImsReasonInfo> CREATOR = new Creator<ImsReasonInfo>() {
    371         @Override
    372         public ImsReasonInfo createFromParcel(Parcel in) {
    373             return new ImsReasonInfo(in);
    374         }
    375 
    376         @Override
    377         public ImsReasonInfo[] newArray(int size) {
    378             return new ImsReasonInfo[size];
    379         }
    380     };
    381 }
    382