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 "vc-core-engine.h"
35 #include "voice-call-engine.h"
37 #define MO_REDIAL_COUNT_MAX 10
38 #define MO_REDIAL_TIMER_INTERVAL_FIRST 3000 /**< MO Redial Timer Interva; - 5 Secs*/
39 #define MO_REDIAL_TIMER_INTERVAL_SECOND 3000 /**< MO Redial Timer Interva; - 1 Minute*/
40 #define MO_REDIAL_TIMER_INTERVAL_THIRD 3000 /**< MO Redial Timer Interva; - 3 Minutes*/
42 #define MINUTE_MINDER_TIMEOUT_VALUE 60000
44 #define DTMF_PAUSE_TIMER_INTERVAL_FIRST 3000 /*3 Seconds */
45 #define DTMF_PAUSE_TIMER_INTERVAL_REST 3000 /*3 Seconds */
46 #define DTMF_PAUSE_TIMER_INTERVAL_GCF_FIRST 800 /*0.8 Second */
47 #define DTMF_PAUSE_TIMER_INTERVAL_GCF_REST 3300 /*3 Seconds */
49 gboolean mo_redial_timer_cb(void *data);
51 #define SET_PATH_TIMER_VALUE 50
52 static guint g_set_path_timer_handler = 0;
53 static gboolean __voicecall_core_set_path_timer_cb(gpointer puser_data);
54 static gboolean __voicecall_core_check_incoming_handle(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);
995 event_data.call_handle = call_handle;
996 event_data.brejected = brejected_number;
997 _vc_core_util_strcpy(event_data.call_num, sizeof(event_data.call_num), tel_number);
999 vcall_engine_send_event_to_client(VC_ENGINE_MSG_INCOM_TO_UI, (void *)&event_data);
1002 /* in case of rejected number, sound & callstatus is not processed */
1003 if (!brejected_number) {
1004 gboolean benabledTestMode = FALSE;
1005 voicecall_snd_register_cm(pcall_core->papp_snd);
1007 /*Send Incoming Call Event to Blue Tooth */
1008 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_INCOM, call_handle, tel_number);
1010 _vc_core_util_set_call_status(VCONFKEY_CALL_VOICE_CONNECTING);
1012 benabledTestMode = __vc_core_is_answermode_enabled_from_testmode();
1013 if ((TRUE == __vc_core_is_answermode_enabled()) || (TRUE == benabledTestMode)) {
1014 CALL_ENG_DEBUG(ENG_DEBUG, "auto answer mode is enabled.");
1015 __voicecall_core_start_auto_answer(pcall_core, benabledTestMode);
1018 CALL_ENG_DEBUG(ENG_DEBUG, "Preparing Sound ");
1019 voicecall_snd_prepare_alert(pcall_core->papp_snd, call_handle);
1020 if (FALSE == voicecall_core_is_connected_call_exist(pcall_core->pcall_engine)) {
1021 CALL_ENG_DEBUG(ENG_DEBUG, "Changing MM Path just before playing the ring tone");
1022 sound_manager_call_session_set_mode(pcall_core->papp_snd->psnd_session, SOUND_CALL_SESSION_MODE_RINGTONE);
1024 CALL_ENG_DEBUG(ENG_DEBUG, "2nd MT call alert.");
1026 voicecall_snd_play_alert(pcall_core->papp_snd);
1028 pcall_core->mtcall_handle = call_handle;
1029 g_idle_add(__voicecall_core_check_incoming_handle, pcall_core);
1035 case VC_CALL_OUTGOING:
1037 int call_handle = param1;
1038 vc_engine_common_with_handle_type event_data;
1039 memset(&event_data, 0, sizeof(event_data));
1041 CALL_ENG_DEBUG(ENG_DEBUG, "MO Call Start: Call handle %d", call_handle);
1045 case VC_CALL_OUTGOING_ORIG:
1047 int call_handle = param1;
1048 vc_engine_outgoing_orig_type event_data;
1049 call_vc_call_objectinfo_t callobject_info;
1051 memset(&event_data, 0, sizeof(event_data));
1052 event_data.call_handle = call_handle;
1053 if (pcall_core->call_setup_info.call_type == VC_CALL_ORIG_TYPE_EMERGENCY) {
1054 event_data.bemergency = TRUE;
1056 event_data.bemergency = FALSE;
1059 CALL_ENG_DEBUG(ENG_DEBUG, "Call Handle = %d, bemergency:[%d]", event_data.call_handle, event_data.bemergency);
1060 vcall_engine_send_event_to_client(VC_ENGINE_MSG_OUTGOING_ORIG_TO_UI, (void *)&event_data);
1062 g_set_path_timer_handler = g_timeout_add(SET_PATH_TIMER_VALUE, __voicecall_core_set_path_timer_cb, pcall_core);
1064 /*Send Event to Blue Tooth */
1065 voicecall_core_get_call_object(pcall_engine, call_handle, &callobject_info);
1066 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_ORIG, call_handle, callobject_info.tel_number);
1070 case VC_CALL_OUTGOING_ALERT:
1072 int call_handle = param1;
1073 vc_engine_common_with_handle_type event_data;
1075 memset(&event_data, 0, sizeof(event_data));
1077 event_data.call_handle = call_handle;
1079 vcall_engine_send_event_to_client(VC_ENGINE_MSG_OUTGOING_ALERT_TO_UI, (void *)&event_data);
1081 /*Play Connected Effect Tone */
1082 CALL_ENG_KPI("voicecall_snd_play_effect_tone start");
1083 if (FALSE == voicecall_snd_play_effect_tone(pcall_core->papp_snd, VOICE_CALL_SND_EFFECT_CALL_CONNECT)) {
1084 CALL_ENG_DEBUG(ENG_DEBUG, "voicecall_snd_play_effect_tone return value is FALSE");
1085 voicecall_snd_change_path(pcall_core->papp_snd);
1087 CALL_ENG_KPI("voicecall_snd_play_effect_tone done");
1089 CALL_ENG_KPI("_vc_bt_send_response_to_bt start");
1090 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_REMOTE_RINGING, call_handle, NULL);
1091 CALL_ENG_KPI("_vc_bt_send_response_to_bt done");
1095 case VC_CALL_ANSWER_CNF:
1097 CALL_ENG_DEBUG(ENG_DEBUG, "Answer confirm");
1098 if (_vc_core_cm_get_call_member_count(&(pcall_engine->call_manager)) == 1) {
1099 CALL_ENG_DEBUG(ENG_DEBUG, "single call state");
1100 voicecall_snd_change_path(pcall_core->papp_snd);
1105 case VC_CALL_CONNECTED:
1107 int call_handle = param1;
1108 vc_engine_connected_type event_data;
1109 int bstatus = FALSE;
1111 memset(&event_data, 0, sizeof(event_data));
1113 CALL_ENG_DEBUG(ENG_DEBUG, "Connected Call Handle : %d", call_handle);
1115 event_data.call_handle = call_handle;
1116 event_data.bt_status = (int)_vc_bt_get_bt_status();
1118 vcall_engine_send_event_to_client(VC_ENGINE_MSG_CONNECTED_TO_UI, (void *)&event_data);
1119 voicecall_snd_stop_alert(pcall_core->papp_snd); /* To stop alert in case of call accept by AT command */
1120 voicecall_snd_change_path(pcall_core->papp_snd);
1122 /* Set phone-status value */
1123 _vc_core_util_set_call_status(VCONFKEY_CALL_VOICE_ACTIVE);
1125 /* check minute minder */
1126 if (vconf_get_bool(VCONFKEY_CISSAPPL_MINUTE_MINDER_BOOL, &bstatus)) {
1127 CALL_ENG_DEBUG(ENG_ERR, "vconf_get_bool failed.");
1130 if (pcall_core->minute_minder_timer == 0) {
1131 pcall_core->minute_minder_timer = g_timeout_add(MINUTE_MINDER_TIMEOUT_VALUE, __voicecall_core_minute_minder, pcall_core);
1135 /*Send Event to Blue Tooth */
1136 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_CONNECT, call_handle, NULL);
1138 /*Call is accepted, reset the flag */
1139 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_ACCEPT_BY_BT, FALSE);
1145 case VC_CALL_NORMAL_END:
1147 int call_handle = param1;
1148 voice_call_end_cause_type_t end_cause = param2;
1149 vc_engine_normal_end_type event_data;
1151 memset(&event_data, 0, sizeof(event_data));
1153 CALL_ENG_DEBUG(ENG_DEBUG, "Normal End Call Handle : %d,End Cause=%d", call_handle, end_cause);
1155 event_data.call_handle = call_handle;
1156 event_data.end_cause_type = end_cause;
1158 __voicecall_core_handle_normal_end(pcall_core, call_handle, end_cause);
1160 vcall_engine_send_event_to_client(VC_ENGINE_MSG_NORMAL_END_TO_UI, (void *)&event_data);
1162 /*Send Event to Blue Tooth */
1163 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_END, call_handle, NULL);
1167 case VC_CALL_INCOM_END:
1169 int call_handle = param1;
1170 vc_engine_common_with_handle_type event_data;
1172 memset(&event_data, 0, sizeof(event_data));
1174 CALL_ENG_DEBUG(ENG_DEBUG, "Incoming call End Call Handle: %d", call_handle);
1176 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_ACCEPT_BY_BT, FALSE);
1178 if (TRUE == __voicecall_core_handle_call_end_on_silent_reject(pcall_core, call_handle)) {
1179 CALL_ENG_DEBUG(ENG_DEBUG, "Call end processed for silent reject:");
1183 event_data.call_handle = call_handle;
1185 __voicecall_core_handle_incoming_call_end(pcall_core, call_handle);
1187 vcall_engine_send_event_to_client(VC_ENGINE_MSG_INCOM_END_TO_UI, (void *)&event_data);
1191 case VC_CALL_INCOM_DROPPED:
1193 CALL_ENG_DEBUG(ENG_DEBUG, "Check it. Not used");
1197 case VC_CALL_REJECTED_END:
1199 int call_handle = param1;
1200 vc_engine_common_with_handle_type event_data;
1202 memset(&event_data, 0, sizeof(event_data));
1204 CALL_ENG_DEBUG(ENG_DEBUG, "Rejected call End Call Handle: %d", call_handle);
1206 event_data.call_handle = call_handle;
1208 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_ACCEPT_BY_BT, FALSE);
1210 __voicecall_core_handle_rejected_call_end(pcall_core, call_handle);
1212 vcall_engine_send_event_to_client(VC_ENGINE_MSG_REJECTED_END_TO_UI, (void *)&event_data);
1216 case VC_CALL_OUTGOING_END:
1218 int call_handle = param1;
1219 int end_cause_type = param2;
1220 int bauto_redial = -1;
1222 CALL_ENG_DEBUG(ENG_DEBUG, "end cause type :[%d]", end_cause_type);
1223 CALL_ENG_DEBUG(ENG_DEBUG, "bauto_redial:[%d]", bauto_redial);
1225 if ((TRUE == bauto_redial) && (FALSE == voicecall_core_is_connected_call_exist(pcall_engine))
1226 && (FALSE == voicecall_core_get_status(pcall_core, CALL_VC_CORE_FLAG_MOCALL_END_BY_USER))
1227 && (TRUE == __voicecall_core_is_redial_cuase(end_cause_type))) {
1229 CALL_ENG_DEBUG(ENG_DEBUG, "It is auto redial case.");
1231 _vc_core_util_set_call_status(VCONFKEY_CALL_OFF);
1233 vc_engine_outgoing_end_type event_data;
1235 memset(&event_data, 0, sizeof(event_data));
1236 event_data.call_handle = call_handle;
1237 event_data.end_cause_type = end_cause_type;
1238 event_data.bauto_redial = TRUE;
1239 vcall_engine_send_event_to_client(VC_ENGINE_MSG_OUTGOING_END_TO_UI, (void *)&event_data);
1241 __voicecall_core_handle_outgoingcall_end(pcall_core, call_handle, end_cause_type);
1246 case VC_CALL_OUTGOING_ABORTED:
1248 vc_engine_common_type event_data;
1250 memset(&event_data, 0, sizeof(event_data));
1252 vcall_engine_send_event_to_client(VC_ENGINE_MSG_OUTGOING_ABORTED_TO_UI, (void *)&event_data);
1256 case VC_CALL_DTMF_ACK:
1258 gboolean bsuccess = param1;
1259 CALL_ENG_DEBUG(ENG_DEBUG, "bsuccess:[%d]", bsuccess);
1260 __voicecall_core_handle_dtmf_ack(pcall_core, bsuccess);
1264 case VC_CALL_AUTO_REDIAL_CHECK:
1266 CALL_ENG_DEBUG(ENG_DEBUG, "Check it. Not used");
1270 case VC_CALL_SS_HELD:
1272 int call_handle = param1;
1273 vc_engine_common_type event_data;
1275 /* held popup shold not be displayed on outgoing popup */
1276 memset(&event_data, 0, sizeof(event_data));
1278 vcall_engine_send_event_to_client(VC_ENGINE_MSG_SS_HELD_TO_UI, (void *)&event_data);
1280 /*Send Event to Blue Tooth */
1281 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_HOLD, call_handle, NULL);
1285 case VC_CALL_SS_RETREIVED:
1287 int call_handle = param1;
1288 vc_engine_common_type event_data;
1290 /* held popup shold not be displayed on outgoing popup */
1291 memset(&event_data, 0, sizeof(event_data));
1292 vcall_engine_send_event_to_client(VC_ENGINE_MSG_SS_RETREIVED_TO_UI, (void *)&event_data);
1294 /*Send Event to Blue Tooth */
1295 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_RETRIEVE, call_handle, NULL);
1299 case VC_CALL_SS_SWAP:
1301 vc_engine_common_type event_data;
1303 int call_handle = param1;
1305 memset(&event_data, 0, sizeof(event_data));
1307 /* Show Call Swapped Message Box */
1308 vcall_engine_send_event_to_client(VC_ENGINE_MSG_SS_SWAP_TO_UI, (void *)&event_data);
1310 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_SWAPPED, call_handle, NULL);
1314 case VC_CALL_SS_SETUP_CONF:
1316 vc_engine_common_type event_data;
1318 memset(&event_data, 0, sizeof(event_data));
1320 /* Show Call Joined Message Box */
1321 vcall_engine_send_event_to_client(VC_ENGINE_MSG_SS_SETUP_CONF_TO_UI, (void *)&event_data);
1323 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_JOINED, 0, NULL);
1327 case VC_CALL_SS_SPLIT_CONF:
1329 vc_engine_common_with_handle_type event_data;
1330 int call_handle = param1;
1331 CALL_ENG_DEBUG(ENG_DEBUG, "The handle to be split is %d", call_handle);
1333 memset(&event_data, 0, sizeof(event_data));
1334 event_data.call_handle = call_handle;
1336 /* Show Private Call Message Box */
1337 vcall_engine_send_event_to_client(VC_ENGINE_MSG_SS_SPLIT_CONF_TO_UI, (void *)&event_data);
1341 case VC_CALL_SS_TRANSFERRED:
1343 vc_engine_common_type event_data;
1345 memset(&event_data, 0, sizeof(event_data));
1347 vcall_engine_send_event_to_client(VC_ENGINE_MSG_SS_TRANSFERRED_TO_UI, (void *)&event_data);
1351 case VC_CALL_SS_CONNECT_LINE_IND:
1353 int call_handle = param1;
1354 char *pconnected_number = (char *)param3;
1355 vc_engine_msg_box_type event_data;
1357 CALL_ENG_DEBUG(ENG_DEBUG, "call_handle : [%d]", call_handle);
1359 /* check whether Call Info for recevice Call Handle exists or not. */
1361 if ((pconnected_number != NULL) && (strlen(pconnected_number) > 0)) {
1362 CALL_ENG_DEBUG(ENG_DEBUG, "connected line ind : [%s]", pconnected_number);
1364 memset(&event_data, 0, sizeof(event_data));
1366 event_data.string_id = IDS_CALL_POP_CALL_IS_DIVERTED;
1367 _vc_core_util_strcpy(event_data.diverted_num, sizeof(event_data.diverted_num), pconnected_number);
1369 CALL_ENG_DEBUG(ENG_DEBUG, "No conneccted info");
1375 case VC_CALL_IND_FORWARD:
1377 vc_engine_ind_forward_type event_data;
1378 int fwd_type = param1;
1380 memset(&event_data, 0, sizeof(event_data));
1381 event_data.fwd_type = fwd_type;
1383 vcall_engine_send_event_to_client(VC_ENGINE_MSG_IND_FORWARD_TO_UI, (void *)&event_data);
1387 case VC_CALL_IND_ACTIVATE:
1389 vc_engine_common_type event_data;
1391 memset(&event_data, 0, sizeof(event_data));
1393 vcall_engine_send_event_to_client(VC_ENGINE_MSG_IND_ACTIVATE_TO_UI, (void *)&event_data);
1397 case VC_CALL_IND_HOLD:
1399 vc_engine_common_type event_data;
1400 int call_handle = param1;
1402 memset(&event_data, 0, sizeof(event_data));
1404 vcall_engine_send_event_to_client(VC_ENGINE_MSG_IND_HOLD_TO_UI, (void *)&event_data);
1406 /*Send Event to Blue Tooth */
1407 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_HOLD, call_handle, NULL);
1411 case VC_CALL_IND_TRANSFER:
1413 CALL_ENG_DEBUG(ENG_DEBUG, "Not used.");
1417 case VC_CALL_IND_SETUPCONFERENCE:
1419 CALL_ENG_DEBUG(ENG_DEBUG, "Not used.");
1423 case VC_CALL_IND_BARRING:
1425 vc_engine_common_type event_data;
1427 memset(&event_data, 0, sizeof(event_data));
1429 vcall_engine_send_event_to_client(VC_ENGINE_MSG_IND_BARRING_TO_UI, (void *)&event_data);
1433 case VC_CALL_IND_WAITING:
1435 vc_engine_common_type event_data;
1437 memset(&event_data, 0, sizeof(event_data));
1439 vcall_engine_send_event_to_client(VC_ENGINE_MSG_IND_WAITING_TO_UI, (void *)&event_data);
1443 case VC_CALL_IND_CUGINFO:
1445 CALL_ENG_DEBUG(ENG_DEBUG, "Not used.");
1449 case VC_CALL_IND_SSNOTIFY:
1451 vc_engine_ind_ssnotify_type event_data;
1452 int ss_type = param1;
1454 memset(&event_data, 0, sizeof(event_data));
1455 event_data.ss_type = ss_type;
1457 vcall_engine_send_event_to_client(VC_ENGINE_MSG_IND_SSNOTIFY_TO_UI, (void *)&event_data);
1461 case VC_CALL_IND_CALLINGNAMEINFO:
1463 CALL_ENG_DEBUG(ENG_DEBUG, "Not used.");
1466 case VC_CALL_IND_ACTIVATECCBS_CNF:
1468 CALL_ENG_DEBUG(ENG_DEBUG, "Not used.");
1472 case VC_CALL_IND_ACTIVATECCBS_USERINFO:
1474 CALL_ENG_DEBUG(ENG_DEBUG, "Not used.");
1478 case VC_CALL_IND_AOC:
1480 CALL_ENG_DEBUG(ENG_DEBUG, "Not yet.");
1484 case VC_ERROR_OCCURED:
1486 int error_code = param1;
1488 CALL_ENG_DEBUG(ENG_DEBUG, "error code:[%d]", error_code);
1489 switch (error_code) {
1490 case ERROR_VOICECALL_INVALID_DTMF_CHAR:
1491 case ERROR_VOICECALL_DTMF_FAILED:
1493 vc_engine_error_occured_type event_data;
1495 memset(&event_data, 0, sizeof(event_data));
1496 event_data.error_code = error_code;
1498 vcall_engine_send_event_to_client(VC_ENGINE_MSG_ERROR_OCCURED_TO_UI, (void *)&event_data);
1503 vc_engine_msg_box_type event_data;
1506 string_id = __voicecall_core_get_string_id_by_errorcode(error_code);
1508 memset(&event_data, 0, sizeof(event_data));
1509 event_data.string_id = __voicecall_core_get_string_id_by_errorcode(error_code);
1511 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
1518 case VC_ACTION_INCOM_FORCE:
1520 int call_handle = param1;
1521 vc_engine_common_with_handle_type event_data;
1523 CALL_ENG_DEBUG(ENG_DEBUG, "Call Handle = %d", call_handle);
1525 memset(&event_data, 0, sizeof(event_data));
1526 event_data.call_handle = call_handle;
1528 vcall_engine_send_event_to_client(VC_ENGINE_MSG_ACTION_INCOM_FORCE_TO_UI, (void *)&event_data);
1532 case VC_ACTION_SAT_REQUEST:
1534 if (SAT_RQST_SETUP_CALL == param1) {
1535 voicecall_sat_callinfo_t *psat_callinfo = (voicecall_sat_callinfo_t *) param3;
1536 vc_engine_outgoing_type event_data;
1538 if (psat_callinfo == NULL) {
1539 CALL_ENG_DEBUG(ENG_ERR, "psat_callinfo is NULL..");
1540 assert(psat_callinfo != NULL);
1542 CALL_ENG_DEBUG(ENG_DEBUG, "VC_ACTION_SAT_REQUEST is received by Voice call.");
1543 pcall_core->call_setup_info.call_setup_by = VC_CALL_SETUP_BY_SAT;
1544 pcall_core->call_setup_info.call_type = VC_CALL_ORIG_TYPE_SAT;
1547 _vc_core_util_strcpy(pcall_core->call_setup_info.source_tel_number, VC_PHONE_NUMBER_LENGTH_MAX, psat_callinfo->call_number);
1548 _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);
1551 CALL_ENG_DEBUG(ENG_ERR, "psat_callinfo->disp_text:[%s]", psat_callinfo->disp_text);
1553 memset(&event_data, 0, sizeof(event_data));
1554 _vc_core_util_strcpy(event_data.call_num, sizeof(event_data.call_num), pcall_core->call_setup_info.tel_number);
1555 event_data.contact_index = -1;
1556 event_data.phone_type = -1;
1557 event_data.bday_remaining_days = -1;
1558 _vc_core_util_strcpy(event_data.call_num, sizeof(event_data.call_num), psat_callinfo->disp_text);
1560 vcall_engine_send_event_to_client(VC_ENGINE_MSG_OUTGOING_TO_UI, (void *)&event_data);
1562 /*Get Icon Information */
1563 if (TRUE == psat_callinfo->bicon_present) { /*bicon_present is TRUE when SAT icon info available and when GCF is enabled */
1564 CALL_ENG_DEBUG(ENG_ERR, "SAT icon available.");
1567 /* Prepare and Make Call with the Give Information */
1568 if (FALSE == voicecall_core_setup_call(pcall_core, FALSE)) {
1569 /*Send Response to SAT Engine */
1570 voicecall_core_send_sat_response(pcall_core->pcall_engine, SAT_RQST_SETUP_CALL, CALL_VC_ME_UNABLE_TO_PROCESS_COMMAND);
1573 } else if (SAT_RQST_SEND_DTMF == param1) {
1574 voicecall_sat_callinfo_t *psat_callinfo = (voicecall_sat_callinfo_t *) param3;
1576 CALL_ENG_DEBUG(ENG_DEBUG, "SAT Send DTMF Number: %s, hidden: %d", psat_callinfo->call_number, psat_callinfo->bsat_hidden);
1577 __voicecall_core_queue_dtmf_string(pcall_core, psat_callinfo->call_number, TRUE);
1579 CALL_ENG_DEBUG(ENG_ERR, "Invalid SAT Request Type: %d", param2);
1584 case VC_ACTION_SAT_RESPONSE:
1586 if (SAT_RESP_SETUP_CALL == param1) {
1587 voicecall_sat_callinfo_t *psat_call_info = (voicecall_sat_callinfo_t *) param3;
1589 CALL_ENG_DEBUG(ENG_DEBUG, "sat_mo_call_ctrl_res = %d", psat_call_info->sat_mo_call_ctrl_res);
1591 if (CALL_NOT_ALLOWED == psat_call_info->sat_mo_call_ctrl_res) {
1592 vc_engine_msg_box_type event_data;
1594 memset(&event_data, 0, sizeof(event_data));
1595 event_data.string_id = IDS_CALL_POP_CALLNOTCALLOWED;
1596 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
1597 } else if (CALL_ALLOWED_WITH_MOD == psat_call_info->sat_mo_call_ctrl_res) {
1598 CALL_ENG_DEBUG(ENG_DEBUG, "psat_call_info->call_number = [%s]", psat_call_info->call_number);
1599 CALL_ENG_DEBUG(ENG_DEBUG, "psat_call_info->disp_text = [%s]", psat_call_info->disp_text);
1601 mocall_index = vcui_app_doc_get_mocall_index(papp_document);
1603 /*Update MO CALL Display Data with the SAT modified info */
1604 if (mocall_index != -1) {
1605 vcui_app_call_display_data_t display_data;
1606 vcui_app_call_display_data_t new_display_data;
1607 vcui_app_view_mo_state_t *pmo_state = NULL;
1609 if (FALSE == vcui_app_cdm_get_display_object_byindex(&papp_document->call_display_manager, mocall_index, &display_data)) {
1613 vcui_app_cdm_clear_display_object(&new_display_data);
1615 /*Copy all must parameters required for MO Call */
1616 new_display_data.call_handle = display_data.call_handle;
1617 new_display_data.call_index = display_data.call_index;
1618 new_display_data.call_type = display_data.call_type;
1619 new_display_data.start_time = display_data.start_time;
1620 new_display_data.used = display_data.used;
1622 if (strlen(psat_call_info->call_number) > 0) {
1623 vcui_app_util_strcpy(new_display_data.source_tel_number, sizeof(new_display_data.source_tel_number), psat_call_info->call_number);
1624 _vc_core_engine_extract_phone_number(new_display_data.source_tel_number, new_display_data.tel_number, VC_PHONE_NUMBER_LENGTH_MAX);
1627 if (strlen(psat_call_info->disp_text) > 0) {
1628 vcui_app_util_strcpy(new_display_data.name, sizeof(new_display_data.name), psat_call_info->disp_text);
1631 /*todo, Check whether contact search need to be done for the SAT modified number */
1633 /*Set the newly modified data to the CDM */
1634 vcui_app_cdm_set_display_object(pdisplay_mgr, &new_display_data);
1636 /*Update the MO View */
1637 pmo_state = (vcui_app_view_mo_state_t *) calloc(1, sizeof(vcui_app_view_mo_state_t));
1638 pmo_state->mo_call_state = VCUI_MO_CALL_STATE_UPDATE;
1640 /* Update MO Call Screen View to update the connection status */
1641 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);
1644 VCUI_DEBUG(VCUI_LOG_ERR, "Invalid Mo Call Index: %d", mocall_index);
1647 } else if (CALL_CHANGED_TO_SS == psat_call_info->sat_mo_call_ctrl_res) {
1648 /*Issue notification to Launch SS */
1654 case VC_ACTION_CALL_END_HELD_RETREIVED:
1656 int call_handle = param1;
1657 vc_engine_common_with_handle_type event_data;
1659 CALL_ENG_DEBUG(ENG_DEBUG, "call handle:[%d]", call_handle);
1661 memset(&event_data, 0, sizeof(event_data));
1663 vcall_engine_send_event_to_client(VC_ENGINE_MSG_ACTION_CALL_END_HELD_RETREIVED_TO_UI, (void *)&event_data);
1667 case VC_ACTION_NO_ACTIVE_TASK:
1669 CALL_ENG_DEBUG(ENG_DEBUG, "Not yet.");
1673 case VC_CALL_GET_VOLUME_RESP:
1675 vc_engine_vol_resp_type event_data;
1677 CALL_ENG_DEBUG(ENG_DEBUG, "Current Voicecall (TAPI)Volume Type %d, Current Volume Level: %d", param1, param2);
1679 memset(&event_data, 0, sizeof(event_data));
1680 event_data.vol_alert_type = VOICE_CALL_VOL_TYPE_VOICE;
1681 event_data.vol_level = param2;
1682 vcall_engine_send_event_to_client(VC_ENGINE_MSG_GET_VOLUME_RESP_TO_UI, (void *)&event_data);
1686 case VC_CALL_NOTI_WBAMR:
1688 vc_engine_wbamr_status_type event_data;
1690 CALL_ENG_DEBUG(ENG_DEBUG, "Current WBAmr status %d", param1);
1692 memset(&event_data, 0, sizeof(event_data));
1693 event_data.bstatus = param1;
1694 vcall_engine_send_event_to_client(VC_ENGINE_MSG_NOTI_WBAMR_TO_UI, (void *)&event_data);
1699 CALL_ENG_DEBUG(ENG_DEBUG, " Engine Event ID : %d not handled", event);
1703 CALL_VC_DUMP_CALLDETAILS(&pcall_engine->call_manager);
1705 CALL_ENG_DEBUG(ENG_DEBUG, " Ended.");
1711 * This function converts Error Code to string id.
1714 * @param[in] error_code error code to be used to display the message content
1716 static int __voicecall_core_get_string_id_by_errorcode(int error_code)
1719 switch (error_code) {
1720 case ERROR_VOICECALL_DTMF_FAILED:
1721 string_id = IDS_CALL_POP_DTMFSENDING_FAIL;
1724 case ERROR_VOICECALL_CALL_NOT_ALLOWED:
1725 string_id = IDS_CALL_POP_CALLNOTCALLOWED;
1728 case ERROR_VOICECALL_CALL_IMPOSSIBLE_NOSIM_NOEMERGNUM:
1729 string_id = IDS_CALL_POP_SOS_CALL_ONLY_IN_NO_SIM_MODE;
1732 case ERROR_VOICECALL_EMERGENCY_CALLS_ONLY:
1733 string_id = IDS_CALL_POP_CALLING_EMERG_ONLY;
1736 case ERROR_VOICECALL_PHONE_NOT_INITIALIZED:
1737 string_id = IDS_CALL_POP_PHONE_NOT_INITIALISED;
1740 case ERROR_VOICECALL_ANSWER_FAILED:
1741 string_id = IDS_CALL_POP_CALLFAILED;
1744 case ERROR_VOICECALL_HOLD_REJECTED:
1745 case ERROR_VOICECALL_HOLD_FAILED:
1746 string_id = IDS_CALL_POP_HOLD_FAILED;
1749 case ERROR_VOICECALL_ACTIVATE_REJECTED:
1750 case ERROR_VOICECALL_RETREIVE_FAILED:
1751 string_id = IDS_CALL_POP_UNABLE_TO_RETRIEVE;
1754 case ERROR_VOICECALL_SWAP_REJECTED:
1755 case ERROR_VOICECALL_SWAP_FAILED:
1756 string_id = IDS_CALL_POP_SWAP_FAILED;
1759 case ERROR_VOICECALL_SPLIT_CONF_FAILED:
1760 string_id = IDS_CALL_POP_SPLIT_FAILED;
1763 case ERROR_VOICECALL_SETUP_CONF_FAILED:
1764 string_id = IDS_CALL_POP_JOIN_FAILED;
1767 case ERROR_VOICECALL_TRANSFER_FAILED:
1768 string_id = IDS_CALL_POP_TRANSFER_FAILED;
1771 case ERROR_VOICECALL_SWAP_NOT_SUPPORTED:
1772 string_id = IDS_CALL_POP_SWAP_NOT_SUPPORTED;
1775 case ERROR_VOICECALL_HOLD_NOT_SUPPORTED:
1776 string_id = IDS_CALL_POP_HOLD_NOT_SUPPORTED;
1779 case ERROR_VOICECALL_RETREIVE_NOT_SUPPORTED:
1780 string_id = IDS_CALL_POP_UNHOLD_NOT_SUPPORTED;
1783 case ERROR_VOICECALL_SETUP_CONF_NOT_SUPPORTED:
1784 string_id = IDS_CALL_POP_JOIN_NOT_SUPPORTED;
1787 case ERROR_VOICECALL_SPLIT_CONF_NOT_SUPPORTED:
1788 string_id = IDS_CALL_POP_SPLIT_NOT_SUPPORTED;
1790 case ERROR_VOICECALL_TRANSFER_NOT_SUPPORTED:
1791 string_id = IDS_CALL_POP_TRANSFER_NOT_SUPPORTED;
1794 case ERROR_VOICECALL_INCOMPLETE:
1795 string_id = IDS_CALL_POP_INCOMPLETE;
1798 case ERROR_VOICECALL_UNAVAILABLE:
1799 string_id = IDS_CALL_POP_UNAVAILABLE;
1802 case ERROR_VOICECALL_TAPI_CAUSE_CALL_FAILED:
1803 string_id = IDS_CALL_POP_CALLFAILED;
1806 case ERROR_VOICECALL_INVALID_CALL_TYPE:
1807 case ERROR_VOICECALL_INVALID_TELEPHONE_NUMBER:
1808 string_id = IDS_CALL_POP_CAUSE_WRONG_NUMBER;
1812 CALL_ENG_DEBUG(ENG_DEBUG, " Invalid Error Code: %x", error_code);
1813 string_id = IDS_CALL_POP_CALLFAILED;
1819 gboolean voicecall_core_set_to_default(call_vc_core_state_t *pcall_core)
1821 CALL_ENG_DEBUG(ENG_DEBUG, "");
1822 if (pcall_core->pcall_engine == NULL)
1825 /*Set Engine states to default */
1826 _vc_core_engine_set_to_default_values(pcall_core->pcall_engine);
1828 /*Initialize MO Call Setup Info */
1829 pcall_core->call_setup_info.mo_call_index = VC_TAPI_INVALID_CALLHANDLE;
1830 pcall_core->call_setup_info.call_setup_by = VC_CALL_SETUP_BY_NORMAL;
1832 pcall_core->call_setup_info.mo_call_index = VC_TAPI_INVALID_CALLHANDLE;
1833 pcall_core->call_setup_info.call_setup_by = VC_CALL_SETUP_BY_NORMAL;
1834 memset(pcall_core->call_setup_info.tel_number, 0, sizeof(pcall_core->call_setup_info.tel_number));
1836 pcall_core->mo_redial_timer = -1;
1837 __vc_core_set_auto_redial_count(pcall_core, 0);
1839 _vc_core_util_set_call_status(VCONFKEY_CALL_OFF);
1840 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_NONE, TRUE);
1842 pcall_core->bt_connected = _vc_bt_get_bt_status();
1843 if (FALSE == pcall_core->bt_connected) {
1844 voicecall_snd_set_path_status(pcall_core->papp_snd, VOICE_CALL_SND_PATH_RECEIVER_EARJACK);
1846 CALL_ENG_DEBUG(ENG_DEBUG, "BT connected, Not changing the sound status");
1850 voicecall_snd_unregister_cm(pcall_core->papp_snd);
1852 if (vconf_set_int(VCONFKEY_FACTORY_CALL_CONNECT_STATE, VCONFKEY_FACTORY_CALL_DISCONNECTED)) {
1853 CALL_ENG_DEBUG(ENG_ERR, "vconf_set_int failed.");
1859 static void __voicecall_core_mocall_reset_engine_state(voicecall_engine_t *pcall_engine)
1861 int eng_state = VC_INOUT_STATE_NONE;
1863 voicecall_core_get_engine_state(pcall_engine, &eng_state);
1865 CALL_ENG_DEBUG(ENG_DEBUG, "current engine state is: %d", eng_state);
1867 if ((eng_state > VC_INOUT_STATE_OUTGOING_START) && (eng_state < VC_INOUT_STATE_OUTGOING_END)) {
1868 voicecall_core_change_engine_state(pcall_engine, VC_INOUT_STATE_NONE);
1870 CALL_ENG_DEBUG(ENG_DEBUG, "Engine state is already changed, current engine state is: %d", eng_state);
1871 CALL_VC_DUMP_CALLDETAILS(&pcall_engine->call_manager);
1876 * This function initialize voicecall core
1878 * @return Returns TRUE on success or FALSE on failure
1879 * @param[in] pcall_core Handle to voicecall core
1880 * @param[in] pcallback_func callback function
1882 int voicecall_core_init(call_vc_core_state_t *pcall_core)
1884 voicecall_engine_t *pcall_engine = NULL;
1886 if (ERROR_VOICECALL_NONE != _vc_core_engine_init(&pcall_engine, (voicecall_cb) voicecall_core_cb, pcall_core)) {
1887 CALL_ENG_DEBUG(ENG_DEBUG, "Voicecall Engine Init Failed");
1891 if (FALSE == voicecall_snd_init(pcall_core, &pcall_core->papp_snd)) {
1892 CALL_ENG_DEBUG(ENG_DEBUG, "voicecall_snd_init() failed");
1895 /*Store Voicecall Engine Handle */
1896 pcall_core->pcall_engine = pcall_engine;
1898 _vc_bt_status_init(pcall_core);
1900 _voicecall_dvc_earjack_init(pcall_core);
1902 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_NONE, TRUE);
1907 * This function prepares a voice call with the given data
1909 * @return Returns TRUE on success or FALSE on failure
1910 * @param[in] pcall_core Handle to voicecall core
1911 * @param[in] bemergency emergency call or not from dialer
1914 gboolean voicecall_core_setup_call(call_vc_core_state_t *pcall_core, gboolean bemergency)
1916 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
1917 voicecall_setup_info_t setupcall_info = { 0, };
1918 voicecall_error_t error_code = -1;
1919 gboolean bemergency_call = FALSE;
1920 gboolean bmocall_exists = FALSE;
1921 gboolean bmtcall_exists = FALSE;
1924 CALL_ENG_DEBUG(ENG_DEBUG, "");
1926 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SOS_CALL_ONLY, bemergency);
1928 _vc_core_engine_status_isexists_call_bytype(pcall_engine, VC_OUTGOING_CALL, &bmocall_exists);
1929 if (TRUE == bmocall_exists) {
1930 CALL_ENG_DEBUG(ENG_DEBUG, "MO call is in progress...");
1931 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
1935 /*Ignore the MO Call, if already an Incoming call is in progress, MT Call is given high priority */
1936 _vc_core_engine_status_isexists_call_bytype(pcall_engine, VC_INCOMING_CALL, &bmtcall_exists);
1937 if (TRUE == bmtcall_exists) {
1938 CALL_ENG_DEBUG(ENG_DEBUG, "MT call is in progress");
1939 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
1943 if (TRUE == _vc_core_util_check_video_call_status()) {
1944 CALL_ENG_DEBUG(ENG_DEBUG, "Voice call is not allowed during video call...");
1945 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
1946 vc_engine_msg_box_type event_data;
1948 memset(&event_data, 0, sizeof(event_data));
1949 event_data.string_id = IDS_CALL_POP_VOICE_CALL_IS_NOT_ALLOWED_DURING_VIDEO_CALL;
1950 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
1955 if (TRUE == _vc_core_util_get_SAP_status()) {
1956 CALL_ENG_DEBUG(ENG_DEBUG, "SAP is on");
1957 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
1958 vc_engine_msg_box_type event_data;
1960 memset(&event_data, 0, sizeof(event_data));
1961 event_data.string_id = IDS_CALL_POP_UNAVAILABLE;
1962 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
1967 /*Prpare a call with the Voicecall Engine */
1968 setupcall_info.call_type = pcall_core->call_setup_info.call_type;
1969 _vc_core_util_strcpy(setupcall_info.source_tel_number, sizeof(setupcall_info.source_tel_number), pcall_core->call_setup_info.source_tel_number);
1970 _vc_core_util_strcpy(setupcall_info.tel_number, sizeof(setupcall_info.tel_number), pcall_core->call_setup_info.tel_number);
1972 /*Get CUG Details */
1973 _vc_core_util_get_cug_info(&setupcall_info);
1975 /*Get Identity Mode */
1976 _vc_core_util_get_identity_mode(&setupcall_info);
1978 CALL_ENG_DEBUG(ENG_DEBUG, "identity_mode = [%d], tel_number = [%s]", setupcall_info.identity_mode, setupcall_info.tel_number);
1980 error_code = _vc_core_engine_prepare_call(pcall_engine, &setupcall_info);
1981 if (ERROR_VOICECALL_NONE != error_code) {
1982 CALL_ENG_DEBUG(ENG_DEBUG, "_vc_core_engine_prepare_call failed, error code: %d", error_code);
1983 _vc_core_engine_finalize_call(pcall_engine, VC_OUTGOING_CALL, -1);
1984 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
1985 vc_engine_msg_box_type event_data;
1987 memset(&event_data, 0, sizeof(event_data));
1988 event_data.string_id = __voicecall_core_get_string_id_by_errorcode(error_code);
1989 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
1992 pcall_core->call_setup_info.call_type = setupcall_info.call_type;
1993 CALL_ENG_DEBUG(ENG_DEBUG, "call_type:[%d]", pcall_core->call_setup_info.call_type);
1995 pcall_core->call_setup_info.mo_call_index = setupcall_info.mo_call_index;
1996 if (TRUE == _vc_core_util_is_offline_mode()) {
1997 _vc_core_engine_finalize_call(pcall_engine, VC_OUTGOING_CALL, -1);
1998 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
2000 vc_engine_msg_box_type event_data;
2002 memset(&event_data, 0, sizeof(event_data));
2003 event_data.string_id = IDS_CALL_POP_CHANGEOFFLINEMODETOCALL;
2004 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
2008 /* Check for Following Conditions , only if not emergency Number */
2009 CALL_ENG_DEBUG(ENG_DEBUG, "mo_call_index = [%d]", setupcall_info.mo_call_index);
2010 error_code = _vc_core_engine_status_check_emergency_byindex(pcall_engine, setupcall_info.mo_call_index, &bemergency_call);
2011 if (ERROR_VOICECALL_NONE != error_code) {
2012 CALL_ENG_DEBUG(ENG_DEBUG, "Emergency Check Error code: %d", error_code);
2016 if (TRUE == _vc_core_util_is_pwlock()) {
2017 CALL_ENG_DEBUG(ENG_DEBUG, "PwLock is enabled.");
2018 if (bemergency_call == FALSE) {
2019 CALL_ENG_DEBUG(ENG_DEBUG, "Only emergency call is possible.");
2020 _vc_core_engine_finalize_call(pcall_engine, VC_OUTGOING_CALL, -1);
2021 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
2023 vc_engine_msg_box_type event_data;
2024 memset(&event_data, 0, sizeof(event_data));
2025 event_data.string_id = IDS_CALL_POP_CALLING_EMERG_ONLY;
2026 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
2032 /*Check for the following cases, if the call is not emergency call */
2033 if (FALSE == bemergency_call) {
2034 vc_engine_msg_box_type event_data;
2036 memset(&event_data, 0, sizeof(event_data));
2037 /* Check for NW Status and Emergency Mode */
2038 if (FALSE == _vc_core_util_get_nw_status(&nw_status)) {
2039 CALL_ENG_DEBUG(ENG_DEBUG, "Can't get a network status...");
2040 _vc_core_engine_finalize_call(pcall_engine, VC_OUTGOING_CALL, -1);
2042 event_data.string_id = IDS_CALL_POP_CALLNOTCALLOWED;
2043 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
2045 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
2048 if ((VCONFKEY_TELEPHONY_SVCTYPE_NONE == nw_status) || (VCONFKEY_TELEPHONY_SVCTYPE_NOSVC == nw_status) || (VCONFKEY_TELEPHONY_SVCTYPE_SEARCH == nw_status)) {
2049 CALL_ENG_DEBUG(ENG_DEBUG, "No Service: Call not Allowed");
2050 _vc_core_engine_finalize_call(pcall_engine, VC_OUTGOING_CALL, -1);
2051 event_data.string_id = IDS_CALL_POP_CALLNOTCALLOWED;
2052 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
2054 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
2056 } else if ((VCONFKEY_TELEPHONY_SVCTYPE_EMERGENCY == nw_status)) {
2057 CALL_ENG_DEBUG(ENG_DEBUG, "Emergency mode: Emergency call only...");
2058 _vc_core_engine_finalize_call(pcall_engine, VC_OUTGOING_CALL, -1);
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);
2062 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
2070 /*Check for voicemail number if it is not an emergency call */
2073 CALL_ENG_DEBUG(ENG_DEBUG, "MO Call Setup OVer");
2075 if (_vc_bt_get_bt_status() == TRUE) {
2076 voicecall_snd_set_path_status(pcall_core->papp_snd, VOICE_CALL_SND_PATH_BT);
2079 voicecall_core_make_call(pcall_core);
2085 * This function makes the actual voicecall prepared by the #voicecall_core_setup_call
2087 * @return Returns TRUE on success or FALSE on failure
2088 * @param[in] pcall_core Handle to voicecall core
2090 gboolean voicecall_core_make_call(call_vc_core_state_t *pcall_core)
2092 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2094 voicecall_error_t error_code = ERROR_VOICECALL_NONE;
2095 int call_handle = -1;
2097 CALL_ENG_DEBUG(ENG_DEBUG, "");
2099 /*Make Actual Call with Voicecall Engine */
2100 error_code = _vc_core_engine_make_call(pcall_engine, pcall_core->call_setup_info.mo_call_index, &call_handle);
2101 if (ERROR_VOICECALL_NONE != error_code) {
2102 vc_engine_msg_box_type event_data;
2104 memset(&event_data, 0, sizeof(event_data));
2106 _vc_core_engine_finalize_call(pcall_engine, VC_OUTGOING_CALL, -1);
2108 CALL_ENG_DEBUG(ENG_DEBUG, "_vc_core_engine_make_call Failed: Error_Code: %d..", error_code);
2110 switch (error_code) {
2111 case ERROR_VOICECALL_TAPI_CAUSE_CALL_FAILED:
2112 event_data.string_id = IDS_CALL_POP_CALLFAILED;
2115 case ERROR_VOICECALL_CALL_IMPOSSIBLE_NOSIM_NOEMERGNUM:
2116 event_data.string_id = IDS_CALL_POP_CALLFAILED;
2120 event_data.string_id = IDS_CALL_BODY_CALLENDED;
2123 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
2128 CALL_ENG_DEBUG(ENG_DEBUG, "Call Handle After Setup Call %d.", call_handle);
2130 voicecall_snd_register_cm(pcall_core->papp_snd);
2132 /* Set phonestatus value */
2133 _vc_core_util_set_call_status(VCONFKEY_CALL_VOICE_CONNECTING);
2139 * This function processed sat setup call
2141 * @return Returns TRUE on success or FALSE on failure
2142 * @param[in] pcall_core Handle to voicecall core
2145 gboolean voicecall_core_process_sat_setup_call(vcall_engine_sat_setup_call_info_t *sat_setup_call_info)
2147 CALL_ENG_DEBUG(ENG_DEBUG, "");
2148 TelSatSetupCallIndCallData_t *SatSetupCallIndCallInfo = NULL;
2150 SatSetupCallIndCallInfo = (TelSatSetupCallIndCallData_t *) calloc(1, sizeof(TelSatSetupCallIndCallData_t));
2151 if (NULL == SatSetupCallIndCallInfo)
2154 SatSetupCallIndCallInfo->commandId = sat_setup_call_info->command_id;
2155 SatSetupCallIndCallInfo->calltype = sat_setup_call_info->command_qualifier;
2156 SatSetupCallIndCallInfo->dispText.stringLen = strlen(sat_setup_call_info->disp_text);
2157 memcpy(SatSetupCallIndCallInfo->dispText.string, sat_setup_call_info->disp_text, strlen(sat_setup_call_info->disp_text));
2159 SatSetupCallIndCallInfo->callNumber.stringLen = strlen(sat_setup_call_info->call_num);
2160 memcpy(SatSetupCallIndCallInfo->callNumber.string, sat_setup_call_info->call_num, strlen(sat_setup_call_info->call_num));
2162 SatSetupCallIndCallInfo->duration = sat_setup_call_info->duration;
2164 _vc_core_engine_handle_sat_events_cb(SatSetupCallIndCallInfo, NULL);
2166 if (SatSetupCallIndCallInfo) {
2167 free(SatSetupCallIndCallInfo);
2168 SatSetupCallIndCallInfo = NULL;
2171 CALL_ENG_DEBUG(ENG_DEBUG, "End..");
2177 * This function processed incoming call
2179 * @return Returns TRUE on success or FALSE on failure
2180 * @param[in] pcall_core Handle to voicecall core
2183 gboolean voicecall_core_process_incoming_call(call_vc_core_incoming_info_t *incoming_call_info)
2185 CALL_ENG_DEBUG(ENG_DEBUG, "");
2186 TelCallIncomingCallInfo_t *IncomingCallInfo = NULL;
2188 CALL_ENG_DEBUG(ENG_DEBUG, " number is : [%s]", incoming_call_info->call_num);
2190 IncomingCallInfo = (TelCallIncomingCallInfo_t *) malloc(sizeof(TelCallIncomingCallInfo_t));
2191 if (NULL == IncomingCallInfo)
2193 memset(IncomingCallInfo, 0, sizeof(IncomingCallInfo));
2195 IncomingCallInfo->CallHandle = incoming_call_info->call_handle;
2196 IncomingCallInfo->CallType = incoming_call_info->call_type;
2197 IncomingCallInfo->CliPresentationIndicator = incoming_call_info->cli_presentation_indicator;
2198 _vc_core_util_strcpy(IncomingCallInfo->szCallingPartyNumber, sizeof(IncomingCallInfo->szCallingPartyNumber), incoming_call_info->call_num);
2199 IncomingCallInfo->CallingNameInfo.NameMode = incoming_call_info->calling_name_mode;
2200 _vc_core_util_strcpy(IncomingCallInfo->CallingNameInfo.szNameData, sizeof(IncomingCallInfo->CallingNameInfo.szNameData), incoming_call_info->calling_name);
2201 _vc_core_util_strcpy(IncomingCallInfo->RedirectInfo.szRedirectedNumber, sizeof(IncomingCallInfo->RedirectInfo.szRedirectedNumber), incoming_call_info->redirected_number);
2202 _vc_core_util_strcpy(IncomingCallInfo->RedirectInfo.szRedirectSubAddress, sizeof(IncomingCallInfo->RedirectInfo.szRedirectSubAddress), incoming_call_info->redirected_sub_address);
2203 IncomingCallInfo->CliCause = incoming_call_info->cli_cause;
2204 IncomingCallInfo->fwded = incoming_call_info->bfwded;
2205 IncomingCallInfo->ActiveLine = incoming_call_info->active_line;
2207 _vc_core_engine_handle_incoming_tapi_events(IncomingCallInfo, NULL);
2209 if (IncomingCallInfo) {
2210 free(IncomingCallInfo);
2211 IncomingCallInfo = NULL;
2214 CALL_ENG_DEBUG(ENG_DEBUG, "End..");
2220 * This function answers an incoming call
2222 * @return Returns TRUE on success or FALSE on failure
2223 * @param[in] pcall_core Handle to voicecall core
2226 gboolean voicecall_core_answer_call(call_vc_core_state_t *pcall_core, gboolean auto_accept)
2228 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2230 gboolean active_calls = FALSE;
2231 gboolean held_calls = FALSE;
2233 CALL_ENG_DEBUG(ENG_DEBUG, "");
2235 /*First Stop the Incoming alert */
2236 voicecall_snd_stop_alert(pcall_core->papp_snd);
2238 __voicecall_core_cancel_auto_answer(pcall_core);
2240 _vc_core_engine_status_isexists_any_call(pcall_engine, &active_calls, &held_calls);
2241 CALL_ENG_DEBUG(ENG_DEBUG, "active_calls=%d, held_calls=%d", active_calls, held_calls);
2243 if (TRUE == active_calls && TRUE == held_calls) {
2244 /* Both Active and held calls available, so show Accept Call Choice Box */
2245 vc_engine_accept_choice_box_type event_data;
2247 memset(&event_data, 0, sizeof(event_data));
2248 event_data.choice = VC_CALL_ACCEPT_2;
2250 vcall_engine_send_event_to_client(VC_ENGINE_MSG_ACCEPT_CHOICE_BOX_TO_UI, (void *)&event_data);
2253 } else if (TRUE == active_calls) {
2254 /*If Auto Accpet is FALSE, show popup for manual accept */
2255 if (FALSE == auto_accept) {
2256 /* Active calls available, so show Accept Call Choice Box */
2257 vc_engine_accept_choice_box_type event_data;
2259 memset(&event_data, 0, sizeof(event_data));
2260 event_data.choice = VC_CALL_ACCEPT_1;
2262 vcall_engine_send_event_to_client(VC_ENGINE_MSG_ACCEPT_CHOICE_BOX_TO_UI, (void *)&event_data);
2264 voicecall_core_answer_call_bytype(pcall_core, VC_ANSWER_HOLD_ACTIVE_AND_ACCEPT);
2267 } else if (TRUE == held_calls) {
2268 /* vcui_app_view_mtcall_destroy(papp_document); */
2271 /* Normal Call Scenario */
2272 voicecall_core_answer_call_bytype(pcall_core, VC_ANSWER_NORMAL);
2278 * This function answers an incoming call according to the given type
2280 * @return Returns TRUE -if answer is sucess, FALSE - otherwise
2281 * @param[in] pcall_core Handle to voicecall core
2283 gboolean voicecall_core_answer_call_bytype(call_vc_core_state_t *pcall_core, voicecall_answer_type_t answer_type)
2285 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2287 voicecall_error_t error_code = ERROR_VOICECALL_NONE;
2289 CALL_ENG_DEBUG(ENG_DEBUG, "answer type: %d", answer_type);
2291 /*First Stop the Incoming alert */
2292 voicecall_snd_stop_alert(pcall_core->papp_snd);
2293 __voicecall_core_cancel_auto_answer(pcall_core);
2295 error_code = _vc_core_engine_answer_call(pcall_engine, answer_type);
2297 if (ERROR_VOICECALL_NONE != error_code) {
2298 CALL_ENG_DEBUG(ENG_ERR, "_vc_core_engine_answer_call Failed : %d", error_code);
2306 * This function rejects an incoming call
2308 * @return Returns TRUE on success or FALSE on failure
2309 * @param[in] pcall_core Handle to voicecall core
2310 * @param[in] bUDUB TRUE - set UDUB, FALSE - reject call
2312 gboolean voicecall_core_reject_mt(call_vc_core_state_t *pcall_core, gboolean bUDUB)
2314 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2315 voicecall_snd_mgr_t *papp_snd = pcall_core->papp_snd;
2317 voicecall_error_t error_code = ERROR_VOICECALL_NONE;
2319 CALL_ENG_DEBUG(ENG_DEBUG, "");
2321 /*Incoming call rejected, reset the accept by flag */
2322 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_ACCEPT_BY_BT, FALSE);
2324 /* Stop Incmoing Call Alert */
2325 voicecall_snd_stop_alert(papp_snd);
2327 __voicecall_core_cancel_auto_answer(pcall_core);
2329 CALL_ENG_DEBUG(ENG_DEBUG, "bUDUB = %d", bUDUB);
2330 error_code = _vc_core_engine_reject_call(pcall_engine, bUDUB);
2332 if (ERROR_VOICECALL_NONE != error_code) {
2333 CALL_ENG_DEBUG(ENG_ERR, "_vc_core_engine_reject_call Failed, error_code = %ud", error_code);
2342 * This function ends the call by state
2344 * @return Returns TRUE on success or FALSE on failure
2345 * @param[in] pcall_core Handle to voicecall core
2347 gboolean voicecall_core_end_call(call_vc_core_state_t *pcall_core)
2349 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2351 CALL_ENG_DEBUG(ENG_DEBUG, "");
2353 return (ERROR_VOICECALL_NONE == _vc_core_engine_end_call(pcall_engine, VC_END_ACTIVE_OR_HELD_CALLS)) ? TRUE : FALSE;
2357 * This function ends the call corresponding to the given call handle
2359 * @return Returns TRUE on success or FALSE on failure
2360 * @param[in] pcall_core Handle to voicecall core
2361 * @param[in] call_handle handle of the call to be ended
2363 gboolean voicecall_core_end_call_by_handle(call_vc_core_state_t *pcall_core, int call_handle)
2365 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2367 CALL_ENG_DEBUG(ENG_DEBUG, "");
2369 return (ERROR_VOICECALL_NONE == _vc_core_engine_end_call_byhandle(pcall_engine, call_handle)) ? TRUE : FALSE;
2373 * This function ends all available calls
2375 * @return Returns TRUE on success or FALSE on failure
2376 * @param[in] pcall_core Handle to voicecall core
2378 gboolean voicecall_core_end_all_calls(call_vc_core_state_t *pcall_core)
2380 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2382 CALL_ENG_DEBUG(ENG_DEBUG, "");
2384 return (ERROR_VOICECALL_NONE == _vc_core_engine_end_call(pcall_engine, VC_END_ALL_CALLS)) ? TRUE : FALSE;
2388 * This function ends all available active calls
2390 * @return Returns TRUE on success or FALSE on failure
2391 * @param[in] pcall_core Handle to voicecall core
2393 gboolean voicecall_core_end_all_active_calls(call_vc_core_state_t *pcall_core)
2395 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2397 CALL_ENG_DEBUG(ENG_DEBUG, "");
2399 return (ERROR_VOICECALL_NONE == _vc_core_engine_end_call(pcall_engine, VC_END_ALL_ACTIVE_CALLS)) ? TRUE : FALSE;
2403 * This function ends all available held calls
2405 * @return Returns TRUE on success or FALSE on failure
2406 * @param[in] pcall_core Handle to voicecall core
2408 gboolean voicecall_core_end_all_held_calls(call_vc_core_state_t *pcall_core)
2410 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2412 CALL_ENG_DEBUG(ENG_DEBUG, "");
2414 return (ERROR_VOICECALL_NONE == _vc_core_engine_end_call(pcall_engine, VC_END_ALL_HELD_CALLS)) ? TRUE : FALSE;
2418 * This function cancel outgoing call
2420 * @return Returns TRUE -if answer is sucess, FALSE - otherwise
2421 * @param[in] pcall_core Handle to voicecall core
2423 gboolean voicecall_core_cancel_call(call_vc_core_state_t *pcall_core)
2426 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2428 voicecall_call_type_bysetup_t call_setup_by = VC_CALL_SETUP_BY_NORMAL;
2430 CALL_ENG_DEBUG(ENG_DEBUG, "");
2432 /*Get Call Setup by Information */
2433 call_setup_by = pcall_core->call_setup_info.call_setup_by;
2435 _vc_core_engine_status_get_engine_iostate(pcall_engine, &io_state);
2438 case VC_INOUT_STATE_OUTGOING_WAIT_HOLD:
2440 int call_handle = -1;
2442 if (VC_CALL_SETUP_BY_SAT == call_setup_by) {
2443 _vc_core_engine_send_sat_response(pcall_engine, SAT_RQST_SETUP_CALL, CALL_VC_ME_CLEAR_DOWN_BEFORE_CONN);
2446 /* Clear the MO Call, since the call is not dialed yet */
2447 _vc_core_engine_status_get_call_handle_bytype(pcall_engine, VC_OUTGOING_CALL, &call_handle);
2448 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_END, call_handle, NULL);
2450 __vc_core_set_auto_redial_count(pcall_core, 0);
2451 voicecall_core_clear_mo_call(pcall_engine);
2453 _vc_core_engine_change_engine_iostate(pcall_engine, VC_INOUT_STATE_OUTGOING_ABORTED);
2457 case VC_INOUT_STATE_OUTGOING_WAIT_ORIG:
2458 case VC_INOUT_STATE_OUTGOING_WAIT_ALERT:
2459 case VC_INOUT_STATE_OUTGOING_WAIT_CONNECTED:
2461 /*To retrieve the held call automatically once the mo call is ended, if held is call is available */
2462 _vc_core_engine_status_set_end_flag(pcall_engine, VC_RETREIVE_CALL_ON_MOCALL_END);
2464 /* release the call , since it is dialed and waiting for connecting */
2465 if (FALSE == voicecall_core_end_mo_call(pcall_engine)) {
2466 CALL_ENG_DEBUG(ENG_DEBUG, "MO Call Release Failed");
2468 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_MOCALL_END_BY_USER, TRUE);
2469 _vc_core_engine_change_engine_iostate(pcall_engine, VC_INOUT_STATE_OUTGOING_WAIT_RELEASE);
2474 case VC_INOUT_STATE_OUTGOING_WAIT_RELEASE:
2476 /*Call already released */
2477 CALL_ENG_DEBUG(ENG_DEBUG, "MO Call has been released already");
2481 case VC_INOUT_STATE_OUTGOING_SHOW_REDIALCAUSE:
2482 case VC_INOUT_STATE_OUTGOING_ABORTED:
2483 case VC_INOUT_STATE_OUTGOING_WAIT_REDIAL:
2485 int call_handle = -1;
2487 if (VC_CALL_SETUP_BY_SAT == call_setup_by) {
2488 _vc_core_engine_send_sat_response(pcall_engine, SAT_RQST_SETUP_CALL, CALL_VC_NETWORK_UNABLE_TO_PROCESS_COMMAND);
2491 /*Stop Signal Play */
2492 voicecall_snd_stop_signal(pcall_core->papp_snd);
2494 __voicecall_core_mocall_reset_engine_state(pcall_engine);
2496 _vc_core_engine_status_get_call_handle_bytype(pcall_engine, VC_OUTGOING_CALL, &call_handle);
2497 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_END, call_handle, NULL);
2499 __vc_core_set_auto_redial_count(pcall_core, 0);
2500 voicecall_core_clear_mo_call(pcall_engine);
2506 CALL_ENG_DEBUG(ENG_DEBUG, "Action not defined for this IO State: %d", io_state);
2514 * This function process hold/retrive/swap conntected call
2516 * @return Returns TRUE -if answer is sucess, FALSE - otherwise
2517 * @param[in] pcall_core Handle to voicecall core
2519 gboolean voicecall_core_process_hold_call(call_vc_core_state_t *pcall_core)
2521 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2523 gboolean active_calls = FALSE;
2524 gboolean held_calls = FALSE;
2526 CALL_ENG_DEBUG(ENG_DEBUG, "");
2528 if (TRUE == voicecall_core_get_status(pcall_core, CALL_VC_CORE_FLAG_SOS_CALL_ONLY)) {
2529 CALL_ENG_DEBUG(ENG_DEBUG, "SOS Call... Ignore this button...");
2533 if (FALSE == voicecall_core_is_incall_request_possible(pcall_engine)) {
2537 voicecall_core_is_call_exists(pcall_engine, &active_calls, &held_calls);
2538 CALL_ENG_DEBUG(ENG_DEBUG, "active calls: %d, held calls: %d", active_calls, held_calls);
2540 if (active_calls && held_calls) {
2542 /*Both Calls available, swap the calls */
2543 if (FALSE == voicecall_core_swap_calls(pcall_engine)) {
2546 } else if (active_calls) {
2547 /*Only activa call available, hold the call */
2548 if (FALSE == voicecall_core_hold_call(pcall_engine)) {
2551 } else if (held_calls) {
2552 /*Only Held call available, retrieve the call */
2553 if (FALSE == voicecall_core_retrieve_call(pcall_engine)) {
2557 CALL_ENG_DEBUG(ENG_DEBUG, "no call exists!");
2565 * This function sets up a conference call
2567 * @return Returns TRUE on success or FALSE on failure
2568 * @param[in] pcall_core Handle to voicecall core
2570 gboolean voicecall_core_setup_conference(call_vc_core_state_t *pcall_core)
2572 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2574 CALL_ENG_DEBUG(ENG_DEBUG, "");
2576 return (ERROR_VOICECALL_NONE == _vc_core_engine_setup_conference(pcall_engine)) ? TRUE : FALSE;
2580 * This function splits the call corressponding to the given call handle and makes a private call
2582 * @return Returns TRUE on success or FALSE on failure
2583 * @param[in] pcall_core Handle to voicecall core
2584 * @param[in] call_handle Call to be splitted from the conference call
2586 gboolean voicecall_core_make_private_call(call_vc_core_state_t *pcall_core, int call_handle)
2588 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2590 CALL_ENG_DEBUG(ENG_DEBUG, "");
2592 return (ERROR_VOICECALL_NONE == _vc_core_engine_private_call(pcall_engine, call_handle)) ? TRUE : FALSE;
2596 * This function transfers the call from active call to the held call
2598 * @return Returns TRUE on success or FALSE on failure
2599 * @param[in] pcall_core Handle to voicecall core
2601 gboolean voicecall_core_transfer_calls(call_vc_core_state_t *pcall_core)
2603 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2605 CALL_ENG_DEBUG(ENG_DEBUG, "");
2607 return (ERROR_VOICECALL_NONE == _vc_core_engine_transfer_calls(pcall_engine)) ? TRUE : FALSE;
2611 * This function sends a dtmf string
2613 * @return Returns TRUE on success or FALSE on failure
2614 * @param[in] pcall_core Handle to voicecall core
2615 * @param[in] dtmf_string dtmf string to be sent
2617 gboolean voicecall_core_send_dtmf(call_vc_core_state_t *pcall_core, char *dtmf_string)
2619 voicecall_error_t error_code = ERROR_VOICECALL_NONE;
2620 CALL_ENG_DEBUG(ENG_DEBUG, "dtmf string: %s", dtmf_string);
2622 pcall_core->bdtmf_queue = FALSE;
2623 error_code = _vc_core_engine_send_dtmf(pcall_core->pcall_engine, dtmf_string);
2624 return (ERROR_VOICECALL_NONE == error_code) ? TRUE : FALSE;
2628 * This function stops sound alert in case of reject with msg
2630 * @return Returns TRUE on success or FALSE on failure
2631 * @param[in] pcall_core Handle to voicecall core
2633 gboolean voicecall_core_stop_alert(call_vc_core_state_t *pcall_core)
2635 CALL_ENG_DEBUG(ENG_DEBUG, "");
2637 /* Stop Incmoing Call Alert */
2638 voicecall_snd_stop_alert(pcall_core->papp_snd);
2643 inline gboolean voicecall_core_get_mo_call_handle(call_vc_core_state_t *pcall_core, int *pcall_handle)
2646 return (ERROR_VOICECALL_NONE == _vc_core_engine_status_get_call_handle_bytype(pcall_core->pcall_engine, VC_OUTGOING_CALL, pcall_handle)) ? TRUE : FALSE;
2649 inline int voicecall_core_get_auto_redial_count(call_vc_core_state_t *pcall_core)
2651 return pcall_core->auto_redial_count;
2654 void __vc_core_set_auto_redial_count(call_vc_core_state_t *pcall_core, int auto_redial_count)
2656 pcall_core->auto_redial_count = auto_redial_count;
2659 gboolean voicecall_core_start_redial(call_vc_core_state_t *pcall_core, int manual_redial)
2661 int auto_redial_status = FALSE;
2662 int redial_count = 1;
2663 int call_handle = -1;
2664 int total_call_member = 0;
2666 CALL_ENG_DEBUG(ENG_DEBUG, "");
2667 CALL_ENG_DEBUG(ENG_DEBUG, "auto_redial_status:[%d]", auto_redial_status);
2669 redial_count = voicecall_core_get_auto_redial_count(pcall_core);
2674 bmanual_redial == TRUE : Redial is made by User, No need to check the auto redial status and count
2675 auto_redial_status == 1: Auto Redial for GCF case, auto redial count must be checked
2677 if ((1 == manual_redial) || ((auto_redial_status == 1) && (redial_count < MO_REDIAL_COUNT_MAX))) {
2678 CALL_ENG_DEBUG(ENG_DEBUG, "redial_count = %d", redial_count);
2680 /*Start Redial Timer */
2681 if (1 == redial_count) {
2682 CALL_ENG_DEBUG(ENG_DEBUG, "MO_REDIAL_TIMER_INTERVAL_FIRST");
2683 pcall_core->mo_redial_timer = g_timeout_add(MO_REDIAL_TIMER_INTERVAL_FIRST, mo_redial_timer_cb, pcall_core);
2684 } else if ((redial_count > 1) && (redial_count < 5)) {
2685 CALL_ENG_DEBUG(ENG_DEBUG, "MO_REDIAL_TIMER_INTERVAL_SECOND");
2686 pcall_core->mo_redial_timer = g_timeout_add(MO_REDIAL_TIMER_INTERVAL_SECOND, mo_redial_timer_cb, pcall_core);
2688 CALL_ENG_DEBUG(ENG_DEBUG, "MO_REDIAL_TIMER_INTERVAL_THIRD");
2689 pcall_core->mo_redial_timer = g_timeout_add(MO_REDIAL_TIMER_INTERVAL_THIRD, mo_redial_timer_cb, pcall_core);
2692 voicecall_core_change_engine_state(pcall_core->pcall_engine, VC_INOUT_STATE_OUTGOING_WAIT_REDIAL);
2694 CALL_ENG_DEBUG(ENG_DEBUG, "You dont need to redial close the MO Call Things");
2696 /* __vcui_app_view_mo_canceltimer_cb() */
2697 _vc_core_engine_status_get_call_handle_bytype(pcall_core->pcall_engine, VC_OUTGOING_CALL, &call_handle);
2698 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_END, call_handle, NULL);
2700 __vc_core_set_auto_redial_count(pcall_core, 0);
2701 voicecall_core_clear_mo_call(pcall_core->pcall_engine);
2703 __voicecall_core_mocall_reset_engine_state(pcall_core->pcall_engine);
2705 voicecall_core_get_total_call_member(pcall_core->pcall_engine, &total_call_member);
2707 voicecall_snd_stop_signal(pcall_core->papp_snd);
2709 /* If No Connected Calls End the UI */
2710 if (total_call_member == 0) {
2711 /*Reset voice call core to default values */
2712 voicecall_core_set_to_default(pcall_core);
2714 voicecall_snd_change_path(pcall_core->papp_snd);
2722 inline gboolean voicecall_core_prepare_redial(call_vc_core_state_t *pcall_core, int call_handle)
2724 voicecall_error_t error_code = ERROR_VOICECALL_NONE;
2726 CALL_ENG_DEBUG(ENG_DEBUG, "");
2728 error_code = _vc_core_engine_prepare_redial(pcall_core->pcall_engine, call_handle);
2730 CALL_ENG_DEBUG(ENG_DEBUG, "_vc_core_engine_prepare_redial returned : %d", error_code);
2732 return (ERROR_VOICECALL_NONE == error_code) ? TRUE : FALSE;
2735 gboolean mo_redial_timer_cb(void *data)
2737 int call_handle = -1;
2740 CALL_ENG_DEBUG(ENG_DEBUG, "mo_redial_timer_cb");
2741 call_vc_core_state_t *pcall_core = (call_vc_core_state_t *)data;
2742 voicecall_core_get_mo_call_handle(pcall_core, &call_handle);
2743 CALL_ENG_DEBUG(ENG_DEBUG, "call handle is %d", call_handle);
2745 redial_count = voicecall_core_get_auto_redial_count(pcall_core);
2747 __vc_core_set_auto_redial_count(pcall_core, redial_count);
2749 CALL_ENG_DEBUG(ENG_DEBUG, "redial_count:[%d]", redial_count);
2751 voicecall_core_prepare_redial(pcall_core, call_handle);
2752 CALL_ENG_DEBUG(ENG_DEBUG, "voicecall_core_prepare_redial done.");
2754 voicecall_core_make_call(pcall_core);
2758 gboolean voicecall_core_stop_redial(call_vc_core_state_t *pcall_core)
2760 int call_handle = -1, total_call_member = -1;
2762 CALL_ENG_DEBUG(ENG_DEBUG, "coming inside voicecall_core_stop_redial");
2764 _vc_core_util_set_call_status(VCONFKEY_CALL_OFF);
2766 /*Cancel the Redial Timer */
2767 if (pcall_core->mo_redial_timer != -1) {
2768 CALL_ENG_DEBUG(ENG_DEBUG, "mo_redial_timer removing..");
2769 g_source_remove(pcall_core->mo_redial_timer);
2770 pcall_core->mo_redial_timer = -1;
2773 /* __vcui_app_view_mo_canceltimer_cb() */
2774 _vc_core_engine_status_get_call_handle_bytype(pcall_core->pcall_engine, VC_OUTGOING_CALL, &call_handle);
2775 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_END, call_handle, NULL);
2777 __vc_core_set_auto_redial_count(pcall_core, 0);
2778 voicecall_core_clear_mo_call(pcall_core->pcall_engine);
2780 __voicecall_core_mocall_reset_engine_state(pcall_core->pcall_engine);
2782 voicecall_core_get_total_call_member(pcall_core->pcall_engine, &total_call_member);
2784 voicecall_snd_stop_signal(pcall_core->papp_snd);
2786 /* If No Connected Calls End the UI */
2787 if (total_call_member == 0) {
2788 /*Reset voice call core to default values */
2789 voicecall_core_set_to_default(pcall_core);
2791 voicecall_snd_change_path(pcall_core->papp_snd);
2797 static gboolean __voicecall_core_auto_answer_timer_cb(gpointer puser_data)
2799 call_vc_core_state_t *pcall_core = (call_vc_core_state_t *)puser_data;
2801 if (pcall_core->auto_answer_timer > 0) {
2802 g_source_remove(pcall_core->auto_answer_timer);
2803 pcall_core->auto_answer_timer = 0;
2806 /*Check for Incoming call and then answer the call */
2807 if (TRUE == voicecall_core_is_incoming_call_exists(pcall_core->pcall_engine)) {
2808 CALL_ENG_DEBUG(ENG_DEBUG, "Call Answered");
2809 voicecall_core_answer_call(pcall_core, TRUE);
2816 static gboolean __voicecall_core_callstatus_set_timer_cb(gpointer puser_data)
2818 call_vc_core_state_t *pcall_core = (call_vc_core_state_t *)puser_data;
2820 if (pcall_core->callstatus_timer > 0) {
2821 g_source_remove(pcall_core->callstatus_timer);
2822 pcall_core->callstatus_timer = 0;
2825 _vc_core_util_set_call_status(VCONFKEY_CALL_VOICE_CONNECTING);
2831 static gboolean __voicecall_core_auto_answer_idle_cb(gpointer puser_data)
2833 call_vc_core_state_t *pcall_core = (call_vc_core_state_t *)puser_data;
2834 int engine_state = 0;
2835 int auto_answer_time = 0, ret = -1;
2836 unsigned long auto_answer_time_interval = 0;
2838 _vc_core_engine_status_get_engine_iostate(pcall_core->pcall_engine, &engine_state);
2839 CALL_ENG_DEBUG(ENG_DEBUG, "eng_state : %d", engine_state);
2840 if (engine_state != VC_INOUT_STATE_INCOME_BOX) {
2841 CALL_ENG_DEBUG(ENG_DEBUG, "Engine State not in Income Box, Current State: %d", engine_state);
2844 /* Read the time interval from gconf and set the redial timer */
2845 ret = vconf_get_int(VCONFKEY_CISSAPPL_ANSWERING_MODE_TIME_INT, &auto_answer_time);
2847 auto_answer_time_interval = auto_answer_time * 1000;
2848 CALL_ENG_DEBUG(ENG_DEBUG, "The time interval is : %ld", auto_answer_time_interval);
2850 CALL_ENG_DEBUG(ENG_DEBUG, "vconf_get_int FAILED");
2854 pcall_core->auto_answer_timer = g_timeout_add(auto_answer_time_interval, __voicecall_core_auto_answer_timer_cb, pcall_core);
2859 * This function checks whether given answer mode is enabled or not
2861 * @return returns TRUE if given answer mode type is enabled in the settings or FALSE otherwise
2864 static gboolean __vc_core_is_answermode_enabled_from_testmode(void)
2866 CALL_ENG_DEBUG(ENG_DEBUG, "..");
2870 ret = vconf_get_int(VCONFKEY_TESTMODE_AUTO_ANSWER, &benabled);
2872 CALL_ENG_DEBUG(ENG_DEBUG, "benabled = %d", benabled);
2873 if (TRUE == benabled)
2878 CALL_ENG_DEBUG(ENG_DEBUG, "vconf_get_int FAILED");
2884 * This function checks whether given answer mode is enabled or not
2886 * @return returns TRUE if given answer mode type is enabled in the settings or FALSE otherwise
2889 static gboolean __vc_core_is_answermode_enabled(void)
2891 CALL_ENG_DEBUG(ENG_DEBUG, "coming inside voicecall_is_answermode_enabled");
2892 int answer_mode_enabled = -1;
2895 ret = vconf_get_int(VCONFKEY_CISSAPPL_ANSWERING_MODE_INT, &answer_mode_enabled);
2897 CALL_ENG_DEBUG(ENG_DEBUG, "answer_mode_enabled = %d", answer_mode_enabled);
2898 if (2 == answer_mode_enabled) /* here 2 is auto answer mode is enabled */
2903 CALL_ENG_DEBUG(ENG_DEBUG, "vconf_get_int FAILED");
2910 * This function processes auto answer request
2912 * @return Returns void
2913 * @param[in] pcall_core Handle to voicecall core
2915 static void __voicecall_core_start_auto_answer(call_vc_core_state_t *pcall_core, gboolean isTestMode)
2917 gboolean earjack_connected = FALSE;
2918 gboolean headset_connected = FALSE;
2920 CALL_ENG_DEBUG(ENG_DEBUG, "..");
2922 if (TRUE == isTestMode) {
2923 CALL_ENG_DEBUG(ENG_DEBUG, "In case Of Testmode, always auto answer enabled");
2925 g_idle_add(__voicecall_core_auto_answer_idle_cb, pcall_core);
2928 earjack_connected = _voicecall_dvc_get_earjack_connected();
2930 if (TRUE == earjack_connected) {
2931 CALL_ENG_DEBUG(ENG_DEBUG, "earjack is connected");
2933 headset_connected = _vc_bt_get_bt_status();
2935 if (TRUE == headset_connected) {
2936 CALL_ENG_DEBUG(ENG_DEBUG, "headset is connected");
2939 if (TRUE == earjack_connected || TRUE == headset_connected) {
2940 g_idle_add(__voicecall_core_auto_answer_idle_cb, pcall_core);
2942 CALL_ENG_DEBUG(ENG_DEBUG, "Without earjack or headset, skip auto answer ");
2948 * This function cancels the auto answering timer
2951 * @param[in] pcall_core Handle to voicecall core
2953 static void __voicecall_core_cancel_auto_answer(call_vc_core_state_t *pcall_core)
2955 CALL_ENG_DEBUG(ENG_DEBUG, "coming inside __voicecall_cancel_auto_answer");
2956 if (pcall_core->auto_answer_timer > 0) {
2957 g_source_remove(pcall_core->auto_answer_timer);
2958 pcall_core->auto_answer_timer = 0;
2964 * This function checks BT headset and Earjack status
2967 * @param[in] pcall_core Handle to voicecall core
2969 static void __voicecall_core_check_headset_earjack_status(call_vc_core_state_t *pcall_core)
2971 gboolean bt_connected = FALSE;
2973 bt_connected = _vc_bt_get_bt_status();
2974 CALL_ENG_DEBUG(ENG_DEBUG, "Bt connected =%d", bt_connected);
2976 pcall_core->bt_connected = bt_connected;
2978 CALL_ENG_DEBUG(ENG_DEBUG, "Update the earjack status");
2979 _voicecall_dvc_get_earjack_status(pcall_core);
2984 * This function parses the in call supplementary services string and returns the in call ss to be used
2986 * @return Returns in call ss state #vcui_app_incall_ss_state_t
2987 * @param[in] pcall_core Handle to voicecall core
2988 * @param[in] number number to be parsed
2990 call_vc_core_incall_ss_state_t voicecall_core_parse_incall_ss_string(call_vc_core_state_t *pcall_core, char *number)
2992 call_vc_core_incall_ss_state_t ss_value = CALL_VC_CORE_SS_USSD;
2994 if (strlen(number) == 1) {
2995 switch (number[0]) {
2997 ss_value = CALL_VC_CORE_SS_0;
3000 ss_value = CALL_VC_CORE_SS_1;
3003 ss_value = CALL_VC_CORE_SS_2;
3006 ss_value = CALL_VC_CORE_SS_3;
3009 ss_value = CALL_VC_CORE_SS_4;
3012 ss_value = CALL_VC_CORE_SS_USSD;
3015 } else if (strlen(number) == 2) {
3016 if ((number[0] == '1') && (number[1] > '0') && (number[1] < '8')) {
3017 pcall_core->selected_call_id_in_ss = atoi(number + 1);
3018 ss_value = CALL_VC_CORE_SS_1X;
3021 if ((number[0] == '2') && (number[1] > '0') && (number[1] < '8')) {
3022 pcall_core->selected_call_id_in_ss = atoi(number + 1);
3023 ss_value = CALL_VC_CORE_SS_2X;
3026 CALL_ENG_DEBUG(ENG_DEBUG, "ss parsed value: %d", ss_value);
3031 * This function starts the supplementary services while on call
3033 * @return Returns TRUE If transfer call can be made or FALSE if not
3034 * @param[in] pcall_core Handle to voicecall core
3035 * @param[in] incall_ss_state state of the In Call Supplementary Service
3037 gboolean voicecall_core_start_incall_ss(call_vc_core_state_t *pcall_core, call_vc_core_incall_ss_state_t incall_ss_state)
3039 gboolean active_calls = FALSE, held_calls = FALSE;
3041 _vc_core_engine_status_isexists_any_call(pcall_core->pcall_engine, &active_calls, &held_calls);
3043 CALL_ENG_DEBUG(ENG_DEBUG, "ss state = %d", incall_ss_state);
3044 vc_engine_msg_box_type event_data;
3045 memset(&event_data, 0, sizeof(event_data));
3046 event_data.string_id = IDS_CALL_POP_OPERATION_REFUSED;
3048 /*Cancel DTMF Sending if any and close the dtmf ui */
3049 /* vcui_app_doc_cancel_dtmf_queue(papp_document); sathwick TBD */
3051 switch (incall_ss_state) {
3052 /* Releases all held calls or Set UDUB(User Determined User Busy) for a waiting call */
3053 case CALL_VC_CORE_SS_0:
3055 /* if an incoming call is activated, reject the incoming all */
3056 if (TRUE == voicecall_core_is_incoming_call_exists(pcall_core->pcall_engine)) {
3057 voicecall_core_reject_mt(pcall_core, TRUE);
3059 } else if (held_calls) {
3060 voicecall_core_end_all_held_calls(pcall_core);
3062 CALL_ENG_DEBUG(ENG_DEBUG, "There are no held calls to do the processing");
3063 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3064 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3068 case CALL_VC_CORE_SS_1:
3070 if (voicecall_core_is_incoming_call_exists(pcall_core->pcall_engine)) {
3071 /* Accept incoming call */
3072 voicecall_core_answer_call_bytype(pcall_core, VC_ANSWER_RELEASE_ACTIVE_AND_ACCEPT);
3074 } else if (voicecall_core_is_outgoing_call_exists(pcall_core->pcall_engine)) {
3075 /* This fucntion checks for held calls to be retreived on response of ending call */
3076 voicecall_core_set_check_ss_on_end(pcall_core);
3077 voicecall_core_end_mo_call(pcall_core->pcall_engine);
3078 } else if (active_calls) {
3079 voicecall_core_end_all_active_calls(pcall_core);
3080 voicecall_core_set_check_ss_on_end(pcall_core);
3081 } else if (held_calls) {
3082 _vc_core_engine_retrieve_call(pcall_core->pcall_engine);
3085 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3086 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3090 case CALL_VC_CORE_SS_1X:
3092 if (voicecall_core_is_incoming_call_exists(pcall_core->pcall_engine)) {
3094 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3095 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3096 } else if (active_calls) {
3098 if (!(ERROR_VOICECALL_NONE == _vc_core_engine_end_call_bycallId(pcall_core->pcall_engine, pcall_core->selected_call_id_in_ss))) {
3100 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3101 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3105 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3106 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3110 case CALL_VC_CORE_SS_2:
3113 if (voicecall_core_is_incoming_call_exists(pcall_core->pcall_engine)) {
3114 if (active_calls && held_calls) {
3116 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3117 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3119 #ifdef _CPHS_DEFINED_ /* Not used currently */
3120 if (TRUE == active_calls && (voicecall_core_get_cphs_csp_status(pcall_core->pcall_engine, VC_CPHS_CSP_HOLD))) {
3122 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3123 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3127 voicecall_core_answer_call(pcall_core, TRUE);
3129 } else if (voicecall_core_is_outgoing_call_exists(pcall_core->pcall_engine)) {
3131 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3132 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3133 } else if (active_calls && held_calls) {
3134 _vc_core_engine_swap_calls(pcall_core->pcall_engine);
3135 } else if (active_calls) {
3136 _vc_core_engine_hold_call(pcall_core->pcall_engine);
3137 } else if (held_calls) {
3138 _vc_core_engine_retrieve_call(pcall_core->pcall_engine);
3141 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3142 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3146 case CALL_VC_CORE_SS_2X:
3148 if (voicecall_core_is_incoming_call_exists(pcall_core->pcall_engine) || voicecall_core_is_outgoing_call_exists(pcall_core->pcall_engine)) {
3150 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3151 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3152 } else if (TRUE == active_calls && FALSE == held_calls) {
3153 int active_members = 0;
3155 voicecall_core_get_active_call_member(pcall_core, &active_members);
3157 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)))) {
3159 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3160 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3164 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3165 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3169 case CALL_VC_CORE_SS_3:
3171 if (TRUE == voicecall_core_is_incoming_call_exists(pcall_core->pcall_engine)) {
3173 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3174 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3178 if (TRUE == voicecall_core_is_conf_call_possible(pcall_core)) {
3179 _vc_core_engine_setup_conference(pcall_core->pcall_engine);
3182 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3183 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3187 case CALL_VC_CORE_SS_4:
3188 if (TRUE == voicecall_core_is_transfer_call_possible(pcall_core)) {
3189 if (FALSE == voicecall_core_transfer_calls(pcall_core)) {
3191 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3192 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3196 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3197 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3201 CALL_ENG_DEBUG(ENG_DEBUG, "Invalid SS State");
3202 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3203 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3209 * This function processed the supplementary services while on call
3211 * @return Returns TRUE If transfer call can be made or FALSE if not
3212 * @param[in] pcall_core Handle to voicecall core
3213 * @param[in] pdialled_number dial number
3215 void voicecall_core_process_incall_ss(call_vc_core_state_t *pcall_core, char *pdialled_number)
3217 call_vc_core_incall_ss_state_t incall_ss_state = CALL_VC_CORE_SS_NONE;
3219 CALL_ENG_DEBUG(ENG_DEBUG, " ..");
3221 incall_ss_state = voicecall_core_parse_incall_ss_string(pcall_core, pdialled_number);
3223 if (incall_ss_state != CALL_VC_CORE_SS_USSD) {
3224 voicecall_core_start_incall_ss(pcall_core, incall_ss_state);
3227 CALL_ENG_DEBUG(ENG_DEBUG, "Involves CISS functionality so need for us to handle and will be handled by CISS");
3228 vc_engine_msg_box_type event_data;
3229 memset(&event_data, 0, sizeof(event_data));
3230 event_data.string_id = IDS_CALL_POP_OPERATION_REFUSED;
3231 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3235 #ifdef PDIAL_SEND_DTMF
3236 gboolean voicecall_core_send_phone_number_dtmf(gpointer puser_data)
3238 call_vc_core_state_t *pcall_core = (call_vc_core_state_t *)vcall_engine_get_core_state();
3239 int call_handle = (int)puser_data;
3240 char dtmf_number[VC_PHONE_NUMBER_LENGTH_MAX];
3241 call_vc_call_objectinfo_t obj_info = { 0, };
3243 CALL_ENG_DEBUG(ENG_DEBUG, "inside ...");
3245 if (TRUE == _vc_core_cm_get_call_object(&pcall_core->pcall_engine->call_manager, call_handle, &obj_info)) {
3246 CALL_ENG_DEBUG(ENG_DEBUG, "Source telephone number - %s", obj_info.source_tel_number);
3247 if (TRUE == _vc_core_util_extract_dtmf_number(obj_info.source_tel_number, dtmf_number, sizeof(dtmf_number))) {
3248 CALL_ENG_DEBUG(ENG_DEBUG, "DTMF number - %s", dtmf_number);
3249 if (VC_CALL_ORIG_TYPE_SAT == pcall_core->call_setup_info.call_type) {
3250 __voicecall_core_queue_dtmf_string(pcall_core, dtmf_number, TRUE);
3252 __voicecall_core_queue_dtmf_string(pcall_core, dtmf_number, FALSE);
3256 CALL_ENG_DEBUG(ENG_DEBUG, "Call Info not available for call handle: %d", call_handle);
3263 * This function cancels the dtmf queue
3265 * @return TRUE - sucess, FALSE otherwise
3266 * @param[in] papp_document Handle to Application Document
3268 gboolean voicecall_core_cancel_dtmf_queue(call_vc_core_state_t *pcall_core)
3270 voicecall_dtmf_info_t *pdtmf_info = (voicecall_dtmf_info_t *)&pcall_core->dtmf_info;
3272 CALL_ENG_DEBUG(ENG_DEBUG, "Start:pcall_core(%p)", pcall_core);
3274 if (FALSE == pdtmf_info->bdtmf_queue) {
3278 /*Remove Pauser Timer */
3279 if (pdtmf_info->dtmf_pause_timer > 0) {
3280 g_source_remove(pdtmf_info->dtmf_pause_timer);
3281 pdtmf_info->dtmf_pause_timer = -1;
3284 /*Reset the Status Flags */
3285 pdtmf_info->bdtmf_queue = FALSE;
3286 pdtmf_info->dtmf_index = 0;
3287 pdtmf_info->bdtmf_wait = FALSE;
3288 memset(pdtmf_info->dtmf_number, 0, sizeof(pdtmf_info->dtmf_number));
3289 if (TRUE == pdtmf_info->bsat_dtmf) {
3290 voicecall_core_send_sat_response(pcall_core->pcall_engine, SAT_RQST_SEND_DTMF, CALL_VC_ME_UNABLE_TO_PROCESS_COMMAND);
3292 pdtmf_info->bsat_dtmf = FALSE;
3293 pdtmf_info->bsat_hidden = FALSE;
3294 CALL_ENG_DEBUG(ENG_DEBUG, "End");
3298 static gboolean __voicecall_core_dtmf_pause_timer_cb(gpointer puser_data)
3300 call_vc_core_state_t *pcall_core = (call_vc_core_state_t *)puser_data;
3302 __voicecall_core_handle_dtmf_ack(pcall_core, TRUE);
3304 /*Always return FALSE, so that it won't be called again */
3308 gboolean __voicecall_core_send_dtmf_idle_cb(gpointer pdata)
3310 call_vc_core_state_t *pcall_core = (call_vc_core_state_t *)pdata;
3311 voicecall_dtmf_info_t *pdtmf_info = (voicecall_dtmf_info_t *)&pcall_core->dtmf_info;
3312 voicecall_error_t vc_error;
3313 vc_engine_dtmf_ack_type event_data;
3314 char dtmf_string[2];
3316 dtmf_string[0] = pdtmf_info->dtmf_number[pdtmf_info->dtmf_index];
3317 dtmf_string[1] = '\0';
3319 CALL_ENG_DEBUG(ENG_DEBUG, "inside ...");
3321 vc_error = _vc_core_engine_send_dtmf(pcall_core->pcall_engine, dtmf_string);
3323 if (vc_error == ERROR_VOICECALL_INVALID_DTMF_CHAR) {
3324 CALL_ENG_DEBUG(ENG_DEBUG, "ERROR_VOICECALL_INVALID_DTMF_CHAR");
3325 } else if (ERROR_VOICECALL_NONE != vc_error) {
3326 voicecall_core_cancel_dtmf_queue(pcall_core);
3327 memset(&event_data, 0, sizeof(event_data));
3328 event_data.bstatus = FALSE;
3329 event_data.string_id = IDS_CALL_POP_DTMFSENDING_FAIL;
3330 vcall_engine_send_event_to_client(VC_ENGINE_MSG_DTMF_ACK_TO_UI, (void *)&event_data);
3332 if (TRUE == pdtmf_info->bsat_dtmf) {
3333 voicecall_core_send_sat_response(pcall_core->pcall_engine, SAT_RQST_SEND_DTMF, CALL_VC_ME_UNABLE_TO_PROCESS_COMMAND);
3336 if (!((TRUE == pdtmf_info->bsat_dtmf) && (TRUE == pdtmf_info->bsat_hidden))) {
3337 memset(&event_data, 0, sizeof(event_data));
3338 event_data.bstatus = FALSE;
3339 event_data.string_id = IDS_CALL_POP_DTMFSENDING_FAIL;
3340 vcall_engine_send_event_to_client(VC_ENGINE_MSG_DTMF_ACK_TO_UI, (void *)&event_data);
3347 static gboolean __voicecall_core_handle_dtmf_ack(call_vc_core_state_t *pcall_core, gboolean success)
3349 voicecall_dtmf_info_t *pdtmf_info = (voicecall_dtmf_info_t *)&pcall_core->dtmf_info;
3350 vc_engine_dtmf_ack_type event_data;
3351 CALL_ENG_DEBUG(ENG_DEBUG, "...");
3353 if (FALSE == pdtmf_info->bdtmf_queue) {
3354 CALL_ENG_DEBUG(ENG_DEBUG, "DTMF Queue Canceled, do nothing");
3358 if (TRUE == success) {
3359 char dtmf_string[2];
3360 pdtmf_info->dtmf_index++;
3362 dtmf_string[0] = pdtmf_info->dtmf_number[pdtmf_info->dtmf_index];
3363 dtmf_string[1] = '\0';
3365 CALL_ENG_DEBUG(ENG_DEBUG, "Current dtmf_index: %d,dtmf_max_length=%d", pdtmf_info->dtmf_index, pdtmf_info->dtmf_max_length);
3366 CALL_ENG_DEBUG(ENG_DEBUG, "Current DTMF String: %s", &pdtmf_info->dtmf_number[pdtmf_info->dtmf_index]);
3368 /*Find the End of the queue */
3369 if (pdtmf_info->dtmf_index >= pdtmf_info->dtmf_max_length) {
3371 CALL_ENG_DEBUG(ENG_DEBUG, "Updating DTMF Progress before destroying");
3373 if (!((TRUE == pdtmf_info->bsat_dtmf) && (TRUE == pdtmf_info->bsat_hidden))) {
3374 memset(&event_data, 0, sizeof(event_data));
3375 event_data.bstatus = FALSE; /*check it*/
3376 event_data.string_id = IDS_CALL_POP_DTMF_SENT; /*check it*/
3377 vcall_engine_send_event_to_client(VC_ENGINE_MSG_DTMF_ACK_TO_UI, (void *)&event_data);
3380 if (TRUE == pdtmf_info->bsat_dtmf) {
3381 voicecall_core_send_sat_response(pcall_core->pcall_engine, SAT_RQST_SEND_DTMF, CALL_VC_ME_RET_SUCCESS);
3384 if (0 == strcasecmp(dtmf_string, "p") || 0 == strcmp(dtmf_string, ",")) {
3385 CALL_ENG_DEBUG(ENG_DEBUG, "Pause on the dtmf string");
3387 memset(&event_data, 0, sizeof(event_data));
3388 event_data.bstatus = TRUE;
3389 event_data.string_id = IDS_CALL_POP_SENDING;
3390 snprintf(event_data.display_string, sizeof(event_data.display_string), "%s", &pdtmf_info->dtmf_number[pdtmf_info->dtmf_index]);
3391 vcall_engine_send_event_to_client(VC_ENGINE_MSG_DTMF_ACK_TO_UI, (void *)&event_data);
3393 int dtmf_interval = 0;
3395 if (FALSE == _vc_core_util_check_gcf_status()) {
3396 dtmf_interval = (pdtmf_info->dtmf_index == 0) ? DTMF_PAUSE_TIMER_INTERVAL_FIRST : DTMF_PAUSE_TIMER_INTERVAL_REST;
3398 #ifdef GCONF_GCF_SAT_TEST
3399 int start_interval = DTMF_PAUSE_TIMER_INTERVAL_GCF_FIRST;
3400 int rest_interval = DTMF_PAUSE_TIMER_INTERVAL_GCF_REST;
3402 GConfClient *client = NULL;
3403 client = gconf_client_get_default();
3404 if (NULL == client) {
3405 CALL_ENG_DEBUG(ENG_DEBUG, "gconf_client_get_default failed..");
3408 start_interval = gconf_client_get_int(client, PATH_DTMF_INTERVAL_GCF_FIRST, NULL);
3410 rest_interval = gconf_client_get_int(client, PATH_DTMF_INTERVAL_GCF_REST, NULL);
3411 g_object_unref(client);
3415 CALL_ENG_DEBUG(ENG_DEBUG, "start_interval:%d, rest_interval = %d", start_interval, rest_interval);
3416 dtmf_interval = (pdtmf_info->dtmf_index == 0) ? start_interval : rest_interval;
3418 dtmf_interval = (pdtmf_info->dtmf_index == 0) ? DTMF_PAUSE_TIMER_INTERVAL_GCF_FIRST : DTMF_PAUSE_TIMER_INTERVAL_GCF_REST;
3421 CALL_ENG_DEBUG(ENG_DEBUG, "dtmf_interval:%d", dtmf_interval);
3422 pdtmf_info->dtmf_pause_timer = g_timeout_add(dtmf_interval, __voicecall_core_dtmf_pause_timer_cb, pcall_core);
3423 } else if (0 == strcasecmp(dtmf_string, "w") || 0 == strcmp(dtmf_string, ";")) {
3424 CALL_ENG_DEBUG(ENG_DEBUG, "Wait on the dtmf string");
3425 memset(&event_data, 0, sizeof(event_data));
3426 event_data.bstatus = TRUE;
3427 event_data.string_id = IDS_CALL_POP_UNAVAILABLE; /*assign ID when string is added*/
3428 snprintf(event_data.display_string, sizeof(event_data.display_string), "%s", &pdtmf_info->dtmf_number[pdtmf_info->dtmf_index]);
3429 vcall_engine_send_event_to_client(VC_ENGINE_MSG_DTMF_ACK_TO_UI, (void *)&event_data);
3431 g_idle_add_full(G_PRIORITY_HIGH_IDLE + 25, __voicecall_core_send_dtmf_idle_cb, pcall_core, NULL);
3435 voicecall_core_cancel_dtmf_queue(pcall_core);
3437 memset(&event_data, 0, sizeof(event_data));
3438 event_data.bstatus = FALSE;
3439 event_data.string_id = IDS_CALL_POP_DTMFSENDING_FAIL;
3440 vcall_engine_send_event_to_client(VC_ENGINE_MSG_DTMF_ACK_TO_UI, (void *)&event_data);
3447 * This function queues the dtmf digits one by one from the given dtmf string
3449 * @return TRUE - sucess, FALSE otherwise
3450 * @param[in] papp_document Handle to Application Document
3451 * @param[in] dtmf_string dtmf string to be queued
3453 static gboolean __voicecall_core_queue_dtmf_string(call_vc_core_state_t *pcall_core, char *dtmf_string, gboolean bsat_dtmf)
3455 voicecall_dtmf_info_t *pdtmf_info = (voicecall_dtmf_info_t *)&pcall_core->dtmf_info;
3456 gboolean bhidden_mode = FALSE;
3458 vc_engine_dtmf_ack_type event_data;
3460 CALL_ENG_DEBUG(ENG_DEBUG, "bsat_dtmf = %d", bsat_dtmf);
3462 if (TRUE == bsat_dtmf) {
3463 /*Always get the status from the engine */
3464 _vc_core_engine_get_sat_dtmf_hidden_mode(pcall_core->pcall_engine, &bhidden_mode);
3465 CALL_ENG_DEBUG(ENG_DEBUG, "SAT Hidden Mode : %d", bhidden_mode);
3468 /*Check for the validity of the DTMF String */
3469 if (FALSE == _vc_core_util_isvalid_full_dtmf_number(dtmf_string)) {
3470 if (TRUE == bsat_dtmf) {
3471 voicecall_core_send_sat_response(pcall_core->pcall_engine, SAT_RQST_SEND_DTMF, CALL_VC_ME_UNABLE_TO_PROCESS_COMMAND);
3474 if (!((TRUE == bsat_dtmf) && (TRUE == bhidden_mode))) {
3475 memset(&event_data, 0, sizeof(event_data));
3476 event_data.bstatus = FALSE;
3477 event_data.string_id = IDS_CALL_POP_INVALID_DTMF;
3478 vcall_engine_send_event_to_client(VC_ENGINE_MSG_DTMF_ACK_TO_UI, (void *)&event_data);
3483 /*Reset DTMF Values */
3484 pdtmf_info->bdtmf_queue = FALSE;
3485 pdtmf_info->dtmf_index = 0;
3486 pdtmf_info->bsat_dtmf = bsat_dtmf;
3488 if (TRUE == bsat_dtmf) {
3490 pdtmf_info->bsat_hidden = bhidden_mode;
3493 /*It takes only 40 characters from the source, rest of the characters are ignored*/
3494 memset(pdtmf_info->dtmf_number, 0, sizeof(pdtmf_info->dtmf_number));
3495 strncpy(pdtmf_info->dtmf_number, dtmf_string, min((sizeof(pdtmf_info->dtmf_number) - 1), strlen(dtmf_string)));
3496 pdtmf_info->dtmf_max_length = strlen(pdtmf_info->dtmf_number);
3497 CALL_ENG_DEBUG(ENG_DEBUG, "Dtmf Number:%s ,dtmf_max_length:%d", pdtmf_info->dtmf_number, pdtmf_info->dtmf_max_length);
3499 dtmf_digit[0] = pdtmf_info->dtmf_number[pdtmf_info->dtmf_index];
3500 dtmf_digit[1] = '\0';
3503 if (0 == strcasecmp(dtmf_digit, "p") || 0 == strcmp(dtmf_digit, ",")) {
3504 int dtmf_interval = 0;
3506 if (FALSE == _vc_core_util_check_gcf_status()) {
3507 dtmf_interval = (pdtmf_info->dtmf_index == 0) ? DTMF_PAUSE_TIMER_INTERVAL_FIRST : DTMF_PAUSE_TIMER_INTERVAL_REST;
3509 #ifdef GCONF_GCF_SAT_TEST
3510 int start_interval = DTMF_PAUSE_TIMER_INTERVAL_GCF_FIRST;
3511 int rest_interval = DTMF_PAUSE_TIMER_INTERVAL_GCF_REST;
3514 GConfClient *client = NULL;
3515 client = gconf_client_get_default();
3516 if (NULL == client) {
3517 CALL_ENG_DEBUG(ENG_DEBUG, "gconf_client_get_default failed..");
3520 start_interval = gconf_client_get_int(client, PATH_DTMF_INTERVAL_GCF_FIRST, NULL);
3522 rest_interval = gconf_client_get_int(client, PATH_DTMF_INTERVAL_GCF_REST, NULL);
3523 g_object_unref(client);
3527 CALL_ENG_DEBUG(ENG_DEBUG, "start_interval:%d, rest_interval = %d", start_interval, rest_interval);
3528 dtmf_interval = (pdtmf_info->dtmf_index == 0) ? start_interval : rest_interval;
3530 dtmf_interval = (pdtmf_info->dtmf_index == 0) ? DTMF_PAUSE_TIMER_INTERVAL_GCF_FIRST : DTMF_PAUSE_TIMER_INTERVAL_GCF_REST;
3532 CALL_ENG_DEBUG(ENG_DEBUG, "updated dtmf_interval:%d", dtmf_interval);
3534 pdtmf_info->dtmf_pause_timer = g_timeout_add(dtmf_interval, __voicecall_core_dtmf_pause_timer_cb, pcall_core);
3535 } else if (0 == strcasecmp(dtmf_digit, "w") || 0 == strcmp(dtmf_digit, ";")) {
3536 /* enable wait flag for dtmf sending */
3537 pdtmf_info->bdtmf_wait = TRUE;
3538 } else if ((ERROR_VOICECALL_NONE != _vc_core_engine_send_dtmf(pcall_core->pcall_engine, dtmf_digit))) {
3539 if (!((TRUE == pdtmf_info->bsat_dtmf) && (TRUE == pdtmf_info->bsat_hidden))) {
3540 memset(&event_data, 0, sizeof(event_data));
3541 event_data.bstatus = FALSE;
3542 event_data.string_id = IDS_CALL_POP_DTMFSENDING_FAIL;
3543 vcall_engine_send_event_to_client(VC_ENGINE_MSG_DTMF_ACK_TO_UI, (void *)&event_data);
3545 if (TRUE == pdtmf_info->bsat_dtmf) {
3546 voicecall_core_send_sat_response(pcall_core->pcall_engine, SAT_RQST_SEND_DTMF, CALL_VC_ME_UNABLE_TO_PROCESS_COMMAND);
3550 pdtmf_info->bdtmf_queue = TRUE;
3552 /*Create Progressbar popup */
3553 if (!((TRUE == pdtmf_info->bsat_dtmf) && (TRUE == pdtmf_info->bsat_hidden))) {
3554 memset(&event_data, 0, sizeof(event_data));
3555 event_data.bstatus = TRUE;
3556 CALL_ENG_DEBUG(ENG_DEBUG, "pdtmf_info->bdtmf_wait [%d]", pdtmf_info->bdtmf_wait);
3557 if (pdtmf_info->bdtmf_wait) {
3558 event_data.string_id = IDS_CALL_POP_UNAVAILABLE;
3560 event_data.string_id = IDS_CALL_POP_SENDING;
3562 _vc_core_util_strcpy(event_data.display_string, VC_PHONE_NUMBER_LENGTH_MAX, pdtmf_info->dtmf_number);
3563 vcall_engine_send_event_to_client(VC_ENGINE_MSG_DTMF_ACK_TO_UI, (void *)&event_data);
3565 CALL_ENG_DEBUG(ENG_DEBUG, "SAT DTMF Hidden Mode, not showing UI");
3571 gboolean voicecall_core_change_sound_path(call_vc_core_state_t *pcall_core, voicecall_snd_audio_type_t sound_path)
3573 voicecall_snd_mgr_t *papp_snd = pcall_core->papp_snd;
3575 int total_call_member = -1;
3577 CALL_ENG_DEBUG(ENG_DEBUG, "sound_path:[%d]", sound_path);
3579 voicecall_core_get_total_call_member(pcall_core->pcall_engine, &total_call_member);
3580 if (total_call_member == 0) {
3581 CALL_ENG_DEBUG(ENG_DEBUG, "There are not active calls hence it should not work");
3585 switch (sound_path) {
3586 case VOICE_CALL_AUDIO_SPEAKER:
3588 if (voicecall_snd_get_path_status(pcall_core->papp_snd) == VOICE_CALL_SND_PATH_BT) {
3589 /*_vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_SWITCH_TO_PHONE, -1, NULL);*/
3590 _vc_bt_request_switch_headset_path(pcall_core, FALSE);
3592 voicecall_snd_set_path_status(pcall_core->papp_snd, VOICE_CALL_SND_PATH_SPEAKER);
3597 case VOICE_CALL_AUDIO_HEADSET:
3599 voicecall_snd_set_path_status(pcall_core->papp_snd, VOICE_CALL_SND_PATH_BT);
3600 /* _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_SWITCH_TO_HEADSET, -1, NULL);*/
3601 _vc_bt_request_switch_headset_path(pcall_core, TRUE);
3607 case VOICE_CALL_AUDIO_RECEIVER_EARJACK:
3609 if (voicecall_snd_get_path_status(pcall_core->papp_snd) == VOICE_CALL_SND_PATH_BT) {
3610 /*_vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_SWITCH_TO_PHONE, -1, NULL);*/
3611 _vc_bt_request_switch_headset_path(pcall_core, FALSE);
3613 voicecall_snd_set_path_status(pcall_core->papp_snd, VOICE_CALL_SND_PATH_RECEIVER_EARJACK);
3620 CALL_ENG_DEBUG(ENG_DEBUG, "Unknown type!!");
3626 /* Change Audio Path according to the current status */
3627 voicecall_snd_change_path(papp_snd);
3632 gboolean voicecall_core_get_sound_path(call_vc_core_state_t *pcall_core, int *sound_path)
3634 voicecall_snd_mgr_t *papp_snd = pcall_core->papp_snd;
3636 CALL_ENG_DEBUG(ENG_DEBUG, "..");
3638 switch (voicecall_snd_get_path_status(papp_snd)) {
3639 case VOICE_CALL_SND_PATH_SPEAKER:
3641 *sound_path = VOICE_CALL_AUDIO_SPEAKER;
3645 case VOICE_CALL_SND_PATH_BT:
3647 *sound_path = VOICE_CALL_AUDIO_HEADSET;
3651 case VOICE_CALL_SND_PATH_RECEIVER_EARJACK:
3654 *sound_path = VOICE_CALL_AUDIO_RECEIVER_EARJACK;
3662 static gboolean __voicecall_core_is_redial_cuase(int end_cause)
3664 CALL_ENG_DEBUG(ENG_DEBUG, "end_cause(%d)", end_cause);
3666 switch (end_cause) {
3667 case VC_ENDCAUSE_CALL_BARRED:
3668 case VC_ENDCAUSE_NO_SERVICE:
3669 case VC_ENDCAUSE_USER_UNAVAILABLE:
3670 case VC_ENDCAUSE_INVALID_NUMBER_FORMAT:
3671 case VC_ENDCAUSE_NUMBER_CHANGED:
3672 case VC_ENDCAUSE_NO_CREDIT:
3673 case VC_ENDCAUSE_UNASSIGNED_NUMBER:
3676 case VC_ENDCAUSE_CALL_ENDED:
3677 case VC_ENDCAUSE_CALL_DISCONNECTED:
3678 case VC_ENDCAUSE_NO_ANSWER:
3679 case VC_ENDCAUSE_NW_BUSY:
3680 case VC_ENDCAUSE_CALL_SERVICE_NOT_ALLOWED:
3681 case VC_ENDCAUSE_NW_FAILED:
3682 case VC_ENDCAUSE_REJECTED:
3683 case VC_ENDCAUSE_USER_BUSY:
3684 case VC_ENDCAUSE_WRONG_GROUP:
3685 case VC_ENDCAUSE_CALL_NOT_ALLOWED:
3686 case VC_ENDCAUSE_CALL_FAILED:
3687 case VC_ENDCAUSE_NO_USER_RESPONDING:
3688 case VC_ENDCAUSE_USER_ALERTING_NO_ANSWER:
3689 case VC_ENDCAUSE_SERVICE_TEMP_UNAVAILABLE:
3690 case VC_ENDCAUSE_USER_DOESNOT_RESPOND:
3691 case VC_ENDCAUSE_IMEI_REJECTED:
3692 case VC_ENDCAUSE_TAPI_ERROR:
3699 * This function processed the supplementary services while on call
3701 * @return Returns TRUE If transfer call can be made or FALSE if not
3702 * @param[in] pcall_core Handle to voicecall core
3704 void voicecall_core_process_dtmf_send_status(call_vc_core_state_t *pcall_core, gboolean bsuccess)
3706 CALL_ENG_DEBUG(ENG_DEBUG, " ..");
3707 VOICECALL_RETURN_IF_FAIL(pcall_core);
3708 __voicecall_core_handle_dtmf_ack(pcall_core, bsuccess);
3712 * This function checks validation of incoming handle
3715 * @param[in] puser_data Handle to voicecall core
3717 static gboolean __voicecall_core_check_incoming_handle(gpointer puser_data)
3719 call_vc_core_state_t *pcall_core = (call_vc_core_state_t *)puser_data;
3720 VOICECALL_RETURN_FALSE_IF_FAIL(pcall_core);
3722 _vc_core_engine_check_incoming_handle(pcall_core->pcall_engine, pcall_core->mtcall_handle);