1 /*
2  * Copyright (C) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef CALL_MANAGER_DISCONNECTED_REASON_H
17 #define CALL_MANAGER_DISCONNECTED_REASON_H
18 
19 namespace OHOS {
20 namespace Telephony {
21 /**
22  * @brief Indicates the causes of call disconnection.
23  *
24  * 3GPP TS 24.008
25  * V17.4.0 10.5.4.11 Cause
26  * The purpose of the cause information element is to describe the reason for
27  * generating certain messages, to provide diagnostic information in the event
28  * of procedural errors and to indicate the location of the cause originator.
29  */
30 enum class DisconnectedReason : int32_t {
31     /**
32      * Indicates the call disconnect due to Unassigned (unallocated) number.
33      */
34     UNASSIGNED_NUMBER = 1,
35     /**
36      * Indicates the call disconnect due to No route to destination.
37      */
38     NO_ROUTE_TO_DESTINATION = 3,
39     /**
40      * Indicates the call disconnect due to Channel unacceptable.
41      */
42     CHANNEL_UNACCEPTABLE = 6,
43     /**
44      * Indicates the call disconnect due to Operator determined barring.
45      */
46     OPERATOR_DETERMINED_BARRING = 8,
47     /**
48      * Indicates the call disconnect due to Call completed elsewhere.
49      */
50     CALL_COMPLETED_ELSEWHERE = 13,
51     /**
52      * Indicates the call disconnect due to Normal call clearing.
53      */
54     NORMAL_CALL_CLEARING = 16,
55     /**
56      * Indicates the call disconnect due to User busy.
57      */
58     USER_BUSY = 17,
59     /**
60      * Indicates the call disconnect due to No user responding.
61      */
62     NO_USER_RESPONDING = 18,
63     /**
64      * Indicates the call disconnect due to User alerting, no answer.
65      */
66     USER_ALERTING_NO_ANSWER = 19,
67     /**
68      * Indicates the call disconnect due to Call rejected.
69      */
70     CALL_REJECTED = 21,
71     /**
72      * Indicates the call disconnect due to Number changed.
73      */
74     NUMBER_CHANGED = 22,
75     /**
76      * Indicates the call disconnect cause is Call rejected due to feature
77      * at the destination.
78      */
79     CALL_REJECTED_DUE_TO_FEATURE_AT_THE_DESTINATION = 24,
80     /**
81      * Indicates the call disconnect due to Pre-emption.
82      */
83     FAILED_PRE_EMPTION = 25,
84     /**
85      * Indicates the call disconnect due to Non selected user clearing.
86      */
87     NON_SELECTED_USER_CLEARING = 26,
88     /**
89      * Indicates the call disconnect due to Destination out of order.
90      */
91     DESTINATION_OUT_OF_ORDER = 27,
92     /**
93      * Indicates the call disconnect due to Invalid number format
94      * (incomplete number).
95      */
96     INVALID_NUMBER_FORMAT = 28,
97     /**
98      * Indicates the call disconnect due to Facility rejected.
99      */
100     FACILITY_REJECTED = 29,
101     /**
102      * Indicates the call disconnect due to Response to STATUS ENQUIRY.
103      */
104     RESPONSE_TO_STATUS_ENQUIRY = 30,
105     /**
106      * Indicates the call disconnect due to Normal, unspecified.
107      */
108     NORMAL_UNSPECIFIED = 31,
109     /**
110      * Indicates the call disconnect due to No circuit/channel available.
111      */
112     NO_CIRCUIT_CHANNEL_AVAILABLE = 34,
113     /**
114      * Indicates the call disconnect due to Network out of order.
115      */
116     NETWORK_OUT_OF_ORDER = 38,
117     /**
118      * Indicates the call disconnect due to Temporary failure.
119      */
120     TEMPORARY_FAILURE = 41,
121     /**
122      * Indicates the call disconnect due to Switching equipment congestion.
123      */
124     SWITCHING_EQUIPMENT_CONGESTION = 42,
125     /**
126      * Indicates the call disconnect due to Access information discarded.
127      */
128     ACCESS_INFORMATION_DISCARDED = 43,
129     /**
130      * Indicates the call disconnect due to requested circuit/channel
131      * not available.
132      */
133     REQUEST_CIRCUIT_CHANNEL_NOT_AVAILABLE = 44,
134     /**
135      * Indicates the call disconnect due to Resources unavailable, unspecified.
136      */
137     RESOURCES_UNAVAILABLE_UNSPECIFIED = 47,
138     /**
139      * Indicates the call disconnect due to Quality of service unavailable.
140      */
141     QUALITY_OF_SERVICE_UNAVAILABLE = 49,
142     /**
143      * Indicates the call disconnect due to Requested facility not subscribed.
144      */
145     REQUESTED_FACILITY_NOT_SUBSCRIBED = 50,
146     /**
147      * Indicates the call disconnect due to Incoming calls barred within the CUG.
148      */
149     INCOMING_CALLS_BARRED_WITHIN_THE_CUG = 55,
150     /**
151      * Indicates the call disconnect due to Bearer capability not authorized.
152      */
153     BEARER_CAPABILITY_NOT_AUTHORIZED = 57,
154     /**
155      * Indicates the call disconnect due to Bearer capability not presently
156      * available.
157      */
158     BEARER_CAPABILITY_NOT_PRESENTLY_AVAILABLE = 58,
159     /**
160      * Indicates the call disconnect due to Service or option not available,
161      * unspecified.
162      */
163     SERVICE_OR_OPTION_NOT_AVAILABLE_UNSPECIFIED = 63,
164     /**
165      * Indicates the call disconnect due to Bearer service not implemented.
166      */
167     BEARER_SERVICE_NOT_IMPLEMENTED = 65,
168     /**
169      * Indicates the call disconnect due to ACM equal to or greater than ACMmax.
170      */
171     ACM_EQUALTO_OR_GREATE_THAN_ACMMAX = 68,
172     /**
173      * Indicates the call disconnect due to Requested facility not implemented.
174      */
175     REQUESTED_FACILITY_NOT_IMPLEMENTED = 69,
176     /**
177      * Indicates the call disconnect due to Only restricted digital information
178      * bearer capability is available.
179      */
180     ONLY_RESTRICTED_DIGITAL_INFO_BEARER_CAPABILITY_IS_AVAILABLE = 70,
181     /**
182      * Indicates the call disconnect due to Service or option not implemented,
183      * unspecified.
184      */
185     SERVICE_OR_OPTION_NOT_IMPLEMENTED_UNSPECIFIED = 79,
186     /**
187      * Indicates the call disconnect due to Invalid transaction identifier
188      * value.
189      */
190     INVALID_TRANSACTION_IDENTIFIER_VALUE = 81,
191     /**
192      * Indicates the call disconnect due to User not member of CUG.
193      */
194     USER_NOT_MEMBER_OF_CUG = 87,
195     /**
196      * Indicates the call disconnect due to Incompatible destination.
197      */
198     INCOMPATIBLE_DESTINATION = 88,
199     /**
200      * Indicates the call disconnect due to Invalid transit network selection.
201      */
202     INVALID_TRANSIT_NETWORK_SELECTION = 91,
203     /**
204      * Indicates the call disconnect due to Semantically incorrect message.
205      */
206     SEMANTICALLY_INCORRECT_MESSAGE = 95,
207     /**
208      * Indicates the call disconnect due to Invalid mandatory information.
209      */
210     INVALID_MANDATORY_INFORMATION = 96,
211     /**
212      * Indicates the call disconnect due to Message type non-existent or not
213      * implemented.
214      */
215     MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED = 97,
216     /**
217      * Indicates the call disconnect due to Message type not compatible with
218      * protocol state.
219      */
220     MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 98,
221     /**
222      * Indicates the call disconnect due to Information element non-existent or
223      * not implemented.
224      */
225     INFORMATION_ELEMENT_NON_EXISTENT_OR_NOT_IMPLEMENTED = 99,
226     /**
227      * Indicates the call disconnect due to Conditional IE error.
228      */
229     CONDITIONAL_IE_ERROR = 100,
230     /**
231      * Indicates the call disconnect due to Message not compatible with
232      * protocol state.
233      */
234     MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 101,
235     /**
236      * Indicates the call disconnect due to Recovery on timer expiry.
237      */
238     RECOVERY_ON_TIMER_EXPIRED = 102,
239     /**
240      * Indicates the call disconnect due to Protocol error, unspecified.
241      */
242     PROTOCOL_ERROR_UNSPECIFIED = 111,
243     /**
244      * Indicates the call disconnect due to Interworking, unspecified.
245      */
246     INTERWORKING_UNSPECIFIED = 127,
247     /**
248      * Indicates the call disconnect due to Call barred.
249      */
250     CALL_BARRED = 240,
251     /**
252      * Indicates the call disconnect due to FDN blocked.
253      */
254     FDN_BLOCKED = 241,
255     /**
256      * Indicates the call disconnect due to IMSI in VLR is unknown.
257      */
258     IMSI_UNKNOWN_IN_VLR = 242,
259     /**
260      * Indicates the call disconnect due to IMEI not accepted.
261      */
262     IMEI_NOT_ACCEPTED = 243,
263     /**
264      * Indicates the call disconnect due to dial modified to USSD.
265      */
266     DIAL_MODIFIED_TO_USSD = 244,
267     /**
268      * Indicates the call disconnect due to dial modified to SS.
269      */
270     DIAL_MODIFIED_TO_SS = 245,
271     /**
272      * Indicates the call disconnect due to dial modified to dial.
273      */
274     DIAL_MODIFIED_TO_DIAL = 246,
275     /**
276      * Indicates the call disconnect due to Radio off.
277      */
278     RADIO_OFF = 247,
279     /**
280      * Indicates the call disconnect due to out of service.
281      */
282     OUT_OF_SERVICE = 248,
283     /**
284      * Indicates the call disconnect due to invalid SIM.
285      */
286     NO_VALID_SIM = 249,
287     /**
288      * Indicates the call disconnect due to radio internal error in modem.
289      */
290     RADIO_INTERNAL_ERROR = 250,
291     /**
292      * Indicates the call disconnect due to network response timeout.
293      */
294     NETWORK_RESP_TIMEOUT = 251,
295     /**
296      * Indicates the call disconnect due to network reject.
297      */
298     NETWORK_REJECT = 252,
299     /**
300      * Indicates the call disconnect due to RRC connection failure. Eg.RACH
301      */
302     RADIO_ACCESS_FAILURE = 253,
303     /**
304      * Indicates the call disconnect due to radio link failure.
305      */
306     RADIO_LINK_FAILURE = 254,
307     /**
308      * Indicates the call disconnect due to poor coverage.
309      */
310     RADIO_LINK_LOST = 255,
311     /**
312      * Indicates the call disconnect due to Radio uplink failure.
313      */
314     RADIO_UPLINK_FAILURE = 256,
315     /**
316      * Indicates the call disconnect due to RRC connection setup failure.
317      */
318     RADIO_SETUP_FAILURE = 257,
319     /**
320      * Indicates the call disconnect due to RRC connection release, normal.
321      */
322     RADIO_RELEASE_NORMAL = 258,
323     /**
324      * Indicates the call disconnect due to RRC connection release, abnormal.
325      */
326     RADIO_RELEASE_ABNORMAL = 259,
327     /**
328      * Indicates the call disconnect due to Access class barring.
329      */
330     ACCESS_CLASS_BLOCKED = 260,
331     /**
332      * Indicates the call disconnect due to Explicit network detach.
333      */
334     NETWORK_DETACH = 261,
335     /**
336      * Indicates the call disconnect due to invalid parameter.
337      */
338     INVALID_PARAMETER = 1025,
339     /**
340      * Indicates the call disconnect due to sim not exit.
341      */
342     SIM_NOT_EXIT = 1026,
343     /**
344      * Indicates the call disconnect due to sim pin need.
345      */
346     SIM_PIN_NEED = 1027,
347     /**
348      * Indicates the call disconnect due to call not allow.
349      */
350     CALL_NOT_ALLOW = 1029,
351     /**
352      * Indicates the call disconnect due to sim invalid.
353      */
354     SIM_INVALID = 1045,
355     /**
356      * Indicates the call disconnect due to unknown error.
357      */
358     FAILED_UNKNOWN = 1279,
359 };
360 
361 /**
362  * @brief Indicates the cause detail of a call disconnection.
363  */
364 struct DisconnectedDetails {
365     /**
366      * Indicates the reason for ending the call.
367      */
368     DisconnectedReason reason = DisconnectedReason::FAILED_UNKNOWN;
369     /**
370      * Indicates the detail message for the ending call reason.
371      */
372     std::string message = "";
373 
DisconnectedDetailsDisconnectedDetails374     DisconnectedDetails() {}
375 
DisconnectedDetailsDisconnectedDetails376     DisconnectedDetails(const DisconnectedDetails &temp)
377     {
378         *this = temp;
379     }
380 
381     DisconnectedDetails &operator=(const DisconnectedDetails &temp)
382     {
383         reason = temp.reason;
384         message = temp.message;
385         return *this;
386     }
387 };
388 } // namespace Telephony
389 } // namespace OHOS
390 #endif // CALL_MANAGER_DISCONNECTED_REASON_H