• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 VOIP_CALL_MANAGER_INFO_H
17 #define VOIP_CALL_MANAGER_INFO_H
18 #include <cstdint>
19 #include <string>
20 #include <vector>
21 
22 namespace OHOS {
23 namespace Telephony {
24 
25 /**
26  * @brief Indicates the voip call state.
27  */
28 enum class VoipCallState {
29     /**
30      * Indicates the call state of idle.
31      */
32     VOIP_CALL_STATE_IDLE = 0,
33     /**
34      * Indicates the call state of incoming.
35      */
36     VOIP_CALL_STATE_INCOMING,
37     /**
38      * Indicates the call state of active.
39      */
40     VOIP_CALL_STATE_ACTIVE,
41     /**
42      * Indicates the call state is holding.
43      */
44     VOIP_CALL_STATE_HOLDING,
45     /**
46      * Indicates the call state of disconnected.
47      */
48     VOIP_CALL_STATE_DISCONNECTED,
49 };
50 
51 /**
52  * @brief Indicates the voip call type.
53  */
54 enum class VoipCallType {
55     /**
56      * Indicates the type of voip voice call.
57      */
58     VOIP_CALL_VOICE = 0,
59     /**
60      * Indicates the type of voip video call.
61      */
62     VOIP_CALL_VIDEO,
63 };
64 
65 /**
66  * @brief Indicates the voip call attribute.
67  */
68 struct VoipCallAttribute {
69     /**
70      * Indicates the callid
71      */
72     std::string callId = "";
73     /**
74      * Indicates the bundleName.
75      */
76     std::string bundleName = "";
77     /**
78      * Indicates the type of voip call.
79      */
80     VoipCallType voipCallType = VoipCallType::VOIP_CALL_VOICE;
81     /**
82      * Indicates the userName.
83      */
84     std::string userName = "";
85     /**
86      * Indicates the user Porfile.
87      */
88     std::vector<uint8_t> userProfile = {};
89     /**
90      * Indicates the package Profile.
91      */
92     std::string abilityName = "";
93     /**
94      * Indicates the state of voip call.
95      */
96     VoipCallState voipCallState = VoipCallState::VOIP_CALL_STATE_IDLE;
97     /**
98      * Indicates the extensionId of voip call.
99      */
100     std::string extensionId = "";
101 };
102 
103 /**
104  * @brief Indicates the voip call event.
105  */
106 enum class VoipCallEvent {
107     /**
108      * Indicates the click event of default.
109      */
110     VOIP_CALL_EVENT_NONE = 0,
111     /**
112      * Indicates the click event of answer voice.
113      */
114     VOIP_CALL_EVENT_ANSWER_VOICE,
115     /**
116      * Indicates the click event of answer video.
117      */
118     VOIP_CALL_EVENT_ANSWER_VIDEO,
119     /**
120      * Indicates the click event of reject.
121      */
122     VOIP_CALL_EVENT_REJECT,
123     /**
124      * Indicates the voip call was hung up by other cause.
125      */
126     VOIP_CALL_EVENT_HANGUP,
127 };
128 
129 /**
130  * @brief Indicates the ErrorReason.
131  */
132 enum class ErrorReason {
133     /**
134      * Indicates there is no error.
135      */
136     ERROR_NONE = 0,
137 
138     /**
139      * Indicates there is already a cellular call.
140      */
141     CELLULAR_CALL_EXISTS = 1,
142 
143     /**
144      * Indicates there is already a voip call.
145      */
146     VOIP_CALL_EXISTS = 2,
147 
148     /**
149      * Indicates this is a invalid call.
150      */
151     INVALID_CALL = 3,
152 
153     /**
154      * Indicates the user answered the cellular call first.
155      */
156     USER_ANSWER_CELLULAR_FIRST = 4,
157 };
158 
159 /**
160  * @brief Indicates the voip call Events.
161  */
162 struct VoipCallEventInfo {
163     /**
164      * Indicates the callid
165      */
166     std::string voipCallId = "";
167     /**
168      * Indicates the bundleName.
169      */
170     std::string bundleName = "";
171     /**
172      * Indicates the click event of voip.
173      */
174     VoipCallEvent voipCallEvent = VoipCallEvent::VOIP_CALL_EVENT_NONE;
175     /**
176      * Indicates the error reason.
177      */
178     ErrorReason errorReason = ErrorReason::ERROR_NONE;
179 };
180 
181 /**
182  * @brief Indicates the ErrorReason.
183  */
184 enum class ReportVoipCallFailedCause {
185     /**
186      * Indicates other failed cause.
187      */
188     OTHER_CAUSED,
189     /**
190      * Indicates application line is busy.
191      */
192     ROUTE_BUSY,
193     /**
194      * Indicates application failed to establish connect.
195      */
196     CONNECT_FAILED,
197 };
198 
199 /**
200  * @brief Indicates the fail cause of voip call.
201  */
202 struct ReportVoipCallFailedCauses {
203     /**
204      * Indicates the callid
205      */
206     std::string callId = "";
207     /**
208      * Indicates the bundleName.
209      */
210     std::string bundleName = "";
211     /**
212      * Indicates the the fail cause of voip call.
213      */
214     ReportVoipCallFailedCause reportVoipCallFailedCause = ReportVoipCallFailedCause::OTHER_CAUSED;
215 };
216 
217 struct ReportVoIPCallParams {
218     std::string callId = "";
219     int32_t status;
220 };
221 
222 enum VoipCallErrorCode {
223     VOIP_ERR_CALLBACK_NOT_EXIST,
224 };
225 
226 enum class VoIPCallStatus : uint32_t {
227     ORIGINAL_STATE = 0,
228 
229     VOIP_EXTENSION_CONNECT_SUCCEED = 1,
230     VOIP_EXTENSION_CONNECT_FAILED = 2,
231     VOIP_EXTENSION_BUSY = 3,
232     VOIP_EXTENSION_CALLBACK_ILLEAGAL_PARAM = 4,
233     VOIP_EXTENSION_OTHER_REASON = 5,
234 
235     VOIP_MANAGER_BUSY = 6,
236     VOIP_MANAGER_OTHER_REASON = 7,
237 
238     EXTENSION_LOAD_SUCCEED = 20,
239     EXTENSION_LOAD_FAILED = 21,
240     REFUSE_ANSWER = 22,
241     DELETE_CALL_NOTIFICATION = 23,
242     HANG_UP_DURING_CALLING = 24,
243     LONGTIME_CALL_NOT_ANSWER = 25,
244     CALL_END_OTHER_REASON = 26,
245     ANSWERED_SUCCEED = 27,
246 
247     HANG_UP_DURING_ANSWERED = 40,
248     VOIP_MANAGER_DESTROYED = 41,
249     HANG_UP_DURING_ANSWERED_OTHER_REASON = 42,
250 
251     VOIP_MANAGER_INVALID_PARAM = 58,
252     VOIP_MANAGER_CALL_NOT_EXIST = 59,
253 
254     PUSH_MANAGER_SERVICE_LOAD_SUCCESS = 60,
255     PUSH_MANAGER_SERVICE_LOAD_FAILED_SYSTEM_ERROR = 61,
256     PUSH_MANAGER_SERVICE_LOAD_FAILED_ILLEGAL_EXTENSION = 62,
257     PUSH_MANAGER_SERVICE_LOAD_FAILED_CALLS_EXCEEDED = 63,
258     PUSH_MANAGER_SERVICE_LOAD_FAILED_VOIP_INTERNAL_ERROR = 64,
259     PUSH_MANAGER_SERVICE_LOAD_FAILED_ILLEGAL_CALL_ID = 65,
260     PUSH_MANAGER_SERVICE_LOAD_FAILED_OTHER_REASON = 66,
261 
262     VOIP_TIMER_TRIGGER = 70,
263 };
264 } // namespace Telephony
265 } // namespace OHOS
266 #endif
267