• 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  * @brief Indicates the call audio event.
26  */
27 enum class CallAudioEvent {
28     /**
29      * Indicates the event of muted.
30      */
31     AUDIO_EVENT_MUTED = 0,
32     /**
33      * Indicates the event of unmuted.
34      */
35     AUDIO_EVENT_UNMUTED = 1,
36     /**
37      * Indicates the event of speaker on.
38      */
39     AUDIO_EVENT_SPEAKER_ON = 2,
40     /**
41      * Indicates the event of speaker off.
42      */
43     AUDIO_EVENT_SPEAKER_OFF = 3,
44 };
45 
46 /**
47  * @brief Indicates the voip call state.
48  */
49 enum class VoipCallState {
50     /**
51      * Indicates the call state of idle.
52      */
53     VOIP_CALL_STATE_IDLE = 0,
54     /**
55      * Indicates the call state of incoming.
56      */
57     VOIP_CALL_STATE_INCOMING,
58     /**
59      * Indicates the call state of active.
60      */
61     VOIP_CALL_STATE_ACTIVE,
62     /**
63      * Indicates the call state is holding.
64      */
65     VOIP_CALL_STATE_HOLDING,
66     /**
67      * Indicates the call state of disconnected.
68      */
69     VOIP_CALL_STATE_DISCONNECTED,
70     /**
71      * Indicates the call state of dialing.
72      */
73     VOIP_CALL_STATE_DIALING,
74     /**
75      * Indicates the call is answered.
76      */
77     VOIP_CALL_STATE_ANSWERED,
78     /**
79      * Indicates the call is disconnecting.
80      */
81     VOIP_CALL_STATE_DISCONNECTING,
82 };
83 
84 /**
85  * @brief Indicates the voip call type.
86  */
87 enum class VoipCallType {
88     /**
89      * Indicates the type of voip voice call.
90      */
91     VOIP_CALL_VOICE = 0,
92     /**
93      * Indicates the type of voip video call.
94      */
95     VOIP_CALL_VIDEO,
96 };
97 
98 /**
99  * @brief Indicates the live video pane is released successfully or fails to be released.
100  */
101 enum class LiveVideWindowEvent {
102     /**
103      * Indicates the live video window is released successfully.
104      */
105     LIVE_VIDEO_WINDOW_EVENT_SUCCESS = 0,
106     /**
107      * Indicates failed to publish the live video window.
108      */
109     LIVE_VIDEO_WINDOW_EVENT_FAIL,
110 };
111 
112 /**
113  * @brief Indicates the voip call attribute.
114  */
115 struct VoipCallAttribute {
116     /**
117      * Indicates the callid
118      */
119     std::string callId = "";
120     /**
121      * Indicates the bundleName.
122      */
123     std::string bundleName = "";
124     /**
125      * Indicates the type of voip call.
126      */
127     VoipCallType voipCallType = VoipCallType::VOIP_CALL_VOICE;
128     /**
129      * Indicates the userName.
130      */
131     std::string userName = "";
132     /**
133      * Indicates the user Porfile.
134      */
135     std::vector<uint8_t> userProfile = {};
136     /**
137      * Indicates the package Profile.
138      */
139     std::string abilityName = "";
140     /**
141      * Indicates the state of voip call.
142      */
143     VoipCallState voipCallState = VoipCallState::VOIP_CALL_STATE_IDLE;
144     /**
145      * Indicates the extensionId of voip call.
146      */
147     std::string extensionId = "";
148     /**
149      * Indicates the process mode of voip call. 1: main process mode; 0: sub process mode
150      */
151     std::string processMode = "1";
152     /**
153      * Indicates whether the VoIP incoming call default show live call banner. Default value is true.
154      */
155     bool showBannerForIncomingCall = true;
156     /**
157      * Indicates whether the VoIP incoming call is a conference. Default value is false.
158      */
159     bool isConferenceCall = false;
160     /**
161      * Indicates whether the VoIP incoming video call is support voice answer. Default value is true.
162      */
163     bool isVoiceAnswerSupported = true;
164     /**
165      * Indicates whether the app has the permission to use microphone. Default value is true.
166      */
167     bool hasMicPermission = true;
168     /**
169      * Indicates whether a call capsule should be displayed while the app is serving as a foreground process.
170      * Default value is false.
171      */
172     bool isCapsuleSticky = false;
173     /**
174      * Indicates whether the VoIP call is from Push kit.
175     */
176     bool isCallByPushKit = true;
177     /**
178      * Indicates the uid of voip call.
179      */
180     int32_t uid = 0;
181     /**
182      * Indicates the fullTokenId of voip call.
183      */
184     uint64_t fullTokenId = 0;
185     /**
186      * Indicates the tokenId of voip call.
187      */
188     uint32_t tokenId = 0;
189 };
190 
191 /**
192  * @brief Indicates the voip call event.
193  */
194 enum class VoipCallEvent {
195     /**
196      * Indicates the click event of default.
197      */
198     VOIP_CALL_EVENT_NONE = 0,
199     /**
200      * Indicates the click event of answer voice.
201      */
202     VOIP_CALL_EVENT_ANSWER_VOICE,
203     /**
204      * Indicates the click event of answer video.
205      */
206     VOIP_CALL_EVENT_ANSWER_VIDEO,
207     /**
208      * Indicates the click event of reject.
209      */
210     VOIP_CALL_EVENT_REJECT,
211     /**
212      * Indicates the voip call was hung up by other cause.
213      */
214     VOIP_CALL_EVENT_HANGUP,
215     /**
216      * Indicates the user clicked muted.
217      */
218     VOIP_CALL_EVENT_MUTED,
219     /**
220      * Indicates the user clicked unmuted.
221      */
222     VOIP_CALL_EVENT_UNMUTED,
223     /**
224      * Indicates the user clicked speaker on.
225      */
226     VOIP_CALL_EVENT_SPEAKER_ON,
227     /**
228      * Indicates the user clicked speaker off.
229      */
230     VOIP_CALL_EVENT_SPEAKER_OFF,
231 };
232 
233 /**
234  * @brief Indicates the ErrorReason.
235  */
236 enum class ErrorReason {
237     /**
238      * Indicates there is no error.
239      */
240     ERROR_NONE = 0,
241 
242     /**
243      * Indicates there is already a cellular call.
244      */
245     CELLULAR_CALL_EXISTS = 1,
246 
247     /**
248      * Indicates there is already a voip call.
249      */
250     VOIP_CALL_EXISTS = 2,
251 
252     /**
253      * Indicates this is a invalid call.
254      */
255     INVALID_CALL = 3,
256 
257     /**
258      * Indicates the user answered the cellular call first.
259      */
260     USER_ANSWER_CELLULAR_FIRST = 4,
261 };
262 
263 /**
264  * @brief Indicates the voip call Events.
265  */
266 struct VoipCallEventInfo {
267     /**
268      * Indicates the callid
269      */
270     std::string voipCallId = "";
271     /**
272      * Indicates the bundleName.
273      */
274     std::string bundleName = "";
275     /**
276      * Indicates the uid.
277      */
278     int32_t uid = 0;
279     /**
280      * Indicates the click event of voip.
281      */
282     VoipCallEvent voipCallEvent = VoipCallEvent::VOIP_CALL_EVENT_NONE;
283     /**
284      * Indicates the error reason.
285      */
286     ErrorReason errorReason = ErrorReason::ERROR_NONE;
287 };
288 
289 /**
290  * @brief Indicates the ErrorReason.
291  */
292 enum class ReportVoipCallFailedCause {
293     /**
294      * Indicates other failed cause.
295      */
296     OTHER_CAUSED,
297     /**
298      * Indicates application line is busy.
299      */
300     ROUTE_BUSY,
301     /**
302      * Indicates application failed to establish connect.
303      */
304     CONNECT_FAILED,
305 };
306 
307 struct ReportVoIPCallParams {
308     std::string callId = "";
309     int32_t status;
310 };
311 
312 enum VoipCallErrorCode {
313     VOIP_ERR_CALLBACK_NOT_EXIST,
314 };
315 
316 enum class VoIPCallStatus : uint32_t {
317     ORIGINAL_STATE = 0,
318 
319     VOIP_EXTENSION_CONNECT_SUCCEED = 1,
320     VOIP_EXTENSION_CONNECT_FAILED = 2,
321     VOIP_EXTENSION_BUSY = 3,
322     VOIP_EXTENSION_CALLBACK_ILLEAGAL_PARAM = 4,
323     VOIP_EXTENSION_OTHER_REASON = 5,
324 
325     VOIP_MANAGER_BUSY = 6,
326     VOIP_MANAGER_OTHER_REASON = 7,
327 
328     LIVE_VIDEO_PUBLISH_SUCCESSED = 13,
329     LIVE_VIDEO_PUBLISH_FAILED = 14,
330 
331     EXTENSION_LOAD_SUCCEED = 20,
332     EXTENSION_LOAD_FAILED = 21,
333     REFUSE_ANSWER = 22,
334     DELETE_CALL_NOTIFICATION = 23,
335     HANG_UP_DURING_CALLING = 24,
336     LONGTIME_CALL_NOT_ANSWER = 25,
337     CALL_END_OTHER_REASON = 26,
338     ANSWERED_SUCCEED = 27,
339 
340     HANG_UP_DURING_ANSWERED = 40,
341     VOIP_MANAGER_DESTROYED = 41,
342     HANG_UP_DURING_ANSWERED_OTHER_REASON = 42,
343 
344     VOIP_MANAGER_INVALID_PARAM = 58,
345     VOIP_MANAGER_CALL_NOT_EXIST = 59,
346 
347     PUSH_MANAGER_SERVICE_LOAD_SUCCESS = 60,
348     PUSH_MANAGER_SERVICE_LOAD_FAILED_SYSTEM_ERROR = 61,
349     PUSH_MANAGER_SERVICE_LOAD_FAILED_ILLEGAL_EXTENSION = 62,
350     PUSH_MANAGER_SERVICE_LOAD_FAILED_CALLS_EXCEEDED = 63,
351     PUSH_MANAGER_SERVICE_LOAD_FAILED_VOIP_INTERNAL_ERROR = 64,
352     PUSH_MANAGER_SERVICE_LOAD_FAILED_ILLEGAL_CALL_ID = 65,
353     PUSH_MANAGER_SERVICE_LOAD_FAILED_OTHER_REASON = 66,
354 
355     VOIP_TIMER_TRIGGER = 70,
356 };
357 } // namespace Telephony
358 } // namespace OHOS
359 #endif
360