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