1e1c44949Sopenharmony_ci/*
2e1c44949Sopenharmony_ci * Copyright (C) 2021 Huawei Device Co., Ltd.
3e1c44949Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4e1c44949Sopenharmony_ci * you may not use this file except in compliance with the License.
5e1c44949Sopenharmony_ci * You may obtain a copy of the License at
6e1c44949Sopenharmony_ci *
7e1c44949Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8e1c44949Sopenharmony_ci *
9e1c44949Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10e1c44949Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11e1c44949Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12e1c44949Sopenharmony_ci * See the License for the specific language governing permissions and
13e1c44949Sopenharmony_ci * limitations under the License.
14e1c44949Sopenharmony_ci */
15e1c44949Sopenharmony_ci
16e1c44949Sopenharmony_ci#include "ott_call.h"
17e1c44949Sopenharmony_ci
18e1c44949Sopenharmony_ci#include "call_manager_errors.h"
19e1c44949Sopenharmony_ci#include "call_manager_hisysevent.h"
20e1c44949Sopenharmony_ci#include "telephony_log_wrapper.h"
21e1c44949Sopenharmony_ci
22e1c44949Sopenharmony_ci#include "ott_call_connection.h"
23e1c44949Sopenharmony_ci#include "ott_conference.h"
24e1c44949Sopenharmony_ci
25e1c44949Sopenharmony_cinamespace OHOS {
26e1c44949Sopenharmony_cinamespace Telephony {
27e1c44949Sopenharmony_ciOTTCall::OTTCall(DialParaInfo &info) : CallBase(info), ottCallConnectionPtr_(std::make_unique<OTTCallConnection>())
28e1c44949Sopenharmony_ci{}
29e1c44949Sopenharmony_ci
30e1c44949Sopenharmony_ciOTTCall::OTTCall(DialParaInfo &info, AppExecFwk::PacMap &extras)
31e1c44949Sopenharmony_ci    : CallBase(info, extras), ottCallConnectionPtr_(std::make_unique<OTTCallConnection>())
32e1c44949Sopenharmony_ci{}
33e1c44949Sopenharmony_ci
34e1c44949Sopenharmony_ciOTTCall::~OTTCall() {}
35e1c44949Sopenharmony_ci
36e1c44949Sopenharmony_ciint32_t OTTCall::DialingProcess()
37e1c44949Sopenharmony_ci{
38e1c44949Sopenharmony_ci    int32_t ret = DialCallBase();
39e1c44949Sopenharmony_ci    if (ret != TELEPHONY_SUCCESS) {
40e1c44949Sopenharmony_ci        HangUpCall();
41e1c44949Sopenharmony_ci    }
42e1c44949Sopenharmony_ci    return ret;
43e1c44949Sopenharmony_ci}
44e1c44949Sopenharmony_ci
45e1c44949Sopenharmony_ciint32_t OTTCall::AnswerCall(int32_t videoState)
46e1c44949Sopenharmony_ci{
47e1c44949Sopenharmony_ci    int32_t ret = AnswerCallBase();
48e1c44949Sopenharmony_ci    if (ret != TELEPHONY_SUCCESS) {
49e1c44949Sopenharmony_ci        TELEPHONY_LOGE("answer call failed!");
50e1c44949Sopenharmony_ci        CallManagerHisysevent::WriteAnswerCallFaultEvent(
51e1c44949Sopenharmony_ci            INVALID_PARAMETER, INVALID_PARAMETER, videoState, ret, "the device is currently not ringing");
52e1c44949Sopenharmony_ci        return CALL_ERR_ANSWER_FAILED;
53e1c44949Sopenharmony_ci    }
54e1c44949Sopenharmony_ci    OttCallRequestInfo requestInfo;
55e1c44949Sopenharmony_ci    ret = PackOttCallRequestInfo(requestInfo);
56e1c44949Sopenharmony_ci    if (ret != TELEPHONY_SUCCESS) {
57e1c44949Sopenharmony_ci        TELEPHONY_LOGE("PackOttCallRequestInfo failed, error%{public}d", ret);
58e1c44949Sopenharmony_ci        CallManagerHisysevent::WriteAnswerCallFaultEvent(
59e1c44949Sopenharmony_ci            INVALID_PARAMETER, INVALID_PARAMETER, videoState, ret, "PackOttCallRequestInfo failed");
60e1c44949Sopenharmony_ci        return CALL_ERR_ANSWER_FAILED;
61e1c44949Sopenharmony_ci    }
62e1c44949Sopenharmony_ci    if (ottCallConnectionPtr_ == nullptr) {
63e1c44949Sopenharmony_ci        TELEPHONY_LOGE("ottCallConnectionPtr_ is nullptr!");
64e1c44949Sopenharmony_ci        return TELEPHONY_ERR_LOCAL_PTR_NULL;
65e1c44949Sopenharmony_ci    }
66e1c44949Sopenharmony_ci    ret = ottCallConnectionPtr_->Answer(requestInfo);
67e1c44949Sopenharmony_ci    if (ret != TELEPHONY_SUCCESS) {
68e1c44949Sopenharmony_ci        TELEPHONY_LOGE("answer call failed!");
69e1c44949Sopenharmony_ci        return CALL_ERR_ANSWER_FAILED;
70e1c44949Sopenharmony_ci    }
71e1c44949Sopenharmony_ci    return TELEPHONY_SUCCESS;
72e1c44949Sopenharmony_ci}
73e1c44949Sopenharmony_ci
74e1c44949Sopenharmony_ciint32_t OTTCall::RejectCall()
75e1c44949Sopenharmony_ci{
76e1c44949Sopenharmony_ci    int32_t ret = RejectCallBase();
77e1c44949Sopenharmony_ci    if (ret != TELEPHONY_SUCCESS) {
78e1c44949Sopenharmony_ci        return ret;
79e1c44949Sopenharmony_ci    }
80e1c44949Sopenharmony_ci    OttCallRequestInfo requestInfo;
81e1c44949Sopenharmony_ci    ret = PackOttCallRequestInfo(requestInfo);
82e1c44949Sopenharmony_ci    if (ret != TELEPHONY_SUCCESS) {
83e1c44949Sopenharmony_ci        TELEPHONY_LOGE("PackOttCallRequestInfo failed, error%{public}d", ret);
84e1c44949Sopenharmony_ci        CallManagerHisysevent::WriteHangUpFaultEvent(
85e1c44949Sopenharmony_ci            INVALID_PARAMETER, INVALID_PARAMETER, ret, "Reject PackOttCallRequestInfo failed");
86e1c44949Sopenharmony_ci        return CALL_ERR_REJECT_FAILED;
87e1c44949Sopenharmony_ci    }
88e1c44949Sopenharmony_ci    ret = ottCallConnectionPtr_->Reject(requestInfo);
89e1c44949Sopenharmony_ci    if (ret != TELEPHONY_SUCCESS) {
90e1c44949Sopenharmony_ci        TELEPHONY_LOGE("reject call failed!");
91e1c44949Sopenharmony_ci        return CALL_ERR_REJECT_FAILED;
92e1c44949Sopenharmony_ci    }
93e1c44949Sopenharmony_ci    return TELEPHONY_SUCCESS;
94e1c44949Sopenharmony_ci}
95e1c44949Sopenharmony_ci
96e1c44949Sopenharmony_ciint32_t OTTCall::HangUpCall()
97e1c44949Sopenharmony_ci{
98e1c44949Sopenharmony_ci    OttCallRequestInfo requestInfo;
99e1c44949Sopenharmony_ci    int32_t ret = PackOttCallRequestInfo(requestInfo);
100e1c44949Sopenharmony_ci    if (ret != TELEPHONY_SUCCESS) {
101e1c44949Sopenharmony_ci        TELEPHONY_LOGE("PackOttCallRequestInfo failed, error%{public}d", ret);
102e1c44949Sopenharmony_ci        CallManagerHisysevent::WriteHangUpFaultEvent(
103e1c44949Sopenharmony_ci            INVALID_PARAMETER, INVALID_PARAMETER, ret, "HangUp PackOttCallRequestInfo failed");
104e1c44949Sopenharmony_ci        return CALL_ERR_HANGUP_FAILED;
105e1c44949Sopenharmony_ci    }
106e1c44949Sopenharmony_ci    ret = ottCallConnectionPtr_->HangUp(requestInfo);
107e1c44949Sopenharmony_ci    if (ret != TELEPHONY_SUCCESS) {
108e1c44949Sopenharmony_ci        TELEPHONY_LOGE("hangUp call failed!");
109e1c44949Sopenharmony_ci        return CALL_ERR_HANGUP_FAILED;
110e1c44949Sopenharmony_ci    }
111e1c44949Sopenharmony_ci    return TELEPHONY_SUCCESS;
112e1c44949Sopenharmony_ci}
113e1c44949Sopenharmony_ci
114e1c44949Sopenharmony_ciint32_t OTTCall::HoldCall()
115e1c44949Sopenharmony_ci{
116e1c44949Sopenharmony_ci    OttCallRequestInfo requestInfo;
117e1c44949Sopenharmony_ci    int32_t ret = PackOttCallRequestInfo(requestInfo);
118e1c44949Sopenharmony_ci    if (ret != TELEPHONY_SUCCESS) {
119e1c44949Sopenharmony_ci        TELEPHONY_LOGE("PackOttCallRequestInfo failed, error%{public}d", ret);
120e1c44949Sopenharmony_ci        return CALL_ERR_HOLD_FAILED;
121e1c44949Sopenharmony_ci    }
122e1c44949Sopenharmony_ci    ret = ottCallConnectionPtr_->HoldCall(requestInfo);
123e1c44949Sopenharmony_ci    if (ret != TELEPHONY_SUCCESS) {
124e1c44949Sopenharmony_ci        TELEPHONY_LOGE("holdCall call failed!");
125e1c44949Sopenharmony_ci        return CALL_ERR_HOLD_FAILED;
126e1c44949Sopenharmony_ci    }
127e1c44949Sopenharmony_ci    return TELEPHONY_SUCCESS;
128e1c44949Sopenharmony_ci}
129e1c44949Sopenharmony_ci
130e1c44949Sopenharmony_ciint32_t OTTCall::UnHoldCall()
131e1c44949Sopenharmony_ci{
132e1c44949Sopenharmony_ci    OttCallRequestInfo requestInfo;
133e1c44949Sopenharmony_ci    int32_t ret = PackOttCallRequestInfo(requestInfo);
134e1c44949Sopenharmony_ci    if (ret != TELEPHONY_SUCCESS) {
135e1c44949Sopenharmony_ci        TELEPHONY_LOGE("PackOttCallRequestInfo failed, error%{public}d", ret);
136e1c44949Sopenharmony_ci        return CALL_ERR_UNHOLD_FAILED;
137e1c44949Sopenharmony_ci    }
138e1c44949Sopenharmony_ci    ret = ottCallConnectionPtr_->UnHoldCall(requestInfo);
139e1c44949Sopenharmony_ci    if (ret != TELEPHONY_SUCCESS) {
140e1c44949Sopenharmony_ci        TELEPHONY_LOGE("unHoldCall call failed!");
141e1c44949Sopenharmony_ci        return CALL_ERR_UNHOLD_FAILED;
142e1c44949Sopenharmony_ci    }
143e1c44949Sopenharmony_ci    return TELEPHONY_SUCCESS;
144e1c44949Sopenharmony_ci}
145e1c44949Sopenharmony_ci
146e1c44949Sopenharmony_ciint32_t OTTCall::SwitchCall()
147e1c44949Sopenharmony_ci{
148e1c44949Sopenharmony_ci    OttCallRequestInfo requestInfo;
149e1c44949Sopenharmony_ci    int32_t ret = PackOttCallRequestInfo(requestInfo);
150e1c44949Sopenharmony_ci    if (ret != TELEPHONY_SUCCESS) {
151e1c44949Sopenharmony_ci        TELEPHONY_LOGE("PackOttCallRequestInfo failed, error%{public}d", ret);
152e1c44949Sopenharmony_ci        return CALL_ERR_UNHOLD_FAILED;
153e1c44949Sopenharmony_ci    }
154e1c44949Sopenharmony_ci    ret = ottCallConnectionPtr_->SwitchCall(requestInfo);
155e1c44949Sopenharmony_ci    if (ret != TELEPHONY_SUCCESS) {
156e1c44949Sopenharmony_ci        TELEPHONY_LOGE("switchCall call failed!");
157e1c44949Sopenharmony_ci        return CALL_ERR_UNHOLD_FAILED;
158e1c44949Sopenharmony_ci    }
159e1c44949Sopenharmony_ci    return TELEPHONY_SUCCESS;
160e1c44949Sopenharmony_ci}
161e1c44949Sopenharmony_ci
162e1c44949Sopenharmony_civoid OTTCall::GetCallAttributeInfo(CallAttributeInfo &info)
163e1c44949Sopenharmony_ci{
164e1c44949Sopenharmony_ci    GetCallAttributeBaseInfo(info);
165e1c44949Sopenharmony_ci}
166e1c44949Sopenharmony_ci
167e1c44949Sopenharmony_cibool OTTCall::GetEmergencyState()
168e1c44949Sopenharmony_ci{
169e1c44949Sopenharmony_ci    return false;
170e1c44949Sopenharmony_ci}
171e1c44949Sopenharmony_ci
172e1c44949Sopenharmony_ciint32_t OTTCall::StartDtmf(char str)
173e1c44949Sopenharmony_ci{
174e1c44949Sopenharmony_ci    return CALL_ERR_FUNCTION_NOT_SUPPORTED;
175e1c44949Sopenharmony_ci}
176e1c44949Sopenharmony_ci
177e1c44949Sopenharmony_ciint32_t OTTCall::StopDtmf()
178e1c44949Sopenharmony_ci{
179e1c44949Sopenharmony_ci    return CALL_ERR_FUNCTION_NOT_SUPPORTED;
180e1c44949Sopenharmony_ci}
181e1c44949Sopenharmony_ci
182e1c44949Sopenharmony_ciint32_t OTTCall::PostDialProceed(bool proceed)
183e1c44949Sopenharmony_ci{
184e1c44949Sopenharmony_ci    return CALL_ERR_FUNCTION_NOT_SUPPORTED;
185e1c44949Sopenharmony_ci}
186e1c44949Sopenharmony_ci
187e1c44949Sopenharmony_ciint32_t OTTCall::GetSlotId()
188e1c44949Sopenharmony_ci{
189e1c44949Sopenharmony_ci    return CALL_ERR_ILLEGAL_CALL_OPERATION;
190e1c44949Sopenharmony_ci}
191e1c44949Sopenharmony_ci
192e1c44949Sopenharmony_ciint32_t OTTCall::CombineConference()
193e1c44949Sopenharmony_ci{
194e1c44949Sopenharmony_ci    int32_t ret = DelayedSingleton<OttConference>::GetInstance()->SetMainCall(GetCallID());
195e1c44949Sopenharmony_ci    if (ret != TELEPHONY_SUCCESS) {
196e1c44949Sopenharmony_ci        TELEPHONY_LOGE("SetMainCall failed,  error%{public}d", ret);
197e1c44949Sopenharmony_ci        return ret;
198e1c44949Sopenharmony_ci    }
199e1c44949Sopenharmony_ci    OttCallRequestInfo requestInfo;
200e1c44949Sopenharmony_ci    ret = PackOttCallRequestInfo(requestInfo);
201e1c44949Sopenharmony_ci    if (ret != TELEPHONY_SUCCESS) {
202e1c44949Sopenharmony_ci        TELEPHONY_LOGE("PackOttCallRequestInfo failed, error%{public}d", ret);
203e1c44949Sopenharmony_ci        return ret;
204e1c44949Sopenharmony_ci    }
205e1c44949Sopenharmony_ci    if (ottCallConnectionPtr_ == nullptr) {
206e1c44949Sopenharmony_ci        TELEPHONY_LOGE("ottCallConnectionPtr_ is nullptr!");
207e1c44949Sopenharmony_ci        return TELEPHONY_ERR_LOCAL_PTR_NULL;
208e1c44949Sopenharmony_ci    }
209e1c44949Sopenharmony_ci    ConferenceState currentState = DelayedSingleton<OttConference>::GetInstance()->GetConferenceState();
210e1c44949Sopenharmony_ci    if (currentState == ConferenceState::CONFERENCE_STATE_CREATING) {
211e1c44949Sopenharmony_ci        TELEPHONY_LOGE("skip combine, a process of combine already exsists");
212e1c44949Sopenharmony_ci        return TELEPHONY_SUCCESS;
213e1c44949Sopenharmony_ci    }
214e1c44949Sopenharmony_ci    DelayedSingleton<OttConference>::GetInstance()->SetConferenceState(ConferenceState::CONFERENCE_STATE_CREATING);
215e1c44949Sopenharmony_ci    return ottCallConnectionPtr_->CombineConference(requestInfo);
216e1c44949Sopenharmony_ci}
217e1c44949Sopenharmony_ci
218e1c44949Sopenharmony_civoid OTTCall::HandleCombineConferenceFailEvent()
219e1c44949Sopenharmony_ci{
220e1c44949Sopenharmony_ci    std::set<std::int32_t> subCallIdList = DelayedSingleton<OttConference>::GetInstance()->GetSubCallIdList();
221e1c44949Sopenharmony_ci    if (subCallIdList.empty()) {
222e1c44949Sopenharmony_ci        DelayedSingleton<OttConference>::GetInstance()->SetMainCall(ERR_ID);
223e1c44949Sopenharmony_ci    } else {
224e1c44949Sopenharmony_ci        DelayedSingleton<OttConference>::GetInstance()->SetMainCall(*subCallIdList.begin());
225e1c44949Sopenharmony_ci    }
226e1c44949Sopenharmony_ci    ConferenceState oldState = DelayedSingleton<OttConference>::GetInstance()->GetOldConferenceState();
227e1c44949Sopenharmony_ci    DelayedSingleton<OttConference>::GetInstance()->SetConferenceState(oldState);
228e1c44949Sopenharmony_ci}
229e1c44949Sopenharmony_ci
230e1c44949Sopenharmony_ciint32_t OTTCall::CanCombineConference()
231e1c44949Sopenharmony_ci{
232e1c44949Sopenharmony_ci    int32_t ret = IsSupportConferenceable();
233e1c44949Sopenharmony_ci    if (ret != TELEPHONY_SUCCESS) {
234e1c44949Sopenharmony_ci        TELEPHONY_LOGE("call unsupported conference, error%{public}d", ret);
235e1c44949Sopenharmony_ci        return ret;
236e1c44949Sopenharmony_ci    }
237e1c44949Sopenharmony_ci    return DelayedSingleton<OttConference>::GetInstance()->CanCombineConference();
238e1c44949Sopenharmony_ci}
239e1c44949Sopenharmony_ci
240e1c44949Sopenharmony_ciint32_t OTTCall::SeparateConference()
241e1c44949Sopenharmony_ci{
242e1c44949Sopenharmony_ci    OttCallRequestInfo requestInfo;
243e1c44949Sopenharmony_ci    int32_t ret = PackOttCallRequestInfo(requestInfo);
244e1c44949Sopenharmony_ci    if (ret != TELEPHONY_SUCCESS) {
245e1c44949Sopenharmony_ci        TELEPHONY_LOGE("PackOttCallRequestInfo failed, error%{public}d", ret);
246e1c44949Sopenharmony_ci        return ret;
247e1c44949Sopenharmony_ci    }
248e1c44949Sopenharmony_ci    if (ottCallConnectionPtr_ == nullptr) {
249e1c44949Sopenharmony_ci        TELEPHONY_LOGE("ottCallConnectionPtr_ is nullptr!");
250e1c44949Sopenharmony_ci        return TELEPHONY_ERR_LOCAL_PTR_NULL;
251e1c44949Sopenharmony_ci    }
252e1c44949Sopenharmony_ci    return ottCallConnectionPtr_->SeparateConference(requestInfo);
253e1c44949Sopenharmony_ci}
254e1c44949Sopenharmony_ci
255e1c44949Sopenharmony_ciint32_t OTTCall::KickOutFromConference()
256e1c44949Sopenharmony_ci{
257e1c44949Sopenharmony_ci    OttCallRequestInfo requestInfo;
258e1c44949Sopenharmony_ci    int32_t ret = PackOttCallRequestInfo(requestInfo);
259e1c44949Sopenharmony_ci    if (ret != TELEPHONY_SUCCESS) {
260e1c44949Sopenharmony_ci        TELEPHONY_LOGE("PackOttCallRequestInfo failed, error%{public}d", ret);
261e1c44949Sopenharmony_ci        return ret;
262e1c44949Sopenharmony_ci    }
263e1c44949Sopenharmony_ci    if (ottCallConnectionPtr_ == nullptr) {
264e1c44949Sopenharmony_ci        TELEPHONY_LOGE("ottCallConnectionPtr_ is nullptr!");
265e1c44949Sopenharmony_ci        return TELEPHONY_ERR_LOCAL_PTR_NULL;
266e1c44949Sopenharmony_ci    }
267e1c44949Sopenharmony_ci    return ottCallConnectionPtr_->KickOutFromConference(requestInfo);
268e1c44949Sopenharmony_ci}
269e1c44949Sopenharmony_ci
270e1c44949Sopenharmony_ciint32_t OTTCall::CanSeparateConference()
271e1c44949Sopenharmony_ci{
272e1c44949Sopenharmony_ci    return DelayedSingleton<OttConference>::GetInstance()->CanSeparateConference();
273e1c44949Sopenharmony_ci}
274e1c44949Sopenharmony_ci
275e1c44949Sopenharmony_ciint32_t OTTCall::CanKickOutFromConference()
276e1c44949Sopenharmony_ci{
277e1c44949Sopenharmony_ci    return DelayedSingleton<OttConference>::GetInstance()->CanKickOutFromConference();
278e1c44949Sopenharmony_ci}
279e1c44949Sopenharmony_ci
280e1c44949Sopenharmony_ciint32_t OTTCall::LaunchConference()
281e1c44949Sopenharmony_ci{
282e1c44949Sopenharmony_ci    int32_t ret = DelayedSingleton<OttConference>::GetInstance()->JoinToConference(GetCallID());
283e1c44949Sopenharmony_ci    if (ret == TELEPHONY_SUCCESS) {
284e1c44949Sopenharmony_ci        SetTelConferenceState(TelConferenceState::TEL_CONFERENCE_ACTIVE);
285e1c44949Sopenharmony_ci    }
286e1c44949Sopenharmony_ci    return ret;
287e1c44949Sopenharmony_ci}
288e1c44949Sopenharmony_ci
289e1c44949Sopenharmony_ciint32_t OTTCall::ExitConference()
290e1c44949Sopenharmony_ci{
291e1c44949Sopenharmony_ci    int32_t ret = DelayedSingleton<OttConference>::GetInstance()->LeaveFromConference(GetCallID());
292e1c44949Sopenharmony_ci    if (ret == TELEPHONY_SUCCESS) {
293e1c44949Sopenharmony_ci        SetTelConferenceState(TelConferenceState::TEL_CONFERENCE_IDLE);
294e1c44949Sopenharmony_ci    }
295e1c44949Sopenharmony_ci    return ret;
296e1c44949Sopenharmony_ci}
297e1c44949Sopenharmony_ci
298e1c44949Sopenharmony_ciint32_t OTTCall::HoldConference()
299e1c44949Sopenharmony_ci{
300e1c44949Sopenharmony_ci    int32_t ret = DelayedSingleton<OttConference>::GetInstance()->HoldConference(GetCallID());
301e1c44949Sopenharmony_ci    if (ret == TELEPHONY_SUCCESS) {
302e1c44949Sopenharmony_ci        SetTelConferenceState(TelConferenceState::TEL_CONFERENCE_HOLDING);
303e1c44949Sopenharmony_ci    }
304e1c44949Sopenharmony_ci    return ret;
305e1c44949Sopenharmony_ci}
306e1c44949Sopenharmony_ci
307e1c44949Sopenharmony_ciint32_t OTTCall::GetMainCallId(int32_t &mainCallId)
308e1c44949Sopenharmony_ci{
309e1c44949Sopenharmony_ci    mainCallId = DelayedSingleton<OttConference>::GetInstance()->GetMainCall();
310e1c44949Sopenharmony_ci    return TELEPHONY_SUCCESS;
311e1c44949Sopenharmony_ci}
312e1c44949Sopenharmony_ci
313e1c44949Sopenharmony_ciint32_t OTTCall::GetSubCallIdList(std::vector<std::u16string> &callIdList)
314e1c44949Sopenharmony_ci{
315e1c44949Sopenharmony_ci    return DelayedSingleton<OttConference>::GetInstance()->GetSubCallIdList(GetCallID(), callIdList);
316e1c44949Sopenharmony_ci}
317e1c44949Sopenharmony_ci
318e1c44949Sopenharmony_ciint32_t OTTCall::GetCallIdListForConference(std::vector<std::u16string> &callIdList)
319e1c44949Sopenharmony_ci{
320e1c44949Sopenharmony_ci    return DelayedSingleton<OttConference>::GetInstance()->GetCallIdListForConference(GetCallID(), callIdList);
321e1c44949Sopenharmony_ci}
322e1c44949Sopenharmony_ci
323e1c44949Sopenharmony_ciint32_t OTTCall::IsSupportConferenceable()
324e1c44949Sopenharmony_ci{
325e1c44949Sopenharmony_ci#ifdef ABILIT_CONFIG_SUPPORT
326e1c44949Sopenharmony_ci    bool ottSupport = GetOttConfig(OTT_SUPPORT_CONFERENCE);
327e1c44949Sopenharmony_ci    if (!ottSupport) {
328e1c44949Sopenharmony_ci        return TELEPHONY_CONFERENCE_OTT_NOT_SUPPORT;
329e1c44949Sopenharmony_ci    }
330e1c44949Sopenharmony_ci    if (isVideoCall()) {
331e1c44949Sopenharmony_ci        ottSupport = GetOTTConfig(OTT_VIDEO_SUPPORT_CONFERENCE)
332e1c44949Sopenharmony_ci    }
333e1c44949Sopenharmony_ci    if (!ottSupport) {
334e1c44949Sopenharmony_ci        return TELEPHONY_CONFERENCE_VIDEO_CALL_NOT_SUPPORT;
335e1c44949Sopenharmony_ci    }
336e1c44949Sopenharmony_ci#endif
337e1c44949Sopenharmony_ci    return TELEPHONY_SUCCESS;
338e1c44949Sopenharmony_ci}
339e1c44949Sopenharmony_ci
340e1c44949Sopenharmony_ciint32_t OTTCall::SendUpdateCallMediaModeRequest(ImsCallMode mode)
341e1c44949Sopenharmony_ci{
342e1c44949Sopenharmony_ci    return CALL_ERR_FUNCTION_NOT_SUPPORTED;
343e1c44949Sopenharmony_ci}
344e1c44949Sopenharmony_ci
345e1c44949Sopenharmony_ciint32_t OTTCall::InitVideoCall()
346e1c44949Sopenharmony_ci{
347e1c44949Sopenharmony_ci    return CALL_ERR_FUNCTION_NOT_SUPPORTED;
348e1c44949Sopenharmony_ci}
349e1c44949Sopenharmony_ci
350e1c44949Sopenharmony_ciint32_t OTTCall::RecieveUpdateCallMediaModeRequest(CallModeReportInfo &imsCallModeInfo)
351e1c44949Sopenharmony_ci{
352e1c44949Sopenharmony_ci    return CALL_ERR_FUNCTION_NOT_SUPPORTED;
353e1c44949Sopenharmony_ci}
354e1c44949Sopenharmony_ci
355e1c44949Sopenharmony_ciint32_t OTTCall::SendUpdateCallMediaModeResponse(ImsCallMode mode)
356e1c44949Sopenharmony_ci{
357e1c44949Sopenharmony_ci    return CALL_ERR_FUNCTION_NOT_SUPPORTED;
358e1c44949Sopenharmony_ci}
359e1c44949Sopenharmony_ci
360e1c44949Sopenharmony_ciint32_t OTTCall::ReceiveUpdateCallMediaModeResponse(CallModeReportInfo &response)
361e1c44949Sopenharmony_ci{
362e1c44949Sopenharmony_ci    return CALL_ERR_FUNCTION_NOT_SUPPORTED;
363e1c44949Sopenharmony_ci}
364e1c44949Sopenharmony_ci
365e1c44949Sopenharmony_ciint32_t OTTCall::UpdateImsCallMode(ImsCallMode mode)
366e1c44949Sopenharmony_ci{
367e1c44949Sopenharmony_ci    return CALL_ERR_FUNCTION_NOT_SUPPORTED;
368e1c44949Sopenharmony_ci}
369e1c44949Sopenharmony_ci
370e1c44949Sopenharmony_ciint32_t OTTCall::ReportImsCallModeInfo(CallMediaModeInfo &response)
371e1c44949Sopenharmony_ci{
372e1c44949Sopenharmony_ci    return CALL_ERR_FUNCTION_NOT_SUPPORTED;
373e1c44949Sopenharmony_ci}
374e1c44949Sopenharmony_ci
375e1c44949Sopenharmony_ciint32_t OTTCall::ControlCamera(std::string &cameraId, int32_t callingUid, int32_t callingPid)
376e1c44949Sopenharmony_ci{
377e1c44949Sopenharmony_ci    return CALL_ERR_FUNCTION_NOT_SUPPORTED;
378e1c44949Sopenharmony_ci}
379e1c44949Sopenharmony_ci
380e1c44949Sopenharmony_ciint32_t OTTCall::SetPreviewWindow(std::string &surfaceId, sptr<Surface> surface)
381e1c44949Sopenharmony_ci{
382e1c44949Sopenharmony_ci    return CALL_ERR_FUNCTION_NOT_SUPPORTED;
383e1c44949Sopenharmony_ci}
384e1c44949Sopenharmony_ci
385e1c44949Sopenharmony_ciint32_t OTTCall::SetDisplayWindow(std::string &surfaceId, sptr<Surface> surface)
386e1c44949Sopenharmony_ci{
387e1c44949Sopenharmony_ci    return CALL_ERR_FUNCTION_NOT_SUPPORTED;
388e1c44949Sopenharmony_ci}
389e1c44949Sopenharmony_ci
390e1c44949Sopenharmony_ciint32_t OTTCall::SetPausePicture(std::string &path)
391e1c44949Sopenharmony_ci{
392e1c44949Sopenharmony_ci    return CALL_ERR_FUNCTION_NOT_SUPPORTED;
393e1c44949Sopenharmony_ci}
394e1c44949Sopenharmony_ci
395e1c44949Sopenharmony_ciint32_t OTTCall::SetDeviceDirection(int32_t rotation)
396e1c44949Sopenharmony_ci{
397e1c44949Sopenharmony_ci    return CALL_ERR_FUNCTION_NOT_SUPPORTED;
398e1c44949Sopenharmony_ci}
399e1c44949Sopenharmony_ci
400e1c44949Sopenharmony_ciint32_t OTTCall::CancelCallUpgrade()
401e1c44949Sopenharmony_ci{
402e1c44949Sopenharmony_ci    return CALL_ERR_FUNCTION_NOT_SUPPORTED;
403e1c44949Sopenharmony_ci}
404e1c44949Sopenharmony_ci
405e1c44949Sopenharmony_ciint32_t OTTCall::RequestCameraCapabilities()
406e1c44949Sopenharmony_ci{
407e1c44949Sopenharmony_ci    return CALL_ERR_FUNCTION_NOT_SUPPORTED;
408e1c44949Sopenharmony_ci}
409e1c44949Sopenharmony_ci
410e1c44949Sopenharmony_ciint32_t OTTCall::SetMute(int32_t mute, int32_t slotId)
411e1c44949Sopenharmony_ci{
412e1c44949Sopenharmony_ci    return CALL_ERR_FUNCTION_NOT_SUPPORTED;
413e1c44949Sopenharmony_ci}
414e1c44949Sopenharmony_ci
415e1c44949Sopenharmony_ciint32_t OTTCall::PackOttCallRequestInfo(OttCallRequestInfo &requestInfo)
416e1c44949Sopenharmony_ci{
417e1c44949Sopenharmony_ci    if (accountNumber_.length() > static_cast<size_t>(kMaxNumberLen)) {
418e1c44949Sopenharmony_ci        TELEPHONY_LOGE("Number out of limit!");
419e1c44949Sopenharmony_ci        return CALL_ERR_NUMBER_OUT_OF_RANGE;
420e1c44949Sopenharmony_ci    }
421e1c44949Sopenharmony_ci    if (memcpy_s(requestInfo.phoneNum, kMaxNumberLen, accountNumber_.c_str(), accountNumber_.length()) != EOK) {
422e1c44949Sopenharmony_ci        TELEPHONY_LOGW("memset_s failed!");
423e1c44949Sopenharmony_ci        return TELEPHONY_ERR_MEMSET_FAIL;
424e1c44949Sopenharmony_ci    }
425e1c44949Sopenharmony_ci    if (bundleName_.length() > static_cast<size_t>(kMaxBundleNameLen)) {
426e1c44949Sopenharmony_ci        TELEPHONY_LOGE("Number out of limit!");
427e1c44949Sopenharmony_ci        return CALL_ERR_NUMBER_OUT_OF_RANGE;
428e1c44949Sopenharmony_ci    }
429e1c44949Sopenharmony_ci    if (memcpy_s(requestInfo.bundleName, kMaxBundleNameLen, bundleName_.c_str(), bundleName_.length()) != EOK) {
430e1c44949Sopenharmony_ci        TELEPHONY_LOGW("memset_s failed!");
431e1c44949Sopenharmony_ci        return TELEPHONY_ERR_MEMSET_FAIL;
432e1c44949Sopenharmony_ci    }
433e1c44949Sopenharmony_ci    requestInfo.videoState = videoState_;
434e1c44949Sopenharmony_ci    return TELEPHONY_SUCCESS;
435e1c44949Sopenharmony_ci}
436e1c44949Sopenharmony_ci} // namespace Telephony
437e1c44949Sopenharmony_ci} // namespace OHOS
438