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.
20 #include "vc-core-util.h"
21 #include "vc-core-engine-types.h"
22 #include "vc-core-callagent.h"
23 #include "vc-core-engine.h"
24 #include "vc-core-error.h"
25 #include "voice-call-core.h"
26 #include "voice-call-dbus.h"
27 #include "voice-call-engine-msg.h"
28 #include "voice-call-service.h"
29 #include "voice-call-device.h"
30 #include "voice-call-sound.h"
32 #include "voice-call-bt.h"
33 #include "phone-misc.h"
34 #include "vc-core-engine.h"
36 #include "voice-call-engine.h"
38 #define MO_REDIAL_COUNT_MAX 10
39 #define MO_REDIAL_TIMER_INTERVAL_FIRST 3000 /**< MO Redial Timer Interva; - 5 Secs*/
40 #define MO_REDIAL_TIMER_INTERVAL_SECOND 3000 /**< MO Redial Timer Interva; - 1 Minute*/
41 #define MO_REDIAL_TIMER_INTERVAL_THIRD 3000 /**< MO Redial Timer Interva; - 3 Minutes*/
43 #define MINUTE_MINDER_TIMEOUT_VALUE 60000
45 #define DTMF_PAUSE_TIMER_INTERVAL_FIRST 3000 /*3 Seconds */
46 #define DTMF_PAUSE_TIMER_INTERVAL_REST 3000 /*3 Seconds */
47 #define DTMF_PAUSE_TIMER_INTERVAL_GCF_FIRST 800 /*0.8 Second */
48 #define DTMF_PAUSE_TIMER_INTERVAL_GCF_REST 3300 /*3 Seconds */
50 gboolean mo_redial_timer_cb(void *data);
52 #define SET_PATH_TIMER_VALUE 50
53 static guint g_set_path_timer_handler = 0;
54 static gboolean __voicecall_core_set_path_timer_cb(gpointer puser_data);
56 /* For Debug Information, Call Engine Event name string constant */
57 char *gszcall_engine_event[VC_ENGINE_EVENT_MAX] = {
60 "VC_CALL_OUTGOING_ORIG",
61 "VC_CALL_OUTGOING_ALERT",
65 "VC_CALL_INCOM_DROPPED",
66 "VC_CALL_REJECTED_END",
67 "VC_CALL_OUTGOING_END", /* 10 */
69 "VC_CALL_OUTGOING_ABORTED",
71 "VC_CALL_AUTO_REDIAL_CHECK",
74 "VC_CALL_SS_RETREIVED",
76 "VC_CALL_SS_SETUP_CONF",
77 "VC_CALL_SS_SPLIT_CONF",
78 "VC_CALL_SS_TRANSFERRED", /* 20 */
80 "VC_CALL_SS_CONNECT_LINE_IND",
81 "VC_CALL_IND_FORWARD",
82 "VC_CALL_IND_ACTIVATE",
84 "VC_CALL_IND_TRANSFER",
85 "VC_CALL_IND_SETUPCONFERENCE",
86 "VC_CALL_IND_BARRING",
87 "VC_CALL_IND_WAITING",
88 "VC_CALL_IND_CUGINFO",
89 "VC_CALL_IND_SSNOTIFY", /* 30 */
91 "VC_CALL_IND_CALLINGNAMEINFO",
92 "VC_CALL_IND_REDIRECT_CNF",
93 "VC_CALL_IND_ACTIVATECCBS_CNF",
94 "VC_CALL_IND_ACTIVATECCBS_USERINFO",
97 "VC_ACTION_INCOM_FORCE",
98 "VC_ACTION_SAT_REQUEST",
99 "VC_ACTION_SAT_RESPONSE",
100 "VC_ACTION_CALL_END_HELD_RETREIVED", /* 40 */
102 "VC_ACTION_NO_ACTIVE_TASK",
103 "VC_CALL_GET_VOLUME_RESP"
106 static gboolean __vc_core_is_answermode_enabled_from_testmode(void);
107 static gboolean __vc_core_is_answermode_enabled(void);
108 static void __voicecall_core_start_auto_answer(call_vc_core_state_t *pcall_core, gboolean isTestMode);
109 static void __voicecall_core_cancel_auto_answer(call_vc_core_state_t *pcall_core);
110 /*static void __voicecall_core_check_headset_earjack_status(call_vc_core_state_t *pcall_core);*/
111 static void __vc_core_set_auto_redial_count(call_vc_core_state_t *pcall_core, int auto_redial_count);
112 /*static gboolean __voicecall_core_callstatus_set_timer_cb(gpointer puser_data);*/
114 static int __voicecall_core_get_string_id_by_errorcode(int error_code);
115 static void __voicecall_core_mocall_reset_engine_state(voicecall_engine_t *pcall_engine);
116 static gboolean __voicecall_core_is_redial_cuase(int end_cause);
118 static gboolean __voicecall_core_queue_dtmf_string(call_vc_core_state_t *pcall_core, char *dtmf_string, gboolean bsat_dtmf);
119 static gboolean __voicecall_core_handle_dtmf_ack(call_vc_core_state_t *pcall_core, gboolean success);
122 * This function puts the currently active call on hold
124 * @return Returns TRUE on success or FALSE on failure
125 * @param[in] pcall_engine Handle to voicecall engine
127 inline gboolean voicecall_core_hold_call(voicecall_engine_t *pcall_engine)
130 voicecall_error_t error_code = ERROR_VOICECALL_NONE;
132 error_code = _vc_core_engine_hold_call(pcall_engine);
134 CALL_ENG_DEBUG(ENG_DEBUG, "Error Code : %d", error_code);
135 return (ERROR_VOICECALL_NONE == error_code || ERROR_VOICECALL_PREVIOUS_REQUEST_IN_PROGRESS == error_code) ? TRUE : FALSE;
139 * This function retreives the currently held call
141 * @return Returns TRUE on success or FALSE on failure
142 * @param[in] pcall_engine Handle to voicecall engine
144 inline gboolean voicecall_core_retrieve_call(voicecall_engine_t *pcall_engine)
146 voicecall_error_t error_code = ERROR_VOICECALL_NONE;
148 error_code = _vc_core_engine_retrieve_call(pcall_engine);
150 CALL_ENG_DEBUG(ENG_DEBUG, "Error Code : %d", error_code);
151 return (ERROR_VOICECALL_NONE == error_code || ERROR_VOICECALL_PREVIOUS_REQUEST_IN_PROGRESS == error_code) ? TRUE : FALSE;
155 * This function swaps the currently available active and held calls
157 * @return Returns TRUE on success or FALSE on failure
158 * @param[in] pcall_engine Handle to voicecall engine
160 inline gboolean voicecall_core_swap_calls(voicecall_engine_t *pcall_engine)
162 voicecall_error_t error_code = ERROR_VOICECALL_NONE;
164 error_code = _vc_core_engine_swap_calls(pcall_engine);
166 CALL_ENG_DEBUG(ENG_DEBUG, "Error Code : %d", error_code);
167 return (ERROR_VOICECALL_NONE == error_code || ERROR_VOICECALL_PREVIOUS_REQUEST_IN_PROGRESS == error_code) ? TRUE : FALSE;
171 * This function clears the MO Call Details
173 * @return Returns TRUE on success or FALSE on failure
174 * @param[in] pcall_engine Handle to voicecall engine
176 inline gboolean voicecall_core_clear_mo_call(voicecall_engine_t *pcall_engine)
178 return (ERROR_VOICECALL_NONE == _vc_core_engine_finalize_call(pcall_engine, VC_OUTGOING_CALL, -1)) ? TRUE : FALSE;
182 * This function clears the Connected Call Details
184 * @return Returns TRUE on success or FALSE on failure
185 * @param[in] pcall_engine Handle to voicecall engine
186 * @param[in] call_handle Handle of the Connected Call to be cleared
188 inline gboolean voicecall_core_clear_connected_call(voicecall_engine_t *pcall_engine, int call_handle)
190 return (ERROR_VOICECALL_NONE == _vc_core_engine_finalize_call(pcall_engine, VC_CONNECTED_CALL, call_handle)) ? TRUE : FALSE;
194 * This function changes the voicecall engine's state
196 * @return Returns TRUE on success or FALSE on failure
197 * @param[in] pcall_engine Handle to voicecall engine
198 * @param[in] eng_state Engine State to be changed
200 inline gboolean voicecall_core_change_engine_state(voicecall_engine_t *pcall_engine, int eng_state)
202 return (ERROR_VOICECALL_NONE == _vc_core_engine_change_engine_iostate(pcall_engine, eng_state)) ? TRUE : FALSE;
206 * This function ends an Outgoing Call
208 * @return Returns TRUE on success or FALSE on failure
209 * @param[in] pcall_engine Handle to voicecall engine
211 inline gboolean voicecall_core_end_mo_call(voicecall_engine_t *pcall_engine)
213 return (ERROR_VOICECALL_NONE == _vc_core_engine_end_call(pcall_engine, VC_END_OUTGOING_CALL)) ? TRUE : FALSE;
217 * This function retreives the Voicecall Engine's State
219 * @return Returns TRUE on success or FALSE on failure
220 * @param[in] pcall_engine Handle to voicecall engine
221 * @param[out] io_state Voicecall Engine InOut State
223 inline gboolean voicecall_core_get_engine_state(voicecall_engine_t *pcall_engine, int *eng_state)
225 return (ERROR_VOICECALL_NONE == _vc_core_engine_status_get_engine_iostate(pcall_engine, eng_state)) ? TRUE : FALSE;
229 * This function checks whether any call exists
231 * @return Returns TRUE on success or FALSE on failure
232 * @param[in] pcall_engine Handle to voicecall engine
233 * @param[out] active_calls TRUE - If active call exists or FALSE If active call doesn't exists
234 * @param[out] held_calls TRUE - If held call exists or FALSE If held call doesn't exists
236 inline gboolean voicecall_core_is_call_exists(voicecall_engine_t *pcall_engine, gboolean *active_calls, gboolean *held_calls)
238 return (ERROR_VOICECALL_NONE == _vc_core_engine_status_isexists_any_call(pcall_engine, active_calls, held_calls)) ? TRUE : FALSE;
242 * This function checks whether incoming call exists or not
244 * @return Returns TRUE if incoming call exists or FALSE on failure
245 * @param[in] pcall_engine Handle to voicecall engine
247 inline gboolean voicecall_core_is_incoming_call_exists(voicecall_engine_t *pcall_engine)
249 gboolean bmtcall_exists = FALSE;
251 _vc_core_engine_status_isexists_call_bytype(pcall_engine, VC_INCOMING_CALL, &bmtcall_exists);
252 return bmtcall_exists;
256 * This function checks whether outgoing call exists or not
258 * @return Returns TRUE if outgoing call exists or FALSE on failure
259 * @param[in] pcall_engine Handle to voicecall engine
261 inline gboolean voicecall_core_is_outgoing_call_exists(voicecall_engine_t *pcall_engine)
263 gboolean bmocall_exists = FALSE;
265 _vc_core_engine_status_isexists_call_bytype(pcall_engine, VC_OUTGOING_CALL, &bmocall_exists);
266 return bmocall_exists;
270 * This function checks whether any connexcted call exists or not
272 * @return Returns TRUE if connected call exists or FALSE on failure
273 * @param[in] pcall_engine Handle to voicecall engine
275 inline gboolean voicecall_core_is_connected_call_exist(voicecall_engine_t *pcall_engine)
277 gboolean bcall_exists = FALSE;
279 _vc_core_engine_status_isexists_call_bytype(pcall_engine, VC_CONNECTED_CALL, &bcall_exists);
284 * This function checks whether any connexcted call exists or not in the given group
286 * @return Returns TRUE if connected call exists or FALSE on failure
287 * @param[in] pcall_engine Handle to voicecall engine
288 * @param[in] group_index Group Index to be searhced
290 inline gboolean voicecall_core_is_connected_call_exist_in_group(voicecall_engine_t *pcall_engine, int group_index)
292 gboolean bcall_exists = FALSE;
293 voicecall_error_t error_code = ERROR_VOICECALL_NONE;
295 if (ERROR_VOICECALL_NONE != _vc_core_engine_group_isexists_connected_call_ingroup(pcall_engine, group_index, &bcall_exists)) {
296 CALL_ENG_DEBUG(ENG_DEBUG, "Error_code %d", error_code);
304 * This function checks whether any call exists
306 * @return Returns TRUE if connected call exists or FALSE on failure
307 * @param[in] pcall_engine Handle to voicecall engine
309 inline gboolean voicecall_core_is_any_call_exists(voicecall_engine_t *pcall_engine)
311 gboolean bcall_exists = FALSE;
313 _vc_core_engine_status_isexists_call_bytype(pcall_engine, VC_INCOMING_CALL, &bcall_exists);
314 CALL_ENG_DEBUG(ENG_DEBUG, "Incoming Call = [%d]", bcall_exists);
316 if (FALSE == bcall_exists) {
317 _vc_core_engine_status_isexists_call_bytype(pcall_engine, VC_OUTGOING_CALL, &bcall_exists);
319 CALL_ENG_DEBUG(ENG_DEBUG, "Outgoing Call = [%d]", bcall_exists);
321 if (FALSE == bcall_exists) {
322 _vc_core_engine_status_isexists_call_bytype(pcall_engine, VC_CONNECTED_CALL, &bcall_exists);
324 CALL_ENG_DEBUG(ENG_DEBUG, "Connected Call = [%d]", bcall_exists);
330 * This function retreives the totally number of availavle calls including connected, MO and MT Calls
332 * @return Returns TRUE if success or FALSE on failure
333 * @param[in] pcall_engine Handle to voicecall engine
334 * @param[out] ptotal_call_member number of avialble calls
336 inline gboolean voicecall_core_get_total_call_member(voicecall_engine_t *pcall_engine, int *ptotal_call_member)
338 return (ERROR_VOICECALL_NONE == _vc_core_engine_status_get_call_member_count(pcall_engine, ptotal_call_member)) ? TRUE : FALSE;
342 * This function checks whether voicecall engine's call agent is idle or not
344 * @return Returns TRUE if call agent is idle or FALSE on failure
345 * @param[in] pcall_engine Handle to voicecall engine
347 inline gboolean voicecall_core_is_callagent_idle(voicecall_engine_t *pcall_engine)
349 gboolean bcallagent_idle = FALSE;
351 _vc_core_engine_status_is_engine_busy(pcall_engine, &bcallagent_idle);
352 CALL_ENG_DEBUG(ENG_DEBUG, "Call Agent Busy State : %d", bcallagent_idle);
354 return !bcallagent_idle;
358 * This function checks the current call status and engine status
360 * @return TRUE, if connected calls available and engine is in idle, FALSE otherwise
361 * @param[in] pcall_engine Handle to voicecall engine
363 inline gboolean voicecall_core_is_incall_request_possible(voicecall_engine_t *pcall_engine)
365 int eng_state = VC_INOUT_STATE_NONE;
366 int member_num_0 = 0;
367 int member_num_1 = 0;
369 _vc_core_engine_group_get_connected_member_count(pcall_engine, 0, &member_num_0);
370 _vc_core_engine_group_get_connected_member_count(pcall_engine, 1, &member_num_1);
371 voicecall_core_get_engine_state(pcall_engine, &eng_state);
372 if (!(voicecall_core_is_callagent_idle(pcall_engine) && ((member_num_1 + member_num_0) > 0)
373 && (eng_state == VC_INOUT_STATE_NONE))) {
374 CALL_ENG_DEBUG(ENG_DEBUG, "Engine Busy, Cannot complete Request,mem_0:%d,mem_1:%d,eng_state:%d ", member_num_0, member_num_1, eng_state);
382 * This function changes the modem call audio path
384 * @return TRUE sucess, FALSE otherwise
385 * @param[in] pcall_engine Handle to voicecall engine
386 * @param[in] audio_path audio path to be changed
388 inline gboolean voicecall_core_change_audio_path(voicecall_engine_t *pcall_engine, voicecall_audio_path_t audio_path, gboolean bextra_volume)
390 return (ERROR_VOICECALL_NONE == _vc_core_engine_change_audio_path(pcall_engine, audio_path, bextra_volume)) ? TRUE : FALSE;
394 * This function sets the voice call audio volume for the given audio path type
396 * @return returns TRUE in success , FALSE otherwise
397 * @param[in] pcall_engine Handle to voicecall engine
398 * @param[in] tapi_snd_path audio path for the volume to be set
399 * @param[in] vol_level volume level
401 inline gboolean voicecall_core_set_audio_volume(voicecall_engine_t *pcall_engine, voicecall_audio_path_t tapi_snd_path, int vol_level)
403 return (ERROR_VOICECALL_NONE == _vc_core_engine_set_audio_volume(pcall_engine, tapi_snd_path, (voicecall_audio_volume_t) vol_level)) ? TRUE : FALSE;
407 * This function retreives the voice call audio volume for the given audio path type
409 * @return returns TRUE in success , FALSE otherwise
410 * @param[in] pcall_engine Handle to voicecall engine
411 * @param[in] audio_path_type audio path for the volume to be retreived
413 inline gboolean voicecall_core_get_audio_volume(voicecall_engine_t *pcall_engine, voicecall_audio_path_t audio_path_type)
415 return (ERROR_VOICECALL_NONE == _vc_core_engine_get_audio_volume(pcall_engine, audio_path_type)) ? TRUE : FALSE;
419 * This function set the voice call audio mute status
421 * @return returns TRUE in success , FALSE otherwise
422 * @param[in] pcall_engine Handle to voicecall engine
423 * @param[in] bvoice_mute mute status
425 inline gboolean voicecall_core_set_audio_mute_status(voicecall_engine_t *pcall_engine, gboolean bvoice_mute)
427 return (ERROR_VOICECALL_NONE == _vc_core_engine_set_audio_mute(pcall_engine, bvoice_mute)) ? TRUE : FALSE;
431 * This function retreives the first active call among the available active calls
433 * @return Returns TRUE if success or FALSE on failure
434 * @param[in] pcall_engine Handle to voicecall engine
435 * @param[out] pcall_handle call handle of the active call
437 inline gboolean voicecall_core_get_zuhause(voicecall_engine_t *pcall_engine, gboolean * bzuhause)
439 return (ERROR_VOICECALL_NONE == _vc_core_engine_status_is_zuhause_area(pcall_engine, bzuhause)) ? TRUE : FALSE;
443 * This function retreives the Voicecall Engine's State
445 * @return Returns TRUE on success or FALSE on failure
446 * @param[in] pcall_engine Handle to voicecall engine
447 * @param[in] call_handle Call handle of the call for which the call object is retrieved
448 * @param[out] pcall_object Pointer to the retrived call object info
450 inline gboolean voicecall_core_get_call_object(voicecall_engine_t *pcall_engine, int call_handle, call_vc_call_objectinfo_t * pcall_object)
452 return (ERROR_VOICECALL_NONE == _vc_core_engine_status_get_call_object(pcall_engine, call_handle, pcall_object)) ? TRUE : FALSE;
456 * This function sends response to sat engine
458 * @return Returns TRUE If transfer call can be made or FALSE if not
459 * @param[in] pcall_engine Handle to voicecall engine
460 * @param[in] sat_rqst_resp_type sat rqst/resp type to be set by the client
461 * @param[in] sat_response_type sat response type to be sent to sat
463 inline gboolean voicecall_core_send_sat_response(voicecall_engine_t *pcall_engine, voicecall_engine_sat_rqst_resp_type sat_rqst_resp_type, call_vc_sat_reponse_type_t sat_response_type)
465 voicecall_error_t error_code = 0;
466 error_code = _vc_core_engine_send_sat_response(pcall_engine, sat_rqst_resp_type, sat_response_type);
467 CALL_ENG_DEBUG(ENG_DEBUG, "error_code:[%d] ", error_code);
468 return (ERROR_VOICECALL_NONE == error_code) ? TRUE : FALSE;
472 * This function retreives the number of active call members
474 * @return Returns TRUE if success or FALSE on failure
475 * @param[in] pcall_core Handle to voicecall core
476 * @param[out] pactive_member_num number of active call members available
478 inline gboolean voicecall_core_get_active_call_member(call_vc_core_state_t *pcall_core, int *pactive_member_num)
480 *pactive_member_num = 0;
481 return (ERROR_VOICECALL_NONE == _vc_core_engine_status_get_call_member_info(pcall_core->pcall_engine, VC_ACTIVE_CALL, pactive_member_num)) ? TRUE : FALSE;
485 * This function checks whether possible to make conference call
487 * @return Returns TRUE If Conference call can be made or FALSE if not
488 * @param[in] papp_document Handle to Application Document
490 inline gboolean voicecall_core_is_conf_call_possible(call_vc_core_state_t *pcall_core)
492 gboolean bconf_call = FALSE;
494 _vc_core_engine_status_is_conf_call_possible(pcall_core->pcall_engine, &bconf_call);
500 * This function checks whether possible to transfer call
502 * @return Returns TRUE If transfer call can be made or FALSE if not
503 * @param[in] pcall_core Handle to voicecall core
505 inline gboolean voicecall_core_is_transfer_call_possible(call_vc_core_state_t *pcall_core)
507 gboolean btransfer_call = FALSE;
509 _vc_core_engine_status_is_transfer_call_possible(pcall_core->pcall_engine, &btransfer_call);
511 return btransfer_call;
515 * This function checks whether the given code is a valid Supplementary Services Code
517 * @return Returns TRUE on success or FALSE on failure
518 * @param[in] pcall_core Handle to voicecall core
519 * @param[in] pszInput Number to be verified
521 inline gboolean voicecall_core_is_valid_sscode(call_vc_core_state_t *pcall_core, const char *pszInput)
523 gboolean bsscode = FALSE;
525 _vc_core_engine_status_isvalid_ss_code(pcall_core->pcall_engine, pszInput, &bsscode);
530 #ifdef _CPHS_DEFINED_
532 * This function gets the cphs status from the engine
534 * @return TRUE if queried status is enabled, FALSE otherwise
535 * @param[in] pcall_core Handle to voicecall core
536 * @param[in] csp_service csp service to be queried
538 inline gboolean voicecall_core_get_cphs_csp_status(call_vc_core_state_t *pcall_core, voicecall_cphs_csp_service csp_service)
540 gboolean bcsp_status = FALSE;
542 _vc_core_engine_status_get_cphs_csp_status(pcall_core->pcall_engine, csp_service, &bcsp_status);
548 * This function informs the Voicecall Engine that current SS operation has been completed
550 * @return Returns TRUE if all the calls are ended or FALSE on failure
551 * @param[in] pcall_core Handle to voicecall core
553 inline gboolean voicecall_core_set_check_ss_on_end(call_vc_core_state_t *pcall_core)
555 return (ERROR_VOICECALL_NONE == _vc_core_engine_status_set_end_flag(pcall_core->pcall_engine, VC_RETREIVE_CALL_ON_MOCALL_END)) ? TRUE : FALSE;
559 * This function extracts vaild phone number
564 inline void voicecall_core_extract_phone_number(const char *source_tel_number, char *phone_number, const int buf_size)
566 _vc_core_engine_extract_phone_number(source_tel_number, phone_number, buf_size);
569 /************************
570 * inline function END
571 **************************/
572 void voicecall_core_set_status(call_vc_core_state_t *pcall_core, call_vc_core_flags_t core_flags, gboolean bstatus)
574 CALL_ENG_DEBUG(ENG_DEBUG, "core flags:[0x%x], Set status:[%d] ", core_flags, bstatus);
576 if (CALL_VC_CORE_FLAG_NONE == core_flags) {
577 /*Set the document flag to defaults */
578 pcall_core->core_status = CALL_VC_CORE_FLAG_NONE;
582 if (TRUE == bstatus) {
584 pcall_core->core_status |= core_flags;
586 /*Remove bit field only if it is already set/ otherwise ignore it */
587 if ((pcall_core->core_status & core_flags) == core_flags) {
588 pcall_core->core_status = (pcall_core->core_status ^ core_flags);
592 CALL_ENG_DEBUG(ENG_DEBUG, "After SET, core_status:[0x%x]", pcall_core->core_status);
596 gboolean voicecall_core_get_status(call_vc_core_state_t *pcall_core, call_vc_core_flags_t core_flags)
598 CALL_ENG_DEBUG(ENG_DEBUG, "core_flags:[0x%x]", core_flags);
599 CALL_ENG_DEBUG(ENG_DEBUG, "Before Get, core_status:[0x%x]", pcall_core->core_status);
601 if ((pcall_core->core_status & core_flags) == core_flags) {
602 CALL_ENG_DEBUG(ENG_DEBUG, "Flag [0x%x] is available", core_flags);
606 CALL_ENG_DEBUG(ENG_DEBUG, "Flag [0x%x] is not available", core_flags);
610 static gboolean __voicecall_core_minute_minder(gpointer puser_data)
612 CALL_ENG_DEBUG(ENG_DEBUG, "..");
613 call_vc_core_state_t *pcall_core = (call_vc_core_state_t *)puser_data;
615 if ((voicecall_core_is_incoming_call_exists(pcall_core->pcall_engine) == FALSE)
616 && (voicecall_core_is_outgoing_call_exists(pcall_core->pcall_engine) == FALSE)
617 && (voicecall_core_is_connected_call_exist(pcall_core->pcall_engine) == TRUE)) {
618 voicecall_snd_play_effect_tone(pcall_core->papp_snd, VOICE_CALL_SND_EFFECT_CALL_MINUTE_MINDER);
624 static gboolean __voicecall_core_set_path_timer_cb(gpointer puser_data)
626 CALL_ENG_DEBUG(ENG_DEBUG, "..");
627 VOICECALL_RETURN_FALSE_IF_FAIL(puser_data != NULL);
628 call_vc_core_state_t *pcall_core = (call_vc_core_state_t *)puser_data;
630 voicecall_snd_change_path(pcall_core->papp_snd);
632 if (g_set_path_timer_handler > 0) {
633 g_source_remove(g_set_path_timer_handler);
634 g_set_path_timer_handler = 0;
640 static gboolean __voicecall_core_handle_call_end_on_silent_reject(call_vc_core_state_t *pcall_core, int call_handle)
642 CALL_ENG_DEBUG(ENG_DEBUG, "call_handle = %d", call_handle);
644 if ((pcall_core->mtcall_silent_reject_handle == call_handle)) {
645 /*Call rejected due to lawmo lock */
646 if (FALSE == voicecall_core_is_connected_call_exist(pcall_core->pcall_engine)) {
647 /*Connected calls need to be checked, Connected emergency calls may be avaialble */
648 voicecall_core_set_to_default(pcall_core);
650 CALL_ENG_DEBUG(ENG_ERR, "Connected calls available");
651 _vc_core_engine_status_dump_call_details(pcall_core->pcall_engine);
653 pcall_core->mtcall_silent_reject_handle = -1;
660 static gboolean __voicecall_core_silent_reject_mt(call_vc_core_state_t *pcall_core, int call_handle)
662 CALL_ENG_DEBUG(ENG_DEBUG, "call_handle = %d", call_handle);
664 voicecall_error_t error_code = ERROR_VOICECALL_NONE;
666 pcall_core->mtcall_silent_reject_handle = call_handle;
669 error_code = _vc_core_engine_reject_call(pcall_core->pcall_engine, FALSE);
671 if (ERROR_VOICECALL_NONE != error_code) {
672 CALL_ENG_DEBUG(ENG_ERR, "_vc_core_engine_reject_call Failed, error_code = %d", error_code);
678 static void __voicecall_core_processing_mo_cancel(call_vc_core_state_t *pcall_core)
680 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
681 int total_call_member;
683 CALL_ENG_DEBUG(ENG_DEBUG, "..");
685 if (TRUE == voicecall_snd_is_signal_playing(pcall_core->papp_snd)) {
686 CALL_ENG_DEBUG(ENG_DEBUG, "Signal is playing, skipping cancel timer");
690 vc_engine_outgoing_end_type event_data;
692 /* normal outgong end */
693 CALL_ENG_DEBUG(ENG_DEBUG, "It is normal outgong end case.");
694 CALL_ENG_DEBUG(ENG_DEBUG, "call_handle:[%d],end_cause_type:[%d]", pcall_core->mo_end_call_handle, pcall_core->mo_end_cause_type);
696 memset(&event_data, 0, sizeof(event_data));
697 event_data.call_handle = pcall_core->mo_end_call_handle;
698 event_data.end_cause_type = pcall_core->mo_end_cause_type;
699 vcall_engine_send_event_to_client(VC_ENGINE_MSG_OUTGOING_END_TO_UI, (void *)&event_data);
701 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_END, pcall_core->mo_end_call_handle, NULL);
703 __vc_core_set_auto_redial_count(pcall_core, 0);
704 voicecall_core_clear_mo_call(pcall_engine);
706 __voicecall_core_mocall_reset_engine_state(pcall_engine);
708 /* __vcui_app_view_mo_finish_call() start */
709 voicecall_snd_stop_signal(pcall_core->papp_snd);
711 voicecall_core_get_total_call_member(pcall_engine, &total_call_member);
712 /* If No Connected Calls End the UI */
713 if (total_call_member == 0) {
714 /*Reset voice call core to default values */
715 voicecall_core_set_to_default(pcall_core);
717 voicecall_snd_change_path(pcall_core->papp_snd);
719 /* __vcui_app_view_mo_finish_call() end */
723 static void __voicecall_core_mocall_signal_play_end_cb(gpointer pdata)
725 call_vc_core_state_t *pcall_core = (call_vc_core_state_t *)pdata;
727 CALL_ENG_DEBUG(ENG_DEBUG, "..");
729 if (FALSE == voicecall_core_is_connected_call_exist(pcall_core->pcall_engine)) {
730 CALL_ENG_DEBUG(ENG_DEBUG, "No More calls, resetting path");
731 _vc_core_util_set_call_status(VCONFKEY_CALL_OFF);
734 if (TRUE == voicecall_core_is_outgoing_call_exists(pcall_core->pcall_engine)) {
735 CALL_ENG_DEBUG(ENG_DEBUG, "Updating MO UI on signal end");
736 __voicecall_core_processing_mo_cancel(pcall_core);
740 static voicecall_snd_signal_type_t __voicecall_core_get_signal_type_from_endcause(int end_cause)
744 CALL_ENG_DEBUG(ENG_DEBUG, "End end_cause_type: %d", end_cause);
747 case VC_ENDCAUSE_USER_BUSY:
748 case VC_ENDCAUSE_USER_DOESNOT_RESPOND:
749 case VC_ENDCAUSE_USER_UNAVAILABLE:
750 case VC_ENDCAUSE_NO_ANSWER:
752 signal_type = VOICE_CALL_SIGNAL_USER_BUSY_TONE;
756 signal_type = VOICE_CALL_SIGNAL_NONE;
760 CALL_ENG_DEBUG(ENG_DEBUG, "Signal Type: %d", signal_type);
765 static void __voicecall_core_handle_normal_end(call_vc_core_state_t *pcall_core, int call_handle, voice_call_end_cause_type_t end_cause)
767 int total_call_member = 0;
768 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
770 /*Set the callstatus to OFF before processing the End Event Animation */
771 if (TRUE == voicecall_core_is_connected_call_exist(pcall_engine)) {
772 _vc_core_util_set_call_status(VCONFKEY_CALL_VOICE_ACTIVE);
773 } else if ((TRUE == voicecall_core_is_incoming_call_exists(pcall_engine)) || (TRUE == voicecall_core_is_outgoing_call_exists(pcall_engine))) {
774 _vc_core_util_set_call_status(VCONFKEY_CALL_VOICE_CONNECTING);
776 /*Reset the Path Actual path must be closed when modem path closed!! */
777 _vc_core_util_set_call_status(VCONFKEY_CALL_OFF);
780 if (FALSE == voicecall_snd_play_effect_tone(pcall_core->papp_snd, VOICE_CALL_SND_EFFECT_CALL_DISCONNECT)) {
781 CALL_ENG_DEBUG(ENG_DEBUG, "Effect tone not played, check and play busy tone");
783 if ((FALSE == voicecall_core_is_connected_call_exist(pcall_engine))
784 && (TRUE == voicecall_core_is_incoming_call_exists(pcall_engine))
785 && (voicecall_snd_get_path_status(pcall_core->papp_snd) == VOICE_CALL_SND_PATH_SPEAKER)) {
786 CALL_ENG_DEBUG(ENG_DEBUG, "Incoming Call: TRUE,Connected Call:FALSE, Speaker: TRUE. So change path to normal");
787 voicecall_snd_set_path_status(pcall_core->papp_snd, VOICE_CALL_SND_PATH_RECEIVER_EARJACK);
788 voicecall_snd_change_path(pcall_core->papp_snd);
791 voicecall_core_clear_connected_call(pcall_engine, call_handle);
793 voicecall_core_get_total_call_member(pcall_engine, &total_call_member);
794 if (0 == total_call_member) {
795 voicecall_core_set_to_default(pcall_core);
800 static gboolean __voicecall_core_handle_rejected_call_end(call_vc_core_state_t *pcall_core, int call_handle)
802 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
804 voicecall_snd_stop_alert(pcall_core->papp_snd);
806 /*Send Incoming call End Event to Blue Tooth */
807 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_END, call_handle, NULL);
809 if (FALSE == voicecall_core_is_connected_call_exist(pcall_engine)) {
810 CALL_ENG_DEBUG(ENG_DEBUG, "No More Calls");
811 voicecall_core_set_to_default(pcall_core);
813 CALL_ENG_DEBUG(ENG_DEBUG, "Setting Path for Voicecall");
814 /*Change Path to Call, when the incomging call is cancelled. */
815 voicecall_snd_change_path(pcall_core->papp_snd);
816 _vc_core_util_set_call_status(VCONFKEY_CALL_VOICE_ACTIVE);
819 CALL_ENG_DEBUG(ENG_DEBUG, "Reject Call End Processed");
823 static void __voicecall_core_handle_outgoingcall_end(call_vc_core_state_t *pcall_core, int call_handle, voice_call_end_cause_type_t end_cause_type)
825 gboolean bsignal_play = FALSE;
826 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
828 CALL_ENG_DEBUG(ENG_DEBUG, "call_handle=:%d,end_cause=%d", call_handle, end_cause_type);
829 pcall_core->mo_end_call_handle = call_handle;
830 pcall_core->mo_end_cause_type = end_cause_type;
832 if (FALSE == voicecall_core_is_connected_call_exist(pcall_engine)) {
833 voicecall_snd_signal_type_t end_signal_type = VOICE_CALL_SIGNAL_NONE;
834 /*Play Signal Tone only when the connected calls are not exists */
835 end_signal_type = __voicecall_core_get_signal_type_from_endcause(end_cause_type);
837 if (end_signal_type != VOICE_CALL_SIGNAL_NONE) {
838 voicecall_snd_set_signal_type(pcall_core->papp_snd, end_signal_type);
839 voicecall_snd_play_signal(pcall_core->papp_snd, __voicecall_core_mocall_signal_play_end_cb, pcall_core);
842 /* signal tone play case : just end string updated */
844 vc_engine_outgoing_end_signal_play_type event_data;
846 /* normal outgong end */
847 CALL_ENG_DEBUG(ENG_DEBUG, "It is normal outgong end case.");
848 CALL_ENG_DEBUG(ENG_DEBUG, "call_handle:[%d],end_cause_type:[%d]", call_handle, pcall_core->mo_end_cause_type);
850 memset(&event_data, 0, sizeof(event_data));
851 event_data.call_handle = call_handle;
852 event_data.end_cause_type = pcall_core->mo_end_cause_type;
853 vcall_engine_send_event_to_client(VC_ENGINE_MSG_OUTGOING_END_SIGNAL_PLAY_TO_UI, (void *)&event_data);
858 CALL_ENG_DEBUG(ENG_DEBUG, "Connected call exists, not playing signal tone");
860 if (TRUE == voicecall_core_is_connected_call_exist(pcall_engine)) {
861 /* Set phonestatus value */
862 _vc_core_util_set_call_status(VCONFKEY_CALL_VOICE_ACTIVE);
863 } else if (FALSE == bsignal_play) {
864 /*Reset the Path Actual path must be closed when modem path closed!! */
865 _vc_core_util_set_call_status(VCONFKEY_CALL_OFF);
869 __voicecall_core_processing_mo_cancel(pcall_core);
873 static gboolean __voicecall_core_handle_incoming_call_end(call_vc_core_state_t *pcall_core, int call_handle)
875 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
877 voicecall_snd_stop_alert(pcall_core->papp_snd);
879 /*Send Incoming call End Event to Blue Tooth */
880 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_END, call_handle, NULL);
882 if (FALSE == voicecall_core_is_connected_call_exist(pcall_engine)) {
883 CALL_ENG_DEBUG(ENG_DEBUG, "No More Calls");
884 voicecall_core_set_to_default(pcall_core);
886 CALL_ENG_DEBUG(ENG_DEBUG, "Setting Path for Voicecall");
887 /*Change Path to Call, when the incomging call is cancelled. */
888 voicecall_snd_change_path(pcall_core->papp_snd);
889 _vc_core_util_set_call_status(VCONFKEY_CALL_VOICE_ACTIVE);
892 CALL_ENG_DEBUG(ENG_DEBUG, "Incoming Call End Processed");
896 static gboolean voicecall_core_cb(int event, int param1, int param2, void *param3, void *puser_data)
898 CALL_ENG_DEBUG(ENG_WARN, " Engine Event: %s(%d)", gszcall_engine_event[event], event);
900 call_vc_core_state_t *pcall_core = (call_vc_core_state_t *)puser_data;
901 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
903 CALL_VC_DUMP_CALLDETAILS(&pcall_engine->call_manager);
908 int call_handle = param1;
909 char tel_number[VC_PHONE_NUMBER_LENGTH_MAX];
910 gboolean bauto_reject = FALSE;
911 gboolean bauto_reject_unknown = FALSE;
912 gboolean restricted = FALSE;
913 gboolean bcalling_namemode = FALSE;
914 gboolean brejected_number = FALSE;
915 vc_engine_incoming_type event_data;
917 memset(&event_data, 0, sizeof(event_data));
918 event_data.bday_remaining_days = -1;
920 CALL_ENG_DEBUG(ENG_DEBUG, "tel_number:[%s]", (char *)param3);
921 _vc_core_util_strcpy(tel_number, sizeof(tel_number), (char *)param3);
923 /*Changing the path to headset/phone will be decided by user accept action.
924 This will apply for second incoming call, if the first call was accpeted by BT Headset
925 and the path was changed to BT headset, then the path will be in headset for second call by default
926 So reset the headset flag for second call so the path will not
927 be automatically changed to headset, it will be decided by user action.
928 If this requirement fits only for first incoming call then comment this fix. */
929 /* vcui_app_snd_set_status(papp_document->papp_snd, VCUI_APP_AUDIO_HEADSET, FALSE); */
931 /*Will be set based on user action */
932 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_ACCEPT_BY_BT, FALSE);
934 if (_vc_core_util_check_video_call_status() == TRUE) {
935 /*Check for Lawmo Lock */
936 if (TRUE == __voicecall_core_silent_reject_mt(pcall_core, call_handle)) {
937 CALL_ENG_DEBUG(ENG_DEBUG, "Call rejected due to silent reject");
942 /* Check for Restricted Mode */
943 _vc_core_engine_status_isrestricted_call(pcall_engine, call_handle, &restricted);
944 _vc_core_engine_status_get_calling_namemode(pcall_engine, call_handle, &bcalling_namemode);
945 if (TRUE == bcalling_namemode) {
946 call_vc_call_objectinfo_t call_object;
948 voicecall_core_get_call_object(pcall_engine, call_handle, &call_object);
949 CALL_ENG_DEBUG(ENG_DEBUG, "call_object.calling_name:[%s]", call_object.calling_name);
951 _vc_core_util_strcpy(event_data.call_name, sizeof(event_data.call_name), call_object.calling_name);
952 } else if (TRUE == restricted) {
953 call_vc_call_objectinfo_t call_object;
955 voicecall_core_get_call_object(pcall_engine, call_handle, &call_object);
956 CALL_ENG_DEBUG(ENG_DEBUG, "call_object.name_mode:[%s]", call_object.name_mode);
958 event_data.brestricted = TRUE;
959 if (call_object.name_mode == CALL_VC_NAME_MODE_PAYPHONE) {
960 event_data.bpayphone = TRUE;
962 event_data.bpayphone = FALSE;
965 event_data.contact_index = -1;
966 event_data.phone_type = -1;
968 voicecall_contact_info_t ct_info;
969 memset(&ct_info, 0, sizeof(ct_info));
970 ct_info.ct_index = -1;
972 voicecall_service_contact_info_by_number(tel_number, &ct_info);
974 _vc_core_util_strcpy(event_data.call_name, sizeof(event_data.call_name), ct_info.display_name);
975 _vc_core_util_strcpy(event_data.call_file_path, sizeof(event_data.call_file_path), ct_info.caller_id_path);
976 _vc_core_util_strcpy(event_data.call_full_file_path, sizeof(event_data.call_full_file_path), ct_info.caller_full_id_path);
977 event_data.contact_index = ct_info.ct_index;
978 event_data.phone_type = ct_info.phone_type;
979 event_data.bday_remaining_days = ct_info.bday_remaining_days;
981 voicecall_snd_mgr_t *papp_snd = pcall_core->papp_snd;
982 char ringtone_path[VOICE_CALL_SND_RINGTONE_PATH_LEN] = { 0, };
983 memset(papp_snd->ring_tone, 0, VOICE_CALL_SND_RINGTONE_PATH_LEN);
984 if (TRUE == g_file_test(ct_info.ring_tone, G_FILE_TEST_EXISTS)) {
985 snprintf(ringtone_path, sizeof(ringtone_path), "file://%s", ct_info.ring_tone);
986 _vc_core_util_strcpy(papp_snd->ring_tone, VOICE_CALL_SND_RINGTONE_PATH_LEN, ringtone_path);
987 CALL_ENG_DEBUG(ENG_DEBUG, "From Contact Ringtone: %s", papp_snd->ring_tone);
989 /*Get Ringtone File From Settings */
990 CALL_ENG_DEBUG(ENG_DEBUG, "Invalid Ringtone from Contact: %s", ct_info.ring_tone);
994 /*Auto Reject Check */
995 if (vconf_get_bool(VCONFKEY_CISSAPPL_AUTO_REJECT_BOOL, &bauto_reject)) {
996 CALL_ENG_DEBUG(ENG_ERR, "vconf_get_bool failed.");
1000 CALL_ENG_DEBUG(ENG_DEBUG, "** Auto Reject Enabled. **");
1002 if (vconf_get_bool(VCONFKEY_CISSAPPL_AUTO_REJECT_UNKNOWN_BOOL, &bauto_reject_unknown)) {
1003 CALL_ENG_DEBUG(ENG_ERR, "vconf_get_bool failed.");
1005 CALL_ENG_DEBUG(ENG_DEBUG, "bauto_reject_unknown:[%d]", bauto_reject_unknown);
1007 if ((0 == strlen(tel_number)) && (TRUE == bauto_reject_unknown)) {
1008 brejected_number = 1;
1009 CALL_ENG_DEBUG(ENG_DEBUG, "Unknwon Rejected.");
1011 phone_misc_h *handle = NULL;
1013 handle = phone_misc_connect();
1014 if (handle == NULL) {
1015 CALL_ENG_DEBUG(ENG_ERR, "misc connect fail");
1016 brejected_number = FALSE;
1018 int ret = phone_misc_block_check(handle, tel_number);
1020 brejected_number = TRUE;
1022 brejected_number = FALSE;
1024 phone_misc_disconnect(handle);
1027 CALL_ENG_DEBUG(ENG_DEBUG, "Call Log DB rejected:[%d]", brejected_number);
1032 event_data.call_handle = call_handle;
1033 event_data.brejected = brejected_number;
1034 _vc_core_util_strcpy(event_data.call_num, sizeof(event_data.call_num), tel_number);
1036 vcall_engine_send_event_to_client(VC_ENGINE_MSG_INCOM_TO_UI, (void *)&event_data);
1039 /* in case of rejected number, sound & callstatus is not processed */
1040 if (!brejected_number) {
1041 gboolean benabledTestMode = FALSE;
1042 voicecall_snd_register_cm(pcall_core->papp_snd);
1044 /*Send Incoming Call Event to Blue Tooth */
1045 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_INCOM, call_handle, tel_number);
1047 _vc_core_util_set_call_status(VCONFKEY_CALL_VOICE_CONNECTING);
1049 benabledTestMode = __vc_core_is_answermode_enabled_from_testmode();
1050 if ((TRUE == __vc_core_is_answermode_enabled()) || (TRUE == benabledTestMode)) {
1051 CALL_ENG_DEBUG(ENG_DEBUG, "auto answer mode is enabled.");
1052 __voicecall_core_start_auto_answer(pcall_core, benabledTestMode);
1055 CALL_ENG_DEBUG(ENG_DEBUG, "Preparing Sound ");
1056 voicecall_snd_prepare_alert(pcall_core->papp_snd, call_handle);
1057 if (FALSE == voicecall_core_is_connected_call_exist(pcall_core->pcall_engine)) {
1058 CALL_ENG_DEBUG(ENG_DEBUG, "Changing MM Path just before playing the ring tone");
1059 sound_manager_call_session_set_mode(pcall_core->papp_snd->psnd_session, SOUND_CALL_SESSION_MODE_RINGTONE);
1061 CALL_ENG_DEBUG(ENG_DEBUG, "2nd MT call alert.");
1063 voicecall_snd_play_alert(pcall_core->papp_snd);
1069 case VC_CALL_OUTGOING:
1071 int call_handle = param1;
1072 vc_engine_common_with_handle_type event_data;
1073 memset(&event_data, 0, sizeof(event_data));
1075 CALL_ENG_DEBUG(ENG_DEBUG, "MO Call Start: Call handle %d", call_handle);
1079 case VC_CALL_OUTGOING_ORIG:
1081 int call_handle = param1;
1082 vc_engine_outgoing_orig_type event_data;
1083 call_vc_call_objectinfo_t callobject_info;
1085 memset(&event_data, 0, sizeof(event_data));
1086 event_data.call_handle = call_handle;
1087 if (pcall_core->call_setup_info.call_type == VC_CALL_ORIG_TYPE_EMERGENCY) {
1088 event_data.bemergency = TRUE;
1090 event_data.bemergency = FALSE;
1093 CALL_ENG_DEBUG(ENG_DEBUG, "Call Handle = %d, bemergency:[%d]", event_data.call_handle, event_data.bemergency);
1094 vcall_engine_send_event_to_client(VC_ENGINE_MSG_OUTGOING_ORIG_TO_UI, (void *)&event_data);
1096 g_set_path_timer_handler = g_timeout_add(SET_PATH_TIMER_VALUE, __voicecall_core_set_path_timer_cb, pcall_core);
1098 /*Send Event to Blue Tooth */
1099 voicecall_core_get_call_object(pcall_engine, call_handle, &callobject_info);
1100 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_ORIG, call_handle, callobject_info.tel_number);
1104 case VC_CALL_OUTGOING_ALERT:
1106 int call_handle = param1;
1107 vc_engine_common_with_handle_type event_data;
1109 memset(&event_data, 0, sizeof(event_data));
1111 event_data.call_handle = call_handle;
1113 vcall_engine_send_event_to_client(VC_ENGINE_MSG_OUTGOING_ALERT_TO_UI, (void *)&event_data);
1115 /*Play Connected Effect Tone */
1116 CALL_ENG_KPI("voicecall_snd_play_effect_tone start");
1117 if (FALSE == voicecall_snd_play_effect_tone(pcall_core->papp_snd, VOICE_CALL_SND_EFFECT_CALL_CONNECT)) {
1118 CALL_ENG_DEBUG(ENG_DEBUG, "voicecall_snd_play_effect_tone return value is FALSE");
1119 voicecall_snd_change_path(pcall_core->papp_snd);
1121 CALL_ENG_KPI("voicecall_snd_play_effect_tone done");
1123 CALL_ENG_KPI("_vc_bt_send_response_to_bt start");
1124 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_REMOTE_RINGING, call_handle, NULL);
1125 CALL_ENG_KPI("_vc_bt_send_response_to_bt done");
1129 case VC_CALL_ANSWER_CNF:
1131 CALL_ENG_DEBUG(ENG_DEBUG, "Answer confirm");
1132 if (_vc_core_cm_get_call_member_count(&(pcall_engine->call_manager)) == 1) {
1133 CALL_ENG_DEBUG(ENG_DEBUG, "single call state");
1134 voicecall_snd_change_path(pcall_core->papp_snd);
1139 case VC_CALL_CONNECTED:
1141 int call_handle = param1;
1142 vc_engine_connected_type event_data;
1143 int bstatus = FALSE;
1145 memset(&event_data, 0, sizeof(event_data));
1147 CALL_ENG_DEBUG(ENG_DEBUG, "Connected Call Handle : %d", call_handle);
1149 event_data.call_handle = call_handle;
1150 event_data.bt_status = (int)_vc_bt_get_bt_status();
1152 vcall_engine_send_event_to_client(VC_ENGINE_MSG_CONNECTED_TO_UI, (void *)&event_data);
1153 voicecall_snd_stop_alert(pcall_core->papp_snd); /* To stop alert in case of call accept by AT command */
1154 voicecall_snd_change_path(pcall_core->papp_snd);
1156 /* Set phone-status value */
1157 _vc_core_util_set_call_status(VCONFKEY_CALL_VOICE_ACTIVE);
1159 /* check minute minder */
1160 if (vconf_get_bool(VCONFKEY_CISSAPPL_MINUTE_MINDER_BOOL, &bstatus)) {
1161 CALL_ENG_DEBUG(ENG_ERR, "vconf_get_bool failed.");
1164 if (pcall_core->minute_minder_timer == 0) {
1165 pcall_core->minute_minder_timer = g_timeout_add(MINUTE_MINDER_TIMEOUT_VALUE, __voicecall_core_minute_minder, pcall_core);
1169 /*Send Event to Blue Tooth */
1170 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_CONNECT, call_handle, NULL);
1172 /*Call is accepted, reset the flag */
1173 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_ACCEPT_BY_BT, FALSE);
1179 case VC_CALL_NORMAL_END:
1181 int call_handle = param1;
1182 voice_call_end_cause_type_t end_cause = param2;
1183 vc_engine_normal_end_type event_data;
1185 memset(&event_data, 0, sizeof(event_data));
1187 CALL_ENG_DEBUG(ENG_DEBUG, "Normal End Call Handle : %d,End Cause=%d", call_handle, end_cause);
1189 event_data.call_handle = call_handle;
1190 event_data.end_cause_type = end_cause;
1192 __voicecall_core_handle_normal_end(pcall_core, call_handle, end_cause);
1194 vcall_engine_send_event_to_client(VC_ENGINE_MSG_NORMAL_END_TO_UI, (void *)&event_data);
1196 /*Send Event to Blue Tooth */
1197 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_END, call_handle, NULL);
1201 case VC_CALL_INCOM_END:
1203 int call_handle = param1;
1204 vc_engine_common_with_handle_type event_data;
1206 memset(&event_data, 0, sizeof(event_data));
1208 CALL_ENG_DEBUG(ENG_DEBUG, "Incoming call End Call Handle: %d", call_handle);
1210 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_ACCEPT_BY_BT, FALSE);
1212 if (TRUE == __voicecall_core_handle_call_end_on_silent_reject(pcall_core, call_handle)) {
1213 CALL_ENG_DEBUG(ENG_DEBUG, "Call end processed for silent reject:");
1217 event_data.call_handle = call_handle;
1219 __voicecall_core_handle_incoming_call_end(pcall_core, call_handle);
1221 vcall_engine_send_event_to_client(VC_ENGINE_MSG_INCOM_END_TO_UI, (void *)&event_data);
1225 case VC_CALL_INCOM_DROPPED:
1227 CALL_ENG_DEBUG(ENG_DEBUG, "Check it. Not used");
1231 case VC_CALL_REJECTED_END:
1233 int call_handle = param1;
1234 vc_engine_common_with_handle_type event_data;
1236 memset(&event_data, 0, sizeof(event_data));
1238 CALL_ENG_DEBUG(ENG_DEBUG, "Rejected call End Call Handle: %d", call_handle);
1240 event_data.call_handle = call_handle;
1242 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_ACCEPT_BY_BT, FALSE);
1244 __voicecall_core_handle_rejected_call_end(pcall_core, call_handle);
1246 vcall_engine_send_event_to_client(VC_ENGINE_MSG_REJECTED_END_TO_UI, (void *)&event_data);
1250 case VC_CALL_OUTGOING_END:
1252 int call_handle = param1;
1253 int end_cause_type = param2;
1254 int bauto_redial = -1;
1256 CALL_ENG_DEBUG(ENG_DEBUG, "end cause type :[%d]", end_cause_type);
1257 CALL_ENG_DEBUG(ENG_DEBUG, "bauto_redial:[%d]", bauto_redial);
1259 if ((TRUE == bauto_redial) && (FALSE == voicecall_core_is_connected_call_exist(pcall_engine))
1260 && (FALSE == voicecall_core_get_status(pcall_core, CALL_VC_CORE_FLAG_MOCALL_END_BY_USER))
1261 && (TRUE == __voicecall_core_is_redial_cuase(end_cause_type))) {
1263 CALL_ENG_DEBUG(ENG_DEBUG, "It is auto redial case.");
1265 _vc_core_util_set_call_status(VCONFKEY_CALL_OFF);
1267 vc_engine_outgoing_end_type event_data;
1269 memset(&event_data, 0, sizeof(event_data));
1270 event_data.call_handle = call_handle;
1271 event_data.end_cause_type = end_cause_type;
1272 event_data.bauto_redial = TRUE;
1273 vcall_engine_send_event_to_client(VC_ENGINE_MSG_OUTGOING_END_TO_UI, (void *)&event_data);
1275 __voicecall_core_handle_outgoingcall_end(pcall_core, call_handle, end_cause_type);
1280 case VC_CALL_OUTGOING_ABORTED:
1282 vc_engine_common_type event_data;
1284 memset(&event_data, 0, sizeof(event_data));
1286 vcall_engine_send_event_to_client(VC_ENGINE_MSG_OUTGOING_ABORTED_TO_UI, (void *)&event_data);
1290 case VC_CALL_DTMF_ACK:
1292 gboolean bsuccess = param1;
1293 CALL_ENG_DEBUG(ENG_DEBUG, "bsuccess:[%d]", bsuccess);
1294 __voicecall_core_handle_dtmf_ack(pcall_core, bsuccess);
1298 case VC_CALL_AUTO_REDIAL_CHECK:
1300 CALL_ENG_DEBUG(ENG_DEBUG, "Check it. Not used");
1304 case VC_CALL_SS_HELD:
1306 int call_handle = param1;
1307 vc_engine_common_type event_data;
1309 /* held popup shold not be displayed on outgoing popup */
1310 memset(&event_data, 0, sizeof(event_data));
1312 vcall_engine_send_event_to_client(VC_ENGINE_MSG_SS_HELD_TO_UI, (void *)&event_data);
1314 /*Send Event to Blue Tooth */
1315 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_HOLD, call_handle, NULL);
1319 case VC_CALL_SS_RETREIVED:
1321 int call_handle = param1;
1322 vc_engine_common_type event_data;
1324 /* held popup shold not be displayed on outgoing popup */
1325 memset(&event_data, 0, sizeof(event_data));
1326 vcall_engine_send_event_to_client(VC_ENGINE_MSG_SS_RETREIVED_TO_UI, (void *)&event_data);
1328 /*Send Event to Blue Tooth */
1329 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_RETRIEVE, call_handle, NULL);
1333 case VC_CALL_SS_SWAP:
1335 vc_engine_common_type event_data;
1337 int call_handle = param1;
1339 memset(&event_data, 0, sizeof(event_data));
1341 /* Show Call Swapped Message Box */
1342 vcall_engine_send_event_to_client(VC_ENGINE_MSG_SS_SWAP_TO_UI, (void *)&event_data);
1344 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_SWAPPED, call_handle, NULL);
1348 case VC_CALL_SS_SETUP_CONF:
1350 vc_engine_common_type event_data;
1352 memset(&event_data, 0, sizeof(event_data));
1354 /* Show Call Joined Message Box */
1355 vcall_engine_send_event_to_client(VC_ENGINE_MSG_SS_SETUP_CONF_TO_UI, (void *)&event_data);
1357 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_JOINED, 0, NULL);
1361 case VC_CALL_SS_SPLIT_CONF:
1363 vc_engine_common_with_handle_type event_data;
1364 int call_handle = param1;
1365 CALL_ENG_DEBUG(ENG_DEBUG, "The handle to be split is %d", call_handle);
1367 memset(&event_data, 0, sizeof(event_data));
1368 event_data.call_handle = call_handle;
1370 /* Show Private Call Message Box */
1371 vcall_engine_send_event_to_client(VC_ENGINE_MSG_SS_SPLIT_CONF_TO_UI, (void *)&event_data);
1375 case VC_CALL_SS_TRANSFERRED:
1377 vc_engine_common_type event_data;
1379 memset(&event_data, 0, sizeof(event_data));
1381 vcall_engine_send_event_to_client(VC_ENGINE_MSG_SS_TRANSFERRED_TO_UI, (void *)&event_data);
1385 case VC_CALL_SS_CONNECT_LINE_IND:
1387 int call_handle = param1;
1388 char *pconnected_number = (char *)param3;
1389 vc_engine_msg_box_type event_data;
1391 CALL_ENG_DEBUG(ENG_DEBUG, "call_handle : [%d]", call_handle);
1393 /* check whether Call Info for recevice Call Handle exists or not. */
1395 if ((pconnected_number != NULL) && (strlen(pconnected_number) > 0)) {
1396 CALL_ENG_DEBUG(ENG_DEBUG, "connected line ind : [%s]", pconnected_number);
1398 memset(&event_data, 0, sizeof(event_data));
1400 event_data.string_id = IDS_CALL_POP_CALL_IS_DIVERTED;
1401 _vc_core_util_strcpy(event_data.diverted_num, sizeof(event_data.diverted_num), pconnected_number);
1403 CALL_ENG_DEBUG(ENG_DEBUG, "No conneccted info");
1409 case VC_CALL_IND_FORWARD:
1411 vc_engine_ind_forward_type event_data;
1412 int fwd_type = param1;
1414 memset(&event_data, 0, sizeof(event_data));
1415 event_data.fwd_type = fwd_type;
1417 vcall_engine_send_event_to_client(VC_ENGINE_MSG_IND_FORWARD_TO_UI, (void *)&event_data);
1421 case VC_CALL_IND_ACTIVATE:
1423 vc_engine_common_type event_data;
1425 memset(&event_data, 0, sizeof(event_data));
1427 vcall_engine_send_event_to_client(VC_ENGINE_MSG_IND_ACTIVATE_TO_UI, (void *)&event_data);
1431 case VC_CALL_IND_HOLD:
1433 vc_engine_common_type event_data;
1434 int call_handle = param1;
1436 memset(&event_data, 0, sizeof(event_data));
1438 vcall_engine_send_event_to_client(VC_ENGINE_MSG_IND_HOLD_TO_UI, (void *)&event_data);
1440 /*Send Event to Blue Tooth */
1441 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_HOLD, call_handle, NULL);
1445 case VC_CALL_IND_TRANSFER:
1447 CALL_ENG_DEBUG(ENG_DEBUG, "Not used.");
1451 case VC_CALL_IND_SETUPCONFERENCE:
1453 CALL_ENG_DEBUG(ENG_DEBUG, "Not used.");
1457 case VC_CALL_IND_BARRING:
1459 vc_engine_common_type event_data;
1461 memset(&event_data, 0, sizeof(event_data));
1463 vcall_engine_send_event_to_client(VC_ENGINE_MSG_IND_BARRING_TO_UI, (void *)&event_data);
1467 case VC_CALL_IND_WAITING:
1469 vc_engine_common_type event_data;
1471 memset(&event_data, 0, sizeof(event_data));
1473 vcall_engine_send_event_to_client(VC_ENGINE_MSG_IND_WAITING_TO_UI, (void *)&event_data);
1477 case VC_CALL_IND_CUGINFO:
1479 CALL_ENG_DEBUG(ENG_DEBUG, "Not used.");
1483 case VC_CALL_IND_SSNOTIFY:
1485 vc_engine_ind_ssnotify_type event_data;
1486 int ss_type = param1;
1488 memset(&event_data, 0, sizeof(event_data));
1489 event_data.ss_type = ss_type;
1491 vcall_engine_send_event_to_client(VC_ENGINE_MSG_IND_SSNOTIFY_TO_UI, (void *)&event_data);
1495 case VC_CALL_IND_CALLINGNAMEINFO:
1497 CALL_ENG_DEBUG(ENG_DEBUG, "Not used.");
1500 case VC_CALL_IND_ACTIVATECCBS_CNF:
1502 CALL_ENG_DEBUG(ENG_DEBUG, "Not used.");
1506 case VC_CALL_IND_ACTIVATECCBS_USERINFO:
1508 CALL_ENG_DEBUG(ENG_DEBUG, "Not used.");
1512 case VC_CALL_IND_AOC:
1514 CALL_ENG_DEBUG(ENG_DEBUG, "Not yet.");
1518 case VC_ERROR_OCCURED:
1520 int error_code = param1;
1522 CALL_ENG_DEBUG(ENG_DEBUG, "error code:[%d]", error_code);
1523 switch (error_code) {
1524 case ERROR_VOICECALL_INVALID_DTMF_CHAR:
1525 case ERROR_VOICECALL_DTMF_FAILED:
1527 vc_engine_error_occured_type event_data;
1529 memset(&event_data, 0, sizeof(event_data));
1530 event_data.error_code = error_code;
1532 vcall_engine_send_event_to_client(VC_ENGINE_MSG_ERROR_OCCURED_TO_UI, (void *)&event_data);
1537 vc_engine_msg_box_type event_data;
1540 string_id = __voicecall_core_get_string_id_by_errorcode(error_code);
1542 memset(&event_data, 0, sizeof(event_data));
1543 event_data.string_id = __voicecall_core_get_string_id_by_errorcode(error_code);
1545 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
1552 case VC_ACTION_INCOM_FORCE:
1554 int call_handle = param1;
1555 vc_engine_common_with_handle_type event_data;
1557 CALL_ENG_DEBUG(ENG_DEBUG, "Call Handle = %d", call_handle);
1559 memset(&event_data, 0, sizeof(event_data));
1560 event_data.call_handle = call_handle;
1562 vcall_engine_send_event_to_client(VC_ENGINE_MSG_ACTION_INCOM_FORCE_TO_UI, (void *)&event_data);
1566 case VC_ACTION_SAT_REQUEST:
1568 if (SAT_RQST_SETUP_CALL == param1) {
1569 voicecall_sat_callinfo_t *psat_callinfo = (voicecall_sat_callinfo_t *) param3;
1570 vc_engine_outgoing_type event_data;
1572 if (psat_callinfo == NULL) {
1573 CALL_ENG_DEBUG(ENG_ERR, "psat_callinfo is NULL..");
1574 assert(psat_callinfo != NULL);
1576 CALL_ENG_DEBUG(ENG_DEBUG, "VC_ACTION_SAT_REQUEST is received by Voice call.");
1577 pcall_core->call_setup_info.call_setup_by = VC_CALL_SETUP_BY_SAT;
1578 pcall_core->call_setup_info.call_type = VC_CALL_ORIG_TYPE_SAT;
1581 _vc_core_util_strcpy(pcall_core->call_setup_info.source_tel_number, VC_PHONE_NUMBER_LENGTH_MAX, psat_callinfo->call_number);
1582 _vc_core_engine_extract_phone_number(pcall_core->call_setup_info.source_tel_number, pcall_core->call_setup_info.tel_number, VC_PHONE_NUMBER_LENGTH_MAX);
1585 CALL_ENG_DEBUG(ENG_ERR, "psat_callinfo->disp_text:[%s]", psat_callinfo->disp_text);
1587 memset(&event_data, 0, sizeof(event_data));
1588 _vc_core_util_strcpy(event_data.call_num, sizeof(event_data.call_num), pcall_core->call_setup_info.tel_number);
1589 event_data.contact_index = -1;
1590 event_data.phone_type = -1;
1591 event_data.bday_remaining_days = -1;
1592 _vc_core_util_strcpy(event_data.call_num, sizeof(event_data.call_num), psat_callinfo->disp_text);
1594 vcall_engine_send_event_to_client(VC_ENGINE_MSG_OUTGOING_TO_UI, (void *)&event_data);
1596 /*Get Icon Information */
1597 if (TRUE == psat_callinfo->bicon_present) { /*bicon_present is TRUE when SAT icon info available and when GCF is enabled */
1598 CALL_ENG_DEBUG(ENG_ERR, "SAT icon available.");
1601 /* Prepare and Make Call with the Give Information */
1602 if (FALSE == voicecall_core_setup_call(pcall_core, FALSE)) {
1603 /*Send Response to SAT Engine */
1604 voicecall_core_send_sat_response(pcall_core->pcall_engine, SAT_RQST_SETUP_CALL, CALL_VC_ME_UNABLE_TO_PROCESS_COMMAND);
1607 } else if (SAT_RQST_SEND_DTMF == param1) {
1608 voicecall_sat_callinfo_t *psat_callinfo = (voicecall_sat_callinfo_t *) param3;
1610 CALL_ENG_DEBUG(ENG_DEBUG, "SAT Send DTMF Number: %s, hidden: %d", psat_callinfo->call_number, psat_callinfo->bsat_hidden);
1611 __voicecall_core_queue_dtmf_string(pcall_core, psat_callinfo->call_number, TRUE);
1613 CALL_ENG_DEBUG(ENG_ERR, "Invalid SAT Request Type: %d", param2);
1618 case VC_ACTION_SAT_RESPONSE:
1620 if (SAT_RESP_SETUP_CALL == param1) {
1621 voicecall_sat_callinfo_t *psat_call_info = (voicecall_sat_callinfo_t *) param3;
1623 CALL_ENG_DEBUG(ENG_DEBUG, "sat_mo_call_ctrl_res = %d", psat_call_info->sat_mo_call_ctrl_res);
1625 if (CALL_NOT_ALLOWED == psat_call_info->sat_mo_call_ctrl_res) {
1626 vc_engine_msg_box_type event_data;
1628 memset(&event_data, 0, sizeof(event_data));
1629 event_data.string_id = IDS_CALL_POP_CALLNOTCALLOWED;
1630 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
1631 } else if (CALL_ALLOWED_WITH_MOD == psat_call_info->sat_mo_call_ctrl_res) {
1632 CALL_ENG_DEBUG(ENG_DEBUG, "psat_call_info->call_number = [%s]", psat_call_info->call_number);
1633 CALL_ENG_DEBUG(ENG_DEBUG, "psat_call_info->disp_text = [%s]", psat_call_info->disp_text);
1635 mocall_index = vcui_app_doc_get_mocall_index(papp_document);
1637 /*Update MO CALL Display Data with the SAT modified info */
1638 if (mocall_index != -1) {
1639 vcui_app_call_display_data_t display_data;
1640 vcui_app_call_display_data_t new_display_data;
1641 vcui_app_view_mo_state_t *pmo_state = NULL;
1643 if (FALSE == vcui_app_cdm_get_display_object_byindex(&papp_document->call_display_manager, mocall_index, &display_data)) {
1647 vcui_app_cdm_clear_display_object(&new_display_data);
1649 /*Copy all must parameters required for MO Call */
1650 new_display_data.call_handle = display_data.call_handle;
1651 new_display_data.call_index = display_data.call_index;
1652 new_display_data.call_type = display_data.call_type;
1653 new_display_data.start_time = display_data.start_time;
1654 new_display_data.used = display_data.used;
1656 if (strlen(psat_call_info->call_number) > 0) {
1657 vcui_app_util_strcpy(new_display_data.source_tel_number, sizeof(new_display_data.source_tel_number), psat_call_info->call_number);
1658 _vc_core_engine_extract_phone_number(new_display_data.source_tel_number, new_display_data.tel_number, VC_PHONE_NUMBER_LENGTH_MAX);
1661 if (strlen(psat_call_info->disp_text) > 0) {
1662 vcui_app_util_strcpy(new_display_data.name, sizeof(new_display_data.name), psat_call_info->disp_text);
1665 /*todo, Check whether contact search need to be done for the SAT modified number */
1667 /*Set the newly modified data to the CDM */
1668 vcui_app_cdm_set_display_object(pdisplay_mgr, &new_display_data);
1670 /*Update the MO View */
1671 pmo_state = (vcui_app_view_mo_state_t *) calloc(1, sizeof(vcui_app_view_mo_state_t));
1672 pmo_state->mo_call_state = VCUI_MO_CALL_STATE_UPDATE;
1674 /* Update MO Call Screen View to update the connection status */
1675 dv_view_manager_update_view(dv_document_get_view_manager(DV_DOCUMENT(papp_document)), VCUI_APP_VIEWID_MO_VIEW, VCUI_APP_UPD_MO_SET_STATE, pmo_state);
1678 VCUI_DEBUG(VCUI_LOG_ERR, "Invalid Mo Call Index: %d", mocall_index);
1681 } else if (CALL_CHANGED_TO_SS == psat_call_info->sat_mo_call_ctrl_res) {
1682 /*Issue notification to Launch SS */
1688 case VC_ACTION_CALL_END_HELD_RETREIVED:
1690 int call_handle = param1;
1691 vc_engine_common_with_handle_type event_data;
1693 CALL_ENG_DEBUG(ENG_DEBUG, "call handle:[%d]", call_handle);
1695 memset(&event_data, 0, sizeof(event_data));
1697 vcall_engine_send_event_to_client(VC_ENGINE_MSG_ACTION_CALL_END_HELD_RETREIVED_TO_UI, (void *)&event_data);
1701 case VC_ACTION_NO_ACTIVE_TASK:
1703 CALL_ENG_DEBUG(ENG_DEBUG, "Not yet.");
1707 case VC_CALL_GET_VOLUME_RESP:
1709 vc_engine_vol_resp_type event_data;
1711 CALL_ENG_DEBUG(ENG_DEBUG, "Current Voicecall (TAPI)Volume Type %d, Current Volume Level: %d", param1, param2);
1713 memset(&event_data, 0, sizeof(event_data));
1714 event_data.vol_alert_type = VOICE_CALL_VOL_TYPE_VOICE;
1715 event_data.vol_level = param2;
1716 vcall_engine_send_event_to_client(VC_ENGINE_MSG_GET_VOLUME_RESP_TO_UI, (void *)&event_data);
1720 case VC_CALL_NOTI_WBAMR:
1722 vc_engine_wbamr_status_type event_data;
1724 CALL_ENG_DEBUG(ENG_DEBUG, "Current WBAmr status %d", param1);
1726 memset(&event_data, 0, sizeof(event_data));
1727 event_data.bstatus = param1;
1728 vcall_engine_send_event_to_client(VC_ENGINE_MSG_NOTI_WBAMR_TO_UI, (void *)&event_data);
1733 CALL_ENG_DEBUG(ENG_DEBUG, " Engine Event ID : %d not handled", event);
1737 CALL_VC_DUMP_CALLDETAILS(&pcall_engine->call_manager);
1739 CALL_ENG_DEBUG(ENG_DEBUG, " Ended.");
1745 * This function converts Error Code to string id.
1748 * @param[in] error_code error code to be used to display the message content
1750 static int __voicecall_core_get_string_id_by_errorcode(int error_code)
1753 switch (error_code) {
1754 case ERROR_VOICECALL_DTMF_FAILED:
1755 string_id = IDS_CALL_POP_DTMFSENDING_FAIL;
1758 case ERROR_VOICECALL_CALL_NOT_ALLOWED:
1759 string_id = IDS_CALL_POP_CALLNOTCALLOWED;
1762 case ERROR_VOICECALL_CALL_IMPOSSIBLE_NOSIM_NOEMERGNUM:
1763 string_id = IDS_CALL_POP_SOS_CALL_ONLY_IN_NO_SIM_MODE;
1766 case ERROR_VOICECALL_EMERGENCY_CALLS_ONLY:
1767 string_id = IDS_CALL_POP_CALLING_EMERG_ONLY;
1770 case ERROR_VOICECALL_PHONE_NOT_INITIALIZED:
1771 string_id = IDS_CALL_POP_PHONE_NOT_INITIALISED;
1774 case ERROR_VOICECALL_ANSWER_FAILED:
1775 string_id = IDS_CALL_POP_CALLFAILED;
1778 case ERROR_VOICECALL_HOLD_REJECTED:
1779 case ERROR_VOICECALL_HOLD_FAILED:
1780 string_id = IDS_CALL_POP_HOLD_FAILED;
1783 case ERROR_VOICECALL_ACTIVATE_REJECTED:
1784 case ERROR_VOICECALL_RETREIVE_FAILED:
1785 string_id = IDS_CALL_POP_UNABLE_TO_RETRIEVE;
1788 case ERROR_VOICECALL_SWAP_REJECTED:
1789 case ERROR_VOICECALL_SWAP_FAILED:
1790 string_id = IDS_CALL_POP_SWAP_FAILED;
1793 case ERROR_VOICECALL_SPLIT_CONF_FAILED:
1794 string_id = IDS_CALL_POP_SPLIT_FAILED;
1797 case ERROR_VOICECALL_SETUP_CONF_FAILED:
1798 string_id = IDS_CALL_POP_JOIN_FAILED;
1801 case ERROR_VOICECALL_TRANSFER_FAILED:
1802 string_id = IDS_CALL_POP_TRANSFER_FAILED;
1805 case ERROR_VOICECALL_SWAP_NOT_SUPPORTED:
1806 string_id = IDS_CALL_POP_SWAP_NOT_SUPPORTED;
1809 case ERROR_VOICECALL_HOLD_NOT_SUPPORTED:
1810 string_id = IDS_CALL_POP_HOLD_NOT_SUPPORTED;
1813 case ERROR_VOICECALL_RETREIVE_NOT_SUPPORTED:
1814 string_id = IDS_CALL_POP_UNHOLD_NOT_SUPPORTED;
1817 case ERROR_VOICECALL_SETUP_CONF_NOT_SUPPORTED:
1818 string_id = IDS_CALL_POP_JOIN_NOT_SUPPORTED;
1821 case ERROR_VOICECALL_SPLIT_CONF_NOT_SUPPORTED:
1822 string_id = IDS_CALL_POP_SPLIT_NOT_SUPPORTED;
1824 case ERROR_VOICECALL_TRANSFER_NOT_SUPPORTED:
1825 string_id = IDS_CALL_POP_TRANSFER_NOT_SUPPORTED;
1828 case ERROR_VOICECALL_INCOMPLETE:
1829 string_id = IDS_CALL_POP_INCOMPLETE;
1832 case ERROR_VOICECALL_UNAVAILABLE:
1833 string_id = IDS_CALL_POP_UNAVAILABLE;
1836 case ERROR_VOICECALL_TAPI_CAUSE_CALL_FAILED:
1837 string_id = IDS_CALL_POP_CALLFAILED;
1840 case ERROR_VOICECALL_INVALID_CALL_TYPE:
1841 case ERROR_VOICECALL_INVALID_TELEPHONE_NUMBER:
1842 string_id = IDS_CALL_POP_CAUSE_WRONG_NUMBER;
1846 CALL_ENG_DEBUG(ENG_DEBUG, " Invalid Error Code: %x", error_code);
1847 string_id = IDS_CALL_POP_CALLFAILED;
1853 gboolean voicecall_core_set_to_default(call_vc_core_state_t *pcall_core)
1855 CALL_ENG_DEBUG(ENG_DEBUG, "");
1856 if (pcall_core->pcall_engine == NULL)
1859 /*Set Engine states to default */
1860 _vc_core_engine_set_to_default_values(pcall_core->pcall_engine);
1862 /*Initialize MO Call Setup Info */
1863 pcall_core->call_setup_info.mo_call_index = VC_TAPI_INVALID_CALLHANDLE;
1864 pcall_core->call_setup_info.call_setup_by = VC_CALL_SETUP_BY_NORMAL;
1866 pcall_core->call_setup_info.mo_call_index = VC_TAPI_INVALID_CALLHANDLE;
1867 pcall_core->call_setup_info.call_setup_by = VC_CALL_SETUP_BY_NORMAL;
1868 memset(pcall_core->call_setup_info.tel_number, 0, sizeof(pcall_core->call_setup_info.tel_number));
1870 pcall_core->mo_redial_timer = -1;
1871 __vc_core_set_auto_redial_count(pcall_core, 0);
1873 _vc_core_util_set_call_status(VCONFKEY_CALL_OFF);
1874 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_NONE, TRUE);
1876 pcall_core->bt_connected = _vc_bt_get_bt_status();
1877 if (FALSE == pcall_core->bt_connected) {
1878 voicecall_snd_set_path_status(pcall_core->papp_snd, VOICE_CALL_SND_PATH_RECEIVER_EARJACK);
1880 CALL_ENG_DEBUG(ENG_DEBUG, "BT connected, Not changing the sound status");
1884 voicecall_snd_unregister_cm(pcall_core->papp_snd);
1886 if (vconf_set_int(VCONFKEY_FACTORY_CALL_CONNECT_STATE, VCONFKEY_FACTORY_CALL_DISCONNECTED)) {
1887 CALL_ENG_DEBUG(ENG_ERR, "vconf_set_int failed.");
1893 static void __voicecall_core_mocall_reset_engine_state(voicecall_engine_t *pcall_engine)
1895 int eng_state = VC_INOUT_STATE_NONE;
1897 voicecall_core_get_engine_state(pcall_engine, &eng_state);
1899 CALL_ENG_DEBUG(ENG_DEBUG, "current engine state is: %d", eng_state);
1901 if ((eng_state > VC_INOUT_STATE_OUTGOING_START) && (eng_state < VC_INOUT_STATE_OUTGOING_END)) {
1902 voicecall_core_change_engine_state(pcall_engine, VC_INOUT_STATE_NONE);
1904 CALL_ENG_DEBUG(ENG_DEBUG, "Engine state is already changed, current engine state is: %d", eng_state);
1905 CALL_VC_DUMP_CALLDETAILS(&pcall_engine->call_manager);
1910 * This function initialize voicecall core
1912 * @return Returns TRUE on success or FALSE on failure
1913 * @param[in] pcall_core Handle to voicecall core
1914 * @param[in] pcallback_func callback function
1916 int voicecall_core_init(call_vc_core_state_t *pcall_core)
1918 voicecall_engine_t *pcall_engine = NULL;
1920 if (ERROR_VOICECALL_NONE != _vc_core_engine_init(&pcall_engine, (voicecall_cb) voicecall_core_cb, pcall_core)) {
1921 CALL_ENG_DEBUG(ENG_DEBUG, "Voicecall Engine Init Failed");
1925 if (FALSE == voicecall_snd_init(pcall_core, &pcall_core->papp_snd)) {
1926 CALL_ENG_DEBUG(ENG_DEBUG, "voicecall_snd_init() failed");
1929 /*Store Voicecall Engine Handle */
1930 pcall_core->pcall_engine = pcall_engine;
1932 _vc_bt_status_init(pcall_core);
1934 _voicecall_dvc_earjack_init(pcall_core);
1936 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_NONE, TRUE);
1941 * This function prepares a voice call with the given data
1943 * @return Returns TRUE on success or FALSE on failure
1944 * @param[in] pcall_core Handle to voicecall core
1945 * @param[in] bemergency emergency call or not from dialer
1948 gboolean voicecall_core_setup_call(call_vc_core_state_t *pcall_core, gboolean bemergency)
1950 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
1951 voicecall_setup_info_t setupcall_info = { 0, };
1952 voicecall_error_t error_code = -1;
1953 gboolean bemergency_call = FALSE;
1954 gboolean bmocall_exists = FALSE;
1955 gboolean bmtcall_exists = FALSE;
1958 CALL_ENG_DEBUG(ENG_DEBUG, "");
1960 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SOS_CALL_ONLY, bemergency);
1962 _vc_core_engine_status_isexists_call_bytype(pcall_engine, VC_OUTGOING_CALL, &bmocall_exists);
1963 if (TRUE == bmocall_exists) {
1964 CALL_ENG_DEBUG(ENG_DEBUG, "MO call is in progress...");
1965 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
1969 /*Ignore the MO Call, if already an Incoming call is in progress, MT Call is given high priority */
1970 _vc_core_engine_status_isexists_call_bytype(pcall_engine, VC_INCOMING_CALL, &bmtcall_exists);
1971 if (TRUE == bmtcall_exists) {
1972 CALL_ENG_DEBUG(ENG_DEBUG, "MT call is in progress");
1973 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
1977 if (TRUE == _vc_core_util_check_video_call_status()) {
1978 CALL_ENG_DEBUG(ENG_DEBUG, "Voice call is not allowed during video call...");
1979 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
1980 vc_engine_msg_box_type event_data;
1982 memset(&event_data, 0, sizeof(event_data));
1983 event_data.string_id = IDS_CALL_POP_VOICE_CALL_IS_NOT_ALLOWED_DURING_VIDEO_CALL;
1984 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
1989 if (TRUE == _vc_core_util_get_SAP_status()) {
1990 CALL_ENG_DEBUG(ENG_DEBUG, "SAP is on");
1991 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
1992 vc_engine_msg_box_type event_data;
1994 memset(&event_data, 0, sizeof(event_data));
1995 event_data.string_id = IDS_CALL_POP_UNAVAILABLE;
1996 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
2001 /*Prpare a call with the Voicecall Engine */
2002 setupcall_info.call_type = pcall_core->call_setup_info.call_type;
2003 _vc_core_util_strcpy(setupcall_info.source_tel_number, sizeof(setupcall_info.source_tel_number), pcall_core->call_setup_info.source_tel_number);
2004 _vc_core_util_strcpy(setupcall_info.tel_number, sizeof(setupcall_info.tel_number), pcall_core->call_setup_info.tel_number);
2006 /*Get CUG Details */
2007 _vc_core_util_get_cug_info(&setupcall_info);
2009 /*Get Identity Mode */
2010 _vc_core_util_get_identity_mode(&setupcall_info);
2012 CALL_ENG_DEBUG(ENG_DEBUG, "identity_mode = [%d], tel_number = [%s]", setupcall_info.identity_mode, setupcall_info.tel_number);
2014 error_code = _vc_core_engine_prepare_call(pcall_engine, &setupcall_info);
2015 if (ERROR_VOICECALL_NONE != error_code) {
2016 CALL_ENG_DEBUG(ENG_DEBUG, "_vc_core_engine_prepare_call failed, error code: %d", error_code);
2017 _vc_core_engine_finalize_call(pcall_engine, VC_OUTGOING_CALL, -1);
2018 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
2019 vc_engine_msg_box_type event_data;
2021 memset(&event_data, 0, sizeof(event_data));
2022 event_data.string_id = __voicecall_core_get_string_id_by_errorcode(error_code);
2023 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
2026 pcall_core->call_setup_info.call_type = setupcall_info.call_type;
2027 CALL_ENG_DEBUG(ENG_DEBUG, "call_type:[%d]", pcall_core->call_setup_info.call_type);
2029 pcall_core->call_setup_info.mo_call_index = setupcall_info.mo_call_index;
2030 if (TRUE == _vc_core_util_is_offline_mode()) {
2031 _vc_core_engine_finalize_call(pcall_engine, VC_OUTGOING_CALL, -1);
2032 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
2034 vc_engine_msg_box_type event_data;
2036 memset(&event_data, 0, sizeof(event_data));
2037 event_data.string_id = IDS_CALL_POP_CHANGEOFFLINEMODETOCALL;
2038 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
2042 /* Check for Following Conditions , only if not emergency Number */
2043 CALL_ENG_DEBUG(ENG_DEBUG, "mo_call_index = [%d]", setupcall_info.mo_call_index);
2044 error_code = _vc_core_engine_status_check_emergency_byindex(pcall_engine, setupcall_info.mo_call_index, &bemergency_call);
2045 if (ERROR_VOICECALL_NONE != error_code) {
2046 CALL_ENG_DEBUG(ENG_DEBUG, "Emergency Check Error code: %d", error_code);
2050 if (TRUE == _vc_core_util_is_pwlock()) {
2051 CALL_ENG_DEBUG(ENG_DEBUG, "PwLock is enabled.");
2052 if (bemergency_call == FALSE) {
2053 CALL_ENG_DEBUG(ENG_DEBUG, "Only emergency call is possible.");
2054 _vc_core_engine_finalize_call(pcall_engine, VC_OUTGOING_CALL, -1);
2055 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
2057 vc_engine_msg_box_type event_data;
2058 memset(&event_data, 0, sizeof(event_data));
2059 event_data.string_id = IDS_CALL_POP_CALLING_EMERG_ONLY;
2060 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
2066 /*Check for the following cases, if the call is not emergency call */
2067 if (FALSE == bemergency_call) {
2068 vc_engine_msg_box_type event_data;
2070 memset(&event_data, 0, sizeof(event_data));
2071 /* Check for NW Status and Emergency Mode */
2072 if (FALSE == _vc_core_util_get_nw_status(&nw_status)) {
2073 CALL_ENG_DEBUG(ENG_DEBUG, "Can't get a network status...");
2074 _vc_core_engine_finalize_call(pcall_engine, VC_OUTGOING_CALL, -1);
2076 event_data.string_id = IDS_CALL_POP_CALLNOTCALLOWED;
2077 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
2079 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
2082 if ((VCONFKEY_TELEPHONY_SVCTYPE_NONE == nw_status) || (VCONFKEY_TELEPHONY_SVCTYPE_NOSVC == nw_status) || (VCONFKEY_TELEPHONY_SVCTYPE_SEARCH == nw_status)) {
2083 CALL_ENG_DEBUG(ENG_DEBUG, "No Service: Call not Allowed");
2084 _vc_core_engine_finalize_call(pcall_engine, VC_OUTGOING_CALL, -1);
2085 event_data.string_id = IDS_CALL_POP_CALLNOTCALLOWED;
2086 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
2088 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
2090 } else if ((VCONFKEY_TELEPHONY_SVCTYPE_EMERGENCY == nw_status)) {
2091 CALL_ENG_DEBUG(ENG_DEBUG, "Emergency mode: Emergency call only...");
2092 _vc_core_engine_finalize_call(pcall_engine, VC_OUTGOING_CALL, -1);
2093 event_data.string_id = IDS_CALL_POP_CALLING_EMERG_ONLY;
2094 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
2096 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
2104 /*Check for voicemail number if it is not an emergency call */
2107 CALL_ENG_DEBUG(ENG_DEBUG, "MO Call Setup OVer");
2109 if (_vc_bt_get_bt_status() == TRUE) {
2110 voicecall_snd_set_path_status(pcall_core->papp_snd, VOICE_CALL_SND_PATH_BT);
2113 voicecall_core_make_call(pcall_core);
2119 * This function makes the actual voicecall prepared by the #voicecall_core_setup_call
2121 * @return Returns TRUE on success or FALSE on failure
2122 * @param[in] pcall_core Handle to voicecall core
2124 gboolean voicecall_core_make_call(call_vc_core_state_t *pcall_core)
2126 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2128 voicecall_error_t error_code = ERROR_VOICECALL_NONE;
2129 int call_handle = -1;
2131 CALL_ENG_DEBUG(ENG_DEBUG, "");
2133 /*Make Actual Call with Voicecall Engine */
2134 error_code = _vc_core_engine_make_call(pcall_engine, pcall_core->call_setup_info.mo_call_index, &call_handle);
2135 if (ERROR_VOICECALL_NONE != error_code) {
2136 vc_engine_msg_box_type event_data;
2138 memset(&event_data, 0, sizeof(event_data));
2140 _vc_core_engine_finalize_call(pcall_engine, VC_OUTGOING_CALL, -1);
2142 CALL_ENG_DEBUG(ENG_DEBUG, "_vc_core_engine_make_call Failed: Error_Code: %d..", error_code);
2144 switch (error_code) {
2145 case ERROR_VOICECALL_TAPI_CAUSE_CALL_FAILED:
2146 event_data.string_id = IDS_CALL_POP_CALLFAILED;
2149 case ERROR_VOICECALL_CALL_IMPOSSIBLE_NOSIM_NOEMERGNUM:
2150 event_data.string_id = IDS_CALL_POP_CALLFAILED;
2154 event_data.string_id = IDS_CALL_BODY_CALLENDED;
2157 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
2162 CALL_ENG_DEBUG(ENG_DEBUG, "Call Handle After Setup Call %d.", call_handle);
2164 voicecall_snd_register_cm(pcall_core->papp_snd);
2166 /* Set phonestatus value */
2167 _vc_core_util_set_call_status(VCONFKEY_CALL_VOICE_CONNECTING);
2173 * This function processed sat setup call
2175 * @return Returns TRUE on success or FALSE on failure
2176 * @param[in] pcall_core Handle to voicecall core
2179 gboolean voicecall_core_process_sat_setup_call(vcall_engine_sat_setup_call_info_t *sat_setup_call_info)
2181 CALL_ENG_DEBUG(ENG_DEBUG, "");
2182 TelSatSetupCallIndCallData_t *SatSetupCallIndCallInfo = NULL;
2184 SatSetupCallIndCallInfo = (TelSatSetupCallIndCallData_t *) calloc(1, sizeof(TelSatSetupCallIndCallData_t));
2185 if (NULL == SatSetupCallIndCallInfo)
2188 SatSetupCallIndCallInfo->commandId = sat_setup_call_info->command_id;
2189 SatSetupCallIndCallInfo->calltype = sat_setup_call_info->command_qualifier;
2190 SatSetupCallIndCallInfo->dispText.stringLen = strlen(sat_setup_call_info->disp_text);
2191 memcpy(SatSetupCallIndCallInfo->dispText.string, sat_setup_call_info->disp_text, strlen(sat_setup_call_info->disp_text));
2193 SatSetupCallIndCallInfo->callNumber.stringLen = strlen(sat_setup_call_info->call_num);
2194 memcpy(SatSetupCallIndCallInfo->callNumber.string, sat_setup_call_info->call_num, strlen(sat_setup_call_info->call_num));
2196 SatSetupCallIndCallInfo->duration = sat_setup_call_info->duration;
2198 _vc_core_engine_handle_sat_events_cb(SatSetupCallIndCallInfo, NULL);
2200 if (SatSetupCallIndCallInfo) {
2201 free(SatSetupCallIndCallInfo);
2202 SatSetupCallIndCallInfo = NULL;
2205 CALL_ENG_DEBUG(ENG_DEBUG, "End..");
2211 * This function processed incoming call
2213 * @return Returns TRUE on success or FALSE on failure
2214 * @param[in] pcall_core Handle to voicecall core
2217 gboolean voicecall_core_process_incoming_call(call_vc_core_incoming_info_t *incoming_call_info)
2219 CALL_ENG_DEBUG(ENG_DEBUG, "");
2220 TelCallIncomingCallInfo_t *IncomingCallInfo = NULL;
2222 CALL_ENG_DEBUG(ENG_DEBUG, " number is : [%s]", incoming_call_info->call_num);
2224 IncomingCallInfo = (TelCallIncomingCallInfo_t *) malloc(sizeof(TelCallIncomingCallInfo_t));
2225 if (NULL == IncomingCallInfo)
2227 memset(IncomingCallInfo, 0, sizeof(IncomingCallInfo));
2229 IncomingCallInfo->CallHandle = incoming_call_info->call_handle;
2230 IncomingCallInfo->CallType = incoming_call_info->call_type;
2231 IncomingCallInfo->CliPresentationIndicator = incoming_call_info->cli_presentation_indicator;
2232 _vc_core_util_strcpy(IncomingCallInfo->szCallingPartyNumber, sizeof(IncomingCallInfo->szCallingPartyNumber), incoming_call_info->call_num);
2233 IncomingCallInfo->CallingNameInfo.NameMode = incoming_call_info->calling_name_mode;
2234 _vc_core_util_strcpy(IncomingCallInfo->CallingNameInfo.szNameData, sizeof(IncomingCallInfo->CallingNameInfo.szNameData), incoming_call_info->calling_name);
2235 _vc_core_util_strcpy(IncomingCallInfo->RedirectInfo.szRedirectedNumber, sizeof(IncomingCallInfo->RedirectInfo.szRedirectedNumber), incoming_call_info->redirected_number);
2236 _vc_core_util_strcpy(IncomingCallInfo->RedirectInfo.szRedirectSubAddress, sizeof(IncomingCallInfo->RedirectInfo.szRedirectSubAddress), incoming_call_info->redirected_sub_address);
2237 IncomingCallInfo->CliCause = incoming_call_info->cli_cause;
2238 IncomingCallInfo->fwded = incoming_call_info->bfwded;
2239 IncomingCallInfo->ActiveLine = incoming_call_info->active_line;
2241 _vc_core_engine_handle_incoming_tapi_events(IncomingCallInfo, NULL);
2243 if (IncomingCallInfo) {
2244 free(IncomingCallInfo);
2245 IncomingCallInfo = NULL;
2248 CALL_ENG_DEBUG(ENG_DEBUG, "End..");
2254 * This function answers an incoming call
2256 * @return Returns TRUE on success or FALSE on failure
2257 * @param[in] pcall_core Handle to voicecall core
2260 gboolean voicecall_core_answer_call(call_vc_core_state_t *pcall_core, gboolean auto_accept)
2262 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2264 gboolean active_calls = FALSE;
2265 gboolean held_calls = FALSE;
2267 CALL_ENG_DEBUG(ENG_DEBUG, "");
2269 /*First Stop the Incoming alert */
2270 voicecall_snd_stop_alert(pcall_core->papp_snd);
2272 __voicecall_core_cancel_auto_answer(pcall_core);
2274 _vc_core_engine_status_isexists_any_call(pcall_engine, &active_calls, &held_calls);
2275 CALL_ENG_DEBUG(ENG_DEBUG, "active_calls=%d, held_calls=%d", active_calls, held_calls);
2277 if (TRUE == active_calls && TRUE == held_calls) {
2278 /* Both Active and held calls available, so show Accept Call Choice Box */
2279 vc_engine_accept_choice_box_type event_data;
2281 memset(&event_data, 0, sizeof(event_data));
2282 event_data.choice = VC_CALL_ACCEPT_2;
2284 vcall_engine_send_event_to_client(VC_ENGINE_MSG_ACCEPT_CHOICE_BOX_TO_UI, (void *)&event_data);
2287 } else if (TRUE == active_calls) {
2288 /*If Auto Accpet is FALSE, show popup for manual accept */
2289 if (FALSE == auto_accept) {
2290 /* Active calls available, so show Accept Call Choice Box */
2291 vc_engine_accept_choice_box_type event_data;
2293 memset(&event_data, 0, sizeof(event_data));
2294 event_data.choice = VC_CALL_ACCEPT_1;
2296 vcall_engine_send_event_to_client(VC_ENGINE_MSG_ACCEPT_CHOICE_BOX_TO_UI, (void *)&event_data);
2298 voicecall_core_answer_call_bytype(pcall_core, VC_ANSWER_HOLD_ACTIVE_AND_ACCEPT);
2301 } else if (TRUE == held_calls) {
2302 /* vcui_app_view_mtcall_destroy(papp_document); */
2305 /* Normal Call Scenario */
2306 voicecall_core_answer_call_bytype(pcall_core, VC_ANSWER_NORMAL);
2312 * This function answers an incoming call according to the given type
2314 * @return Returns TRUE -if answer is sucess, FALSE - otherwise
2315 * @param[in] pcall_core Handle to voicecall core
2317 gboolean voicecall_core_answer_call_bytype(call_vc_core_state_t *pcall_core, voicecall_answer_type_t answer_type)
2319 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2321 voicecall_error_t error_code = ERROR_VOICECALL_NONE;
2323 CALL_ENG_DEBUG(ENG_DEBUG, "answer type: %d", answer_type);
2325 /*First Stop the Incoming alert */
2326 voicecall_snd_stop_alert(pcall_core->papp_snd);
2327 __voicecall_core_cancel_auto_answer(pcall_core);
2329 error_code = _vc_core_engine_answer_call(pcall_engine, answer_type);
2331 if (ERROR_VOICECALL_NONE != error_code) {
2332 CALL_ENG_DEBUG(ENG_ERR, "_vc_core_engine_answer_call Failed : %d", error_code);
2340 * This function rejects an incoming call
2342 * @return Returns TRUE on success or FALSE on failure
2343 * @param[in] pcall_core Handle to voicecall core
2344 * @param[in] bUDUB TRUE - set UDUB, FALSE - reject call
2346 gboolean voicecall_core_reject_mt(call_vc_core_state_t *pcall_core, gboolean bUDUB)
2348 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2349 voicecall_snd_mgr_t *papp_snd = pcall_core->papp_snd;
2351 voicecall_error_t error_code = ERROR_VOICECALL_NONE;
2353 CALL_ENG_DEBUG(ENG_DEBUG, "");
2355 /*Incoming call rejected, reset the accept by flag */
2356 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_ACCEPT_BY_BT, FALSE);
2358 /* Stop Incmoing Call Alert */
2359 voicecall_snd_stop_alert(papp_snd);
2361 __voicecall_core_cancel_auto_answer(pcall_core);
2363 CALL_ENG_DEBUG(ENG_DEBUG, "bUDUB = %d", bUDUB);
2364 error_code = _vc_core_engine_reject_call(pcall_engine, bUDUB);
2366 if (ERROR_VOICECALL_NONE != error_code) {
2367 CALL_ENG_DEBUG(ENG_ERR, "_vc_core_engine_reject_call Failed, error_code = %ud", error_code);
2376 * This function ends the call by state
2378 * @return Returns TRUE on success or FALSE on failure
2379 * @param[in] pcall_core Handle to voicecall core
2381 gboolean voicecall_core_end_call(call_vc_core_state_t *pcall_core)
2383 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2385 CALL_ENG_DEBUG(ENG_DEBUG, "");
2387 return (ERROR_VOICECALL_NONE == _vc_core_engine_end_call(pcall_engine, VC_END_ACTIVE_OR_HELD_CALLS)) ? TRUE : FALSE;
2391 * This function ends the call corresponding to the given call handle
2393 * @return Returns TRUE on success or FALSE on failure
2394 * @param[in] pcall_core Handle to voicecall core
2395 * @param[in] call_handle handle of the call to be ended
2397 gboolean voicecall_core_end_call_by_handle(call_vc_core_state_t *pcall_core, int call_handle)
2399 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2401 CALL_ENG_DEBUG(ENG_DEBUG, "");
2403 return (ERROR_VOICECALL_NONE == _vc_core_engine_end_call_byhandle(pcall_engine, call_handle)) ? TRUE : FALSE;
2407 * This function ends all available calls
2409 * @return Returns TRUE on success or FALSE on failure
2410 * @param[in] pcall_core Handle to voicecall core
2412 gboolean voicecall_core_end_all_calls(call_vc_core_state_t *pcall_core)
2414 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2416 CALL_ENG_DEBUG(ENG_DEBUG, "");
2418 return (ERROR_VOICECALL_NONE == _vc_core_engine_end_call(pcall_engine, VC_END_ALL_CALLS)) ? TRUE : FALSE;
2422 * This function ends all available active calls
2424 * @return Returns TRUE on success or FALSE on failure
2425 * @param[in] pcall_core Handle to voicecall core
2427 gboolean voicecall_core_end_all_active_calls(call_vc_core_state_t *pcall_core)
2429 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2431 CALL_ENG_DEBUG(ENG_DEBUG, "");
2433 return (ERROR_VOICECALL_NONE == _vc_core_engine_end_call(pcall_engine, VC_END_ALL_ACTIVE_CALLS)) ? TRUE : FALSE;
2437 * This function ends all available held calls
2439 * @return Returns TRUE on success or FALSE on failure
2440 * @param[in] pcall_core Handle to voicecall core
2442 gboolean voicecall_core_end_all_held_calls(call_vc_core_state_t *pcall_core)
2444 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2446 CALL_ENG_DEBUG(ENG_DEBUG, "");
2448 return (ERROR_VOICECALL_NONE == _vc_core_engine_end_call(pcall_engine, VC_END_ALL_HELD_CALLS)) ? TRUE : FALSE;
2452 * This function cancel outgoing call
2454 * @return Returns TRUE -if answer is sucess, FALSE - otherwise
2455 * @param[in] pcall_core Handle to voicecall core
2457 gboolean voicecall_core_cancel_call(call_vc_core_state_t *pcall_core)
2460 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2462 voicecall_call_type_bysetup_t call_setup_by = VC_CALL_SETUP_BY_NORMAL;
2464 CALL_ENG_DEBUG(ENG_DEBUG, "");
2466 /*Get Call Setup by Information */
2467 call_setup_by = pcall_core->call_setup_info.call_setup_by;
2469 _vc_core_engine_status_get_engine_iostate(pcall_engine, &io_state);
2472 case VC_INOUT_STATE_OUTGOING_WAIT_HOLD:
2474 int call_handle = -1;
2476 if (VC_CALL_SETUP_BY_SAT == call_setup_by) {
2477 _vc_core_engine_send_sat_response(pcall_engine, SAT_RQST_SETUP_CALL, CALL_VC_ME_CLEAR_DOWN_BEFORE_CONN);
2480 /* Clear the MO Call, since the call is not dialed yet */
2481 _vc_core_engine_status_get_call_handle_bytype(pcall_engine, VC_OUTGOING_CALL, &call_handle);
2482 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_END, call_handle, NULL);
2484 __vc_core_set_auto_redial_count(pcall_core, 0);
2485 voicecall_core_clear_mo_call(pcall_engine);
2487 _vc_core_engine_change_engine_iostate(pcall_engine, VC_INOUT_STATE_OUTGOING_ABORTED);
2491 case VC_INOUT_STATE_OUTGOING_WAIT_ORIG:
2492 case VC_INOUT_STATE_OUTGOING_WAIT_ALERT:
2493 case VC_INOUT_STATE_OUTGOING_WAIT_CONNECTED:
2495 /*To retrieve the held call automatically once the mo call is ended, if held is call is available */
2496 _vc_core_engine_status_set_end_flag(pcall_engine, VC_RETREIVE_CALL_ON_MOCALL_END);
2498 /* release the call , since it is dialed and waiting for connecting */
2499 if (FALSE == voicecall_core_end_mo_call(pcall_engine)) {
2500 CALL_ENG_DEBUG(ENG_DEBUG, "MO Call Release Failed");
2502 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_MOCALL_END_BY_USER, TRUE);
2503 _vc_core_engine_change_engine_iostate(pcall_engine, VC_INOUT_STATE_OUTGOING_WAIT_RELEASE);
2508 case VC_INOUT_STATE_OUTGOING_WAIT_RELEASE:
2510 /*Call already released */
2511 CALL_ENG_DEBUG(ENG_DEBUG, "MO Call has been released already");
2515 case VC_INOUT_STATE_OUTGOING_SHOW_REDIALCAUSE:
2516 case VC_INOUT_STATE_OUTGOING_ABORTED:
2517 case VC_INOUT_STATE_OUTGOING_WAIT_REDIAL:
2519 int call_handle = -1;
2521 if (VC_CALL_SETUP_BY_SAT == call_setup_by) {
2522 _vc_core_engine_send_sat_response(pcall_engine, SAT_RQST_SETUP_CALL, CALL_VC_NETWORK_UNABLE_TO_PROCESS_COMMAND);
2525 /*Stop Signal Play */
2526 voicecall_snd_stop_signal(pcall_core->papp_snd);
2528 __voicecall_core_mocall_reset_engine_state(pcall_engine);
2530 _vc_core_engine_status_get_call_handle_bytype(pcall_engine, VC_OUTGOING_CALL, &call_handle);
2531 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_END, call_handle, NULL);
2533 __vc_core_set_auto_redial_count(pcall_core, 0);
2534 voicecall_core_clear_mo_call(pcall_engine);
2540 CALL_ENG_DEBUG(ENG_DEBUG, "Action not defined for this IO State: %d", io_state);
2548 * This function process hold/retrive/swap conntected call
2550 * @return Returns TRUE -if answer is sucess, FALSE - otherwise
2551 * @param[in] pcall_core Handle to voicecall core
2553 gboolean voicecall_core_process_hold_call(call_vc_core_state_t *pcall_core)
2555 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2557 gboolean active_calls = FALSE;
2558 gboolean held_calls = FALSE;
2560 CALL_ENG_DEBUG(ENG_DEBUG, "");
2562 if (TRUE == voicecall_core_get_status(pcall_core, CALL_VC_CORE_FLAG_SOS_CALL_ONLY)) {
2563 CALL_ENG_DEBUG(ENG_DEBUG, "SOS Call... Ignore this button...");
2567 if (FALSE == voicecall_core_is_incall_request_possible(pcall_engine)) {
2571 voicecall_core_is_call_exists(pcall_engine, &active_calls, &held_calls);
2572 CALL_ENG_DEBUG(ENG_DEBUG, "active calls: %d, held calls: %d", active_calls, held_calls);
2574 if (active_calls && held_calls) {
2576 /*Both Calls available, swap the calls */
2577 if (FALSE == voicecall_core_swap_calls(pcall_engine)) {
2580 } else if (active_calls) {
2581 /*Only activa call available, hold the call */
2582 if (FALSE == voicecall_core_hold_call(pcall_engine)) {
2585 } else if (held_calls) {
2586 /*Only Held call available, retrieve the call */
2587 if (FALSE == voicecall_core_retrieve_call(pcall_engine)) {
2591 CALL_ENG_DEBUG(ENG_DEBUG, "no call exists!");
2599 * This function sets up a conference call
2601 * @return Returns TRUE on success or FALSE on failure
2602 * @param[in] pcall_core Handle to voicecall core
2604 gboolean voicecall_core_setup_conference(call_vc_core_state_t *pcall_core)
2606 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2608 CALL_ENG_DEBUG(ENG_DEBUG, "");
2610 return (ERROR_VOICECALL_NONE == _vc_core_engine_setup_conference(pcall_engine)) ? TRUE : FALSE;
2614 * This function splits the call corressponding to the given call handle and makes a private call
2616 * @return Returns TRUE on success or FALSE on failure
2617 * @param[in] pcall_core Handle to voicecall core
2618 * @param[in] call_handle Call to be splitted from the conference call
2620 gboolean voicecall_core_make_private_call(call_vc_core_state_t *pcall_core, int call_handle)
2622 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2624 CALL_ENG_DEBUG(ENG_DEBUG, "");
2626 return (ERROR_VOICECALL_NONE == _vc_core_engine_private_call(pcall_engine, call_handle)) ? TRUE : FALSE;
2630 * This function transfers the call from active call to the held call
2632 * @return Returns TRUE on success or FALSE on failure
2633 * @param[in] pcall_core Handle to voicecall core
2635 gboolean voicecall_core_transfer_calls(call_vc_core_state_t *pcall_core)
2637 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2639 CALL_ENG_DEBUG(ENG_DEBUG, "");
2641 return (ERROR_VOICECALL_NONE == _vc_core_engine_transfer_calls(pcall_engine)) ? TRUE : FALSE;
2645 * This function sends a dtmf string
2647 * @return Returns TRUE on success or FALSE on failure
2648 * @param[in] pcall_core Handle to voicecall core
2649 * @param[in] dtmf_string dtmf string to be sent
2651 gboolean voicecall_core_send_dtmf(call_vc_core_state_t *pcall_core, char *dtmf_string)
2653 voicecall_error_t error_code = ERROR_VOICECALL_NONE;
2654 CALL_ENG_DEBUG(ENG_DEBUG, "dtmf string: %s", dtmf_string);
2656 pcall_core->bdtmf_queue = FALSE;
2657 error_code = _vc_core_engine_send_dtmf(pcall_core->pcall_engine, dtmf_string);
2658 return (ERROR_VOICECALL_NONE == error_code) ? TRUE : FALSE;
2662 * This function stops sound alert in case of reject with msg
2664 * @return Returns TRUE on success or FALSE on failure
2665 * @param[in] pcall_core Handle to voicecall core
2667 gboolean voicecall_core_stop_alert(call_vc_core_state_t *pcall_core)
2669 CALL_ENG_DEBUG(ENG_DEBUG, "");
2671 /* Stop Incmoing Call Alert */
2672 voicecall_snd_stop_alert(pcall_core->papp_snd);
2677 inline gboolean voicecall_core_get_mo_call_handle(call_vc_core_state_t *pcall_core, int *pcall_handle)
2680 return (ERROR_VOICECALL_NONE == _vc_core_engine_status_get_call_handle_bytype(pcall_core->pcall_engine, VC_OUTGOING_CALL, pcall_handle)) ? TRUE : FALSE;
2683 inline int voicecall_core_get_auto_redial_count(call_vc_core_state_t *pcall_core)
2685 return pcall_core->auto_redial_count;
2688 void __vc_core_set_auto_redial_count(call_vc_core_state_t *pcall_core, int auto_redial_count)
2690 pcall_core->auto_redial_count = auto_redial_count;
2693 gboolean voicecall_core_start_redial(call_vc_core_state_t *pcall_core, int manual_redial)
2695 int auto_redial_status = FALSE;
2696 int redial_count = 1;
2697 int call_handle = -1;
2698 int total_call_member = 0;
2700 CALL_ENG_DEBUG(ENG_DEBUG, "");
2701 CALL_ENG_DEBUG(ENG_DEBUG, "auto_redial_status:[%d]", auto_redial_status);
2703 redial_count = voicecall_core_get_auto_redial_count(pcall_core);
2708 bmanual_redial == TRUE : Redial is made by User, No need to check the auto redial status and count
2709 auto_redial_status == 1: Auto Redial for GCF case, auto redial count must be checked
2711 if ((1 == manual_redial) || ((auto_redial_status == 1) && (redial_count < MO_REDIAL_COUNT_MAX))) {
2712 CALL_ENG_DEBUG(ENG_DEBUG, "redial_count = %d", redial_count);
2714 /*Start Redial Timer */
2715 if (1 == redial_count) {
2716 CALL_ENG_DEBUG(ENG_DEBUG, "MO_REDIAL_TIMER_INTERVAL_FIRST");
2717 pcall_core->mo_redial_timer = g_timeout_add(MO_REDIAL_TIMER_INTERVAL_FIRST, mo_redial_timer_cb, pcall_core);
2718 } else if ((redial_count > 1) && (redial_count < 5)) {
2719 CALL_ENG_DEBUG(ENG_DEBUG, "MO_REDIAL_TIMER_INTERVAL_SECOND");
2720 pcall_core->mo_redial_timer = g_timeout_add(MO_REDIAL_TIMER_INTERVAL_SECOND, mo_redial_timer_cb, pcall_core);
2722 CALL_ENG_DEBUG(ENG_DEBUG, "MO_REDIAL_TIMER_INTERVAL_THIRD");
2723 pcall_core->mo_redial_timer = g_timeout_add(MO_REDIAL_TIMER_INTERVAL_THIRD, mo_redial_timer_cb, pcall_core);
2726 voicecall_core_change_engine_state(pcall_core->pcall_engine, VC_INOUT_STATE_OUTGOING_WAIT_REDIAL);
2728 CALL_ENG_DEBUG(ENG_DEBUG, "You dont need to redial close the MO Call Things");
2730 /* __vcui_app_view_mo_canceltimer_cb() */
2731 _vc_core_engine_status_get_call_handle_bytype(pcall_core->pcall_engine, VC_OUTGOING_CALL, &call_handle);
2732 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_END, call_handle, NULL);
2734 __vc_core_set_auto_redial_count(pcall_core, 0);
2735 voicecall_core_clear_mo_call(pcall_core->pcall_engine);
2737 __voicecall_core_mocall_reset_engine_state(pcall_core->pcall_engine);
2739 voicecall_core_get_total_call_member(pcall_core->pcall_engine, &total_call_member);
2741 voicecall_snd_stop_signal(pcall_core->papp_snd);
2743 /* If No Connected Calls End the UI */
2744 if (total_call_member == 0) {
2745 /*Reset voice call core to default values */
2746 voicecall_core_set_to_default(pcall_core);
2748 voicecall_snd_change_path(pcall_core->papp_snd);
2756 inline gboolean voicecall_core_prepare_redial(call_vc_core_state_t *pcall_core, int call_handle)
2758 voicecall_error_t error_code = ERROR_VOICECALL_NONE;
2760 CALL_ENG_DEBUG(ENG_DEBUG, "");
2762 error_code = _vc_core_engine_prepare_redial(pcall_core->pcall_engine, call_handle);
2764 CALL_ENG_DEBUG(ENG_DEBUG, "_vc_core_engine_prepare_redial returned : %d", error_code);
2766 return (ERROR_VOICECALL_NONE == error_code) ? TRUE : FALSE;
2769 gboolean mo_redial_timer_cb(void *data)
2771 int call_handle = -1;
2774 CALL_ENG_DEBUG(ENG_DEBUG, "mo_redial_timer_cb");
2775 call_vc_core_state_t *pcall_core = (call_vc_core_state_t *)data;
2776 voicecall_core_get_mo_call_handle(pcall_core, &call_handle);
2777 CALL_ENG_DEBUG(ENG_DEBUG, "call handle is %d", call_handle);
2779 redial_count = voicecall_core_get_auto_redial_count(pcall_core);
2781 __vc_core_set_auto_redial_count(pcall_core, redial_count);
2783 CALL_ENG_DEBUG(ENG_DEBUG, "redial_count:[%d]", redial_count);
2785 voicecall_core_prepare_redial(pcall_core, call_handle);
2786 CALL_ENG_DEBUG(ENG_DEBUG, "voicecall_core_prepare_redial done.");
2788 voicecall_core_make_call(pcall_core);
2792 gboolean voicecall_core_stop_redial(call_vc_core_state_t *pcall_core)
2794 int call_handle = -1, total_call_member = -1;
2796 CALL_ENG_DEBUG(ENG_DEBUG, "coming inside voicecall_core_stop_redial");
2798 _vc_core_util_set_call_status(VCONFKEY_CALL_OFF);
2800 /*Cancel the Redial Timer */
2801 if (pcall_core->mo_redial_timer != -1) {
2802 CALL_ENG_DEBUG(ENG_DEBUG, "mo_redial_timer removing..");
2803 g_source_remove(pcall_core->mo_redial_timer);
2804 pcall_core->mo_redial_timer = -1;
2807 /* __vcui_app_view_mo_canceltimer_cb() */
2808 _vc_core_engine_status_get_call_handle_bytype(pcall_core->pcall_engine, VC_OUTGOING_CALL, &call_handle);
2809 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_END, call_handle, NULL);
2811 __vc_core_set_auto_redial_count(pcall_core, 0);
2812 voicecall_core_clear_mo_call(pcall_core->pcall_engine);
2814 __voicecall_core_mocall_reset_engine_state(pcall_core->pcall_engine);
2816 voicecall_core_get_total_call_member(pcall_core->pcall_engine, &total_call_member);
2818 voicecall_snd_stop_signal(pcall_core->papp_snd);
2820 /* If No Connected Calls End the UI */
2821 if (total_call_member == 0) {
2822 /*Reset voice call core to default values */
2823 voicecall_core_set_to_default(pcall_core);
2825 voicecall_snd_change_path(pcall_core->papp_snd);
2831 static gboolean __voicecall_core_auto_answer_timer_cb(gpointer puser_data)
2833 call_vc_core_state_t *pcall_core = (call_vc_core_state_t *)puser_data;
2835 if (pcall_core->auto_answer_timer > 0) {
2836 g_source_remove(pcall_core->auto_answer_timer);
2837 pcall_core->auto_answer_timer = 0;
2840 /*Check for Incoming call and then answer the call */
2841 if (TRUE == voicecall_core_is_incoming_call_exists(pcall_core->pcall_engine)) {
2842 CALL_ENG_DEBUG(ENG_DEBUG, "Call Answered");
2843 voicecall_core_answer_call(pcall_core, TRUE);
2850 static gboolean __voicecall_core_callstatus_set_timer_cb(gpointer puser_data)
2852 call_vc_core_state_t *pcall_core = (call_vc_core_state_t *)puser_data;
2854 if (pcall_core->callstatus_timer > 0) {
2855 g_source_remove(pcall_core->callstatus_timer);
2856 pcall_core->callstatus_timer = 0;
2859 _vc_core_util_set_call_status(VCONFKEY_CALL_VOICE_CONNECTING);
2865 static gboolean __voicecall_core_auto_answer_idle_cb(gpointer puser_data)
2867 call_vc_core_state_t *pcall_core = (call_vc_core_state_t *)puser_data;
2868 int engine_state = 0;
2869 int auto_answer_time = 0, ret = -1;
2870 unsigned long auto_answer_time_interval = 0;
2872 _vc_core_engine_status_get_engine_iostate(pcall_core->pcall_engine, &engine_state);
2873 CALL_ENG_DEBUG(ENG_DEBUG, "eng_state : %d", engine_state);
2874 if (engine_state != VC_INOUT_STATE_INCOME_BOX) {
2875 CALL_ENG_DEBUG(ENG_DEBUG, "Engine State not in Income Box, Current State: %d", engine_state);
2878 /* Read the time interval from gconf and set the redial timer */
2879 ret = vconf_get_int(VCONFKEY_CISSAPPL_ANSWERING_MODE_TIME_INT, &auto_answer_time);
2881 auto_answer_time_interval = auto_answer_time * 1000;
2882 CALL_ENG_DEBUG(ENG_DEBUG, "The time interval is : %ld", auto_answer_time_interval);
2884 CALL_ENG_DEBUG(ENG_DEBUG, "vconf_get_int FAILED");
2888 pcall_core->auto_answer_timer = g_timeout_add(auto_answer_time_interval, __voicecall_core_auto_answer_timer_cb, pcall_core);
2893 * This function checks whether given answer mode is enabled or not
2895 * @return returns TRUE if given answer mode type is enabled in the settings or FALSE otherwise
2898 static gboolean __vc_core_is_answermode_enabled_from_testmode(void)
2900 CALL_ENG_DEBUG(ENG_DEBUG, "..");
2904 ret = vconf_get_int(VCONFKEY_TESTMODE_AUTO_ANSWER, &benabled);
2906 CALL_ENG_DEBUG(ENG_DEBUG, "benabled = %d", benabled);
2907 if (TRUE == benabled)
2912 CALL_ENG_DEBUG(ENG_DEBUG, "vconf_get_int FAILED");
2918 * This function checks whether given answer mode is enabled or not
2920 * @return returns TRUE if given answer mode type is enabled in the settings or FALSE otherwise
2923 static gboolean __vc_core_is_answermode_enabled(void)
2925 CALL_ENG_DEBUG(ENG_DEBUG, "coming inside voicecall_is_answermode_enabled");
2926 int answer_mode_enabled = -1;
2929 ret = vconf_get_int(VCONFKEY_CISSAPPL_ANSWERING_MODE_INT, &answer_mode_enabled);
2931 CALL_ENG_DEBUG(ENG_DEBUG, "answer_mode_enabled = %d", answer_mode_enabled);
2932 if (2 == answer_mode_enabled) /* here 2 is auto answer mode is enabled */
2937 CALL_ENG_DEBUG(ENG_DEBUG, "vconf_get_int FAILED");
2944 * This function processes auto answer request
2946 * @return Returns void
2947 * @param[in] pcall_core Handle to voicecall core
2949 static void __voicecall_core_start_auto_answer(call_vc_core_state_t *pcall_core, gboolean isTestMode)
2951 gboolean earjack_connected = FALSE;
2952 gboolean headset_connected = FALSE;
2954 CALL_ENG_DEBUG(ENG_DEBUG, "..");
2956 if (TRUE == isTestMode) {
2957 CALL_ENG_DEBUG(ENG_DEBUG, "In case Of Testmode, always auto answer enabled");
2959 g_idle_add(__voicecall_core_auto_answer_idle_cb, pcall_core);
2962 earjack_connected = _voicecall_dvc_get_earjack_connected();
2964 if (TRUE == earjack_connected) {
2965 CALL_ENG_DEBUG(ENG_DEBUG, "earjack is connected");
2967 headset_connected = _vc_bt_get_bt_status();
2969 if (TRUE == headset_connected) {
2970 CALL_ENG_DEBUG(ENG_DEBUG, "headset is connected");
2973 if (TRUE == earjack_connected || TRUE == headset_connected) {
2974 g_idle_add(__voicecall_core_auto_answer_idle_cb, pcall_core);
2976 CALL_ENG_DEBUG(ENG_DEBUG, "Without earjack or headset, skip auto answer ");
2982 * This function cancels the auto answering timer
2985 * @param[in] pcall_core Handle to voicecall core
2987 static void __voicecall_core_cancel_auto_answer(call_vc_core_state_t *pcall_core)
2989 CALL_ENG_DEBUG(ENG_DEBUG, "coming inside __voicecall_cancel_auto_answer");
2990 if (pcall_core->auto_answer_timer > 0) {
2991 g_source_remove(pcall_core->auto_answer_timer);
2992 pcall_core->auto_answer_timer = 0;
2998 * This function checks BT headset and Earjack status
3001 * @param[in] pcall_core Handle to voicecall core
3003 static void __voicecall_core_check_headset_earjack_status(call_vc_core_state_t *pcall_core)
3005 gboolean bt_connected = FALSE;
3007 bt_connected = _vc_bt_get_bt_status();
3008 CALL_ENG_DEBUG(ENG_DEBUG, "Bt connected =%d", bt_connected);
3010 pcall_core->bt_connected = bt_connected;
3012 CALL_ENG_DEBUG(ENG_DEBUG, "Update the earjack status");
3013 _voicecall_dvc_get_earjack_status(pcall_core);
3018 * This function parses the in call supplementary services string and returns the in call ss to be used
3020 * @return Returns in call ss state #vcui_app_incall_ss_state_t
3021 * @param[in] pcall_core Handle to voicecall core
3022 * @param[in] number number to be parsed
3024 call_vc_core_incall_ss_state_t voicecall_core_parse_incall_ss_string(call_vc_core_state_t *pcall_core, char *number)
3026 call_vc_core_incall_ss_state_t ss_value = CALL_VC_CORE_SS_USSD;
3028 if (strlen(number) == 1) {
3029 switch (number[0]) {
3031 ss_value = CALL_VC_CORE_SS_0;
3034 ss_value = CALL_VC_CORE_SS_1;
3037 ss_value = CALL_VC_CORE_SS_2;
3040 ss_value = CALL_VC_CORE_SS_3;
3043 ss_value = CALL_VC_CORE_SS_4;
3046 ss_value = CALL_VC_CORE_SS_USSD;
3049 } else if (strlen(number) == 2) {
3050 if ((number[0] == '1') && (number[1] > '0') && (number[1] < '8')) {
3051 pcall_core->selected_call_id_in_ss = atoi(number + 1);
3052 ss_value = CALL_VC_CORE_SS_1X;
3055 if ((number[0] == '2') && (number[1] > '0') && (number[1] < '8')) {
3056 pcall_core->selected_call_id_in_ss = atoi(number + 1);
3057 ss_value = CALL_VC_CORE_SS_2X;
3060 CALL_ENG_DEBUG(ENG_DEBUG, "ss parsed value: %d", ss_value);
3065 * This function starts the supplementary services while on call
3067 * @return Returns TRUE If transfer call can be made or FALSE if not
3068 * @param[in] pcall_core Handle to voicecall core
3069 * @param[in] incall_ss_state state of the In Call Supplementary Service
3071 gboolean voicecall_core_start_incall_ss(call_vc_core_state_t *pcall_core, call_vc_core_incall_ss_state_t incall_ss_state)
3073 gboolean active_calls = FALSE, held_calls = FALSE;
3075 _vc_core_engine_status_isexists_any_call(pcall_core->pcall_engine, &active_calls, &held_calls);
3077 CALL_ENG_DEBUG(ENG_DEBUG, "ss state = %d", incall_ss_state);
3078 vc_engine_msg_box_type event_data;
3079 memset(&event_data, 0, sizeof(event_data));
3080 event_data.string_id = IDS_CALL_POP_OPERATION_REFUSED;
3082 /*Cancel DTMF Sending if any and close the dtmf ui */
3083 /* vcui_app_doc_cancel_dtmf_queue(papp_document); sathwick TBD */
3085 switch (incall_ss_state) {
3086 /* Releases all held calls or Set UDUB(User Determined User Busy) for a waiting call */
3087 case CALL_VC_CORE_SS_0:
3089 /* if an incoming call is activated, reject the incoming all */
3090 if (TRUE == voicecall_core_is_incoming_call_exists(pcall_core->pcall_engine)) {
3091 voicecall_core_reject_mt(pcall_core, TRUE);
3093 } else if (held_calls) {
3094 voicecall_core_end_all_held_calls(pcall_core);
3096 CALL_ENG_DEBUG(ENG_DEBUG, "There are no held calls to do the processing");
3097 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3098 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3102 case CALL_VC_CORE_SS_1:
3104 if (voicecall_core_is_incoming_call_exists(pcall_core->pcall_engine)) {
3105 /* Accept incoming call */
3106 voicecall_core_answer_call_bytype(pcall_core, VC_ANSWER_RELEASE_ACTIVE_AND_ACCEPT);
3108 } else if (voicecall_core_is_outgoing_call_exists(pcall_core->pcall_engine)) {
3109 /* This fucntion checks for held calls to be retreived on response of ending call */
3110 voicecall_core_set_check_ss_on_end(pcall_core);
3111 voicecall_core_end_mo_call(pcall_core->pcall_engine);
3112 } else if (active_calls) {
3113 voicecall_core_end_all_active_calls(pcall_core);
3114 voicecall_core_set_check_ss_on_end(pcall_core);
3115 } else if (held_calls) {
3116 _vc_core_engine_retrieve_call(pcall_core->pcall_engine);
3119 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3120 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3124 case CALL_VC_CORE_SS_1X:
3126 if (voicecall_core_is_incoming_call_exists(pcall_core->pcall_engine)) {
3128 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3129 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3130 } else if (active_calls) {
3132 if (!(ERROR_VOICECALL_NONE == _vc_core_engine_end_call_bycallId(pcall_core->pcall_engine, pcall_core->selected_call_id_in_ss))) {
3134 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3135 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3139 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3140 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3144 case CALL_VC_CORE_SS_2:
3147 if (voicecall_core_is_incoming_call_exists(pcall_core->pcall_engine)) {
3148 if (active_calls && held_calls) {
3150 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3151 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3153 #ifdef _CPHS_DEFINED_ /* Not used currently */
3154 if (TRUE == active_calls && (voicecall_core_get_cphs_csp_status(pcall_core->pcall_engine, VC_CPHS_CSP_HOLD))) {
3156 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3157 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3161 voicecall_core_answer_call(pcall_core, TRUE);
3163 } else if (voicecall_core_is_outgoing_call_exists(pcall_core->pcall_engine)) {
3165 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3166 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3167 } else if (active_calls && held_calls) {
3168 _vc_core_engine_swap_calls(pcall_core->pcall_engine);
3169 } else if (active_calls) {
3170 _vc_core_engine_hold_call(pcall_core->pcall_engine);
3171 } else if (held_calls) {
3172 _vc_core_engine_retrieve_call(pcall_core->pcall_engine);
3175 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3176 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3180 case CALL_VC_CORE_SS_2X:
3182 if (voicecall_core_is_incoming_call_exists(pcall_core->pcall_engine) || voicecall_core_is_outgoing_call_exists(pcall_core->pcall_engine)) {
3184 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3185 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3186 } else if (TRUE == active_calls && FALSE == held_calls) {
3187 int active_members = 0;
3189 voicecall_core_get_active_call_member(pcall_core, &active_members);
3191 if (!(active_members > 1 && (ERROR_VOICECALL_NONE == _vc_core_engine_private_call_by_callid(pcall_core->pcall_engine, pcall_core->selected_call_id_in_ss)))) {
3193 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3194 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3198 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3199 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3203 case CALL_VC_CORE_SS_3:
3205 if (TRUE == voicecall_core_is_incoming_call_exists(pcall_core->pcall_engine)) {
3207 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3208 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3212 if (TRUE == voicecall_core_is_conf_call_possible(pcall_core)) {
3213 _vc_core_engine_setup_conference(pcall_core->pcall_engine);
3216 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3217 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3221 case CALL_VC_CORE_SS_4:
3222 if (TRUE == voicecall_core_is_transfer_call_possible(pcall_core)) {
3223 if (FALSE == voicecall_core_transfer_calls(pcall_core)) {
3225 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3226 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3230 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3231 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3235 CALL_ENG_DEBUG(ENG_DEBUG, "Invalid SS State");
3236 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3237 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3243 * This function processed the supplementary services while on call
3245 * @return Returns TRUE If transfer call can be made or FALSE if not
3246 * @param[in] pcall_core Handle to voicecall core
3247 * @param[in] pdialled_number dial number
3249 void voicecall_core_process_incall_ss(call_vc_core_state_t *pcall_core, char *pdialled_number)
3251 call_vc_core_incall_ss_state_t incall_ss_state = CALL_VC_CORE_SS_NONE;
3253 CALL_ENG_DEBUG(ENG_DEBUG, " ..");
3255 incall_ss_state = voicecall_core_parse_incall_ss_string(pcall_core, pdialled_number);
3257 if (incall_ss_state != CALL_VC_CORE_SS_USSD) {
3258 voicecall_core_start_incall_ss(pcall_core, incall_ss_state);
3261 CALL_ENG_DEBUG(ENG_DEBUG, "Involves CISS functionality so need for us to handle and will be handled by CISS");
3262 vc_engine_msg_box_type event_data;
3263 memset(&event_data, 0, sizeof(event_data));
3264 event_data.string_id = IDS_CALL_POP_OPERATION_REFUSED;
3265 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3269 #ifdef PDIAL_SEND_DTMF
3270 gboolean voicecall_core_send_phone_number_dtmf(gpointer puser_data)
3272 call_vc_core_state_t *pcall_core = (call_vc_core_state_t *)vcall_engine_get_core_state();
3273 int call_handle = (int)puser_data;
3274 char dtmf_number[VC_PHONE_NUMBER_LENGTH_MAX];
3275 call_vc_call_objectinfo_t obj_info = { 0, };
3277 CALL_ENG_DEBUG(ENG_DEBUG, "inside ...");
3279 if (TRUE == _vc_core_cm_get_call_object(&pcall_core->pcall_engine->call_manager, call_handle, &obj_info)) {
3280 CALL_ENG_DEBUG(ENG_DEBUG, "Source telephone number - %s", obj_info.source_tel_number);
3281 if (TRUE == _vc_core_util_extract_dtmf_number(obj_info.source_tel_number, dtmf_number, sizeof(dtmf_number))) {
3282 CALL_ENG_DEBUG(ENG_DEBUG, "DTMF number - %s", dtmf_number);
3283 if (VC_CALL_ORIG_TYPE_SAT == pcall_core->call_setup_info.call_type) {
3284 __voicecall_core_queue_dtmf_string(pcall_core, dtmf_number, TRUE);
3286 __voicecall_core_queue_dtmf_string(pcall_core, dtmf_number, FALSE);
3290 CALL_ENG_DEBUG(ENG_DEBUG, "Call Info not available for call handle: %d", call_handle);
3297 * This function cancels the dtmf queue
3299 * @return TRUE - sucess, FALSE otherwise
3300 * @param[in] papp_document Handle to Application Document
3302 gboolean voicecall_core_cancel_dtmf_queue(call_vc_core_state_t *pcall_core)
3304 voicecall_dtmf_info_t *pdtmf_info = (voicecall_dtmf_info_t *)&pcall_core->dtmf_info;
3306 CALL_ENG_DEBUG(ENG_DEBUG, "Start:pcall_core(%p)", pcall_core);
3308 if (FALSE == pdtmf_info->bdtmf_queue) {
3312 /*Remove Pauser Timer */
3313 if (pdtmf_info->dtmf_pause_timer > 0) {
3314 g_source_remove(pdtmf_info->dtmf_pause_timer);
3315 pdtmf_info->dtmf_pause_timer = -1;
3318 /*Reset the Status Flags */
3319 pdtmf_info->bdtmf_queue = FALSE;
3320 pdtmf_info->dtmf_index = 0;
3321 pdtmf_info->bdtmf_wait = FALSE;
3322 memset(pdtmf_info->dtmf_number, 0, sizeof(pdtmf_info->dtmf_number));
3323 if (TRUE == pdtmf_info->bsat_dtmf) {
3324 voicecall_core_send_sat_response(pcall_core->pcall_engine, SAT_RQST_SEND_DTMF, CALL_VC_ME_UNABLE_TO_PROCESS_COMMAND);
3326 pdtmf_info->bsat_dtmf = FALSE;
3327 pdtmf_info->bsat_hidden = FALSE;
3328 CALL_ENG_DEBUG(ENG_DEBUG, "End");
3332 static gboolean __voicecall_core_dtmf_pause_timer_cb(gpointer puser_data)
3334 call_vc_core_state_t *pcall_core = (call_vc_core_state_t *)puser_data;
3336 __voicecall_core_handle_dtmf_ack(pcall_core, TRUE);
3338 /*Always return FALSE, so that it won't be called again */
3342 gboolean __voicecall_core_send_dtmf_idle_cb(gpointer pdata)
3344 call_vc_core_state_t *pcall_core = (call_vc_core_state_t *)pdata;
3345 voicecall_dtmf_info_t *pdtmf_info = (voicecall_dtmf_info_t *)&pcall_core->dtmf_info;
3346 voicecall_error_t vc_error;
3347 vc_engine_dtmf_ack_type event_data;
3348 char dtmf_string[2];
3350 dtmf_string[0] = pdtmf_info->dtmf_number[pdtmf_info->dtmf_index];
3351 dtmf_string[1] = '\0';
3353 CALL_ENG_DEBUG(ENG_DEBUG, "inside ...");
3355 vc_error = _vc_core_engine_send_dtmf(pcall_core->pcall_engine, dtmf_string);
3357 if (vc_error == ERROR_VOICECALL_INVALID_DTMF_CHAR) {
3358 CALL_ENG_DEBUG(ENG_DEBUG, "ERROR_VOICECALL_INVALID_DTMF_CHAR");
3359 } else if (ERROR_VOICECALL_NONE != vc_error) {
3360 voicecall_core_cancel_dtmf_queue(pcall_core);
3361 memset(&event_data, 0, sizeof(event_data));
3362 event_data.bstatus = FALSE;
3363 event_data.string_id = IDS_CALL_POP_DTMFSENDING_FAIL;
3364 vcall_engine_send_event_to_client(VC_ENGINE_MSG_DTMF_ACK_TO_UI, (void *)&event_data);
3366 if (TRUE == pdtmf_info->bsat_dtmf) {
3367 voicecall_core_send_sat_response(pcall_core->pcall_engine, SAT_RQST_SEND_DTMF, CALL_VC_ME_UNABLE_TO_PROCESS_COMMAND);
3370 if (!((TRUE == pdtmf_info->bsat_dtmf) && (TRUE == pdtmf_info->bsat_hidden))) {
3371 memset(&event_data, 0, sizeof(event_data));
3372 event_data.bstatus = FALSE;
3373 event_data.string_id = IDS_CALL_POP_DTMFSENDING_FAIL;
3374 vcall_engine_send_event_to_client(VC_ENGINE_MSG_DTMF_ACK_TO_UI, (void *)&event_data);
3381 static gboolean __voicecall_core_handle_dtmf_ack(call_vc_core_state_t *pcall_core, gboolean success)
3383 voicecall_dtmf_info_t *pdtmf_info = (voicecall_dtmf_info_t *)&pcall_core->dtmf_info;
3384 vc_engine_dtmf_ack_type event_data;
3385 CALL_ENG_DEBUG(ENG_DEBUG, "...");
3387 if (FALSE == pdtmf_info->bdtmf_queue) {
3388 CALL_ENG_DEBUG(ENG_DEBUG, "DTMF Queue Canceled, do nothing");
3392 if (TRUE == success) {
3393 char dtmf_string[2];
3394 pdtmf_info->dtmf_index++;
3396 dtmf_string[0] = pdtmf_info->dtmf_number[pdtmf_info->dtmf_index];
3397 dtmf_string[1] = '\0';
3399 CALL_ENG_DEBUG(ENG_DEBUG, "Current dtmf_index: %d,dtmf_max_length=%d", pdtmf_info->dtmf_index, pdtmf_info->dtmf_max_length);
3400 CALL_ENG_DEBUG(ENG_DEBUG, "Current DTMF String: %s", &pdtmf_info->dtmf_number[pdtmf_info->dtmf_index]);
3402 /*Find the End of the queue */
3403 if (pdtmf_info->dtmf_index >= pdtmf_info->dtmf_max_length) {
3405 CALL_ENG_DEBUG(ENG_DEBUG, "Updating DTMF Progress before destroying");
3407 if (!((TRUE == pdtmf_info->bsat_dtmf) && (TRUE == pdtmf_info->bsat_hidden))) {
3408 memset(&event_data, 0, sizeof(event_data));
3409 event_data.bstatus = FALSE; /*check it*/
3410 event_data.string_id = IDS_CALL_POP_DTMF_SENT; /*check it*/
3411 vcall_engine_send_event_to_client(VC_ENGINE_MSG_DTMF_ACK_TO_UI, (void *)&event_data);
3414 if (TRUE == pdtmf_info->bsat_dtmf) {
3415 voicecall_core_send_sat_response(pcall_core->pcall_engine, SAT_RQST_SEND_DTMF, CALL_VC_ME_RET_SUCCESS);
3418 if (0 == strcasecmp(dtmf_string, "p") || 0 == strcmp(dtmf_string, ",")) {
3419 CALL_ENG_DEBUG(ENG_DEBUG, "Pause on the dtmf string");
3421 memset(&event_data, 0, sizeof(event_data));
3422 event_data.bstatus = TRUE;
3423 event_data.string_id = IDS_CALL_POP_SENDING;
3424 snprintf(event_data.display_string, sizeof(event_data.display_string), "%s", &pdtmf_info->dtmf_number[pdtmf_info->dtmf_index]);
3425 vcall_engine_send_event_to_client(VC_ENGINE_MSG_DTMF_ACK_TO_UI, (void *)&event_data);
3427 int dtmf_interval = 0;
3429 if (FALSE == _vc_core_util_check_gcf_status()) {
3430 dtmf_interval = (pdtmf_info->dtmf_index == 0) ? DTMF_PAUSE_TIMER_INTERVAL_FIRST : DTMF_PAUSE_TIMER_INTERVAL_REST;
3432 #ifdef GCONF_GCF_SAT_TEST
3433 int start_interval = DTMF_PAUSE_TIMER_INTERVAL_GCF_FIRST;
3434 int rest_interval = DTMF_PAUSE_TIMER_INTERVAL_GCF_REST;
3436 GConfClient *client = NULL;
3437 client = gconf_client_get_default();
3438 if (NULL == client) {
3439 CALL_ENG_DEBUG(ENG_DEBUG, "gconf_client_get_default failed..");
3442 start_interval = gconf_client_get_int(client, PATH_DTMF_INTERVAL_GCF_FIRST, NULL);
3444 rest_interval = gconf_client_get_int(client, PATH_DTMF_INTERVAL_GCF_REST, NULL);
3445 g_object_unref(client);
3449 CALL_ENG_DEBUG(ENG_DEBUG, "start_interval:%d, rest_interval = %d", start_interval, rest_interval);
3450 dtmf_interval = (pdtmf_info->dtmf_index == 0) ? start_interval : rest_interval;
3452 dtmf_interval = (pdtmf_info->dtmf_index == 0) ? DTMF_PAUSE_TIMER_INTERVAL_GCF_FIRST : DTMF_PAUSE_TIMER_INTERVAL_GCF_REST;
3455 CALL_ENG_DEBUG(ENG_DEBUG, "dtmf_interval:%d", dtmf_interval);
3456 pdtmf_info->dtmf_pause_timer = g_timeout_add(dtmf_interval, __voicecall_core_dtmf_pause_timer_cb, pcall_core);
3457 } else if (0 == strcasecmp(dtmf_string, "w") || 0 == strcmp(dtmf_string, ";")) {
3458 CALL_ENG_DEBUG(ENG_DEBUG, "Wait on the dtmf string");
3459 memset(&event_data, 0, sizeof(event_data));
3460 event_data.bstatus = TRUE;
3461 event_data.string_id = IDS_CALL_POP_UNAVAILABLE; /*assign ID when string is added*/
3462 snprintf(event_data.display_string, sizeof(event_data.display_string), "%s", &pdtmf_info->dtmf_number[pdtmf_info->dtmf_index]);
3463 vcall_engine_send_event_to_client(VC_ENGINE_MSG_DTMF_ACK_TO_UI, (void *)&event_data);
3465 g_idle_add_full(G_PRIORITY_HIGH_IDLE + 25, __voicecall_core_send_dtmf_idle_cb, pcall_core, NULL);
3469 voicecall_core_cancel_dtmf_queue(pcall_core);
3471 memset(&event_data, 0, sizeof(event_data));
3472 event_data.bstatus = FALSE;
3473 event_data.string_id = IDS_CALL_POP_DTMFSENDING_FAIL;
3474 vcall_engine_send_event_to_client(VC_ENGINE_MSG_DTMF_ACK_TO_UI, (void *)&event_data);
3481 * This function queues the dtmf digits one by one from the given dtmf string
3483 * @return TRUE - sucess, FALSE otherwise
3484 * @param[in] papp_document Handle to Application Document
3485 * @param[in] dtmf_string dtmf string to be queued
3487 static gboolean __voicecall_core_queue_dtmf_string(call_vc_core_state_t *pcall_core, char *dtmf_string, gboolean bsat_dtmf)
3489 voicecall_dtmf_info_t *pdtmf_info = (voicecall_dtmf_info_t *)&pcall_core->dtmf_info;
3490 gboolean bhidden_mode = FALSE;
3492 vc_engine_dtmf_ack_type event_data;
3494 CALL_ENG_DEBUG(ENG_DEBUG, "bsat_dtmf = %d", bsat_dtmf);
3496 if (TRUE == bsat_dtmf) {
3497 /*Always get the status from the engine */
3498 _vc_core_engine_get_sat_dtmf_hidden_mode(pcall_core->pcall_engine, &bhidden_mode);
3499 CALL_ENG_DEBUG(ENG_DEBUG, "SAT Hidden Mode : %d", bhidden_mode);
3502 /*Check for the validity of the DTMF String */
3503 if (FALSE == _vc_core_util_isvalid_full_dtmf_number(dtmf_string)) {
3504 if (TRUE == bsat_dtmf) {
3505 voicecall_core_send_sat_response(pcall_core->pcall_engine, SAT_RQST_SEND_DTMF, CALL_VC_ME_UNABLE_TO_PROCESS_COMMAND);
3508 if (!((TRUE == bsat_dtmf) && (TRUE == bhidden_mode))) {
3509 memset(&event_data, 0, sizeof(event_data));
3510 event_data.bstatus = FALSE;
3511 event_data.string_id = IDS_CALL_POP_INVALID_DTMF;
3512 vcall_engine_send_event_to_client(VC_ENGINE_MSG_DTMF_ACK_TO_UI, (void *)&event_data);
3517 /*Reset DTMF Values */
3518 pdtmf_info->bdtmf_queue = FALSE;
3519 pdtmf_info->dtmf_index = 0;
3520 pdtmf_info->bsat_dtmf = bsat_dtmf;
3522 if (TRUE == bsat_dtmf) {
3524 pdtmf_info->bsat_hidden = bhidden_mode;
3527 /*It takes only 40 characters from the source, rest of the characters are ignored*/
3528 memset(pdtmf_info->dtmf_number, 0, sizeof(pdtmf_info->dtmf_number));
3529 strncpy(pdtmf_info->dtmf_number, dtmf_string, min((sizeof(pdtmf_info->dtmf_number) - 1), strlen(dtmf_string)));
3530 pdtmf_info->dtmf_max_length = strlen(pdtmf_info->dtmf_number);
3531 CALL_ENG_DEBUG(ENG_DEBUG, "Dtmf Number:%s ,dtmf_max_length:%d", pdtmf_info->dtmf_number, pdtmf_info->dtmf_max_length);
3533 dtmf_digit[0] = pdtmf_info->dtmf_number[pdtmf_info->dtmf_index];
3534 dtmf_digit[1] = '\0';
3537 if (0 == strcasecmp(dtmf_digit, "p") || 0 == strcmp(dtmf_digit, ",")) {
3538 int dtmf_interval = 0;
3540 if (FALSE == _vc_core_util_check_gcf_status()) {
3541 dtmf_interval = (pdtmf_info->dtmf_index == 0) ? DTMF_PAUSE_TIMER_INTERVAL_FIRST : DTMF_PAUSE_TIMER_INTERVAL_REST;
3543 #ifdef GCONF_GCF_SAT_TEST
3544 int start_interval = DTMF_PAUSE_TIMER_INTERVAL_GCF_FIRST;
3545 int rest_interval = DTMF_PAUSE_TIMER_INTERVAL_GCF_REST;
3548 GConfClient *client = NULL;
3549 client = gconf_client_get_default();
3550 if (NULL == client) {
3551 CALL_ENG_DEBUG(ENG_DEBUG, "gconf_client_get_default failed..");
3554 start_interval = gconf_client_get_int(client, PATH_DTMF_INTERVAL_GCF_FIRST, NULL);
3556 rest_interval = gconf_client_get_int(client, PATH_DTMF_INTERVAL_GCF_REST, NULL);
3557 g_object_unref(client);
3561 CALL_ENG_DEBUG(ENG_DEBUG, "start_interval:%d, rest_interval = %d", start_interval, rest_interval);
3562 dtmf_interval = (pdtmf_info->dtmf_index == 0) ? start_interval : rest_interval;
3564 dtmf_interval = (pdtmf_info->dtmf_index == 0) ? DTMF_PAUSE_TIMER_INTERVAL_GCF_FIRST : DTMF_PAUSE_TIMER_INTERVAL_GCF_REST;
3566 CALL_ENG_DEBUG(ENG_DEBUG, "updated dtmf_interval:%d", dtmf_interval);
3568 pdtmf_info->dtmf_pause_timer = g_timeout_add(dtmf_interval, __voicecall_core_dtmf_pause_timer_cb, pcall_core);
3569 } else if (0 == strcasecmp(dtmf_digit, "w") || 0 == strcmp(dtmf_digit, ";")) {
3570 /* enable wait flag for dtmf sending */
3571 pdtmf_info->bdtmf_wait = TRUE;
3572 } else if ((ERROR_VOICECALL_NONE != _vc_core_engine_send_dtmf(pcall_core->pcall_engine, dtmf_digit))) {
3573 if (!((TRUE == pdtmf_info->bsat_dtmf) && (TRUE == pdtmf_info->bsat_hidden))) {
3574 memset(&event_data, 0, sizeof(event_data));
3575 event_data.bstatus = FALSE;
3576 event_data.string_id = IDS_CALL_POP_DTMFSENDING_FAIL;
3577 vcall_engine_send_event_to_client(VC_ENGINE_MSG_DTMF_ACK_TO_UI, (void *)&event_data);
3579 if (TRUE == pdtmf_info->bsat_dtmf) {
3580 voicecall_core_send_sat_response(pcall_core->pcall_engine, SAT_RQST_SEND_DTMF, CALL_VC_ME_UNABLE_TO_PROCESS_COMMAND);
3584 pdtmf_info->bdtmf_queue = TRUE;
3586 /*Create Progressbar popup */
3587 if (!((TRUE == pdtmf_info->bsat_dtmf) && (TRUE == pdtmf_info->bsat_hidden))) {
3588 memset(&event_data, 0, sizeof(event_data));
3589 event_data.bstatus = TRUE;
3590 CALL_ENG_DEBUG(ENG_DEBUG, "pdtmf_info->bdtmf_wait [%d]", pdtmf_info->bdtmf_wait);
3591 if (pdtmf_info->bdtmf_wait) {
3592 event_data.string_id = IDS_CALL_POP_UNAVAILABLE;
3594 event_data.string_id = IDS_CALL_POP_SENDING;
3596 _vc_core_util_strcpy(event_data.display_string, VC_PHONE_NUMBER_LENGTH_MAX, pdtmf_info->dtmf_number);
3597 vcall_engine_send_event_to_client(VC_ENGINE_MSG_DTMF_ACK_TO_UI, (void *)&event_data);
3599 CALL_ENG_DEBUG(ENG_DEBUG, "SAT DTMF Hidden Mode, not showing UI");
3605 gboolean voicecall_core_change_sound_path(call_vc_core_state_t *pcall_core, voicecall_snd_audio_type_t sound_path)
3607 voicecall_snd_mgr_t *papp_snd = pcall_core->papp_snd;
3609 int total_call_member = -1;
3611 CALL_ENG_DEBUG(ENG_DEBUG, "sound_path:[%d]", sound_path);
3613 voicecall_core_get_total_call_member(pcall_core->pcall_engine, &total_call_member);
3614 if (total_call_member == 0) {
3615 CALL_ENG_DEBUG(ENG_DEBUG, "There are not active calls hence it should not work");
3619 switch (sound_path) {
3620 case VOICE_CALL_AUDIO_SPEAKER:
3622 if (voicecall_snd_get_path_status(pcall_core->papp_snd) == VOICE_CALL_SND_PATH_BT) {
3623 /*_vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_SWITCH_TO_PHONE, -1, NULL);*/
3624 _vc_bt_request_switch_headset_path(pcall_core, FALSE);
3626 voicecall_snd_set_path_status(pcall_core->papp_snd, VOICE_CALL_SND_PATH_SPEAKER);
3631 case VOICE_CALL_AUDIO_HEADSET:
3633 voicecall_snd_set_path_status(pcall_core->papp_snd, VOICE_CALL_SND_PATH_BT);
3634 /* _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_SWITCH_TO_HEADSET, -1, NULL);*/
3635 _vc_bt_request_switch_headset_path(pcall_core, TRUE);
3641 case VOICE_CALL_AUDIO_RECEIVER_EARJACK:
3643 if (voicecall_snd_get_path_status(pcall_core->papp_snd) == VOICE_CALL_SND_PATH_BT) {
3644 /*_vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_SWITCH_TO_PHONE, -1, NULL);*/
3645 _vc_bt_request_switch_headset_path(pcall_core, FALSE);
3647 voicecall_snd_set_path_status(pcall_core->papp_snd, VOICE_CALL_SND_PATH_RECEIVER_EARJACK);
3654 CALL_ENG_DEBUG(ENG_DEBUG, "Unknown type!!");
3660 /* Change Audio Path according to the current status */
3661 voicecall_snd_change_path(papp_snd);
3666 gboolean voicecall_core_get_sound_path(call_vc_core_state_t *pcall_core, int *sound_path)
3668 voicecall_snd_mgr_t *papp_snd = pcall_core->papp_snd;
3670 CALL_ENG_DEBUG(ENG_DEBUG, "..");
3672 switch (voicecall_snd_get_path_status(papp_snd)) {
3673 case VOICE_CALL_SND_PATH_SPEAKER:
3675 *sound_path = VOICE_CALL_AUDIO_SPEAKER;
3679 case VOICE_CALL_SND_PATH_BT:
3681 *sound_path = VOICE_CALL_AUDIO_HEADSET;
3685 case VOICE_CALL_SND_PATH_RECEIVER_EARJACK:
3688 *sound_path = VOICE_CALL_AUDIO_RECEIVER_EARJACK;
3696 static gboolean __voicecall_core_is_redial_cuase(int end_cause)
3698 CALL_ENG_DEBUG(ENG_DEBUG, "end_cause(%d)", end_cause);
3700 switch (end_cause) {
3701 case VC_ENDCAUSE_CALL_BARRED:
3702 case VC_ENDCAUSE_NO_SERVICE:
3703 case VC_ENDCAUSE_USER_UNAVAILABLE:
3704 case VC_ENDCAUSE_INVALID_NUMBER_FORMAT:
3705 case VC_ENDCAUSE_NUMBER_CHANGED:
3706 case VC_ENDCAUSE_NO_CREDIT:
3707 case VC_ENDCAUSE_UNASSIGNED_NUMBER:
3710 case VC_ENDCAUSE_CALL_ENDED:
3711 case VC_ENDCAUSE_CALL_DISCONNECTED:
3712 case VC_ENDCAUSE_NO_ANSWER:
3713 case VC_ENDCAUSE_NW_BUSY:
3714 case VC_ENDCAUSE_CALL_SERVICE_NOT_ALLOWED:
3715 case VC_ENDCAUSE_NW_FAILED:
3716 case VC_ENDCAUSE_REJECTED:
3717 case VC_ENDCAUSE_USER_BUSY:
3718 case VC_ENDCAUSE_WRONG_GROUP:
3719 case VC_ENDCAUSE_CALL_NOT_ALLOWED:
3720 case VC_ENDCAUSE_CALL_FAILED:
3721 case VC_ENDCAUSE_NO_USER_RESPONDING:
3722 case VC_ENDCAUSE_USER_ALERTING_NO_ANSWER:
3723 case VC_ENDCAUSE_SERVICE_TEMP_UNAVAILABLE:
3724 case VC_ENDCAUSE_USER_DOESNOT_RESPOND:
3725 case VC_ENDCAUSE_IMEI_REJECTED:
3726 case VC_ENDCAUSE_TAPI_ERROR:
3733 * This function processed the supplementary services while on call
3735 * @return Returns TRUE If transfer call can be made or FALSE if not
3736 * @param[in] pcall_core Handle to voicecall core
3738 void voicecall_core_process_dtmf_send_status(call_vc_core_state_t *pcall_core, gboolean bsuccess)
3740 CALL_ENG_DEBUG(ENG_DEBUG, " ..");
3741 VOICECALL_RETURN_IF_FAIL(pcall_core);
3742 __voicecall_core_handle_dtmf_ack(pcall_core, bsuccess);