2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.tizenopensource.org/license
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include "voice-call-engine.h"
19 #include "voice-call-core.h"
20 #include "voice-call-service.h"
21 #include "voice-call-dbus.h"
22 #include "voice-call-device.h"
23 #include "vc-core-util.h"
24 #include "vc-core-engine-types.h"
25 #include "vc-core-engine-status.h"
26 #include "vc-core-engine-group.h"
30 vcall_engine_app_cb cb_func;
33 call_vc_core_state_t *global_pcall_core = NULL;
35 static app_cb_t *app_client_data = NULL;
38 * This function send events to client.
40 * @return int API Result Code.
43 gboolean vcall_engine_send_event_to_client(int event, void *pdata)
45 CALL_ENG_DEBUG(ENG_DEBUG, "..");
46 if (app_client_data->cb_func != NULL) {
47 CALL_ENG_DEBUG(ENG_DEBUG, "Sending Event to APP Client");
48 app_client_data->cb_func(event, pdata, app_client_data->puser_data);
50 CALL_ENG_DEBUG(ENG_ERR, "End..");
55 * This function initialize voice call engine.
57 * @return int API Result Code.
60 int vcall_engine_init(vcall_engine_app_cb pcb_func, void *puser_data)
62 CALL_ENG_DEBUG(ENG_WARN, "..");
64 global_pcall_core = (call_vc_core_state_t *)calloc(1, sizeof(call_vc_core_state_t));
65 if (global_pcall_core == NULL) {
66 CALL_ENG_DEBUG(ENG_ERR, "Memory Allocation Failed");
67 return VCALL_ENGINE_API_FAILED;
69 CALL_ENG_DEBUG(ENG_DEBUG, "global_pcall_core alloctated memory:[%d],global_pcall_core(0x%x)", sizeof(call_vc_core_state_t), global_pcall_core);
71 if (FALSE == voicecall_core_init(global_pcall_core)) {
72 CALL_ENG_DEBUG(ENG_DEBUG, "voicecall_core_init() failed");
73 return VCALL_ENGINE_API_FAILED;
76 app_client_data = (app_cb_t *) calloc(1, sizeof(app_cb_t));
77 if (app_client_data == NULL) {
78 CALL_ENG_DEBUG(ENG_ERR, "Memory Allocation Failed");
79 return VCALL_ENGINE_API_FAILED;
81 app_client_data->cb_func = pcb_func;
82 app_client_data->puser_data = puser_data;
84 CALL_ENG_DEBUG(ENG_DEBUG, "Init dbus connection");
85 vc_engine_dbus_receiver_setup();
86 return VCALL_ENGINE_API_SUCCESS;
91 * This function processes mo nomal call.
93 * @return int API Result Code.
96 int vcall_engine_process_normal_call(char *number, int ct_index, gboolean b_download_call)
98 CALL_ENG_DEBUG(ENG_DEBUG, " number is (%s)", number);
99 voicecall_engine_t *pcall_engine = global_pcall_core->pcall_engine;
100 vc_engine_outgoing_type event_data;
101 char number_after_removal[VC_PHONE_NUMBER_LENGTH_MAX] = {"\0",};
104 if (number == NULL || pcall_engine == NULL)
105 return VCALL_ENGINE_API_FAILED;
107 _vc_core_engine_status_set_download_call(pcall_engine, b_download_call);
109 /* check the call-engine state before proceeding with call processing */
110 _vc_core_engine_status_get_engine_iostate(pcall_engine, &io_state);
111 if (io_state != VC_INOUT_STATE_NONE) {
112 CALL_ENG_DEBUG(ENG_DEBUG, "IO State [%d] not NONE, cannot proceed with the call", io_state);
113 voicecall_core_set_status(global_pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
114 vc_engine_msg_box_type mbox_event_data;
116 memset(&mbox_event_data, 0, sizeof(mbox_event_data));
117 mbox_event_data.string_id = IDS_CALL_POP_CALLNOTCALLOWED;
118 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&mbox_event_data);
119 return VCALL_ENGINE_API_FAILED;
122 memset(&(global_pcall_core->call_setup_info), 0, sizeof(global_pcall_core->call_setup_info));
123 global_pcall_core->call_setup_info.call_setup_by = VC_CALL_SETUP_BY_NORMAL;
124 global_pcall_core->call_setup_info.call_type = VC_CALL_ORIG_TYPE_NORMAL;
126 memset(&event_data, 0, sizeof(event_data));
128 _vc_core_util_remove_invalid_chars(number, number_after_removal);
129 snprintf(global_pcall_core->call_setup_info.source_tel_number, VC_PHONE_NUMBER_LENGTH_MAX, "%s", number_after_removal);
130 voicecall_core_extract_phone_number(number_after_removal, event_data.call_num, VC_PHONE_NUMBER_LENGTH_MAX);
132 if (strlen(event_data.call_num) >= VC_PHONE_NUMBER_LENGTH_MAX) {
133 CALL_ENG_DEBUG(ENG_ERR, " WARNING!! number is larger than max num length!!");
134 memcpy(global_pcall_core->call_setup_info.tel_number, event_data.call_num, VC_PHONE_NUMBER_LENGTH_MAX-1);
136 memcpy(global_pcall_core->call_setup_info.tel_number, event_data.call_num, strlen(event_data.call_num));
138 CALL_ENG_DEBUG(ENG_DEBUG, "number:[%s]", number);
139 CALL_ENG_DEBUG(ENG_DEBUG, "number_after_removal:[%s]", number_after_removal);
140 CALL_ENG_DEBUG(ENG_DEBUG, "global_pcall_core->call_setup_info.source_tel_number:[%s]", global_pcall_core->call_setup_info.source_tel_number);
141 CALL_ENG_DEBUG(ENG_DEBUG, "global_pcall_core->call_setup_info.tel_number:[%s]", global_pcall_core->call_setup_info.tel_number);
142 CALL_ENG_DEBUG(ENG_DEBUG, "event_data.call_num:[%s]", event_data.call_num);
145 voicecall_contact_info_t ct_info;
146 memset(&ct_info, 0, sizeof(ct_info));
148 ct_info.ct_index = ct_index;
150 voicecall_service_contact_info_by_number(event_data.call_num, &ct_info);
151 event_data.contact_index = ct_info.ct_index;
152 event_data.phone_type = ct_info.phone_type;
153 event_data.bday_remaining_days = ct_info.bday_remaining_days;
155 _vc_core_util_strcpy(event_data.call_name, sizeof(event_data.call_name), ct_info.display_name);
156 _vc_core_util_strcpy(event_data.call_file_path, sizeof(event_data.call_file_path), ct_info.caller_id_path);
157 _vc_core_util_strcpy(event_data.call_full_file_path, sizeof(event_data.call_full_file_path), ct_info.caller_full_id_path);
158 CALL_ENG_DEBUG(ENG_DEBUG, " contact copy ended!!");
160 vcall_engine_send_event_to_client(VC_ENGINE_MSG_OUTGOING_TO_UI, (void *)&event_data);
162 if (voicecall_core_setup_call(global_pcall_core, FALSE)) {
163 CALL_ENG_DEBUG(ENG_DEBUG, " success!!");
165 CALL_ENG_DEBUG(ENG_DEBUG, " failed!!");
167 return VCALL_ENGINE_API_SUCCESS;
172 * This function processes mo emergency call.
174 * @return int API Result Code.
177 int vcall_engine_process_emergency_call(char *number)
179 CALL_ENG_DEBUG(ENG_DEBUG, " number is : [%s]", number);
180 voicecall_engine_t *pcall_engine = global_pcall_core->pcall_engine;
181 gboolean bDefaultNumber = FALSE;
182 vc_engine_outgoing_type event_data;
185 /* check the call-engine state before proceeding with emergency call processing */
186 _vc_core_engine_status_get_engine_iostate(pcall_engine, &io_state);
187 if (io_state != VC_INOUT_STATE_NONE) {
188 CALL_ENG_DEBUG(ENG_DEBUG, "IO State [%d] not NONE, cannot proceed with the call", io_state);
189 voicecall_core_set_status(global_pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
190 vc_engine_msg_box_type mbox_event_data;
192 memset(&mbox_event_data, 0, sizeof(mbox_event_data));
193 mbox_event_data.string_id = IDS_CALL_POP_CALLNOTCALLOWED;
194 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&mbox_event_data);
195 return VCALL_ENGINE_API_FAILED;
198 memset(&event_data, 0, sizeof(event_data));
200 memset(&(global_pcall_core->call_setup_info), 0, sizeof(global_pcall_core->call_setup_info));
202 bDefaultNumber = strlen(number) ? FALSE : TRUE;
203 if (bDefaultNumber == TRUE) {
204 global_pcall_core->call_setup_info.call_setup_by = VC_CALL_SETUP_BY_NORMAL;
205 global_pcall_core->call_setup_info.call_type = VC_CALL_ORIG_TYPE_EMERGENCY;
206 if (strlen("911") < sizeof(event_data.call_num))
207 _vc_core_util_strcpy(event_data.call_num, VC_PHONE_NUMBER_LENGTH_MAX, "911");
209 memcpy(global_pcall_core->call_setup_info.tel_number, "911", strlen("911"));
211 global_pcall_core->call_setup_info.call_setup_by = VC_CALL_SETUP_BY_NORMAL;
212 global_pcall_core->call_setup_info.call_type = VC_CALL_ORIG_TYPE_PINLOCK;
213 voicecall_core_extract_phone_number(number, event_data.call_num, VC_PHONE_NUMBER_LENGTH_MAX);
214 if (strlen(number) > VC_PHONE_NUMBER_LENGTH_MAX) {
215 CALL_ENG_DEBUG(ENG_ERR, " WARNING!! number is larger than max num length!!");
216 memcpy(global_pcall_core->call_setup_info.source_tel_number, number, VC_PHONE_NUMBER_LENGTH_MAX);
217 memcpy(global_pcall_core->call_setup_info.tel_number, number, VC_PHONE_NUMBER_LENGTH_MAX);
219 memcpy(global_pcall_core->call_setup_info.source_tel_number, number, VC_PHONE_NUMBER_LENGTH_MAX);
220 memcpy(global_pcall_core->call_setup_info.tel_number, number, strlen(number));
224 event_data.contact_index = -1;
225 event_data.phone_type = -1;
226 event_data.bday_remaining_days = -1;
228 vcall_engine_send_event_to_client(VC_ENGINE_MSG_OUTGOING_TO_UI, (void *)&event_data);
230 if (voicecall_core_setup_call(global_pcall_core, TRUE)) {
231 CALL_ENG_DEBUG(ENG_DEBUG, " success!!");
233 CALL_ENG_DEBUG(ENG_DEBUG, " failed!!");
235 return VCALL_ENGINE_API_SUCCESS;
239 * This function processes emergency call for testing purpose.
241 * @return int API Result Code.
244 int vcall_engine_process_emergency_call_test(char *number)
246 CALL_ENG_DEBUG(ENG_DEBUG, " number is : [%s]", number);
247 voicecall_engine_t *pcall_engine = global_pcall_core->pcall_engine;
248 gboolean bDefaultNumber = FALSE;
249 vc_engine_outgoing_type event_data;
252 /* check the call-engine state before proceeding with emergency call processing */
253 _vc_core_engine_status_get_engine_iostate(pcall_engine, &io_state);
254 if (io_state != VC_INOUT_STATE_NONE) {
255 CALL_ENG_DEBUG(ENG_DEBUG, "IO State [%d] not NONE, cannot proceed with the call", io_state);
256 voicecall_core_set_status(global_pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
257 vc_engine_msg_box_type mbox_event_data;
259 memset(&mbox_event_data, 0, sizeof(mbox_event_data));
260 mbox_event_data.string_id = IDS_CALL_POP_CALLNOTCALLOWED;
261 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&mbox_event_data);
262 return VCALL_ENGINE_API_FAILED;
265 memset(&event_data, 0, sizeof(event_data));
267 memset(&(global_pcall_core->call_setup_info), 0, sizeof(global_pcall_core->call_setup_info));
269 bDefaultNumber = strlen(number) ? FALSE : TRUE;
270 if (bDefaultNumber == TRUE) {
271 global_pcall_core->call_setup_info.call_setup_by = VC_CALL_SETUP_BY_NORMAL;
272 global_pcall_core->call_setup_info.call_type = VC_CALL_ORIG_TYPE_EMERGENCY;
273 if (strlen("911") < sizeof(event_data.call_num))
274 _vc_core_util_strcpy(event_data.call_num, VC_PHONE_NUMBER_LENGTH_MAX, "911");
276 memcpy(global_pcall_core->call_setup_info.tel_number, "911", strlen("911"));
278 global_pcall_core->call_setup_info.call_setup_by = VC_CALL_SETUP_BY_NORMAL;
279 global_pcall_core->call_setup_info.call_type = VC_CALL_ORIG_TYPE_PINLOCK;
280 voicecall_core_extract_phone_number(number, event_data.call_num, VC_PHONE_NUMBER_LENGTH_MAX);
281 if (strlen(number) > VC_PHONE_NUMBER_LENGTH_MAX) {
282 CALL_ENG_DEBUG(ENG_ERR, " WARNING!! number is larger than max num length!!");
283 memcpy(global_pcall_core->call_setup_info.source_tel_number, number, VC_PHONE_NUMBER_LENGTH_MAX);
284 memcpy(global_pcall_core->call_setup_info.tel_number, number, VC_PHONE_NUMBER_LENGTH_MAX);
286 memcpy(global_pcall_core->call_setup_info.source_tel_number, number, VC_PHONE_NUMBER_LENGTH_MAX);
287 memcpy(global_pcall_core->call_setup_info.tel_number, number, strlen(number));
291 event_data.contact_index = -1;
292 event_data.phone_type = -1;
293 event_data.bday_remaining_days = -1;
295 vcall_engine_send_event_to_client(VC_ENGINE_MSG_OUTGOING_TO_UI, (void *)&event_data);
299 vc_engine_outgoing_orig_type orig_event_data;
301 memset(&orig_event_data, 0, sizeof(orig_event_data));
302 orig_event_data.call_handle = call_handle;
303 orig_event_data.bemergency = TRUE;
305 CALL_ENG_DEBUG(ENG_DEBUG, "Call Handle = %d, bemergency:[%d]", orig_event_data.call_handle, orig_event_data.bemergency);
306 vcall_engine_send_event_to_client(VC_ENGINE_MSG_OUTGOING_ORIG_TO_UI_TEST, (void *)&orig_event_data);
309 return VCALL_ENGINE_API_SUCCESS;
313 * This function processes sat setup call.
315 * @return int API Result Code.
318 int vcall_engine_process_sat_setup_call(vcall_engine_sat_setup_call_info_t *sat_setup_call_info)
320 CALL_ENG_DEBUG(ENG_WARN, "..");
321 voicecall_core_process_sat_setup_call(sat_setup_call_info);
322 return VCALL_ENGINE_API_SUCCESS;
326 * This function processes incoming call.
328 * @return int API Result Code.
331 int vcall_engine_process_incoming_call(vcall_engine_incoming_info_t *incoming_call_info)
333 call_vc_core_incoming_info_t tmp_incom_info = { 0, };
335 CALL_ENG_DEBUG(ENG_WARN, "..");
337 tmp_incom_info.call_handle = incoming_call_info->call_handle;
338 tmp_incom_info.call_type = incoming_call_info->call_type;
339 tmp_incom_info.cli_presentation_indicator = incoming_call_info->cli_presentation_indicator;
340 _vc_core_util_strcpy(tmp_incom_info.call_num, sizeof(tmp_incom_info.call_num), incoming_call_info->call_num);
341 tmp_incom_info.calling_name_mode = incoming_call_info->calling_name_mode;
342 _vc_core_util_strcpy(tmp_incom_info.calling_name, sizeof(tmp_incom_info.calling_name), incoming_call_info->calling_name);
343 _vc_core_util_strcpy(tmp_incom_info.redirected_number, sizeof(tmp_incom_info.redirected_number), incoming_call_info->redirected_number);
344 _vc_core_util_strcpy(tmp_incom_info.redirected_sub_address, sizeof(tmp_incom_info.redirected_sub_address), incoming_call_info->redirected_sub_address);
345 tmp_incom_info.cli_cause = incoming_call_info->cli_cause;
346 tmp_incom_info.bfwded = incoming_call_info->bfwded;
347 tmp_incom_info.active_line = incoming_call_info->active_line;
349 voicecall_core_process_incoming_call(&tmp_incom_info);
350 return VCALL_ENGINE_API_SUCCESS;
354 * This function answers an incoming call
356 * @return int API Result Code.
359 int vcall_engine_answer_call(void)
361 CALL_ENG_DEBUG(ENG_WARN, "..");
362 int ret = VCALL_ENGINE_API_FAILED;
364 ret = voicecall_core_answer_call(global_pcall_core, FALSE);
365 CALL_ENG_DEBUG(ENG_DEBUG, " ret:[%d]", ret);
370 * This function answers an incoming call according to the given type
372 * @return int API Result Code.
373 * @param[in] answer_type answer type
375 int vcall_engine_answer_call_by_type(vcall_engine_answer_type_t answer_type)
377 CALL_ENG_DEBUG(ENG_WARN, "..");
378 CALL_ENG_DEBUG(ENG_DEBUG, "answer_type:[%d]", answer_type);
380 if (TRUE == voicecall_core_answer_call_bytype(global_pcall_core, answer_type)) {
381 return VCALL_ENGINE_API_SUCCESS;
383 return VCALL_ENGINE_API_FAILED;
389 * This function cancel outgoing call
391 * @return int API Result Code.
394 int vcall_engine_cancel_call(void)
396 CALL_ENG_DEBUG(ENG_WARN, "..");
398 if (TRUE == voicecall_core_cancel_call(global_pcall_core)) {
399 return VCALL_ENGINE_API_SUCCESS;
401 return VCALL_ENGINE_API_FAILED;
406 * This function reject incoming call
408 * @return int API Result Code.
411 int vcall_engine_reject_call(void)
413 CALL_ENG_DEBUG(ENG_WARN, "..");
415 if (TRUE == voicecall_core_reject_mt(global_pcall_core, TRUE)) {
416 return VCALL_ENGINE_API_SUCCESS;
418 return VCALL_ENGINE_API_FAILED;
423 * This function release a active or held call
425 * @return int API Result Code.
428 int vcall_engine_release_call(void)
430 CALL_ENG_DEBUG(ENG_WARN, "..");
432 if (TRUE == voicecall_core_end_call(global_pcall_core)) {
433 return VCALL_ENGINE_API_SUCCESS;
435 return VCALL_ENGINE_API_FAILED;
440 * This function release a call by handle
442 * @return int API Result Code.
443 * @param[in] int call_handle
445 int vcall_engine_release_call_by_handle(int call_handle)
447 CALL_ENG_DEBUG(ENG_WARN, "..");
448 CALL_ENG_DEBUG(ENG_DEBUG, "call_handle:[%d]", call_handle);
450 if (TRUE == voicecall_core_end_call_by_handle(global_pcall_core, call_handle)) {
451 return VCALL_ENGINE_API_SUCCESS;
453 return VCALL_ENGINE_API_FAILED;
458 * This function release calls by type
460 * @return int API Result Code.
461 * @param[in] release_type release_type
463 int vcall_engine_release_call_by_type(vcall_engine_release_type_t release_type)
465 CALL_ENG_DEBUG(ENG_WARN, "..");
468 CALL_ENG_DEBUG(ENG_DEBUG, " release_type : [%d]", release_type);
469 switch (release_type) {
470 case VCALL_ENGINE_RELEASE_ALL_ACTIVE_CALLS:
472 ret = voicecall_core_end_all_active_calls(global_pcall_core);
476 case VCALL_ENGINE_RELEASE_ALL_HELD_CALLS:
478 ret = voicecall_core_end_all_held_calls(global_pcall_core);
482 case VCALL_ENGINE_RELEASE_ALL_CALLS:
484 ret = voicecall_core_end_all_calls(global_pcall_core);
489 CALL_ENG_DEBUG(ENG_DEBUG, " Unknown release_type : [%d]", release_type);
495 return VCALL_ENGINE_API_SUCCESS;
497 return VCALL_ENGINE_API_FAILED;
502 * This function processes hold/retrive/swap calls.
504 * @return int API Result Code.
507 int vcall_engine_process_hold_call(void)
509 CALL_ENG_DEBUG(ENG_WARN, "..");
512 ret = voicecall_core_process_hold_call(global_pcall_core);
514 return VCALL_ENGINE_API_SUCCESS;
516 return VCALL_ENGINE_API_FAILED;
521 * This function processes in call SS code..
523 * @return int API Result Code.
526 void vcall_engine_process_incall_ss(char *number)
528 CALL_ENG_DEBUG(ENG_WARN, "number(%s)");
530 voicecall_core_process_incall_ss(global_pcall_core, number);
534 * This function sets up a conference calls
536 * @return int API Result Code.
539 int vcall_engine_join_call(void)
541 CALL_ENG_DEBUG(ENG_WARN, "..");
544 ret = voicecall_core_setup_conference(global_pcall_core);
546 return VCALL_ENGINE_API_SUCCESS;
548 return VCALL_ENGINE_API_FAILED;
553 * This function make a private call in conference calls.
555 * @return int API Result Code.
556 * @param[in] int call_handle
558 int vcall_engine_split_call(int call_handle)
560 CALL_ENG_DEBUG(ENG_WARN, "..");
563 ret = voicecall_core_make_private_call(global_pcall_core, call_handle);
565 return VCALL_ENGINE_API_SUCCESS;
567 return VCALL_ENGINE_API_FAILED;
572 * This function transfers the call from active call to the held call
574 * @return int API Result Code.
575 * @param[in] int call_handle
577 int vcall_engine_transfer_call(void)
579 CALL_ENG_DEBUG(ENG_WARN, "..");
582 ret = voicecall_core_transfer_calls(global_pcall_core);
584 return VCALL_ENGINE_API_SUCCESS;
586 return VCALL_ENGINE_API_FAILED;
591 * This function processed loud speaker.
593 * @return int API Result Code.
594 * @param[in] int bstatus
596 int vcall_engine_process_loudspeaker(int bstatus)
598 CALL_ENG_DEBUG(ENG_WARN, "..");
601 CALL_ENG_DEBUG(ENG_DEBUG, " bstatus : [%d]", bstatus);
603 ret = voicecall_service_loudspeaker_on(global_pcall_core);
605 ret = voicecall_service_loudspeaker_off(global_pcall_core);
609 return VCALL_ENGINE_API_SUCCESS;
611 return VCALL_ENGINE_API_FAILED;
616 * This function processed voice mute status.
618 * @return int API Result Code.
619 * @param[in] int bstatus
621 int vcall_engine_process_voice_mute(int bstatus)
623 CALL_ENG_DEBUG(ENG_WARN, "..");
626 CALL_ENG_DEBUG(ENG_DEBUG, " bstatus : [%d]", bstatus);
628 ret = voicecall_service_mute_status_on(global_pcall_core);
630 ret = voicecall_service_mute_status_off(global_pcall_core);
634 return VCALL_ENGINE_API_SUCCESS;
636 return VCALL_ENGINE_API_FAILED;
641 * This function gets the volume level
643 * @return int API Result Code.
644 * @param[in] vcall_engine_vol_type_t vol_type
645 * @param[in] voicecall_snd_volume_alert_type_t vol_alert_type
647 int vcall_engine_get_volume_level(vcall_engine_vol_type_t vol_type)
649 CALL_ENG_DEBUG(ENG_WARN, "..");
651 CALL_ENG_DEBUG(ENG_DEBUG, " vol_type : [%d]", vol_type);
652 /* jspark 201007 decide to sync or async. */
654 return voicecall_snd_get_volume(global_pcall_core->papp_snd, vol_type);
659 * This function sets the volume level
661 * @return int API Result Code.
662 * @param[in] vcall_engine_vol_type_t vol_type
663 * @param[in] int vol_level
665 int vcall_engine_set_volume_level(vcall_engine_vol_type_t vol_type, int vol_level)
667 CALL_ENG_DEBUG(ENG_WARN, "..");
670 CALL_ENG_DEBUG(ENG_DEBUG, " vol_type : [%d], vol_level:[%d]", vol_type, vol_level);
671 ret = voicecall_service_set_volume(global_pcall_core, vol_type, vol_level);
673 return VCALL_ENGINE_API_SUCCESS;
675 return VCALL_ENGINE_API_FAILED;
680 * This function stop alert
682 * @return int API Result Code.
685 int vcall_engine_stop_alert(void)
687 CALL_ENG_DEBUG(ENG_WARN, "..");
690 ret = voicecall_core_stop_alert(global_pcall_core);
692 return VCALL_ENGINE_API_SUCCESS;
694 return VCALL_ENGINE_API_FAILED;
699 * This function mute alert.
701 * @return int API Result Code.
704 int vcall_engine_mute_alert(void)
706 CALL_ENG_DEBUG(ENG_WARN, "..");
709 ret = voicecall_snd_mute_alert(global_pcall_core->papp_snd);
711 return VCALL_ENGINE_API_SUCCESS;
713 return VCALL_ENGINE_API_FAILED;
718 * This function process auto redial.
720 * @return int API Result Code.
721 * @param[in] int bstatus
723 int vcall_engine_process_auto_redial(int bstatus)
725 CALL_ENG_DEBUG(ENG_WARN, "..");
728 CALL_ENG_DEBUG(ENG_DEBUG, " bstatus : [%d]", bstatus);
730 ret = voicecall_core_start_redial(global_pcall_core, TRUE);
732 ret = voicecall_core_stop_redial(global_pcall_core);
735 return VCALL_ENGINE_API_SUCCESS;
737 return VCALL_ENGINE_API_FAILED;
742 * This function send the DTMF number
744 * @return int API Result Code.
745 * @param[in] char* dtmf_number
747 int vcall_engine_send_dtmf_number(char *dtmf_number)
749 CALL_ENG_DEBUG(ENG_WARN, "..");
752 ret = voicecall_core_send_dtmf(global_pcall_core, dtmf_number);
755 return VCALL_ENGINE_API_SUCCESS;
757 return VCALL_ENGINE_API_FAILED;
762 * This function processed sound path
764 * @return int API Result Code.
765 * @param[in] int sound_path
767 int vcall_engine_change_sound_path(vcall_engine_audio_type_t sound_path)
769 CALL_ENG_DEBUG(ENG_WARN, "..");
772 ret = voicecall_core_change_sound_path(global_pcall_core, sound_path);
775 return VCALL_ENGINE_API_SUCCESS;
777 return VCALL_ENGINE_API_FAILED;
782 * This function get sound path
784 * @return int API Result Code.
785 * @param[out] int sound_path
787 int vcall_engine_get_sound_path(int *sound_path)
789 CALL_ENG_DEBUG(ENG_WARN, "..");
793 ret = voicecall_core_get_sound_path(global_pcall_core, &snd_path);
795 if (snd_path == VOICE_CALL_AUDIO_SPEAKER) {
796 *sound_path = VCALL_ENGINE_AUDIO_SPEAKER;
797 } else if (snd_path == VOICE_CALL_AUDIO_HEADSET) {
798 *sound_path = VCALL_ENGINE_AUDIO_HEADSET;
799 } else if (snd_path == VOICE_CALL_AUDIO_RECEIVER_EARJACK) {
800 *sound_path = VCALL_ENGINE_AUDIO_RECEIVER_EARJACK;
802 *sound_path = VCALL_ENGINE_AUDIO_RECEIVER_EARJACK;
806 return VCALL_ENGINE_API_SUCCESS;
808 return VCALL_ENGINE_API_FAILED;
813 * This function set call engine to default
815 * @return int API Result Code.
818 int vcall_engine_set_to_default()
820 CALL_ENG_DEBUG(ENG_WARN, "..");
823 ret = voicecall_core_set_to_default(global_pcall_core);
826 return VCALL_ENGINE_API_SUCCESS;
828 return VCALL_ENGINE_API_FAILED;
832 gpointer vcall_engine_get_core_state(void)
834 return global_pcall_core;
838 * This function is interface to call-utility to perform string copy
840 * @return instance of the core state
841 * @param[out] pbuffer Target Buffer
842 * @param[in] buf_count Size of Target Buffer
843 * @param[in] pstring Source String
845 gboolean vcall_engine_util_strcpy(char *pbuffer, int buf_count, const char *pstring)
847 return _vc_core_util_strcpy(pbuffer, buf_count, pstring);
851 * This function returns the number of groups
853 * @param[in] pcount count of the groups
855 gboolean vcall_engine_get_group_count(int *pcount)
857 CALL_ENG_DEBUG(ENG_DEBUG, "..");
858 return _vc_core_engine_group_get_enabled_group_count(global_pcall_core->pcall_engine, pcount);
862 * This function is interface to call-utility to perform string copy
864 * @return instance of the core state
865 * @param[out] pbuffer Target Buffer
866 * @param[in] time time
868 char *vcall_engine_util_get_date_time(time_t time)
870 CALL_ENG_DEBUG(ENG_DEBUG, "..");
871 return _vc_core_util_get_date_time(time);
875 * This function is force reset all engine status.
880 void vcall_engine_force_reset(void)
882 CALL_ENG_DEBUG(ENG_DEBUG, "..");
884 voicecall_snd_unregister_cm(global_pcall_core->papp_snd);
886 _vc_core_util_set_call_status(VCONFKEY_CALL_OFF);
888 voicecall_core_end_all_calls(global_pcall_core);
892 * This function will process the dtmf send request from UI
893 * It is executed when wait(w/W/;) is finished while sending a dtmf string
898 void vcall_engine_send_dtmf(gboolean bsuccess)
900 CALL_ENG_DEBUG(ENG_DEBUG, "..");
902 voicecall_core_process_dtmf_send_status(global_pcall_core, bsuccess);
906 * This function is interface to call-utility to check for ss string
908 * @return TRUE or FALSE if success/failure
909 * @param[in] call_number pointer to the number
911 gboolean vcall_engine_check_incall_ss_string(char *call_number)
913 CALL_ENG_DEBUG(ENG_DEBUG, "..");
914 return _vc_core_util_check_incall_ss_string(call_number);
918 * This function checks whether a given number is a SS string or not
920 * @return TRUE or FALSE if success/failure
921 * @param[in] call_number pointer to the number
923 gboolean vcall_engine_check_ss_string(char *call_number)
925 CALL_ENG_DEBUG(ENG_DEBUG, "..");
926 return _vc_core_util_check_ss_string(call_number);
930 * This function controls the lcd state
933 * @param[in] lcd_state state of the lcd control
935 void vcall_engine_device_control_lcd_state(voicecall_lcd_control_t lcd_state)
937 CALL_ENG_DEBUG(ENG_DEBUG, "..");
938 _voicecall_dvc_control_lcd_state(lcd_state);