2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.tizenopensource.org/license
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include "vc-core-util.h"
19 #include "vc-core-engine-types.h"
20 #include "vc-core-callagent.h"
21 #include "vc-core-engine.h"
22 #include "vc-core-error.h"
23 #include "voice-call-core.h"
24 #include "voice-call-dbus.h"
25 #include "voice-call-engine-msg.h"
26 #include "voice-call-service.h"
28 #include "voice-call-bt.h"
29 #include "vc-core-engine.h"
31 #include "voice-call-engine.h"
33 #define MO_REDIAL_COUNT_MAX 10
34 #define MO_REDIAL_TIMER_INTERVAL_FIRST 3000 /**< MO Redial Timer Interva; - 5 Secs*/
35 #define MO_REDIAL_TIMER_INTERVAL_SECOND 3000 /**< MO Redial Timer Interva; - 1 Minute*/
36 #define MO_REDIAL_TIMER_INTERVAL_THIRD 3000 /**< MO Redial Timer Interva; - 3 Minutes*/
38 #define MINUTE_MINDER_TIMEOUT_VALUE 60000
40 #define DTMF_PAUSE_TIMER_INTERVAL_FIRST 3000 /*3 Seconds */
41 #define DTMF_PAUSE_TIMER_INTERVAL_REST 3000 /*3 Seconds */
42 #define DTMF_PAUSE_TIMER_INTERVAL_GCF_FIRST 800 /*0.8 Second */
43 #define DTMF_PAUSE_TIMER_INTERVAL_GCF_REST 3300 /*3 Seconds */
45 gboolean mo_redial_timer_cb(void *data);
47 #define SET_PATH_TIMER_VALUE 50
48 static guint g_set_path_timer_handler = 0;
49 static gboolean __voicecall_core_set_path_timer_cb(gpointer puser_data);
51 /* For Debug Information, Call Engine Event name string constant */
52 char *gszcall_engine_event[VC_ENGINE_EVENT_MAX] = {
55 "VC_CALL_OUTGOING_ORIG",
56 "VC_CALL_OUTGOING_ALERT",
60 "VC_CALL_INCOM_DROPPED",
61 "VC_CALL_REJECTED_END",
62 "VC_CALL_OUTGOING_END", /* 10 */
64 "VC_CALL_OUTGOING_ABORTED",
66 "VC_CALL_AUTO_REDIAL_CHECK",
69 "VC_CALL_SS_RETREIVED",
71 "VC_CALL_SS_SETUP_CONF",
72 "VC_CALL_SS_SPLIT_CONF",
73 "VC_CALL_SS_TRANSFERRED", /* 20 */
75 "VC_CALL_SS_CONNECT_LINE_IND",
76 "VC_CALL_IND_FORWARD",
77 "VC_CALL_IND_ACTIVATE",
79 "VC_CALL_IND_TRANSFER",
80 "VC_CALL_IND_SETUPCONFERENCE",
81 "VC_CALL_IND_BARRING",
82 "VC_CALL_IND_WAITING",
83 "VC_CALL_IND_CUGINFO",
84 "VC_CALL_IND_SSNOTIFY", /* 30 */
86 "VC_CALL_IND_CALLINGNAMEINFO",
87 "VC_CALL_IND_REDIRECT_CNF",
88 "VC_CALL_IND_ACTIVATECCBS_CNF",
89 "VC_CALL_IND_ACTIVATECCBS_USERINFO",
92 "VC_ACTION_INCOM_FORCE",
93 "VC_ACTION_SAT_REQUEST",
94 "VC_ACTION_SAT_RESPONSE",
95 "VC_ACTION_CALL_END_HELD_RETREIVED", /* 40 */
97 "VC_ACTION_NO_ACTIVE_TASK",
98 "VC_CALL_GET_VOLUME_RESP"
101 static void __voicecall_core_check_headset_earjack_status(call_vc_core_state_t *pcall_core);
102 static void __vc_core_set_auto_redial_count(call_vc_core_state_t *pcall_core, int auto_redial_count);
103 static gboolean __voicecall_core_callstatus_set_timer_cb(gpointer puser_data);
105 static int __voicecall_core_get_string_id_by_errorcode(int error_code);
106 static void __voicecall_core_mocall_reset_engine_state(voicecall_engine_t *pcall_engine);
107 static gboolean __voicecall_core_is_redial_cuase(int end_cause);
109 #ifdef PDIAL_SEND_DTMF
110 static gboolean __voicecall_core_queue_dtmf_string(call_vc_core_state_t *pcall_core, char *dtmf_string, gboolean bsat_dtmf);
111 static gboolean __voicecall_core_handle_dtmf_ack(call_vc_core_state_t *pcall_core, gboolean success);
115 * This function puts the currently active call on hold
117 * @return Returns TRUE on success or FALSE on failure
118 * @param[in] pcall_engine Handle to voicecall engine
120 inline gboolean voicecall_core_hold_call(voicecall_engine_t *pcall_engine)
123 voicecall_error_t error_code = ERROR_VOICECALL_NONE;
125 PRINT_CURRENT_TIME("Call Hold Start at");
126 error_code = _vc_core_engine_hold_call(pcall_engine);
128 CALL_ENG_DEBUG(ENG_DEBUG, "Error Code : %d", error_code);
129 return (ERROR_VOICECALL_NONE == error_code || ERROR_VOICECALL_PREVIOUS_REQUEST_IN_PROGRESS == error_code) ? TRUE : FALSE;
133 * This function retreives the currently held call
135 * @return Returns TRUE on success or FALSE on failure
136 * @param[in] pcall_engine Handle to voicecall engine
138 inline gboolean voicecall_core_retrieve_call(voicecall_engine_t *pcall_engine)
140 voicecall_error_t error_code = ERROR_VOICECALL_NONE;
142 PRINT_CURRENT_TIME("Call Retrieve Start at");
143 error_code = _vc_core_engine_retrieve_call(pcall_engine);
145 CALL_ENG_DEBUG(ENG_DEBUG, "Error Code : %d", error_code);
146 return (ERROR_VOICECALL_NONE == error_code || ERROR_VOICECALL_PREVIOUS_REQUEST_IN_PROGRESS == error_code) ? TRUE : FALSE;
150 * This function swaps the currently available active and held calls
152 * @return Returns TRUE on success or FALSE on failure
153 * @param[in] pcall_engine Handle to voicecall engine
155 inline gboolean voicecall_core_swap_calls(voicecall_engine_t *pcall_engine)
157 voicecall_error_t error_code = ERROR_VOICECALL_NONE;
159 PRINT_CURRENT_TIME("Call Swap Start at");
160 error_code = _vc_core_engine_swap_calls(pcall_engine);
162 CALL_ENG_DEBUG(ENG_DEBUG, "Error Code : %d", error_code);
163 return (ERROR_VOICECALL_NONE == error_code || ERROR_VOICECALL_PREVIOUS_REQUEST_IN_PROGRESS == error_code) ? TRUE : FALSE;
167 * This function clears the MO Call Details
169 * @return Returns TRUE on success or FALSE on failure
170 * @param[in] pcall_engine Handle to voicecall engine
172 inline gboolean voicecall_core_clear_mo_call(voicecall_engine_t *pcall_engine)
174 return (ERROR_VOICECALL_NONE == _vc_core_engine_finalize_call(pcall_engine, VC_OUTGOING_CALL, -1)) ? TRUE : FALSE;
178 * This function clears the Connected Call Details
180 * @return Returns TRUE on success or FALSE on failure
181 * @param[in] pcall_engine Handle to voicecall engine
182 * @param[in] call_handle Handle of the Connected Call to be cleared
184 inline gboolean voicecall_core_clear_connected_call(voicecall_engine_t *pcall_engine, int call_handle)
186 return (ERROR_VOICECALL_NONE == _vc_core_engine_finalize_call(pcall_engine, VC_CONNECTED_CALL, call_handle)) ? TRUE : FALSE;
190 * This function changes the voicecall engine's state
192 * @return Returns TRUE on success or FALSE on failure
193 * @param[in] pcall_engine Handle to voicecall engine
194 * @param[in] eng_state Engine State to be changed
196 inline gboolean voicecall_core_change_engine_state(voicecall_engine_t *pcall_engine, int eng_state)
198 return (ERROR_VOICECALL_NONE == _vc_core_engine_change_engine_iostate(pcall_engine, eng_state)) ? TRUE : FALSE;
202 * This function ends an Outgoing Call
204 * @return Returns TRUE on success or FALSE on failure
205 * @param[in] pcall_engine Handle to voicecall engine
207 inline gboolean voicecall_core_end_mo_call(voicecall_engine_t *pcall_engine)
209 return (ERROR_VOICECALL_NONE == _vc_core_engine_end_call(pcall_engine, VC_END_OUTGOING_CALL)) ? TRUE : FALSE;
213 * This function retreives the Voicecall Engine's State
215 * @return Returns TRUE on success or FALSE on failure
216 * @param[in] pcall_engine Handle to voicecall engine
217 * @param[out] io_state Voicecall Engine InOut State
219 inline gboolean voicecall_core_get_engine_state(voicecall_engine_t *pcall_engine, int *eng_state)
221 return (ERROR_VOICECALL_NONE == _vc_core_engine_status_get_engine_iostate(pcall_engine, eng_state)) ? TRUE : FALSE;
225 * This function checks whether any call exists
227 * @return Returns TRUE on success or FALSE on failure
228 * @param[in] pcall_engine Handle to voicecall engine
229 * @param[out] active_calls TRUE - If active call exists or FALSE If active call doesn't exists
230 * @param[out] held_calls TRUE - If held call exists or FALSE If held call doesn't exists
232 inline gboolean voicecall_core_is_call_exists(voicecall_engine_t *pcall_engine, gboolean * active_calls, gboolean * held_calls)
234 return (ERROR_VOICECALL_NONE == _vc_core_engine_status_isexists_any_call(pcall_engine, active_calls, held_calls)) ? TRUE : FALSE;
238 * This function checks whether incoming call exists or not
240 * @return Returns TRUE if incoming call exists or FALSE on failure
241 * @param[in] pcall_engine Handle to voicecall engine
243 inline gboolean voicecall_core_is_incoming_call_exists(voicecall_engine_t *pcall_engine)
245 gboolean bmtcall_exists = FALSE;
247 _vc_core_engine_status_isexists_call_bytype(pcall_engine, VC_INCOMING_CALL, &bmtcall_exists);
248 return bmtcall_exists;
252 * This function checks whether outgoing call exists or not
254 * @return Returns TRUE if outgoing call exists or FALSE on failure
255 * @param[in] pcall_engine Handle to voicecall engine
257 inline gboolean voicecall_core_is_outgoing_call_exists(voicecall_engine_t *pcall_engine)
259 gboolean bmocall_exists = FALSE;
261 _vc_core_engine_status_isexists_call_bytype(pcall_engine, VC_OUTGOING_CALL, &bmocall_exists);
262 return bmocall_exists;
266 * This function checks whether any connexcted call exists or not
268 * @return Returns TRUE if connected call exists or FALSE on failure
269 * @param[in] pcall_engine Handle to voicecall engine
271 inline gboolean voicecall_core_is_connected_call_exist(voicecall_engine_t *pcall_engine)
273 gboolean bcall_exists = FALSE;
275 _vc_core_engine_status_isexists_call_bytype(pcall_engine, VC_CONNECTED_CALL, &bcall_exists);
280 * This function checks whether any connexcted call exists or not in the given group
282 * @return Returns TRUE if connected call exists or FALSE on failure
283 * @param[in] pcall_engine Handle to voicecall engine
284 * @param[in] group_index Group Index to be searhced
286 inline gboolean voicecall_core_is_connected_call_exist_in_group(voicecall_engine_t *pcall_engine, int group_index)
288 gboolean bcall_exists = FALSE;
289 voicecall_error_t error_code = ERROR_VOICECALL_NONE;
291 if (ERROR_VOICECALL_NONE != _vc_core_engine_group_isexists_connected_call_ingroup(pcall_engine, group_index, &bcall_exists)) {
292 CALL_ENG_DEBUG(ENG_DEBUG, "Error_code %d", error_code);
300 * This function checks whether any call exists
302 * @return Returns TRUE if connected call exists or FALSE on failure
303 * @param[in] pcall_engine Handle to voicecall engine
305 inline gboolean voicecall_core_is_any_call_exists(voicecall_engine_t *pcall_engine)
307 gboolean bcall_exists = FALSE;
309 _vc_core_engine_status_isexists_call_bytype(pcall_engine, VC_INCOMING_CALL, &bcall_exists);
310 CALL_ENG_DEBUG(ENG_DEBUG, "Incoming Call = [%d]", bcall_exists);
312 if (FALSE == bcall_exists) {
313 _vc_core_engine_status_isexists_call_bytype(pcall_engine, VC_OUTGOING_CALL, &bcall_exists);
315 CALL_ENG_DEBUG(ENG_DEBUG, "Outgoing Call = [%d]", bcall_exists);
317 if (FALSE == bcall_exists) {
318 _vc_core_engine_status_isexists_call_bytype(pcall_engine, VC_CONNECTED_CALL, &bcall_exists);
320 CALL_ENG_DEBUG(ENG_DEBUG, "Connected Call = [%d]", bcall_exists);
326 * This function retreives the totally number of availavle calls including connected, MO and MT Calls
328 * @return Returns TRUE if success or FALSE on failure
329 * @param[in] pcall_engine Handle to voicecall engine
330 * @param[out] ptotal_call_member number of avialble calls
332 inline gboolean voicecall_core_get_total_call_member(voicecall_engine_t *pcall_engine, int *ptotal_call_member)
334 return (ERROR_VOICECALL_NONE == _vc_core_engine_status_get_call_member_count(pcall_engine, ptotal_call_member)) ? TRUE : FALSE;
338 * This function checks whether voicecall engine's call agent is idle or not
340 * @return Returns TRUE if call agent is idle or FALSE on failure
341 * @param[in] pcall_engine Handle to voicecall engine
343 inline gboolean voicecall_core_is_callagent_idle(voicecall_engine_t *pcall_engine)
345 gboolean bcallagent_idle = FALSE;
347 _vc_core_engine_status_is_engine_busy(pcall_engine, &bcallagent_idle);
348 CALL_ENG_DEBUG(ENG_DEBUG, "Call Agent Busy State : %d", bcallagent_idle);
350 return !bcallagent_idle;
354 * This function checks the current call status and engine status
356 * @return TRUE, if connected calls available and engine is in idle, FALSE otherwise
357 * @param[in] pcall_engine Handle to voicecall engine
359 inline gboolean voicecall_core_is_incall_request_possible(voicecall_engine_t *pcall_engine)
361 int eng_state = VC_INOUT_STATE_NONE;
362 int member_num_0 = 0;
363 int member_num_1 = 0;
365 _vc_core_engine_group_get_connected_member_count(pcall_engine, 0, &member_num_0);
366 _vc_core_engine_group_get_connected_member_count(pcall_engine, 1, &member_num_1);
367 voicecall_core_get_engine_state(pcall_engine, &eng_state);
368 if (!(voicecall_core_is_callagent_idle(pcall_engine) && ((member_num_1 + member_num_0) > 0)
369 && (eng_state == VC_INOUT_STATE_NONE))) {
370 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);
378 * This function changes the modem call audio path
380 * @return TRUE sucess, FALSE otherwise
381 * @param[in] pcall_engine Handle to voicecall engine
382 * @param[in] audio_path audio path to be changed
384 inline gboolean voicecall_core_change_audio_path(voicecall_engine_t *pcall_engine, voicecall_audio_path_t audio_path)
386 return (ERROR_VOICECALL_NONE == _vc_core_engine_change_audio_path(pcall_engine, audio_path)) ? TRUE : FALSE;
390 * This function sets the voice call audio volume for the given audio path type
392 * @return returns TRUE in success , FALSE otherwise
393 * @param[in] pcall_engine Handle to voicecall engine
394 * @param[in] tapi_snd_path audio path for the volume to be set
395 * @param[in] vol_level volume level
397 inline gboolean voicecall_core_set_audio_volume(voicecall_engine_t *pcall_engine, voicecall_audio_path_t tapi_snd_path, int vol_level)
399 return (ERROR_VOICECALL_NONE == _vc_core_engine_set_audio_volume(pcall_engine, tapi_snd_path, (voicecall_audio_volume_t) vol_level)) ? TRUE : FALSE;
403 * This function retreives the voice call audio volume for the given audio path type
405 * @return returns TRUE in success , FALSE otherwise
406 * @param[in] pcall_engine Handle to voicecall engine
407 * @param[in] audio_path_type audio path for the volume to be retreived
409 inline gboolean voicecall_core_get_audio_volume(voicecall_engine_t *pcall_engine, voicecall_audio_path_t audio_path_type)
411 return (ERROR_VOICECALL_NONE == _vc_core_engine_get_audio_volume(pcall_engine, audio_path_type)) ? TRUE : FALSE;
415 * This function set the voice call audio mute status
417 * @return returns TRUE in success , FALSE otherwise
418 * @param[in] pcall_engine Handle to voicecall engine
419 * @param[in] bvoice_mute mute status
421 inline gboolean voicecall_core_set_audio_mute_status(voicecall_engine_t *pcall_engine, gboolean bvoice_mute)
423 return (ERROR_VOICECALL_NONE == _vc_core_engine_set_audio_mute(pcall_engine, bvoice_mute)) ? TRUE : FALSE;
427 * This function retreives the first active call among the available active calls
429 * @return Returns TRUE if success or FALSE on failure
430 * @param[in] pcall_engine Handle to voicecall engine
431 * @param[out] pcall_handle call handle of the active call
433 inline gboolean voicecall_core_get_zuhause(voicecall_engine_t *pcall_engine, gboolean * bzuhause)
435 return (ERROR_VOICECALL_NONE == _vc_core_engine_status_is_zuhause_area(pcall_engine, bzuhause)) ? TRUE : FALSE;
439 * This function retreives the Voicecall Engine's State
441 * @return Returns TRUE on success or FALSE on failure
442 * @param[in] pcall_engine Handle to voicecall engine
443 * @param[in] call_handle Call handle of the call for which the call object is retrieved
444 * @param[out] pcall_object Pointer to the retrived call object info
446 inline gboolean voicecall_core_get_call_object(voicecall_engine_t *pcall_engine, int call_handle, call_vc_call_objectinfo_t * pcall_object)
448 return (ERROR_VOICECALL_NONE == _vc_core_engine_status_get_call_object(pcall_engine, call_handle, pcall_object)) ? TRUE : FALSE;
452 * This function sends response to sat engine
454 * @return Returns TRUE If transfer call can be made or FALSE if not
455 * @param[in] pcall_engine Handle to voicecall engine
456 * @param[in] sat_rqst_resp_type sat rqst/resp type to be set by the client
457 * @param[in] sat_response_type sat response type to be sent to sat
459 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)
461 voicecall_error_t error_code = 0;
462 error_code = _vc_core_engine_send_sat_response(pcall_engine, sat_rqst_resp_type, sat_response_type);
463 CALL_ENG_DEBUG(ENG_DEBUG, "error_code:[%d] ", error_code);
464 return (ERROR_VOICECALL_NONE == error_code) ? TRUE : FALSE;
468 * This function retreives the number of active call members
470 * @return Returns TRUE if success or FALSE on failure
471 * @param[in] pcall_core Handle to voicecall core
472 * @param[out] pactive_member_num number of active call members available
474 inline gboolean voicecall_core_get_active_call_member(call_vc_core_state_t *pcall_core, int *pactive_member_num)
476 *pactive_member_num = 0;
477 return (ERROR_VOICECALL_NONE == _vc_core_engine_status_get_call_member_info(pcall_core->pcall_engine, VC_ACTIVE_CALL, pactive_member_num)) ? TRUE : FALSE;
481 * This function checks whether possible to make conference call
483 * @return Returns TRUE If Conference call can be made or FALSE if not
484 * @param[in] papp_document Handle to Application Document
486 inline gboolean voicecall_core_is_conf_call_possible(call_vc_core_state_t *pcall_core)
488 gboolean bconf_call = FALSE;
490 _vc_core_engine_status_is_conf_call_possible(pcall_core->pcall_engine, &bconf_call);
496 * This function checks whether possible to transfer call
498 * @return Returns TRUE If transfer call can be made or FALSE if not
499 * @param[in] pcall_core Handle to voicecall core
501 inline gboolean voicecall_core_is_transfer_call_possible(call_vc_core_state_t *pcall_core)
503 gboolean btransfer_call = FALSE;
505 _vc_core_engine_status_is_transfer_call_possible(pcall_core->pcall_engine, &btransfer_call);
507 return btransfer_call;
511 * This function checks whether the given code is a valid Supplementary Services Code
513 * @return Returns TRUE on success or FALSE on failure
514 * @param[in] pcall_core Handle to voicecall core
515 * @param[in] pszInput Number to be verified
517 inline gboolean voicecall_core_is_valid_sscode(call_vc_core_state_t *pcall_core, const char *pszInput)
519 gboolean bsscode = FALSE;
521 _vc_core_engine_status_isvalid_ss_code(pcall_core->pcall_engine, pszInput, &bsscode);
526 #ifdef _CPHS_DEFINED_
528 * This function gets the cphs status from the engine
530 * @return TRUE if queried status is enabled, FALSE otherwise
531 * @param[in] pcall_core Handle to voicecall core
532 * @param[in] csp_service csp service to be queried
534 inline gboolean voicecall_core_get_cphs_csp_status(call_vc_core_state_t *pcall_core, voicecall_cphs_csp_service csp_service)
536 gboolean bcsp_status = FALSE;
538 _vc_core_engine_status_get_cphs_csp_status(pcall_core->pcall_engine, csp_service, &bcsp_status);
544 * This function informs the Voicecall Engine that current SS operation has been completed
546 * @return Returns TRUE if all the calls are ended or FALSE on failure
547 * @param[in] pcall_core Handle to voicecall core
549 inline gboolean voicecall_core_set_check_ss_on_end(call_vc_core_state_t *pcall_core)
551 return (ERROR_VOICECALL_NONE == _vc_core_engine_status_set_end_flag(pcall_core->pcall_engine, VC_RETREIVE_CALL_ON_MOCALL_END)) ? TRUE : FALSE;
555 * This function extracts vaild phone number
560 inline void voicecall_core_extract_phone_number(const char *source_tel_number, char *phone_number, const int buf_size)
562 _vc_core_engine_extract_phone_number(source_tel_number, phone_number, buf_size);
565 /************************
566 * inline function END
567 **************************/
568 void voicecall_core_set_status(call_vc_core_state_t *pcall_core, call_vc_core_flags_t core_flags, gboolean bstatus)
570 CALL_ENG_DEBUG(ENG_DEBUG, "core flags:[0x%x], Set status:[%d] ", core_flags, bstatus);
572 if (CALL_VC_CORE_FLAG_NONE == core_flags) {
573 /*Set the document flag to defaults */
574 pcall_core->core_status = CALL_VC_CORE_FLAG_NONE;
578 if (TRUE == bstatus) {
580 pcall_core->core_status |= core_flags;
582 /*Remove bit field only if it is already set/ otherwise ignore it */
583 if ((pcall_core->core_status & core_flags) == core_flags) {
584 pcall_core->core_status = (pcall_core->core_status ^ core_flags);
588 CALL_ENG_DEBUG(ENG_DEBUG, "After SET, core_status:[0x%x]", pcall_core->core_status);
592 gboolean voicecall_core_get_status(call_vc_core_state_t *pcall_core, call_vc_core_flags_t core_flags)
594 CALL_ENG_DEBUG(ENG_DEBUG, "core_flags:[0x%x]", core_flags);
595 CALL_ENG_DEBUG(ENG_DEBUG, "Before Get, core_status:[0x%x]", pcall_core->core_status);
597 if ((pcall_core->core_status & core_flags) == core_flags) {
598 CALL_ENG_DEBUG(ENG_DEBUG, "Flag [0x%x] is available", core_flags);
602 CALL_ENG_DEBUG(ENG_DEBUG, "Flag [0x%x] is not available", core_flags);
606 #ifdef VC_ENG_FDN_SUPPORT
607 gboolean voicecall_core_check_fdn_status(call_vc_core_state_t *pcall_core)
609 gboolean bfdn_enabled = FALSE;
611 /*Check the FDN Status of the number with the contact */
612 _vc_core_engine_status_isenabled_fdn(pcall_core->pcall_engine, &bfdn_enabled);
613 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_FDN_SVC_ENABLED, bfdn_enabled);
615 if (TRUE == bfdn_enabled) {
616 gboolean bct_exists = FALSE;
618 CALL_ENG_DEBUG(ENG_DEBUG, "FDN mode enabled..");
620 vc_engine_msg_box_type event_data;
621 memset(&event_data, 0, sizeof(event_data));
623 CALL_ENG_DEBUG(ENG_DEBUG, "FDN only...");
624 _vc_core_engine_finalize_call(pcall_core->pcall_engine, VC_OUTGOING_CALL, -1);
626 event_data.string_id = IDS_CALL_POP_FDNCALLONLY;
627 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
632 CALL_ENG_DEBUG(ENG_DEBUG, "FDN mode disabled..");
639 static gboolean __voicecall_core_minute_minder(gpointer puser_data)
641 CALL_ENG_DEBUG(ENG_DEBUG, "..");
642 call_vc_core_state_t *pcall_core = (call_vc_core_state_t *)puser_data;
644 if ((voicecall_core_is_incoming_call_exists(pcall_core->pcall_engine) == FALSE)
645 && (voicecall_core_is_outgoing_call_exists(pcall_core->pcall_engine) == FALSE)
646 && (voicecall_core_is_connected_call_exist(pcall_core->pcall_engine) == TRUE)) {
647 voicecall_snd_play_effect_tone(pcall_core->papp_snd, VOICE_CALL_SND_EFFECT_CALL_MINUTE_MINDER);
653 static gboolean __voicecall_core_set_path_timer_cb(gpointer puser_data)
655 CALL_ENG_DEBUG(ENG_DEBUG, "..");
656 VOICECALL_RETURN_FALSE_IF_FAIL(puser_data != NULL);
657 call_vc_core_state_t *pcall_core = (call_vc_core_state_t *)puser_data;
659 voicecall_snd_change_path(pcall_core->papp_snd);
661 if (g_set_path_timer_handler > 0) {
662 g_source_remove(g_set_path_timer_handler);
663 g_set_path_timer_handler = 0;
669 static gboolean __voicecall_core_handle_call_end_on_silent_reject(call_vc_core_state_t *pcall_core, int call_handle)
671 CALL_ENG_DEBUG(ENG_DEBUG, "call_handle = %d", call_handle);
673 if ((pcall_core->mtcall_silent_reject_handle == call_handle)) {
674 if (FALSE == voicecall_core_is_connected_call_exist(pcall_core->pcall_engine)) {
675 /*Connected calls need to be checked, Connected emergency calls may be avaialble */
676 voicecall_snd_change_mm_path(pcall_core->papp_snd, VOICE_CALL_MM_RESET);
677 voicecall_core_set_to_default(pcall_core);
679 CALL_ENG_DEBUG(ENG_ERR, "Connected calls available");
680 _vc_core_engine_status_dump_call_details(pcall_core->pcall_engine);
682 pcall_core->mtcall_silent_reject_handle = -1;
689 static gboolean __voicecall_core_silent_reject_mt(call_vc_core_state_t *pcall_core, int call_handle)
691 CALL_ENG_DEBUG(ENG_DEBUG, "call_handle = %d", call_handle);
693 voicecall_error_t error_code = ERROR_VOICECALL_NONE;
695 pcall_core->mtcall_silent_reject_handle = call_handle;
698 error_code = _vc_core_engine_reject_call(pcall_core->pcall_engine, FALSE);
700 if (ERROR_VOICECALL_NONE != error_code) {
701 CALL_ENG_DEBUG(ENG_ERR, "_vc_core_engine_reject_call Failed, error_code = %d", error_code);
707 static void __voicecall_core_processing_mo_cancel(call_vc_core_state_t *pcall_core)
709 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
710 int total_call_member;
712 CALL_ENG_DEBUG(ENG_DEBUG, "..");
714 if (TRUE == voicecall_snd_is_signal_playing(pcall_core->papp_snd)) {
715 CALL_ENG_DEBUG(ENG_DEBUG, "Signal is playing, skipping cancel timer");
719 vc_engine_outgoing_end_type event_data;
721 /* normal outgong end */
722 CALL_ENG_DEBUG(ENG_DEBUG, "It is normal outgong end case.");
723 CALL_ENG_DEBUG(ENG_DEBUG, "call_handle:[%d],end_cause_type:[%d]", pcall_core->mo_end_call_handle, pcall_core->mo_end_cause_type);
725 memset(&event_data, 0, sizeof(event_data));
726 event_data.call_handle = pcall_core->mo_end_call_handle;
727 event_data.end_cause_type = pcall_core->mo_end_cause_type;
728 vcall_engine_send_event_to_client(VC_ENGINE_MSG_OUTGOING_END_TO_UI, (void *)&event_data);
730 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_END, pcall_core->mo_end_call_handle, NULL);
732 __vc_core_set_auto_redial_count(pcall_core, 0);
733 voicecall_core_clear_mo_call(pcall_engine);
735 __voicecall_core_mocall_reset_engine_state(pcall_engine);
737 /* __vcui_app_view_mo_finish_call() start */
738 voicecall_snd_stop_signal(pcall_core->papp_snd);
740 voicecall_core_get_total_call_member(pcall_engine, &total_call_member);
741 /* If No Connected Calls End the UI */
742 if (total_call_member == 0) {
743 /*Reset voice call core to default values */
744 voicecall_core_set_to_default(pcall_core);
746 voicecall_snd_change_path(pcall_core->papp_snd);
748 /* __vcui_app_view_mo_finish_call() end */
752 static void __voicecall_core_mocall_signal_play_end_cb(gpointer pdata)
754 call_vc_core_state_t *pcall_core = (call_vc_core_state_t *)pdata;
756 CALL_ENG_DEBUG(ENG_DEBUG, "..");
758 if (FALSE == voicecall_core_is_connected_call_exist(pcall_core->pcall_engine)) {
759 CALL_ENG_DEBUG(ENG_DEBUG, "No More calls, resetting path");
760 voicecall_snd_change_mm_path(pcall_core->papp_snd, VOICE_CALL_MM_RESET);
761 _vc_core_util_set_call_status(VCONFKEY_CALL_OFF);
764 if (TRUE == voicecall_core_is_outgoing_call_exists(pcall_core->pcall_engine)) {
765 CALL_ENG_DEBUG(ENG_DEBUG, "Updating MO UI on signal end");
766 __voicecall_core_processing_mo_cancel(pcall_core);
770 static voicecall_snd_signal_type_t __voicecall_core_get_signal_type_from_endcause(int end_cause)
774 CALL_ENG_DEBUG(ENG_DEBUG, "End end_cause_type: %d", end_cause);
777 case VC_ENDCAUSE_USER_BUSY:
778 case VC_ENDCAUSE_USER_DOESNOT_RESPOND:
779 case VC_ENDCAUSE_USER_UNAVAILABLE:
780 case VC_ENDCAUSE_NO_ANSWER:
782 signal_type = VOICE_CALL_SIGNAL_USER_BUSY_TONE;
786 signal_type = VOICE_CALL_SIGNAL_NONE;
790 CALL_ENG_DEBUG(ENG_DEBUG, "Signal Type: %d", signal_type);
795 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)
797 int total_call_member = 0;
798 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
800 /*Set the callstatus to OFF before processing the End Event Animation */
801 if (TRUE == voicecall_core_is_connected_call_exist(pcall_engine)) {
802 _vc_core_util_set_call_status(VCONFKEY_CALL_VOICE_ACTIVE);
803 } else if ((TRUE == voicecall_core_is_incoming_call_exists(pcall_engine)) || (TRUE == voicecall_core_is_outgoing_call_exists(pcall_engine))) {
804 _vc_core_util_set_call_status(VCONFKEY_CALL_VOICE_CONNECTING);
806 /*Reset the Path. Actual path must be closed when modem path closed!! */
807 voicecall_snd_change_mm_path(pcall_core->papp_snd, VOICE_CALL_MM_RESET);
808 _vc_core_util_set_call_status(VCONFKEY_CALL_OFF);
811 if (FALSE == voicecall_snd_play_effect_tone(pcall_core->papp_snd, VOICE_CALL_SND_EFFECT_CALL_DISCONNECT)) {
812 CALL_ENG_DEBUG(ENG_DEBUG, "Effect tone not played, check and play busy tone");
816 if ((FALSE == voicecall_core_is_connected_call_exist(pcall_engine))
817 && (TRUE == voicecall_core_is_incoming_call_exists(pcall_engine))
818 && (voicecall_snd_get_path_status(pcall_core->papp_snd) == VOICE_CALL_SND_PATH_SPEAKER)) {
819 CALL_ENG_DEBUG(ENG_DEBUG, "Incoming Call: TRUE,Connected Call:FALSE, Speaker: TRUE. So change path to normal");
820 voicecall_snd_set_path_status(pcall_core->papp_snd, VOICE_CALL_SND_PATH_RECEIVER);
821 voicecall_snd_change_path(pcall_core->papp_snd);
824 if ((FALSE == voicecall_core_is_connected_call_exist(pcall_engine))
825 && (TRUE == voicecall_core_is_incoming_call_exists(pcall_engine))
826 && (TRUE == voicecall_snd_get_status(pcall_core->papp_snd, VOICE_CALL_AUDIO_SPEAKER))) {
827 CALL_ENG_DEBUG(ENG_DEBUG, "Incoming Call: TRUE,Connected Call:FALSE, Speaker: TRUE. So change path to normal");
828 voicecall_snd_set_status(pcall_core->papp_snd, VOICE_CALL_AUDIO_SPEAKER, FALSE);
829 voicecall_snd_change_path(pcall_core->papp_snd);
833 voicecall_core_clear_connected_call(pcall_engine, call_handle);
835 voicecall_core_get_total_call_member(pcall_engine, &total_call_member);
836 if (0 == total_call_member) {
837 voicecall_core_set_to_default(pcall_core);
842 static gboolean __voicecall_core_handle_rejected_call_end(call_vc_core_state_t *pcall_core, int call_handle)
844 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
846 voicecall_snd_stop_alert(pcall_core->papp_snd);
848 /*Send Incoming call End Event to Blue Tooth */
849 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_END, call_handle, NULL);
851 if (FALSE == voicecall_core_is_connected_call_exist(pcall_engine)) {
852 CALL_ENG_DEBUG(ENG_DEBUG, "No More Calls");
853 voicecall_core_set_to_default(pcall_core);
855 CALL_ENG_DEBUG(ENG_DEBUG, "Setting Path for Voicecall");
856 /*Change Path to Call, when the incomging call is cancelled. */
857 voicecall_snd_change_path(pcall_core->papp_snd);
858 _vc_core_util_set_call_status(VCONFKEY_CALL_VOICE_ACTIVE);
861 CALL_ENG_DEBUG(ENG_DEBUG, "Reject Call End Processed");
865 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)
867 gboolean bsignal_play = FALSE;
868 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
870 CALL_ENG_DEBUG(ENG_DEBUG, "call_handle=:%d,end_cause=%d", call_handle, end_cause_type);
871 pcall_core->mo_end_call_handle = call_handle;
872 pcall_core->mo_end_cause_type = end_cause_type;
874 if (FALSE == voicecall_core_is_connected_call_exist(pcall_engine)) {
875 voicecall_snd_signal_type_t end_signal_type = VOICE_CALL_SIGNAL_NONE;
876 /*Play Signal Tone only when the connected calls are not exists */
877 end_signal_type = __voicecall_core_get_signal_type_from_endcause(end_cause_type);
879 if (end_signal_type != VOICE_CALL_SIGNAL_NONE) {
880 voicecall_snd_set_signal_type(pcall_core->papp_snd, end_signal_type);
881 voicecall_snd_play_signal(pcall_core->papp_snd, __voicecall_core_mocall_signal_play_end_cb, pcall_core);
884 /* signal tone play case : just end string updated */
886 vc_engine_outgoing_end_signal_play_type event_data;
888 /* normal outgong end */
889 CALL_ENG_DEBUG(ENG_DEBUG, "It is normal outgong end case.");
890 CALL_ENG_DEBUG(ENG_DEBUG, "call_handle:[%d],end_cause_type:[%d]", call_handle, pcall_core->mo_end_cause_type);
892 memset(&event_data, 0, sizeof(event_data));
893 event_data.call_handle = call_handle;
894 event_data.end_cause_type = pcall_core->mo_end_cause_type;
895 vcall_engine_send_event_to_client(VC_ENGINE_MSG_OUTGOING_END_SIGNAL_PLAY_TO_UI, (void *)&event_data);
900 CALL_ENG_DEBUG(ENG_DEBUG, "Connected call exists, not playing signal tone");
902 if (TRUE == voicecall_core_is_connected_call_exist(pcall_engine)) {
903 /* Set phonestatus value */
904 _vc_core_util_set_call_status(VCONFKEY_CALL_VOICE_ACTIVE);
905 } else if (FALSE == bsignal_play) {
906 /*Reset the Path. Actual path must be closed when modem path closed!! */
907 voicecall_snd_change_mm_path(pcall_core->papp_snd, VOICE_CALL_MM_RESET);
908 _vc_core_util_set_call_status(VCONFKEY_CALL_OFF);
912 __voicecall_core_processing_mo_cancel(pcall_core);
916 static gboolean __voicecall_core_handle_incoming_call_end(call_vc_core_state_t *pcall_core, int call_handle)
918 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
920 voicecall_snd_stop_alert(pcall_core->papp_snd);
922 /*Send Incoming call End Event to Blue Tooth */
923 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_END, call_handle, NULL);
925 if (FALSE == voicecall_core_is_connected_call_exist(pcall_engine)) {
926 CALL_ENG_DEBUG(ENG_DEBUG, "No More Calls");
927 voicecall_core_set_to_default(pcall_core);
929 CALL_ENG_DEBUG(ENG_DEBUG, "Setting Path for Voicecall");
930 /*Change Path to Call, when the incomging call is cancelled. */
931 voicecall_snd_change_path(pcall_core->papp_snd);
932 _vc_core_util_set_call_status(VCONFKEY_CALL_VOICE_ACTIVE);
935 CALL_ENG_DEBUG(ENG_DEBUG, "Incoming Call End Processed");
939 static gboolean voicecall_core_cb(int event, int param1, int param2, void *param3, void *puser_data)
941 CALL_ENG_DEBUG(ENG_WARN, " Engine Event: %s(%d)", gszcall_engine_event[event], event);
943 call_vc_core_state_t *pcall_core = (call_vc_core_state_t *)puser_data;
944 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
946 CALL_VC_DUMP_CALLDETAILS(&pcall_engine->call_manager);
951 int call_handle = param1;
952 char tel_number[VC_PHONE_NUMBER_LENGTH_MAX];
953 gboolean bauto_reject = FALSE;
954 gboolean bauto_reject_unknown = FALSE;
955 gboolean restricted = FALSE;
956 gboolean bcalling_namemode = FALSE;
957 gboolean brejected_number = FALSE;
958 vc_engine_incoming_type event_data;
960 memset(&event_data, 0, sizeof(event_data));
962 CALL_ENG_DEBUG(ENG_DEBUG, "tel_number:[%s]", (char *)param3);
963 _vc_core_util_strcpy(tel_number, sizeof(tel_number), (char *)param3);
967 __voicecall_core_check_headset_earjack_status(pcall_core);
970 /*Changing the path to headset/phone will be decided by user accept action.
971 This will apply for second incoming call, if the first call was accpeted by BT Headset
972 and the path was changed to BT headset, then the path will be in headset for second call by default
973 So reset the headset flag for second call so the path will not
974 be automatically changed to headset, it will be decided by user action.
975 If this requirement fits only for first incoming call then comment this fix. */
976 /* vcui_app_snd_set_status(papp_document->papp_snd, VCUI_APP_AUDIO_HEADSET, FALSE); */
978 /*Will be set based on user action */
979 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_ACCEPT_BY_BT, FALSE);
981 if (_vc_core_util_check_video_call_status() == TRUE) {
982 if (TRUE == __voicecall_core_silent_reject_mt(pcall_core, call_handle)) {
983 CALL_ENG_DEBUG(ENG_DEBUG, "Call rejected due to silent reject");
988 /* Check for Restricted Mode */
989 _vc_core_engine_status_isrestricted_call(pcall_engine, call_handle, &restricted);
990 _vc_core_engine_status_get_calling_namemode(pcall_engine, call_handle, &bcalling_namemode);
991 if (TRUE == bcalling_namemode) {
992 call_vc_call_objectinfo_t call_object;
994 voicecall_core_get_call_object(pcall_engine, call_handle, &call_object);
995 CALL_ENG_DEBUG(ENG_DEBUG, "call_object.calling_name:[%s]", call_object.calling_name);
997 _vc_core_util_strcpy(event_data.call_name, sizeof(event_data.call_name), call_object.calling_name);
998 } else if (TRUE == restricted) {
999 call_vc_call_objectinfo_t call_object;
1001 voicecall_core_get_call_object(pcall_engine, call_handle, &call_object);
1002 CALL_ENG_DEBUG(ENG_DEBUG, "call_object.name_mode:[%s]", call_object.name_mode);
1004 event_data.brestricted = TRUE;
1005 if (call_object.name_mode == CALL_VC_NAME_MODE_PAYPHONE) {
1006 event_data.bpayphone = TRUE;
1008 event_data.bpayphone = FALSE;
1011 event_data.contact_index = -1;
1012 event_data.phone_type = -1;
1016 event_data.call_handle = call_handle;
1017 event_data.brejected = brejected_number;
1018 _vc_core_util_strcpy(event_data.call_num, sizeof(event_data.call_num), tel_number);
1020 vcall_engine_send_event_to_client(VC_ENGINE_MSG_INCOM_TO_UI, (void *)&event_data);
1022 _vc_core_util_set_sleep_status(CALL_VC_POWER_PROHIBIT_DIMMING);
1024 /* in case of rejected number, sound & callstatus is not processed */
1025 if (!brejected_number) {
1026 gboolean benabledTestMode = FALSE;
1027 voicecall_snd_register_cm(pcall_core->papp_snd);
1029 /*Send Incoming Call Event to Blue Tooth */
1030 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_INCOM, call_handle, tel_number);
1032 CALL_ENG_DEBUG(ENG_DEBUG, "Preparing Sound ");
1033 voicecall_snd_prepare_alert(pcall_core->papp_snd, call_handle);
1034 if (FALSE == voicecall_core_is_connected_call_exist(pcall_core->pcall_engine)) {
1035 CALL_ENG_DEBUG(ENG_DEBUG, "Changing MM Path just before playing the ring tone");
1036 voicecall_snd_change_mm_path(pcall_core->papp_snd, VOICE_CALL_MM_RING_TONE);
1038 CALL_ENG_DEBUG(ENG_DEBUG, "2nd MT call alert.");
1040 voicecall_snd_play_alert(pcall_core->papp_snd);
1042 _vc_core_util_set_call_status(VCONFKEY_CALL_VOICE_CONNECTING);
1048 case VC_CALL_OUTGOING:
1050 int call_handle = param1;
1051 vc_engine_common_with_handle_type event_data;
1052 memset(&event_data, 0, sizeof(event_data));
1054 CALL_ENG_DEBUG(ENG_DEBUG, "MO Call Start: Call handle %d", call_handle);
1058 case VC_CALL_OUTGOING_ORIG:
1060 int call_handle = param1;
1061 vc_engine_outgoing_orig_type event_data;
1062 call_vc_call_objectinfo_t callobject_info;
1064 memset(&event_data, 0, sizeof(event_data));
1065 event_data.call_handle = call_handle;
1066 if (pcall_core->call_setup_info.call_type == VC_CALL_ORIG_TYPE_EMERGENCY) {
1067 event_data.bemergency = TRUE;
1069 event_data.bemergency = FALSE;
1072 CALL_ENG_DEBUG(ENG_DEBUG, "Call Handle = %d, bemergency:[%d]", event_data.call_handle, event_data.bemergency);
1073 vcall_engine_send_event_to_client(VC_ENGINE_MSG_OUTGOING_ORIG_TO_UI, (void *)&event_data);
1074 _voicecall_dvc_proximity_sensor_init(pcall_core);
1076 g_set_path_timer_handler = g_timeout_add(SET_PATH_TIMER_VALUE, __voicecall_core_set_path_timer_cb, pcall_core);
1078 /*Send Event to Blue Tooth */
1079 voicecall_core_get_call_object(pcall_engine, call_handle, &callobject_info);
1080 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_ORIG, call_handle, callobject_info.tel_number);
1084 case VC_CALL_OUTGOING_ALERT:
1086 int call_handle = param1;
1087 vc_engine_common_with_handle_type event_data;
1089 memset(&event_data, 0, sizeof(event_data));
1091 PRINT_CURRENT_TIME("Alert Indication received at ");
1093 event_data.call_handle = call_handle;
1095 vcall_engine_send_event_to_client(VC_ENGINE_MSG_OUTGOING_ALERT_TO_UI, (void *)&event_data);
1097 /*Play Connected Effect Tone */
1098 CALL_ENG_KPI("voicecall_snd_play_effect_tone start");
1099 if (FALSE == voicecall_snd_play_effect_tone(pcall_core->papp_snd, VOICE_CALL_SND_EFFECT_CALL_CONNECT)) {
1100 CALL_ENG_DEBUG(ENG_DEBUG, "voicecall_snd_play_effect_tone return value is FALSE");
1101 voicecall_snd_change_path(pcall_core->papp_snd);
1103 CALL_ENG_KPI("voicecall_snd_play_effect_tone done");
1105 CALL_ENG_KPI("_vc_bt_send_response_to_bt start");
1106 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_REMOTE_RINGING, call_handle, NULL);
1107 CALL_ENG_KPI("_vc_bt_send_response_to_bt done");
1111 case VC_CALL_ANSWER_CNF:
1113 CALL_ENG_DEBUG(ENG_DEBUG, "Answer confirm");
1114 if (_vc_core_cm_get_call_member_count(&(pcall_engine->call_manager)) == 1) {
1115 CALL_ENG_DEBUG(ENG_DEBUG, "single call state");
1116 voicecall_snd_change_path(pcall_core->papp_snd);
1121 case VC_CALL_CONNECTED:
1123 int call_handle = param1;
1124 vc_engine_connected_type event_data;
1125 int bstatus = FALSE;
1127 memset(&event_data, 0, sizeof(event_data));
1129 CALL_ENG_DEBUG(ENG_DEBUG, "Connected Call Handle : %d", call_handle);
1131 event_data.call_handle = call_handle;
1132 event_data.bt_status = (int)_vc_bt_get_bt_status();
1134 vcall_engine_send_event_to_client(VC_ENGINE_MSG_CONNECTED_TO_UI, (void *)&event_data);
1135 _voicecall_dvc_proximity_sensor_init(pcall_core);
1137 voicecall_snd_change_path(pcall_core->papp_snd);
1139 /* Set phonestatus value */
1140 _vc_core_util_set_call_status(VCONFKEY_CALL_VOICE_ACTIVE);
1141 _vc_core_util_set_sleep_status(CALL_VC_POWER_GRANT_DIMMING);
1143 /* check minute minder */
1144 if (vconf_get_bool(VCONFKEY_CISSAPPL_MINUTE_MINDER_BOOL, &bstatus)) {
1145 CALL_ENG_DEBUG(ENG_ERR, "vconf_get_bool failed.");
1148 if (pcall_core->minute_minder_timer == 0) {
1149 pcall_core->minute_minder_timer = g_timeout_add(MINUTE_MINDER_TIMEOUT_VALUE, __voicecall_core_minute_minder, pcall_core);
1153 /*Send Event to Blue Tooth */
1154 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_CONNECT, call_handle, NULL);
1156 /*Call is accepted, reset the flag */
1157 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_ACCEPT_BY_BT, FALSE);
1159 #ifdef PDIAL_SEND_DTMF
1160 g_idle_add(voicecall_core_send_phone_number_dtmf, (gpointer) call_handle);
1165 case VC_CALL_NORMAL_END:
1167 int call_handle = param1;
1168 voice_call_end_cause_type_t end_cause = param2;
1169 vc_engine_normal_end_type event_data;
1170 int active_call_members = -1;
1172 memset(&event_data, 0, sizeof(event_data));
1174 CALL_ENG_DEBUG(ENG_DEBUG, "Normal End Call Handle : %d,End Cause=%d", call_handle, end_cause);
1176 event_data.call_handle = call_handle;
1177 event_data.end_cause_type = end_cause;
1179 __voicecall_core_handle_normal_end(pcall_core, call_handle, end_cause);
1181 vcall_engine_send_event_to_client(VC_ENGINE_MSG_NORMAL_END_TO_UI, (void *)&event_data);
1183 /*Send Event to Blue Tooth */
1184 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_END, call_handle, NULL);
1188 case VC_CALL_INCOM_END:
1190 int call_handle = param1;
1191 vc_engine_common_with_handle_type event_data;
1193 memset(&event_data, 0, sizeof(event_data));
1195 CALL_ENG_DEBUG(ENG_DEBUG, "Incoming call End Call Handle: %d", call_handle);
1197 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_ACCEPT_BY_BT, FALSE);
1199 if (TRUE == __voicecall_core_handle_call_end_on_silent_reject(pcall_core, call_handle)) {
1200 CALL_ENG_DEBUG(ENG_DEBUG, "Call end processed for silent reject:");
1204 event_data.call_handle = call_handle;
1206 __voicecall_core_handle_incoming_call_end(pcall_core, call_handle);
1208 _vc_core_util_set_sleep_status(CALL_VC_POWER_GRANT_DIMMING);
1209 vcall_engine_send_event_to_client(VC_ENGINE_MSG_INCOM_END_TO_UI, (void *)&event_data);
1213 case VC_CALL_INCOM_DROPPED:
1215 CALL_ENG_DEBUG(ENG_DEBUG, "Check it. Not used");
1219 case VC_CALL_REJECTED_END:
1221 int call_handle = param1;
1222 vc_engine_common_with_handle_type event_data;
1224 memset(&event_data, 0, sizeof(event_data));
1226 CALL_ENG_DEBUG(ENG_DEBUG, "Rejected call End Call Handle: %d", call_handle);
1228 event_data.call_handle = call_handle;
1230 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_ACCEPT_BY_BT, FALSE);
1232 __voicecall_core_handle_rejected_call_end(pcall_core, call_handle);
1234 _vc_core_util_set_sleep_status(CALL_VC_POWER_GRANT_DIMMING);
1235 vcall_engine_send_event_to_client(VC_ENGINE_MSG_REJECTED_END_TO_UI, (void *)&event_data);
1239 case VC_CALL_OUTGOING_END:
1241 int call_handle = param1;
1242 int end_cause_type = param2;
1243 int bauto_redial = -1;
1245 CALL_ENG_DEBUG(ENG_DEBUG, "end cause type :[%d]", end_cause_type);
1247 if (vconf_get_bool(VCONFKEY_CISSAPPL_VOICE_AUTO_REDIAL_BOOL, &bauto_redial)) {
1248 CALL_ENG_DEBUG(ENG_ERR, "vconf_get_bool failed.");
1251 CALL_ENG_DEBUG(ENG_DEBUG, "bauto_redial:[%d]", bauto_redial);
1253 if ((TRUE == bauto_redial) && (FALSE == voicecall_core_is_connected_call_exist(pcall_engine))
1254 && (FALSE == voicecall_core_get_status(pcall_core, CALL_VC_CORE_FLAG_MOCALL_END_BY_USER))
1255 && (TRUE == __voicecall_core_is_redial_cuase(end_cause_type))) {
1257 CALL_ENG_DEBUG(ENG_DEBUG, "It is auto redial case.");
1259 _vc_core_util_set_call_status(VCONFKEY_CALL_OFF);
1261 vc_engine_outgoing_end_type event_data;
1263 memset(&event_data, 0, sizeof(event_data));
1264 event_data.call_handle = call_handle;
1265 event_data.end_cause_type = end_cause_type;
1266 event_data.bauto_redial = TRUE;
1267 vcall_engine_send_event_to_client(VC_ENGINE_MSG_OUTGOING_END_TO_UI, (void *)&event_data);
1269 __voicecall_core_handle_outgoingcall_end(pcall_core, call_handle, end_cause_type);
1271 _vc_core_util_set_sleep_status(CALL_VC_POWER_GRANT_DIMMING);
1275 case VC_CALL_OUTGOING_ABORTED:
1277 vc_engine_common_type event_data;
1279 memset(&event_data, 0, sizeof(event_data));
1281 vcall_engine_send_event_to_client(VC_ENGINE_MSG_OUTGOING_ABORTED_TO_UI, (void *)&event_data);
1283 _vc_core_util_set_sleep_status(CALL_VC_POWER_GRANT_DIMMING);
1287 case VC_CALL_DTMF_ACK:
1289 gboolean bsuccess = param1;
1290 CALL_ENG_DEBUG(ENG_DEBUG, "bsuccess:[%d]", bsuccess);
1291 #ifdef PDIAL_SEND_DTMF
1292 __voicecall_core_handle_dtmf_ack(pcall_core, bsuccess);
1297 case VC_CALL_AUTO_REDIAL_CHECK:
1299 CALL_ENG_DEBUG(ENG_DEBUG, "Check it. Not used");
1303 case VC_CALL_SS_HELD:
1306 int call_handle = param1;
1307 vc_engine_common_type event_data;
1308 PRINT_CURRENT_TIME("Call Hold Ends at");
1310 /* held popup shold not be displayed on outgoing popup */
1311 memset(&event_data, 0, sizeof(event_data));
1313 vcall_engine_send_event_to_client(VC_ENGINE_MSG_SS_HELD_TO_UI, (void *)&event_data);
1315 /*Send Event to Blue Tooth */
1316 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_HOLD, call_handle, NULL);
1320 case VC_CALL_SS_RETREIVED:
1322 int call_handle = param1;
1323 vc_engine_common_type event_data;
1324 PRINT_CURRENT_TIME("Call Retrieve Ends at");
1326 /* held popup shold not be displayed on outgoing popup */
1327 memset(&event_data, 0, sizeof(event_data));
1328 vcall_engine_send_event_to_client(VC_ENGINE_MSG_SS_RETREIVED_TO_UI, (void *)&event_data);
1330 /*Send Event to Blue Tooth */
1331 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_RETRIEVE, call_handle, NULL);
1335 case VC_CALL_SS_SWAP:
1337 vc_engine_common_type event_data;
1339 int call_handle = param1;
1340 PRINT_CURRENT_TIME("Call Swap Ends at");
1342 memset(&event_data, 0, sizeof(event_data));
1344 /* Show Call Swapped Message Box */
1345 vcall_engine_send_event_to_client(VC_ENGINE_MSG_SS_SWAP_TO_UI, (void *)&event_data);
1347 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_SWAPPED, call_handle, NULL);
1351 case VC_CALL_SS_SETUP_CONF:
1353 vc_engine_common_type event_data;
1355 PRINT_CURRENT_TIME("Setup Conf Ends at");
1357 memset(&event_data, 0, sizeof(event_data));
1359 /* Show Call Joined Message Box */
1360 vcall_engine_send_event_to_client(VC_ENGINE_MSG_SS_SETUP_CONF_TO_UI, (void *)&event_data);
1362 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_JOINED, 0, NULL);
1366 case VC_CALL_SS_SPLIT_CONF:
1368 vc_engine_common_with_handle_type event_data;
1369 int call_handle = param1;
1370 CALL_ENG_DEBUG(ENG_DEBUG, "The handle to be split is %d", call_handle);
1372 PRINT_CURRENT_TIME("Split Conf Ends at");
1374 memset(&event_data, 0, sizeof(event_data));
1375 event_data.call_handle = call_handle;
1377 /* Show Private Call Message Box */
1378 vcall_engine_send_event_to_client(VC_ENGINE_MSG_SS_SPLIT_CONF_TO_UI, (void *)&event_data);
1382 case VC_CALL_SS_TRANSFERRED:
1384 vc_engine_common_type event_data;
1386 memset(&event_data, 0, sizeof(event_data));
1388 vcall_engine_send_event_to_client(VC_ENGINE_MSG_SS_TRANSFERRED_TO_UI, (void *)&event_data);
1392 case VC_CALL_SS_CONNECT_LINE_IND:
1394 int call_handle = param1;
1395 char *pconnected_number = (char *)param3;
1396 vc_engine_msg_box_type event_data;
1398 CALL_ENG_DEBUG(ENG_DEBUG, "call_handle : [%d]", call_handle);
1400 /* check whether Call Info for recevice Call Handle exists or not. */
1402 if ((pconnected_number != NULL) && (strlen(pconnected_number) > 0)) {
1403 CALL_ENG_DEBUG(ENG_DEBUG, "connected line ind : [%s]", pconnected_number);
1405 memset(&event_data, 0, sizeof(event_data));
1407 event_data.string_id = IDS_CALL_POP_CALL_IS_DIVERTED;
1408 _vc_core_util_strcpy(event_data.diverted_num, sizeof(event_data.diverted_num), pconnected_number);
1410 CALL_ENG_DEBUG(ENG_DEBUG, "No conneccted info");
1416 case VC_CALL_IND_FORWARD:
1418 vc_engine_ind_forward_type event_data;
1419 int fwd_type = param1;
1421 memset(&event_data, 0, sizeof(event_data));
1422 event_data.fwd_type = fwd_type;
1424 vcall_engine_send_event_to_client(VC_ENGINE_MSG_IND_FORWARD_TO_UI, (void *)&event_data);
1428 case VC_CALL_IND_ACTIVATE:
1430 vc_engine_common_type event_data;
1432 memset(&event_data, 0, sizeof(event_data));
1434 vcall_engine_send_event_to_client(VC_ENGINE_MSG_IND_ACTIVATE_TO_UI, (void *)&event_data);
1438 case VC_CALL_IND_HOLD:
1440 vc_engine_common_type event_data;
1441 int call_handle = param1;
1443 memset(&event_data, 0, sizeof(event_data));
1445 vcall_engine_send_event_to_client(VC_ENGINE_MSG_IND_HOLD_TO_UI, (void *)&event_data);
1447 /*Send Event to Blue Tooth */
1448 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_HOLD, call_handle, NULL);
1452 case VC_CALL_IND_TRANSFER:
1454 CALL_ENG_DEBUG(ENG_DEBUG, "Not used.");
1458 case VC_CALL_IND_SETUPCONFERENCE:
1460 CALL_ENG_DEBUG(ENG_DEBUG, "Not used.");
1464 case VC_CALL_IND_BARRING:
1466 vc_engine_common_type event_data;
1468 memset(&event_data, 0, sizeof(event_data));
1470 vcall_engine_send_event_to_client(VC_ENGINE_MSG_IND_BARRING_TO_UI, (void *)&event_data);
1474 case VC_CALL_IND_WAITING:
1476 vc_engine_common_type event_data;
1478 memset(&event_data, 0, sizeof(event_data));
1480 vcall_engine_send_event_to_client(VC_ENGINE_MSG_IND_WAITING_TO_UI, (void *)&event_data);
1484 case VC_CALL_IND_CUGINFO:
1486 CALL_ENG_DEBUG(ENG_DEBUG, "Not used.");
1490 case VC_CALL_IND_SSNOTIFY:
1492 vc_engine_ind_ssnotify_type event_data;
1493 int ss_type = param1;
1495 memset(&event_data, 0, sizeof(event_data));
1496 event_data.ss_type = ss_type;
1498 vcall_engine_send_event_to_client(VC_ENGINE_MSG_IND_SSNOTIFY_TO_UI, (void *)&event_data);
1502 case VC_CALL_IND_CALLINGNAMEINFO:
1504 CALL_ENG_DEBUG(ENG_DEBUG, "Not used.");
1507 case VC_CALL_IND_ACTIVATECCBS_CNF:
1509 CALL_ENG_DEBUG(ENG_DEBUG, "Not used.");
1513 case VC_CALL_IND_ACTIVATECCBS_USERINFO:
1515 CALL_ENG_DEBUG(ENG_DEBUG, "Not used.");
1519 case VC_CALL_IND_AOC:
1521 CALL_ENG_DEBUG(ENG_DEBUG, "Not yet.");
1525 case VC_ERROR_OCCURED:
1527 int error_code = param1;
1529 CALL_ENG_DEBUG(ENG_DEBUG, "error code:[%d]", error_code);
1530 switch (error_code) {
1531 case ERROR_VOICECALL_INVALID_DTMF_CHAR:
1532 case ERROR_VOICECALL_DTMF_FAILED:
1534 vc_engine_error_occured_type event_data;
1536 memset(&event_data, 0, sizeof(event_data));
1537 event_data.error_code = error_code;
1539 vcall_engine_send_event_to_client(VC_ENGINE_MSG_ERROR_OCCURED_TO_UI, (void *)&event_data);
1544 vc_engine_msg_box_type event_data;
1547 string_id = __voicecall_core_get_string_id_by_errorcode(error_code);
1549 memset(&event_data, 0, sizeof(event_data));
1550 event_data.string_id = __voicecall_core_get_string_id_by_errorcode(error_code);
1552 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
1559 case VC_ACTION_INCOM_FORCE:
1561 int call_handle = param1;
1562 vc_engine_common_with_handle_type event_data;
1564 CALL_ENG_DEBUG(ENG_DEBUG, "Call Handle = %d", call_handle);
1566 memset(&event_data, 0, sizeof(event_data));
1567 event_data.call_handle = call_handle;
1569 vcall_engine_send_event_to_client(VC_ENGINE_MSG_ACTION_INCOM_FORCE_TO_UI, (void *)&event_data);
1573 case VC_ACTION_SAT_REQUEST:
1575 if (SAT_RQST_SETUP_CALL == param1) {
1576 voicecall_sat_callinfo_t *psat_callinfo = (voicecall_sat_callinfo_t *) param3;
1577 vc_engine_outgoing_type event_data;
1579 if (psat_callinfo == NULL) {
1580 CALL_ENG_DEBUG(ENG_ERR, "psat_callinfo is NULL..");
1581 assert(psat_callinfo != NULL);
1583 CALL_ENG_DEBUG(ENG_DEBUG, "VC_ACTION_SAT_REQUEST is received by Voice call.");
1584 pcall_core->call_setup_info.call_setup_by = VC_CALL_SETUP_BY_SAT;
1585 pcall_core->call_setup_info.call_type = VC_CALL_ORIG_TYPE_SAT;
1588 _vc_core_util_strcpy(pcall_core->call_setup_info.source_tel_number, VC_PHONE_NUMBER_LENGTH_MAX, psat_callinfo->call_number);
1589 _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);
1592 CALL_ENG_DEBUG(ENG_ERR, "psat_callinfo->disp_text:[%s]", psat_callinfo->disp_text);
1594 memset(&event_data, 0, sizeof(event_data));
1595 _vc_core_util_strcpy(event_data.call_num, sizeof(event_data.call_num), pcall_core->call_setup_info.tel_number);
1596 event_data.contact_index = -1;
1597 event_data.phone_type = -1;
1598 _vc_core_util_strcpy(event_data.call_num, sizeof(event_data.call_num), psat_callinfo->disp_text);
1600 vcall_engine_send_event_to_client(VC_ENGINE_MSG_OUTGOING_TO_UI, (void *)&event_data);
1602 /*Get Icon Information */
1603 if (TRUE == psat_callinfo->bicon_present) { /*bicon_present is TRUE when SAT icon info available and when GCF is enabled */
1604 CALL_ENG_DEBUG(ENG_ERR, "SAT icon available.");
1607 /* Prepare and Make Call with the Give Information */
1608 if (FALSE == voicecall_core_setup_call(pcall_core, FALSE)) {
1609 /*Send Response to SAT Engine */
1610 voicecall_core_send_sat_response(pcall_core->pcall_engine, SAT_RQST_SETUP_CALL, CALL_VC_ME_UNABLE_TO_PROCESS_COMMAND);
1613 } else if (SAT_RQST_SEND_DTMF == param1) {
1614 voicecall_sat_callinfo_t *psat_callinfo = (voicecall_sat_callinfo_t *) param3;
1616 CALL_ENG_DEBUG(ENG_DEBUG, "SAT Send DTMF Number: %s, hidden: %d", psat_callinfo->call_number, psat_callinfo->bsat_hidden);
1617 __voicecall_core_queue_dtmf_string(pcall_core, psat_callinfo->call_number, TRUE);
1619 CALL_ENG_DEBUG(ENG_ERR, "Invalid SAT Request Type: %d", param2);
1624 case VC_ACTION_SAT_RESPONSE:
1626 if (SAT_RESP_SETUP_CALL == param1) {
1627 voicecall_sat_callinfo_t *psat_call_info = (voicecall_sat_callinfo_t *) param3;
1629 CALL_ENG_DEBUG(ENG_DEBUG, "sat_mo_call_ctrl_res = %d", psat_call_info->sat_mo_call_ctrl_res);
1631 if (CALL_NOT_ALLOWED == psat_call_info->sat_mo_call_ctrl_res) {
1632 vc_engine_msg_box_type event_data;
1634 memset(&event_data, 0, sizeof(event_data));
1635 event_data.string_id = IDS_CALL_POP_CALLNOTCALLOWED;
1636 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
1637 } else if (CALL_ALLOWED_WITH_MOD == psat_call_info->sat_mo_call_ctrl_res) {
1638 CALL_ENG_DEBUG(ENG_DEBUG, "psat_call_info->call_number = [%s]", psat_call_info->call_number);
1639 CALL_ENG_DEBUG(ENG_DEBUG, "psat_call_info->disp_text = [%s]", psat_call_info->disp_text);
1641 mocall_index = vcui_app_doc_get_mocall_index(papp_document);
1643 /*Update MO CALL Display Data with the SAT modified info */
1644 if (mocall_index != -1) {
1645 vcui_app_call_display_data_t display_data;
1646 vcui_app_call_display_data_t new_display_data;
1647 vcui_app_view_mo_state_t *pmo_state = NULL;
1649 if (FALSE == vcui_app_cdm_get_display_object_byindex(&papp_document->call_display_manager, mocall_index, &display_data)) {
1653 vcui_app_cdm_clear_display_object(&new_display_data);
1655 /*Copy all must parameters required for MO Call */
1656 new_display_data.call_handle = display_data.call_handle;
1657 new_display_data.call_index = display_data.call_index;
1658 new_display_data.call_type = display_data.call_type;
1659 new_display_data.start_time = display_data.start_time;
1660 new_display_data.used = display_data.used;
1662 if (strlen(psat_call_info->call_number) > 0) {
1663 vcui_app_util_strcpy(new_display_data.source_tel_number, sizeof(new_display_data.source_tel_number), psat_call_info->call_number);
1664 _vc_core_engine_extract_phone_number(new_display_data.source_tel_number, new_display_data.tel_number, VC_PHONE_NUMBER_LENGTH_MAX);
1667 if (strlen(psat_call_info->disp_text) > 0) {
1668 vcui_app_util_strcpy(new_display_data.name, sizeof(new_display_data.name), psat_call_info->disp_text);
1671 /* todo, Check whether contact search need to be done for the SAT modified number */
1673 /*Set the newly modified data to the CDM */
1674 vcui_app_cdm_set_display_object(pdisplay_mgr, &new_display_data);
1676 /*Update the MO View */
1677 pmo_state = (vcui_app_view_mo_state_t *) calloc(1, sizeof(vcui_app_view_mo_state_t));
1678 pmo_state->mo_call_state = VCUI_MO_CALL_STATE_UPDATE;
1680 /* Update MO Call Screen View to update the connection status */
1681 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);
1684 VCUI_DEBUG(VCUI_LOG_ERR, "Invalid Mo Call Index: %d", mocall_index);
1687 } else if (CALL_CHANGED_TO_SS == psat_call_info->sat_mo_call_ctrl_res) {
1688 /*Issue notification to Launch SS */
1694 case VC_ACTION_CALL_END_HELD_RETREIVED:
1696 int call_handle = param1;
1697 vc_engine_common_with_handle_type event_data;
1699 CALL_ENG_DEBUG(ENG_DEBUG, "call handle:[%d]", call_handle);
1701 memset(&event_data, 0, sizeof(event_data));
1703 vcall_engine_send_event_to_client(VC_ENGINE_MSG_ACTION_CALL_END_HELD_RETREIVED_TO_UI, (void *)&event_data);
1707 case VC_ACTION_NO_ACTIVE_TASK:
1709 CALL_ENG_DEBUG(ENG_DEBUG, "Not yet.");
1713 case VC_CALL_GET_VOLUME_RESP:
1715 vc_engine_vol_resp_type event_data;
1717 CALL_ENG_DEBUG(ENG_DEBUG, "Current Voicecall (TAPI)Volume Type %d, Current Volume Level: %d", param1, param2);
1719 memset(&event_data, 0, sizeof(event_data));
1720 event_data.vol_alert_type = VOICE_CALL_VOL_TYPE_VOICE;
1721 event_data.vol_level = param2;
1722 vcall_engine_send_event_to_client(VC_ENGINE_MSG_GET_VOLUME_RESP_TO_UI, (void *)&event_data);
1727 CALL_ENG_DEBUG(ENG_DEBUG, " Engine Event ID : %d not handled", event);
1731 CALL_VC_DUMP_CALLDETAILS(&pcall_engine->call_manager);
1733 CALL_ENG_DEBUG(ENG_DEBUG, " Ended.");
1739 * This function converts Error Code to string id.
1742 * @param[in] error_code error code to be used to display the message content
1744 static int __voicecall_core_get_string_id_by_errorcode(int error_code)
1747 switch (error_code) {
1748 case ERROR_VOICECALL_DTMF_FAILED:
1749 string_id = IDS_CALL_POP_DTMFSENDING_FAIL;
1752 case ERROR_VOICECALL_CALL_NOT_ALLOWED:
1753 string_id = IDS_CALL_POP_CALLNOTCALLOWED;
1756 case ERROR_VOICECALL_CALL_IMPOSSIBLE_NOSIM_NOEMERGNUM:
1757 string_id = IDS_CALL_POP_SOS_CALL_ONLY_IN_NO_SIM_MODE;
1760 case ERROR_VOICECALL_EMERGENCY_CALLS_ONLY:
1761 string_id = IDS_CALL_POP_CALLING_EMERG_ONLY;
1764 case ERROR_VOICECALL_PHONE_NOT_INITIALIZED:
1765 string_id = IDS_CALL_POP_PHONE_NOT_INITIALISED;
1768 case ERROR_VOICECALL_ANSWER_FAILED:
1769 string_id = IDS_CALL_POP_CALLFAILED;
1772 case ERROR_VOICECALL_HOLD_REJECTED:
1773 case ERROR_VOICECALL_HOLD_FAILED:
1774 string_id = IDS_CALL_POP_HOLD_FAILED;
1777 case ERROR_VOICECALL_ACTIVATE_REJECTED:
1778 case ERROR_VOICECALL_RETREIVE_FAILED:
1779 string_id = IDS_CALL_POP_UNABLE_TO_RETRIEVE;
1782 case ERROR_VOICECALL_SWAP_REJECTED:
1783 case ERROR_VOICECALL_SWAP_FAILED:
1784 string_id = IDS_CALL_POP_SWAP_FAILED;
1787 case ERROR_VOICECALL_SPLIT_CONF_FAILED:
1788 string_id = IDS_CALL_POP_SPLIT_FAILED;
1791 case ERROR_VOICECALL_SETUP_CONF_FAILED:
1792 string_id = IDS_CALL_POP_JOIN_FAILED;
1795 case ERROR_VOICECALL_TRANSFER_FAILED:
1796 string_id = IDS_CALL_POP_TRANSFER_FAILED;
1799 case ERROR_VOICECALL_SWAP_NOT_SUPPORTED:
1800 string_id = IDS_CALL_POP_SWAP_NOT_SUPPORTED;
1803 case ERROR_VOICECALL_HOLD_NOT_SUPPORTED:
1804 string_id = IDS_CALL_POP_HOLD_NOT_SUPPORTED;
1807 case ERROR_VOICECALL_RETREIVE_NOT_SUPPORTED:
1808 string_id = IDS_CALL_POP_UNHOLD_NOT_SUPPORTED;
1811 case ERROR_VOICECALL_SETUP_CONF_NOT_SUPPORTED:
1812 string_id = IDS_CALL_POP_JOIN_NOT_SUPPORTED;
1815 case ERROR_VOICECALL_SPLIT_CONF_NOT_SUPPORTED:
1816 string_id = IDS_CALL_POP_SPLIT_NOT_SUPPORTED;
1818 case ERROR_VOICECALL_TRANSFER_NOT_SUPPORTED:
1819 string_id = IDS_CALL_POP_TRANSFER_NOT_SUPPORTED;
1822 case ERROR_VOICECALL_INCOMPLETE:
1823 string_id = IDS_CALL_POP_INCOMPLETE;
1826 case ERROR_VOICECALL_UNAVAILABLE:
1827 string_id = IDS_CALL_POP_UNAVAILABLE;
1830 case ERROR_VOICECALL_TAPI_CAUSE_CALL_FAILED:
1831 string_id = IDS_CALL_POP_CALLFAILED;
1834 case ERROR_VOICECALL_INVALID_CALL_TYPE:
1835 case ERROR_VOICECALL_INVALID_TELEPHONE_NUMBER:
1836 string_id = IDS_CALL_POP_CAUSE_WRONG_NUMBER;
1840 CALL_ENG_DEBUG(ENG_DEBUG, " Invalid Error Code: %x", error_code);
1841 string_id = IDS_CALL_POP_CALLFAILED;
1847 gboolean voicecall_core_set_to_default(call_vc_core_state_t *pcall_core)
1849 CALL_ENG_DEBUG(ENG_DEBUG, "");
1850 if (pcall_core->pcall_engine == NULL)
1853 /*Set Engine states to default */
1854 _vc_core_engine_set_to_default_values(pcall_core->pcall_engine);
1856 /*Initialize MO Call Setup Info */
1857 pcall_core->call_setup_info.mo_call_index = VC_TAPI_INVALID_CALLHANDLE;
1858 pcall_core->call_setup_info.call_setup_by = VC_CALL_SETUP_BY_NORMAL;
1860 pcall_core->call_setup_info.mo_call_index = VC_TAPI_INVALID_CALLHANDLE;
1861 pcall_core->call_setup_info.call_setup_by = VC_CALL_SETUP_BY_NORMAL;
1862 memset(pcall_core->call_setup_info.tel_number, 0, sizeof(pcall_core->call_setup_info.tel_number));
1864 pcall_core->mo_redial_timer = -1;
1865 __vc_core_set_auto_redial_count(pcall_core, 0);
1867 _vc_core_util_set_call_status(VCONFKEY_CALL_OFF);
1868 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_NONE, TRUE);
1869 _vc_core_util_set_sleep_status(CALL_VC_POWER_NORMAL_STATUS);
1871 pcall_core->bt_connected = _vc_bt_get_bt_status();
1872 if (FALSE == pcall_core->bt_connected) {
1874 voicecall_snd_set_path_status(pcall_core->papp_snd, VOICE_CALL_SND_PATH_RECEIVER);
1876 voicecall_snd_set_status(pcall_core->papp_snd, VOICE_CALL_AUDIO_HEADSET, pcall_core->bt_connected);
1879 CALL_ENG_DEBUG(ENG_DEBUG, "BT connected, Not changing the sound status");
1883 voicecall_snd_unregister_cm(pcall_core->papp_snd);
1888 static void __voicecall_core_mocall_reset_engine_state(voicecall_engine_t *pcall_engine)
1890 int eng_state = VC_INOUT_STATE_NONE;
1892 voicecall_core_get_engine_state(pcall_engine, &eng_state);
1894 CALL_ENG_DEBUG(ENG_DEBUG, "current engine state is: %d", eng_state);
1896 if ((eng_state > VC_INOUT_STATE_OUTGOING_START) && (eng_state < VC_INOUT_STATE_OUTGOING_END)) {
1897 voicecall_core_change_engine_state(pcall_engine, VC_INOUT_STATE_NONE);
1899 CALL_ENG_DEBUG(ENG_DEBUG, "Engine state is already changed, current engine state is: %d", eng_state);
1900 CALL_VC_DUMP_CALLDETAILS(&pcall_engine->call_manager);
1905 * This function initialize voicecall core
1907 * @return Returns TRUE on success or FALSE on failure
1908 * @param[in] pcall_core Handle to voicecall core
1909 * @param[in] pcallback_func callback function
1911 int voicecall_core_init(call_vc_core_state_t *pcall_core)
1913 voicecall_engine_t *pcall_engine = NULL;
1915 if (ERROR_VOICECALL_NONE != _vc_core_engine_init(&pcall_engine, (voicecall_cb) voicecall_core_cb, pcall_core)) {
1916 CALL_ENG_DEBUG(ENG_DEBUG, "Voicecall Engine Init Failed");
1920 if (FALSE == voicecall_snd_init(pcall_core, &pcall_core->papp_snd)) {
1921 CALL_ENG_DEBUG(ENG_DEBUG, "voicecall_snd_init() failed");
1924 /*Store Voicecall Engine Handle */
1925 pcall_core->pcall_engine = pcall_engine;
1927 _vc_bt_status_init(pcall_core);
1929 _voicecall_dvc_earjack_init(pcall_core);
1931 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_NONE, TRUE);
1936 * This function prepares a voice call with the given data
1938 * @return Returns TRUE on success or FALSE on failure
1939 * @param[in] pcall_core Handle to voicecall core
1940 * @param[in] bemergency emergency call or not from dialer
1943 gboolean voicecall_core_setup_call(call_vc_core_state_t *pcall_core, gboolean bemergency)
1945 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
1946 voicecall_setup_info_t setupcall_info = { 0, };
1947 voicecall_error_t error_code = -1;
1948 gboolean bemergency_call = FALSE;
1950 gboolean bmocall_exists = FALSE;
1951 gboolean bmtcall_exists = FALSE;
1954 CALL_ENG_DEBUG(ENG_DEBUG, "");
1956 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SOS_CALL_ONLY, bemergency);
1958 _vc_core_engine_status_isexists_call_bytype(pcall_engine, VC_OUTGOING_CALL, &bmocall_exists);
1959 if (TRUE == bmocall_exists) {
1960 CALL_ENG_DEBUG(ENG_DEBUG, "MO call is in progress...");
1961 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
1965 /*Ignore the MO Call, if already an Incoming call is in progress, MT Call is given high priority */
1966 _vc_core_engine_status_isexists_call_bytype(pcall_engine, VC_INCOMING_CALL, &bmtcall_exists);
1967 if (TRUE == bmtcall_exists) {
1968 CALL_ENG_DEBUG(ENG_DEBUG, "MT call is in progress");
1969 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
1973 if (TRUE == _vc_core_util_check_video_call_status()) {
1974 CALL_ENG_DEBUG(ENG_DEBUG, "Voice call is not allowed during video call...");
1975 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
1976 vc_engine_msg_box_type event_data;
1978 memset(&event_data, 0, sizeof(event_data));
1979 event_data.string_id = IDS_CALL_POP_VOICE_CALL_IS_NOT_ALLOWED_DURING_VIDEO_CALL;
1980 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
1985 if (TRUE == _vc_core_util_get_SAP_status()) {
1986 CALL_ENG_DEBUG(ENG_DEBUG, "SAP is on");
1987 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
1988 vc_engine_msg_box_type event_data;
1990 memset(&event_data, 0, sizeof(event_data));
1991 event_data.string_id = IDS_CALL_POP_UNAVAILABLE;
1992 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
1997 /*Prpare a call with the Voicecall Engine */
1998 setupcall_info.call_type = pcall_core->call_setup_info.call_type;
1999 _vc_core_util_strcpy(setupcall_info.source_tel_number, sizeof(setupcall_info.source_tel_number), pcall_core->call_setup_info.source_tel_number);
2000 _vc_core_util_strcpy(setupcall_info.tel_number, sizeof(setupcall_info.tel_number), pcall_core->call_setup_info.tel_number);
2002 /*Get CUG Details */
2003 _vc_core_util_get_cug_info(&setupcall_info);
2005 /*Get Identity Mode */
2006 _vc_core_util_get_identity_mode(&setupcall_info);
2008 CALL_ENG_DEBUG(ENG_DEBUG, "identity_mode = [%d], tel_number = [%s]", setupcall_info.identity_mode, setupcall_info.tel_number);
2010 error_code = _vc_core_engine_prepare_call(pcall_engine, &setupcall_info);
2011 if (ERROR_VOICECALL_NONE != error_code) {
2012 CALL_ENG_DEBUG(ENG_DEBUG, "_vc_core_engine_prepare_call failed, error code: %d", error_code);
2013 _vc_core_engine_finalize_call(pcall_engine, VC_OUTGOING_CALL, -1);
2014 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
2015 vc_engine_msg_box_type event_data;
2017 memset(&event_data, 0, sizeof(event_data));
2018 event_data.string_id = __voicecall_core_get_string_id_by_errorcode(error_code);
2019 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
2022 pcall_core->call_setup_info.call_type = setupcall_info.call_type;
2023 CALL_ENG_DEBUG(ENG_DEBUG, "call_type:[%d]", pcall_core->call_setup_info.call_type);
2025 pcall_core->call_setup_info.mo_call_index = setupcall_info.mo_call_index;
2026 if (TRUE == _vc_core_util_is_offline_mode()) {
2027 _vc_core_engine_finalize_call(pcall_engine, VC_OUTGOING_CALL, -1);
2028 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
2030 vc_engine_msg_box_type event_data;
2032 memset(&event_data, 0, sizeof(event_data));
2033 event_data.string_id = IDS_CALL_POP_CHANGEOFFLINEMODETOCALL;
2034 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
2038 /* Check for Following Conditions , only if not emergency Number */
2039 CALL_ENG_DEBUG(ENG_DEBUG, "mo_call_index = [%d]", setupcall_info.mo_call_index);
2040 error_code = _vc_core_engine_status_check_emergency_byindex(pcall_engine, setupcall_info.mo_call_index, &bemergency_call);
2041 if (ERROR_VOICECALL_NONE != error_code) {
2042 CALL_ENG_DEBUG(ENG_DEBUG, "Emergency Check Error code: %d", error_code);
2046 if (TRUE == _vc_core_util_is_pwlock()) {
2047 CALL_ENG_DEBUG(ENG_DEBUG, "PwLock is enabled.");
2048 if (bemergency_call == FALSE) {
2049 CALL_ENG_DEBUG(ENG_DEBUG, "Only emergency call is possible.");
2050 _vc_core_engine_finalize_call(pcall_engine, VC_OUTGOING_CALL, -1);
2051 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
2053 vc_engine_msg_box_type event_data;
2054 memset(&event_data, 0, sizeof(event_data));
2055 event_data.string_id = IDS_CALL_POP_CALLING_EMERG_ONLY;
2056 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
2062 /*Check for the following cases, if the call is not emergency call */
2063 if (FALSE == bemergency_call) {
2064 vc_engine_msg_box_type event_data;
2066 memset(&event_data, 0, sizeof(event_data));
2067 /* Check for NW Status and Emergency Mode */
2068 if (FALSE == _vc_core_util_get_nw_status(&nw_status)) {
2069 CALL_ENG_DEBUG(ENG_DEBUG, "Can't get a network status...");
2070 _vc_core_engine_finalize_call(pcall_engine, VC_OUTGOING_CALL, -1);
2072 event_data.string_id = IDS_CALL_POP_CALLNOTCALLOWED;
2073 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
2075 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
2078 if ((VCONFKEY_TELEPHONY_SVCTYPE_NONE == nw_status) || (VCONFKEY_TELEPHONY_SVCTYPE_NOSVC == nw_status) || (VCONFKEY_TELEPHONY_SVCTYPE_SEARCH == nw_status)) {
2079 CALL_ENG_DEBUG(ENG_DEBUG, "No Service: Call not Allowed");
2080 _vc_core_engine_finalize_call(pcall_engine, VC_OUTGOING_CALL, -1);
2081 event_data.string_id = IDS_CALL_POP_CALLNOTCALLOWED;
2082 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
2084 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
2086 } else if ((VCONFKEY_TELEPHONY_SVCTYPE_EMERGENCY == nw_status)) {
2087 CALL_ENG_DEBUG(ENG_DEBUG, "Emergency mode: Emergency call only...");
2088 _vc_core_engine_finalize_call(pcall_engine, VC_OUTGOING_CALL, -1);
2089 event_data.string_id = IDS_CALL_POP_CALLING_EMERG_ONLY;
2090 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
2092 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
2100 #ifdef VC_ENG_FDN_SUPPORT
2101 /*Check FDN Status */
2102 if (setupcall_info.call_setup_by != VC_CALL_SETUP_BY_SAT) {
2103 if (FALSE == voicecall_core_check_fdn_status(pcall_core)) {
2104 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_SETUPCALL_FAIL, TRUE);
2110 /*Check for voicemail number if it is not an emergency call */
2113 CALL_ENG_DEBUG(ENG_DEBUG, "MO Call Setup OVer");
2116 if(_vc_bt_get_bt_status() == TRUE){
2117 voicecall_snd_set_path_status(pcall_core->papp_snd,VOICE_CALL_SND_PATH_BT);
2121 voicecall_core_make_call(pcall_core);
2127 * This function makes the actual voicecall prepared by the #voicecall_core_setup_call
2129 * @return Returns TRUE on success or FALSE on failure
2130 * @param[in] pcall_core Handle to voicecall core
2132 gboolean voicecall_core_make_call(call_vc_core_state_t *pcall_core)
2134 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2136 voicecall_error_t error_code = ERROR_VOICECALL_NONE;
2137 int call_handle = -1;
2139 CALL_ENG_DEBUG(ENG_DEBUG, "");
2141 _vc_core_util_set_sleep_status(CALL_VC_POWER_PROHIBIT_DIMMING);
2143 /*Make Actual Call with Voicecall Engine */
2144 error_code = _vc_core_engine_make_call(pcall_engine, pcall_core->call_setup_info.mo_call_index, &call_handle);
2145 if (ERROR_VOICECALL_NONE != error_code) {
2146 vc_engine_msg_box_type event_data;
2148 memset(&event_data, 0, sizeof(event_data));
2150 _vc_core_engine_finalize_call(pcall_engine, VC_OUTGOING_CALL, -1);
2152 CALL_ENG_DEBUG(ENG_DEBUG, "_vc_core_engine_make_call Failed: Error_Code: %d..", error_code);
2154 switch (error_code) {
2155 case ERROR_VOICECALL_TAPI_CAUSE_CALL_FAILED:
2156 event_data.string_id = IDS_CALL_POP_CALLFAILED;
2159 case ERROR_VOICECALL_CALL_IMPOSSIBLE_NOSIM_NOEMERGNUM:
2160 event_data.string_id = IDS_CALL_POP_CALLFAILED;
2164 event_data.string_id = IDS_CALL_BODY_CALLENDED;
2167 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
2169 _vc_core_util_set_sleep_status(CALL_VC_POWER_GRANT_DIMMING);
2174 CALL_ENG_DEBUG(ENG_DEBUG, "Call Handle After Setup Call %d.", call_handle);
2176 voicecall_snd_register_cm(pcall_core->papp_snd);
2178 /* Set phonestatus value */
2179 _vc_core_util_set_call_status(VCONFKEY_CALL_VOICE_CONNECTING);
2185 * This function processed sat setup call
2187 * @return Returns TRUE on success or FALSE on failure
2188 * @param[in] pcall_core Handle to voicecall core
2191 gboolean voicecall_core_process_sat_setup_call(vcall_engine_sat_setup_call_info_t *sat_setup_call_info)
2193 CALL_ENG_DEBUG(ENG_DEBUG, "");
2194 TelSatSetupCallIndCallData_t *SatSetupCallIndCallInfo = NULL;
2196 SatSetupCallIndCallInfo = (TelSatSetupCallIndCallData_t *) calloc(1, sizeof(TelSatSetupCallIndCallData_t));
2197 if (NULL == SatSetupCallIndCallInfo)
2200 SatSetupCallIndCallInfo->commandId = sat_setup_call_info->command_id;
2201 SatSetupCallIndCallInfo->calltype = sat_setup_call_info->command_qualifier;
2202 SatSetupCallIndCallInfo->dispText.stringLen = strlen(sat_setup_call_info->disp_text);
2203 memcpy(SatSetupCallIndCallInfo->dispText.string, sat_setup_call_info->disp_text, strlen(sat_setup_call_info->disp_text));
2205 SatSetupCallIndCallInfo->callNumber.stringLen = strlen(sat_setup_call_info->call_num);
2206 memcpy(SatSetupCallIndCallInfo->callNumber.string, sat_setup_call_info->call_num, strlen(sat_setup_call_info->call_num));
2208 SatSetupCallIndCallInfo->duration = sat_setup_call_info->duration;
2210 _vc_core_engine_handle_sat_events_cb(SatSetupCallIndCallInfo, NULL);
2212 if (SatSetupCallIndCallInfo) {
2213 free(SatSetupCallIndCallInfo);
2214 SatSetupCallIndCallInfo = NULL;
2217 CALL_ENG_DEBUG(ENG_DEBUG, "End..");
2223 * This function processed incoming call
2225 * @return Returns TRUE on success or FALSE on failure
2226 * @param[in] pcall_core Handle to voicecall core
2229 gboolean voicecall_core_process_incoming_call(call_vc_core_incoming_info_t *incoming_call_info)
2231 CALL_ENG_DEBUG(ENG_DEBUG, "");
2232 TelCallIncomingCallInfo_t *IncomingCallInfo = NULL;
2234 CALL_ENG_DEBUG(ENG_DEBUG, " number is : [%s]", incoming_call_info->call_num);
2236 IncomingCallInfo = (TelCallIncomingCallInfo_t *) malloc(sizeof(TelCallIncomingCallInfo_t));
2237 if (NULL == IncomingCallInfo)
2239 memset(IncomingCallInfo, 0, sizeof(IncomingCallInfo));
2241 IncomingCallInfo->CallHandle = incoming_call_info->call_handle;
2242 IncomingCallInfo->CallType = incoming_call_info->call_type;
2243 IncomingCallInfo->CliPresentationIndicator = incoming_call_info->cli_presentation_indicator;
2244 _vc_core_util_strcpy(IncomingCallInfo->szCallingPartyNumber, sizeof(IncomingCallInfo->szCallingPartyNumber), incoming_call_info->call_num);
2245 IncomingCallInfo->CallingNameInfo.NameMode = incoming_call_info->calling_name_mode;
2246 _vc_core_util_strcpy(IncomingCallInfo->CallingNameInfo.szNameData, sizeof(IncomingCallInfo->CallingNameInfo.szNameData), incoming_call_info->calling_name);
2247 _vc_core_util_strcpy(IncomingCallInfo->RedirectInfo.szRedirectedNumber, sizeof(IncomingCallInfo->RedirectInfo.szRedirectedNumber), incoming_call_info->redirected_number);
2248 _vc_core_util_strcpy(IncomingCallInfo->RedirectInfo.szRedirectSubAddress, sizeof(IncomingCallInfo->RedirectInfo.szRedirectSubAddress), incoming_call_info->redirected_sub_address);
2249 IncomingCallInfo->CliCause = incoming_call_info->cli_cause;
2250 IncomingCallInfo->fwded = incoming_call_info->bfwded;
2251 IncomingCallInfo->ActiveLine = incoming_call_info->active_line;
2253 _vc_core_engine_handle_incoming_tapi_events(IncomingCallInfo, NULL);
2255 if (IncomingCallInfo) {
2256 free(IncomingCallInfo);
2257 IncomingCallInfo = NULL;
2260 CALL_ENG_DEBUG(ENG_DEBUG, "End..");
2266 * This function answers an incoming call
2268 * @return Returns TRUE on success or FALSE on failure
2269 * @param[in] pcall_core Handle to voicecall core
2272 gboolean voicecall_core_answer_call(call_vc_core_state_t *pcall_core, gboolean auto_accept)
2274 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2276 gboolean active_calls = FALSE;
2277 gboolean held_calls = FALSE;
2279 CALL_ENG_DEBUG(ENG_DEBUG, "");
2281 /*First Stop the Incoming alert */
2282 voicecall_snd_stop_alert(pcall_core->papp_snd);
2284 _vc_core_engine_status_isexists_any_call(pcall_engine, &active_calls, &held_calls);
2285 CALL_ENG_DEBUG(ENG_DEBUG, "active_calls=%d, held_calls=%d", active_calls, held_calls);
2287 if (TRUE == active_calls && TRUE == held_calls) {
2288 /* Both Active and held calls available, so show Accept Call Choice Box */
2289 vc_engine_accept_choice_box_type event_data;
2291 memset(&event_data, 0, sizeof(event_data));
2292 event_data.choice = VC_CALL_ACCEPT_2;
2294 vcall_engine_send_event_to_client(VC_ENGINE_MSG_ACCEPT_CHOICE_BOX_TO_UI, (void *)&event_data);
2297 } else if (TRUE == active_calls) {
2298 /*If Auto Accpet is FALSE, show popup for manual accept */
2299 if (FALSE == auto_accept) {
2300 /* Active calls available, so show Accept Call Choice Box */
2301 vc_engine_accept_choice_box_type event_data;
2303 memset(&event_data, 0, sizeof(event_data));
2304 event_data.choice = VC_CALL_ACCEPT_1;
2306 vcall_engine_send_event_to_client(VC_ENGINE_MSG_ACCEPT_CHOICE_BOX_TO_UI, (void *)&event_data);
2308 voicecall_core_answer_call_bytype(pcall_core, VC_ANSWER_HOLD_ACTIVE_AND_ACCEPT);
2311 } else if (TRUE == held_calls) {
2312 /* vcui_app_view_mtcall_destroy(papp_document); */
2315 /* Normal Call Scenario */
2316 voicecall_core_answer_call_bytype(pcall_core, VC_ANSWER_NORMAL);
2322 * This function answers an incoming call according to the given type
2324 * @return Returns TRUE -if answer is sucess, FALSE - otherwise
2325 * @param[in] pcall_core Handle to voicecall core
2327 gboolean voicecall_core_answer_call_bytype(call_vc_core_state_t *pcall_core, voicecall_answer_type_t answer_type)
2329 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2331 voicecall_error_t error_code = ERROR_VOICECALL_NONE;
2333 CALL_ENG_DEBUG(ENG_DEBUG, "answer type: %d", answer_type);
2335 /*First Stop the Incoming alert */
2336 voicecall_snd_stop_alert(pcall_core->papp_snd);
2338 error_code = _vc_core_engine_answer_call(pcall_engine, answer_type);
2340 if (ERROR_VOICECALL_NONE != error_code) {
2341 CALL_ENG_DEBUG(ENG_ERR, "_vc_core_engine_answer_call Failed : %d", error_code);
2349 * This function rejects an incoming call
2351 * @return Returns TRUE on success or FALSE on failure
2352 * @param[in] pcall_core Handle to voicecall core
2353 * @param[in] bUDUB TRUE - set UDUB, FALSE - reject call
2355 gboolean voicecall_core_reject_mt(call_vc_core_state_t *pcall_core, gboolean bUDUB)
2357 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2358 voicecall_snd_mgr_t *papp_snd = pcall_core->papp_snd;
2360 voicecall_error_t error_code = ERROR_VOICECALL_NONE;
2362 CALL_ENG_DEBUG(ENG_DEBUG, "");
2364 /*Incoming call rejected, reset the accept by flag */
2365 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_ACCEPT_BY_BT, FALSE);
2367 /* Stop Incmoing Call Alert */
2368 voicecall_snd_stop_alert(papp_snd);
2370 CALL_ENG_DEBUG(ENG_DEBUG, "bUDUB = %d", bUDUB);
2371 error_code = _vc_core_engine_reject_call(pcall_engine, bUDUB);
2373 if (ERROR_VOICECALL_NONE != error_code) {
2374 CALL_ENG_DEBUG(ENG_ERR, "_vc_core_engine_reject_call Failed, error_code = %ud", error_code);
2383 * This function ends the call by state
2385 * @return Returns TRUE on success or FALSE on failure
2386 * @param[in] pcall_core Handle to voicecall core
2388 gboolean voicecall_core_end_call(call_vc_core_state_t *pcall_core)
2390 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2392 CALL_ENG_DEBUG(ENG_DEBUG, "");
2394 return (ERROR_VOICECALL_NONE == _vc_core_engine_end_call(pcall_engine, VC_END_ACTIVE_OR_HELD_CALLS)) ? TRUE : FALSE;
2398 * This function ends the call corresponding to the given call handle
2400 * @return Returns TRUE on success or FALSE on failure
2401 * @param[in] pcall_core Handle to voicecall core
2402 * @param[in] call_handle handle of the call to be ended
2404 gboolean voicecall_core_end_call_by_handle(call_vc_core_state_t *pcall_core, int call_handle)
2406 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2408 CALL_ENG_DEBUG(ENG_DEBUG, "");
2410 return (ERROR_VOICECALL_NONE == _vc_core_engine_end_call_byhandle(pcall_engine, call_handle)) ? TRUE : FALSE;
2414 * This function ends all available calls
2416 * @return Returns TRUE on success or FALSE on failure
2417 * @param[in] pcall_core Handle to voicecall core
2419 gboolean voicecall_core_end_all_calls(call_vc_core_state_t *pcall_core)
2421 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2423 CALL_ENG_DEBUG(ENG_DEBUG, "");
2425 return (ERROR_VOICECALL_NONE == _vc_core_engine_end_call(pcall_engine, VC_END_ALL_CALLS)) ? TRUE : FALSE;
2429 * This function ends all available active calls
2431 * @return Returns TRUE on success or FALSE on failure
2432 * @param[in] pcall_core Handle to voicecall core
2434 gboolean voicecall_core_end_all_active_calls(call_vc_core_state_t *pcall_core)
2436 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2438 CALL_ENG_DEBUG(ENG_DEBUG, "");
2440 return (ERROR_VOICECALL_NONE == _vc_core_engine_end_call(pcall_engine, VC_END_ALL_ACTIVE_CALLS)) ? TRUE : FALSE;
2444 * This function ends all available held calls
2446 * @return Returns TRUE on success or FALSE on failure
2447 * @param[in] pcall_core Handle to voicecall core
2449 gboolean voicecall_core_end_all_held_calls(call_vc_core_state_t *pcall_core)
2451 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2453 CALL_ENG_DEBUG(ENG_DEBUG, "");
2455 return (ERROR_VOICECALL_NONE == _vc_core_engine_end_call(pcall_engine, VC_END_ALL_HELD_CALLS)) ? TRUE : FALSE;
2459 * This function cancel outgoing call
2461 * @return Returns TRUE -if answer is sucess, FALSE - otherwise
2462 * @param[in] pcall_core Handle to voicecall core
2464 gboolean voicecall_core_cancel_call(call_vc_core_state_t *pcall_core)
2467 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2469 voicecall_call_type_bysetup_t call_setup_by = VC_CALL_SETUP_BY_NORMAL;
2471 CALL_ENG_DEBUG(ENG_DEBUG, "");
2473 /*Get Call Setup by Information */
2474 call_setup_by = pcall_core->call_setup_info.call_setup_by;
2476 _vc_core_engine_status_get_engine_iostate(pcall_engine, &io_state);
2479 case VC_INOUT_STATE_OUTGOING_WAIT_HOLD:
2481 int call_handle = -1;
2483 if (VC_CALL_SETUP_BY_SAT == call_setup_by) {
2484 _vc_core_engine_send_sat_response(pcall_engine, SAT_RQST_SETUP_CALL, CALL_VC_ME_CLEAR_DOWN_BEFORE_CONN);
2487 /* Clear the MO Call, since the call is not dialed yet */
2488 _vc_core_engine_status_get_call_handle_bytype(pcall_engine, VC_OUTGOING_CALL, &call_handle);
2489 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_END, call_handle, NULL);
2491 __vc_core_set_auto_redial_count(pcall_core, 0);
2492 voicecall_core_clear_mo_call(pcall_engine);
2494 _vc_core_engine_change_engine_iostate(pcall_engine, VC_INOUT_STATE_OUTGOING_ABORTED);
2498 case VC_INOUT_STATE_OUTGOING_WAIT_ORIG:
2499 case VC_INOUT_STATE_OUTGOING_WAIT_ALERT:
2500 case VC_INOUT_STATE_OUTGOING_WAIT_CONNECTED:
2502 /*To retrieve the held call automatically once the mo call is ended, if held is call is available */
2503 _vc_core_engine_status_set_end_flag(pcall_engine, VC_RETREIVE_CALL_ON_MOCALL_END);
2505 /* release the call , since it is dialed and waiting for connecting */
2506 if (FALSE == voicecall_core_end_mo_call(pcall_engine)) {
2507 CALL_ENG_DEBUG(ENG_DEBUG, "MO Call Release Failed");
2509 voicecall_core_set_status(pcall_core, CALL_VC_CORE_FLAG_MOCALL_END_BY_USER, TRUE);
2510 _vc_core_engine_change_engine_iostate(pcall_engine, VC_INOUT_STATE_OUTGOING_WAIT_RELEASE);
2515 case VC_INOUT_STATE_OUTGOING_WAIT_RELEASE:
2517 /*Call already released */
2518 CALL_ENG_DEBUG(ENG_DEBUG, "MO Call has been released already");
2522 case VC_INOUT_STATE_OUTGOING_SHOW_REDIALCAUSE:
2523 case VC_INOUT_STATE_OUTGOING_ABORTED:
2524 case VC_INOUT_STATE_OUTGOING_WAIT_REDIAL:
2526 int call_handle = -1;
2528 if (VC_CALL_SETUP_BY_SAT == call_setup_by) {
2529 _vc_core_engine_send_sat_response(pcall_engine, SAT_RQST_SETUP_CALL, CALL_VC_NETWORK_UNABLE_TO_PROCESS_COMMAND);
2532 /*Stop Signal Play */
2533 voicecall_snd_stop_signal(pcall_core->papp_snd);
2535 __voicecall_core_mocall_reset_engine_state(pcall_engine);
2537 _vc_core_engine_status_get_call_handle_bytype(pcall_engine, VC_OUTGOING_CALL, &call_handle);
2538 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_END, call_handle, NULL);
2540 __vc_core_set_auto_redial_count(pcall_core, 0);
2541 voicecall_core_clear_mo_call(pcall_engine);
2547 CALL_ENG_DEBUG(ENG_DEBUG, "Action not defined for this IO State: %d", io_state);
2555 * This function process hold/retrive/swap conntected call
2557 * @return Returns TRUE -if answer is sucess, FALSE - otherwise
2558 * @param[in] pcall_core Handle to voicecall core
2560 gboolean voicecall_core_process_hold_call(call_vc_core_state_t *pcall_core)
2562 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2564 gboolean active_calls = FALSE;
2565 gboolean held_calls = FALSE;
2567 CALL_ENG_DEBUG(ENG_DEBUG, "");
2569 if (TRUE == voicecall_core_get_status(pcall_core, CALL_VC_CORE_FLAG_SOS_CALL_ONLY)) {
2570 CALL_ENG_DEBUG(ENG_DEBUG, "SOS Call... Ignore this button...");
2574 if (FALSE == voicecall_core_is_incall_request_possible(pcall_engine)) {
2578 voicecall_core_is_call_exists(pcall_engine, &active_calls, &held_calls);
2579 CALL_ENG_DEBUG(ENG_DEBUG, "active calls: %d, held calls: %d", active_calls, held_calls);
2581 if (active_calls && held_calls) {
2582 /*Both Calls available, swap the calls */
2583 if (FALSE == voicecall_core_swap_calls(pcall_engine)) {
2586 } else if (active_calls) {
2587 /*Only activa call available, hold the call */
2588 if (FALSE == voicecall_core_hold_call(pcall_engine)) {
2591 } else if (held_calls) {
2592 /*Only Held call available, retrieve the call */
2593 if (FALSE == voicecall_core_retrieve_call(pcall_engine)) {
2597 CALL_ENG_DEBUG(ENG_DEBUG, "no call exists!");
2605 * This function sets up a conference call
2607 * @return Returns TRUE on success or FALSE on failure
2608 * @param[in] pcall_core Handle to voicecall core
2610 gboolean voicecall_core_setup_conference(call_vc_core_state_t *pcall_core)
2612 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2614 CALL_ENG_DEBUG(ENG_DEBUG, "");
2616 PRINT_CURRENT_TIME("Setup Conf Start at");
2617 return (ERROR_VOICECALL_NONE == _vc_core_engine_setup_conference(pcall_engine)) ? TRUE : FALSE;
2621 * This function splits the call corressponding to the given call handle and makes a private call
2623 * @return Returns TRUE on success or FALSE on failure
2624 * @param[in] pcall_core Handle to voicecall core
2625 * @param[in] call_handle Call to be splitted from the conference call
2627 gboolean voicecall_core_make_private_call(call_vc_core_state_t *pcall_core, int call_handle)
2629 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2631 CALL_ENG_DEBUG(ENG_DEBUG, "");
2633 PRINT_CURRENT_TIME("Split Conf Start at");
2634 return (ERROR_VOICECALL_NONE == _vc_core_engine_private_call(pcall_engine, call_handle)) ? TRUE : FALSE;
2638 * This function transfers the call from active call to the held call
2640 * @return Returns TRUE on success or FALSE on failure
2641 * @param[in] pcall_core Handle to voicecall core
2643 gboolean voicecall_core_transfer_calls(call_vc_core_state_t *pcall_core)
2645 voicecall_engine_t *pcall_engine = pcall_core->pcall_engine;
2647 CALL_ENG_DEBUG(ENG_DEBUG, "");
2649 return (ERROR_VOICECALL_NONE == _vc_core_engine_transfer_calls(pcall_engine)) ? TRUE : FALSE;
2653 * This function sends a dtmf string
2655 * @return Returns TRUE on success or FALSE on failure
2656 * @param[in] pcall_core Handle to voicecall core
2657 * @param[in] dtmf_string dtmf string to be sent
2659 gboolean voicecall_core_send_dtmf(call_vc_core_state_t *pcall_core, char *dtmf_string)
2661 voicecall_error_t error_code = ERROR_VOICECALL_NONE;
2662 CALL_ENG_DEBUG(ENG_DEBUG, "dtmf string: %s", dtmf_string);
2664 pcall_core->bdtmf_queue = FALSE;
2665 error_code = _vc_core_engine_send_dtmf(pcall_core->pcall_engine, dtmf_string);
2666 return (ERROR_VOICECALL_NONE == error_code) ? TRUE : FALSE;
2670 * This function stops sound alert
2672 * @return Returns TRUE on success or FALSE on failure
2673 * @param[in] pcall_core Handle to voicecall core
2675 gboolean voicecall_core_stop_alert(call_vc_core_state_t *pcall_core)
2677 CALL_ENG_DEBUG(ENG_DEBUG, "");
2679 /* Stop Incmoing Call Alert */
2680 voicecall_snd_stop_alert(pcall_core->papp_snd);
2685 inline gboolean voicecall_core_get_mo_call_handle(call_vc_core_state_t *pcall_core, int *pcall_handle)
2688 return (ERROR_VOICECALL_NONE == _vc_core_engine_status_get_call_handle_bytype(pcall_core->pcall_engine, VC_OUTGOING_CALL, pcall_handle)) ? TRUE : FALSE;
2691 inline int voicecall_core_get_auto_redial_count(call_vc_core_state_t *pcall_core)
2693 return pcall_core->auto_redial_count;
2696 void __vc_core_set_auto_redial_count(call_vc_core_state_t *pcall_core, int auto_redial_count)
2698 pcall_core->auto_redial_count = auto_redial_count;
2701 gboolean voicecall_core_start_redial(call_vc_core_state_t *pcall_core, int manual_redial)
2703 int auto_redial_status = FALSE;
2704 int redial_count = 1;
2705 int call_handle = -1;
2706 int total_call_member = 0;
2708 CALL_ENG_DEBUG(ENG_DEBUG, "");
2710 if (vconf_get_bool(VCONFKEY_CISSAPPL_VOICE_AUTO_REDIAL_BOOL, &auto_redial_status)) {
2711 CALL_ENG_DEBUG(ENG_ERR, "vconf_get_bool failed.");
2714 CALL_ENG_DEBUG(ENG_DEBUG, "auto_redial_status:[%d]", auto_redial_status);
2716 redial_count = voicecall_core_get_auto_redial_count(pcall_core);
2721 bmanual_redial == TRUE : Redial is made by User, No need to check the auto redial status and count
2722 auto_redial_status == 1: Auto Redial for GCF case, auto redial count must be checked
2724 if ((1 == manual_redial) || ((auto_redial_status == 1) && (redial_count < MO_REDIAL_COUNT_MAX))) {
2725 CALL_ENG_DEBUG(ENG_DEBUG, "redial_count = %d", redial_count);
2727 /*Start Redial Timer */
2728 if (1 == redial_count) {
2729 CALL_ENG_DEBUG(ENG_DEBUG, "MO_REDIAL_TIMER_INTERVAL_FIRST");
2730 pcall_core->mo_redial_timer = g_timeout_add(MO_REDIAL_TIMER_INTERVAL_FIRST, mo_redial_timer_cb, pcall_core);
2731 } else if ((redial_count > 1) && (redial_count < 5)) {
2732 CALL_ENG_DEBUG(ENG_DEBUG, "MO_REDIAL_TIMER_INTERVAL_SECOND");
2733 pcall_core->mo_redial_timer = g_timeout_add(MO_REDIAL_TIMER_INTERVAL_SECOND, mo_redial_timer_cb, pcall_core);
2735 CALL_ENG_DEBUG(ENG_DEBUG, "MO_REDIAL_TIMER_INTERVAL_THIRD");
2736 pcall_core->mo_redial_timer = g_timeout_add(MO_REDIAL_TIMER_INTERVAL_THIRD, mo_redial_timer_cb, pcall_core);
2739 voicecall_core_change_engine_state(pcall_core->pcall_engine, VC_INOUT_STATE_OUTGOING_WAIT_REDIAL);
2741 CALL_ENG_DEBUG(ENG_DEBUG, "You dont need to redial close the MO Call Things");
2743 voicecall_snd_change_mm_path(pcall_core->papp_snd, VOICE_CALL_MM_RESET);
2745 /* __vcui_app_view_mo_canceltimer_cb() */
2746 _vc_core_engine_status_get_call_handle_bytype(pcall_core->pcall_engine, VC_OUTGOING_CALL, &call_handle);
2747 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_END, call_handle, NULL);
2749 __vc_core_set_auto_redial_count(pcall_core, 0);
2750 voicecall_core_clear_mo_call(pcall_core->pcall_engine);
2752 __voicecall_core_mocall_reset_engine_state(pcall_core->pcall_engine);
2754 voicecall_core_get_total_call_member(pcall_core->pcall_engine, &total_call_member);
2756 voicecall_snd_stop_signal(pcall_core->papp_snd);
2758 /* If No Connected Calls End the UI */
2759 if (total_call_member == 0) {
2760 /*Reset voice call core to default values */
2761 voicecall_core_set_to_default(pcall_core);
2763 voicecall_snd_change_path(pcall_core->papp_snd);
2771 inline gboolean voicecall_core_prepare_redial(call_vc_core_state_t *pcall_core, int call_handle)
2773 voicecall_error_t error_code = ERROR_VOICECALL_NONE;
2775 CALL_ENG_DEBUG(ENG_DEBUG, "");
2777 error_code = _vc_core_engine_prepare_redial(pcall_core->pcall_engine, call_handle);
2779 CALL_ENG_DEBUG(ENG_DEBUG, "_vc_core_engine_prepare_redial returned : %d", error_code);
2781 return (ERROR_VOICECALL_NONE == error_code) ? TRUE : FALSE;
2784 gboolean mo_redial_timer_cb(void *data)
2786 int call_handle = -1;
2789 CALL_ENG_DEBUG(ENG_DEBUG, "mo_redial_timer_cb");
2790 call_vc_core_state_t *pcall_core = (call_vc_core_state_t *)data;
2791 voicecall_core_get_mo_call_handle(pcall_core, &call_handle);
2792 CALL_ENG_DEBUG(ENG_DEBUG, "call handle is %d", call_handle);
2794 redial_count = voicecall_core_get_auto_redial_count(pcall_core);
2796 __vc_core_set_auto_redial_count(pcall_core, redial_count);
2798 CALL_ENG_DEBUG(ENG_DEBUG, "redial_count:[%d]", redial_count);
2800 voicecall_core_prepare_redial(pcall_core, call_handle);
2801 CALL_ENG_DEBUG(ENG_DEBUG, "voicecall_core_prepare_redial done.");
2803 voicecall_core_make_call(pcall_core);
2807 gboolean voicecall_core_stop_redial(call_vc_core_state_t *pcall_core)
2809 int call_handle = -1, total_call_member = -1;
2811 CALL_ENG_DEBUG(ENG_DEBUG, "coming inside voicecall_core_stop_redial");
2813 voicecall_snd_change_mm_path(pcall_core->papp_snd, VOICE_CALL_MM_RESET);
2814 _vc_core_util_set_call_status(VCONFKEY_CALL_OFF);
2816 /*Cancel the Redial Timer */
2817 if (pcall_core->mo_redial_timer != -1) {
2818 CALL_ENG_DEBUG(ENG_DEBUG, "mo_redial_timer removing..");
2819 g_source_remove(pcall_core->mo_redial_timer);
2820 pcall_core->mo_redial_timer = -1;
2823 /* __vcui_app_view_mo_canceltimer_cb() */
2824 _vc_core_engine_status_get_call_handle_bytype(pcall_core->pcall_engine, VC_OUTGOING_CALL, &call_handle);
2825 _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_CALL_END, call_handle, NULL);
2827 __vc_core_set_auto_redial_count(pcall_core, 0);
2828 voicecall_core_clear_mo_call(pcall_core->pcall_engine);
2830 __voicecall_core_mocall_reset_engine_state(pcall_core->pcall_engine);
2832 voicecall_core_get_total_call_member(pcall_core->pcall_engine, &total_call_member);
2834 voicecall_snd_stop_signal(pcall_core->papp_snd);
2836 /* If No Connected Calls End the UI */
2837 if (total_call_member == 0) {
2838 /*Reset voice call core to default values */
2839 voicecall_core_set_to_default(pcall_core);
2841 voicecall_snd_change_path(pcall_core->papp_snd);
2847 static gboolean __voicecall_core_auto_answer_timer_cb(gpointer puser_data)
2849 call_vc_core_state_t *pcall_core = (call_vc_core_state_t *)puser_data;
2851 if (pcall_core->auto_answer_timer > 0) {
2852 g_source_remove(pcall_core->auto_answer_timer);
2853 pcall_core->auto_answer_timer = 0;
2856 /*Check for Incoming call and then answer the call */
2857 if (TRUE == voicecall_core_is_incoming_call_exists(pcall_core->pcall_engine)) {
2858 CALL_ENG_DEBUG(ENG_DEBUG, "Call Answered");
2859 voicecall_core_answer_call(pcall_core, TRUE);
2865 static gboolean __voicecall_core_callstatus_set_timer_cb(gpointer puser_data)
2867 call_vc_core_state_t *pcall_core = (call_vc_core_state_t *)puser_data;
2869 if (pcall_core->callstatus_timer > 0) {
2870 g_source_remove(pcall_core->callstatus_timer);
2871 pcall_core->callstatus_timer = 0;
2874 _vc_core_util_set_call_status(VCONFKEY_CALL_VOICE_CONNECTING);
2879 static gboolean __voicecall_core_auto_answer_idle_cb(gpointer puser_data)
2881 call_vc_core_state_t *pcall_core = (call_vc_core_state_t *)puser_data;
2882 int engine_state = 0;
2883 int auto_answer_time = 0, ret = -1;
2884 unsigned long auto_answer_time_interval = 0;
2886 _vc_core_engine_status_get_engine_iostate(pcall_core->pcall_engine, &engine_state);
2887 CALL_ENG_DEBUG(ENG_DEBUG, "eng_state : %d", engine_state);
2888 if (engine_state != VC_INOUT_STATE_INCOME_BOX) {
2889 CALL_ENG_DEBUG(ENG_DEBUG, "Engine State not in Income Box, Current State: %d", engine_state);
2892 /* Read the time interval from gconf and set the redial timer */
2893 ret = vconf_get_int(VCONFKEY_CISSAPPL_ANSWERING_MODE_TIME_INT, &auto_answer_time);
2895 auto_answer_time_interval = auto_answer_time * 1000;
2896 CALL_ENG_DEBUG(ENG_DEBUG, "The time interval is : %ld", auto_answer_time_interval);
2898 CALL_ENG_DEBUG(ENG_DEBUG, "vconf_get_int FAILED");
2902 pcall_core->auto_answer_timer = g_timeout_add(auto_answer_time_interval, __voicecall_core_auto_answer_timer_cb, pcall_core);
2907 * This function checks BT headset and Earjack status
2910 * @param[in] pcall_core Handle to voicecall core
2912 static void __voicecall_core_check_headset_earjack_status(call_vc_core_state_t *pcall_core)
2914 gboolean bt_connected = FALSE;
2916 bt_connected = _vc_bt_get_bt_status();
2917 CALL_ENG_DEBUG(ENG_DEBUG, "Bt connected =%d", bt_connected);
2919 pcall_core->bt_connected = bt_connected;
2922 voicecall_snd_set_status(pcall_core->papp_snd, VOICE_CALL_AUDIO_HEADSET, bt_connected);
2925 CALL_ENG_DEBUG(ENG_DEBUG, "Update the earjack status");
2926 _voicecall_dvc_get_earjack_status(pcall_core);
2930 * This function parses the in call supplementary services string and returns the in call ss to be used
2932 * @return Returns in call ss state #vcui_app_incall_ss_state_t
2933 * @param[in] pcall_core Handle to voicecall core
2934 * @param[in] number number to be parsed
2936 call_vc_core_incall_ss_state_t voicecall_core_parse_incall_ss_string(call_vc_core_state_t *pcall_core, char *number)
2938 call_vc_core_incall_ss_state_t ss_value = CALL_VC_CORE_SS_USSD;
2940 if (strlen(number) == 1) {
2941 switch (number[0]) {
2943 ss_value = CALL_VC_CORE_SS_0;
2946 ss_value = CALL_VC_CORE_SS_1;
2949 ss_value = CALL_VC_CORE_SS_2;
2952 ss_value = CALL_VC_CORE_SS_3;
2955 ss_value = CALL_VC_CORE_SS_4;
2958 ss_value = CALL_VC_CORE_SS_USSD;
2961 } else if (strlen(number) == 2) {
2962 if ((number[0] == '1') && (number[1] > '0') && (number[1] < '8')) {
2963 pcall_core->selected_call_id_in_ss = atoi(number + 1);
2964 ss_value = CALL_VC_CORE_SS_1X;
2967 if ((number[0] == '2') && (number[1] > '0') && (number[1] < '8')) {
2968 pcall_core->selected_call_id_in_ss = atoi(number + 1);
2969 ss_value = CALL_VC_CORE_SS_2X;
2972 CALL_ENG_DEBUG(ENG_DEBUG, "ss parsed value: %d", ss_value);
2977 * This function starts the supplementary services while on call
2979 * @return Returns TRUE If transfer call can be made or FALSE if not
2980 * @param[in] pcall_core Handle to voicecall core
2981 * @param[in] incall_ss_state state of the In Call Supplementary Service
2983 gboolean voicecall_core_start_incall_ss(call_vc_core_state_t *pcall_core, call_vc_core_incall_ss_state_t incall_ss_state)
2985 gboolean active_calls = FALSE, held_calls = FALSE;
2987 _vc_core_engine_status_isexists_any_call(pcall_core->pcall_engine, &active_calls, &held_calls);
2989 CALL_ENG_DEBUG(ENG_DEBUG, "ss state = %d", incall_ss_state);
2990 vc_engine_msg_box_type event_data;
2991 memset(&event_data, 0, sizeof(event_data));
2992 event_data.string_id = IDS_CALL_POP_OPERATION_REFUSED;
2994 /*Cancel DTMF Sending if any and close the dtmf ui */
2995 /* vcui_app_doc_cancel_dtmf_queue(papp_document); sathwick TBD */
2997 switch (incall_ss_state) {
2998 /* Releases all held calls or Set UDUB(User Determined User Busy) for a waiting call */
2999 case CALL_VC_CORE_SS_0:
3001 /* if an incoming call is activated, reject the incoming all */
3002 if (TRUE == voicecall_core_is_incoming_call_exists(pcall_core->pcall_engine)) {
3003 voicecall_core_reject_mt(pcall_core, TRUE);
3005 } else if (held_calls) {
3006 voicecall_core_end_all_held_calls(pcall_core);
3008 CALL_ENG_DEBUG(ENG_DEBUG, "There are no held calls to do the processing");
3009 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3010 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3014 case CALL_VC_CORE_SS_1:
3016 if (voicecall_core_is_incoming_call_exists(pcall_core->pcall_engine)) {
3017 /* Accept incoming call */
3018 voicecall_core_answer_call_bytype(pcall_core, VC_ANSWER_RELEASE_ACTIVE_AND_ACCEPT);
3020 } else if (voicecall_core_is_outgoing_call_exists(pcall_core->pcall_engine)) {
3021 /* This fucntion checks for held calls to be retreived on response of ending call */
3022 voicecall_core_set_check_ss_on_end(pcall_core);
3023 voicecall_core_end_mo_call(pcall_core->pcall_engine);
3024 } else if (active_calls) {
3025 voicecall_core_end_all_active_calls(pcall_core);
3026 voicecall_core_set_check_ss_on_end(pcall_core);
3027 } else if (held_calls) {
3028 _vc_core_engine_retrieve_call(pcall_core->pcall_engine);
3031 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3032 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3036 case CALL_VC_CORE_SS_1X:
3038 if (voicecall_core_is_incoming_call_exists(pcall_core->pcall_engine)) {
3040 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3041 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3042 } else if (active_calls) {
3044 if (!(ERROR_VOICECALL_NONE == _vc_core_engine_end_call_bycallId(pcall_core->pcall_engine, pcall_core->selected_call_id_in_ss))) {
3046 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3047 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3051 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3052 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3056 case CALL_VC_CORE_SS_2:
3059 if (voicecall_core_is_incoming_call_exists(pcall_core->pcall_engine)) {
3060 if (active_calls && held_calls) {
3062 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3063 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3065 #ifdef _CPHS_DEFINED_ /* Not used currently */
3066 if (TRUE == active_calls && (voicecall_core_get_cphs_csp_status(pcall_core->pcall_engine, VC_CPHS_CSP_HOLD))) {
3068 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3069 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3073 voicecall_core_answer_call(pcall_core, TRUE);
3075 } else if (voicecall_core_is_outgoing_call_exists(pcall_core->pcall_engine)) {
3077 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3078 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3079 } else if (active_calls && held_calls) {
3080 _vc_core_engine_swap_calls(pcall_core->pcall_engine);
3081 } else if (active_calls) {
3082 _vc_core_engine_hold_call(pcall_core->pcall_engine);
3083 } else if (held_calls) {
3084 _vc_core_engine_retrieve_call(pcall_core->pcall_engine);
3087 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3088 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3092 case CALL_VC_CORE_SS_2X:
3094 if (voicecall_core_is_incoming_call_exists(pcall_core->pcall_engine) || voicecall_core_is_outgoing_call_exists(pcall_core->pcall_engine)) {
3096 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3097 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3098 } else if (TRUE == active_calls && FALSE == held_calls) {
3099 int active_members = 0;
3101 voicecall_core_get_active_call_member(pcall_core, &active_members);
3103 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)))) {
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 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3111 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3115 case CALL_VC_CORE_SS_3:
3117 if (TRUE == voicecall_core_is_incoming_call_exists(pcall_core->pcall_engine)) {
3119 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3120 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3124 if (TRUE == voicecall_core_is_conf_call_possible(pcall_core)) {
3125 _vc_core_engine_setup_conference(pcall_core->pcall_engine);
3128 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3129 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3133 case CALL_VC_CORE_SS_4:
3134 if (TRUE == voicecall_core_is_transfer_call_possible(pcall_core)) {
3135 if (FALSE == voicecall_core_transfer_calls(pcall_core)) {
3137 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3138 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3142 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3143 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3146 if ( !(vcui_app_doc_is_transfer_call_possible(papp_document) && TRUE == vcui_app_doc_transfer_calls(papp_document)) )
3148 vcui_app_msgbox(papp_document, vcui_app_rsr_load_string(IDS_CALL_POP_OPERATION_REFUSED),GTK_MESSAGE_ALERT);
3153 CALL_ENG_DEBUG(ENG_DEBUG, "Invalid SS State");
3154 CALL_ENG_DEBUG(ENG_DEBUG, "Need to show a popup to the user ");
3155 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3161 * This function processed the supplementary services while on call
3163 * @return Returns TRUE If transfer call can be made or FALSE if not
3164 * @param[in] pcall_core Handle to voicecall core
3165 * @param[in] pdialled_number dial number
3167 void voicecall_core_process_incall_ss(call_vc_core_state_t *pcall_core, char *pdialled_number)
3169 call_vc_core_incall_ss_state_t incall_ss_state = CALL_VC_CORE_SS_NONE;
3171 CALL_ENG_DEBUG(ENG_DEBUG, " ..");
3173 incall_ss_state = voicecall_core_parse_incall_ss_string(pcall_core, pdialled_number);
3175 if (incall_ss_state != CALL_VC_CORE_SS_USSD) {
3176 voicecall_core_start_incall_ss(pcall_core, incall_ss_state);
3179 CALL_ENG_DEBUG(ENG_DEBUG, "Involves CISS functionality so need for us to handle and will be handled by CISS");
3180 vc_engine_msg_box_type event_data;
3181 memset(&event_data, 0, sizeof(event_data));
3182 event_data.string_id = IDS_CALL_POP_OPERATION_REFUSED;
3183 vcall_engine_send_event_to_client(VC_ENGINE_MSG_MESSAGE_BOX_TO_UI, (void *)&event_data);
3187 #ifdef PDIAL_SEND_DTMF
3188 gboolean voicecall_core_send_phone_number_dtmf(gpointer puser_data)
3190 call_vc_core_state_t *pcall_core = (call_vc_core_state_t *)vcall_engine_get_core_state();
3191 int call_handle = (int)puser_data;
3192 char dtmf_number[VC_PHONE_NUMBER_LENGTH_MAX];
3193 call_vc_call_objectinfo_t obj_info = { 0, };
3195 CALL_ENG_DEBUG(ENG_DEBUG, "inside ...");
3197 if (TRUE == _vc_core_cm_get_call_object(&pcall_core->pcall_engine->call_manager, call_handle, &obj_info)) {
3198 CALL_ENG_DEBUG(ENG_DEBUG, "Source telephone number - %s", obj_info.source_tel_number);
3199 if (TRUE == _vc_core_util_extract_dtmf_number(obj_info.source_tel_number, dtmf_number, sizeof(dtmf_number))) {
3200 CALL_ENG_DEBUG(ENG_DEBUG, "DTMF number - %s", dtmf_number);
3201 if (VC_CALL_ORIG_TYPE_SAT == pcall_core->call_setup_info.call_type) {
3202 __voicecall_core_queue_dtmf_string(pcall_core, dtmf_number, TRUE);
3204 __voicecall_core_queue_dtmf_string(pcall_core, dtmf_number, FALSE);
3208 CALL_ENG_DEBUG(ENG_DEBUG, "Call Info not available for call handle: %d", call_handle);
3215 * This function cancels the dtmf queue
3217 * @return TRUE - sucess, FALSE otherwise
3218 * @param[in] papp_document Handle to Application Document
3220 gboolean voicecall_core_cancel_dtmf_queue(call_vc_core_state_t *pcall_core)
3222 voicecall_dtmf_info_t *pdtmf_info = (voicecall_dtmf_info_t *)&pcall_core->dtmf_info;
3224 CALL_ENG_DEBUG(ENG_DEBUG, "Start:pcall_core(%p)", pcall_core);
3226 if (FALSE == pdtmf_info->bdtmf_queue) {
3230 /*Remove Pauser Timer */
3231 g_source_remove(pdtmf_info->dtmf_pause_timer);
3232 pdtmf_info->dtmf_pause_timer = -1;
3234 /*Reset the Status Flags */
3235 pdtmf_info->bdtmf_queue = FALSE;
3236 pdtmf_info->dtmf_index = 0;
3237 memset(pdtmf_info->dtmf_number, 0, sizeof(pdtmf_info->dtmf_number));
3238 if (TRUE == pdtmf_info->bsat_dtmf) {
3239 voicecall_core_send_sat_response(pcall_core->pcall_engine, SAT_RQST_SEND_DTMF, CALL_VC_ME_UNABLE_TO_PROCESS_COMMAND);
3241 pdtmf_info->bsat_dtmf = FALSE;
3242 pdtmf_info->bsat_hidden = FALSE;
3243 CALL_ENG_DEBUG(ENG_DEBUG, "End");
3247 static gboolean __voicecall_core_dtmf_pause_timer_cb(gpointer puser_data)
3249 call_vc_core_state_t *pcall_core = (call_vc_core_state_t *)puser_data;
3251 __voicecall_core_handle_dtmf_ack(pcall_core, TRUE);
3253 /*Always return FALSE, so that it won't be called again */
3257 gboolean __voicecall_core_send_dtmf_idle_cb(gpointer pdata)
3259 call_vc_core_state_t *pcall_core = (call_vc_core_state_t *)pdata;
3260 voicecall_dtmf_info_t *pdtmf_info = (voicecall_dtmf_info_t *)&pcall_core->dtmf_info;
3261 voicecall_error_t vc_error;
3262 vc_engine_dtmf_ack_type event_data;
3263 char dtmf_string[2];
3265 dtmf_string[0] = pdtmf_info->dtmf_number[pdtmf_info->dtmf_index];
3266 dtmf_string[1] = '\0';
3268 CALL_ENG_DEBUG(ENG_DEBUG, "inside ...");
3270 vc_error = _vc_core_engine_send_dtmf(pcall_core->pcall_engine, dtmf_string);
3272 if (vc_error == ERROR_VOICECALL_INVALID_DTMF_CHAR) {
3273 CALL_ENG_DEBUG(ENG_DEBUG, "ERROR_VOICECALL_INVALID_DTMF_CHAR");
3274 } else if (ERROR_VOICECALL_NONE != vc_error) {
3275 voicecall_core_cancel_dtmf_queue(pcall_core);
3276 memset(&event_data, 0, sizeof(event_data));
3277 event_data.bstatus = FALSE;
3278 event_data.string_id = -1;
3279 vcall_engine_send_event_to_client(VC_ENGINE_MSG_DTMF_ACK_TO_UI, (void *)&event_data);
3281 if (TRUE == pdtmf_info->bsat_dtmf) {
3282 voicecall_core_send_sat_response(pcall_core->pcall_engine, SAT_RQST_SEND_DTMF, CALL_VC_ME_UNABLE_TO_PROCESS_COMMAND);
3285 if (!((TRUE == pdtmf_info->bsat_dtmf) && (TRUE == pdtmf_info->bsat_hidden))) {
3286 memset(&event_data, 0, sizeof(event_data));
3287 event_data.bstatus = FALSE;
3288 event_data.string_id = IDS_CALL_POP_DTMFSENDING_FAIL;
3289 vcall_engine_send_event_to_client(VC_ENGINE_MSG_DTMF_ACK_TO_UI, (void *)&event_data);
3296 static gboolean __voicecall_core_handle_dtmf_ack(call_vc_core_state_t *pcall_core, gboolean success)
3298 voicecall_dtmf_info_t *pdtmf_info = (voicecall_dtmf_info_t *)&pcall_core->dtmf_info;
3299 vc_engine_dtmf_ack_type event_data;
3300 CALL_ENG_DEBUG(ENG_DEBUG, "...");
3302 if (FALSE == pdtmf_info->bdtmf_queue) {
3303 CALL_ENG_DEBUG(ENG_DEBUG, "DTMF Queue Canceled, do nothing");
3307 if (TRUE == success) {
3308 char dtmf_string[2];
3309 pdtmf_info->dtmf_index++;
3311 dtmf_string[0] = pdtmf_info->dtmf_number[pdtmf_info->dtmf_index];
3312 dtmf_string[1] = '\0';
3314 CALL_ENG_DEBUG(ENG_DEBUG, "Current dtmf_index: %d,dtmf_max_length=%d", pdtmf_info->dtmf_index, pdtmf_info->dtmf_max_length);
3315 CALL_ENG_DEBUG(ENG_DEBUG, "Current DTMF String: %s", &pdtmf_info->dtmf_number[pdtmf_info->dtmf_index]);
3317 /*Update the DTMF Sending UI only, if it is available */
3318 memset(&event_data, 0, sizeof(event_data));
3319 event_data.bstatus = TRUE;
3320 event_data.string_id = IDS_CALL_POP_SENDING;
3321 snprintf(event_data.display_string, sizeof(event_data.display_string), &pdtmf_info->dtmf_number[pdtmf_info->dtmf_index]);
3322 vcall_engine_send_event_to_client(VC_ENGINE_MSG_DTMF_ACK_TO_UI, (void *)&event_data);
3324 /*Find the End of the queue */
3325 if (pdtmf_info->dtmf_index >= pdtmf_info->dtmf_max_length) {
3327 CALL_ENG_DEBUG(ENG_DEBUG, "Updating DTMF Progress before destroying");
3329 if (!((TRUE == pdtmf_info->bsat_dtmf) && (TRUE == pdtmf_info->bsat_hidden))) {
3330 memset(&event_data, 0, sizeof(event_data));
3331 event_data.bstatus = FALSE;
3332 event_data.string_id = IDS_CALL_POP_DTMF_SENT;
3333 vcall_engine_send_event_to_client(VC_ENGINE_MSG_DTMF_ACK_TO_UI, (void *)&event_data);
3336 if (TRUE == pdtmf_info->bsat_dtmf) {
3337 voicecall_core_send_sat_response(pcall_core->pcall_engine, SAT_RQST_SEND_DTMF, CALL_VC_ME_RET_SUCCESS);
3340 if (0 == strcasecmp(dtmf_string, "p")) {
3341 int dtmf_interval = 0;
3343 if (FALSE == _vc_core_util_check_gcf_status()) {
3344 dtmf_interval = (pdtmf_info->dtmf_index == 0) ? DTMF_PAUSE_TIMER_INTERVAL_FIRST : DTMF_PAUSE_TIMER_INTERVAL_REST;
3346 #ifdef GCONF_GCF_SAT_TEST
3347 int start_interval = DTMF_PAUSE_TIMER_INTERVAL_GCF_FIRST;
3348 int rest_interval = DTMF_PAUSE_TIMER_INTERVAL_GCF_REST;
3350 GConfClient *client = NULL;
3351 client = gconf_client_get_default();
3352 if (NULL == client) {
3353 CALL_ENG_DEBUG(ENG_DEBUG, "gconf_client_get_default failed..");
3356 start_interval = gconf_client_get_int(client, PATH_DTMF_INTERVAL_GCF_FIRST, NULL);
3358 rest_interval = gconf_client_get_int(client, PATH_DTMF_INTERVAL_GCF_REST, NULL);
3359 g_object_unref(client);
3363 CALL_ENG_DEBUG(ENG_DEBUG, "start_interval:%d, rest_interval = %d", start_interval, rest_interval);
3364 dtmf_interval = (pdtmf_info->dtmf_index == 0) ? start_interval : rest_interval;
3366 dtmf_interval = (pdtmf_info->dtmf_index == 0) ? DTMF_PAUSE_TIMER_INTERVAL_GCF_FIRST : DTMF_PAUSE_TIMER_INTERVAL_GCF_REST;
3368 CALL_ENG_DEBUG(ENG_DEBUG, "dtmf_interval:%d", dtmf_interval);
3370 pdtmf_info->dtmf_pause_timer = g_timeout_add(dtmf_interval, __voicecall_core_dtmf_pause_timer_cb, pcall_core);
3372 g_idle_add_full(G_PRIORITY_HIGH_IDLE + 25, __voicecall_core_send_dtmf_idle_cb, pcall_core, NULL);
3376 voicecall_core_cancel_dtmf_queue(pcall_core);
3378 memset(&event_data, 0, sizeof(event_data));
3379 event_data.bstatus = FALSE;
3380 event_data.string_id = IDS_CALL_POP_DTMFSENDING_FAIL;
3381 vcall_engine_send_event_to_client(VC_ENGINE_MSG_DTMF_ACK_TO_UI, (void *)&event_data);
3388 * This function queues the dtmf digits one by one from the given dtmf string
3390 * @return TRUE - sucess, FALSE otherwise
3391 * @param[in] papp_document Handle to Application Document
3392 * @param[in] dtmf_string dtmf string to be queued
3394 static gboolean __voicecall_core_queue_dtmf_string(call_vc_core_state_t *pcall_core, char *dtmf_string, gboolean bsat_dtmf)
3396 voicecall_dtmf_info_t *pdtmf_info = (voicecall_dtmf_info_t *)&pcall_core->dtmf_info;
3397 gboolean bhidden_mode = FALSE;
3399 vc_engine_dtmf_ack_type event_data;
3401 CALL_ENG_DEBUG(ENG_DEBUG, "bsat_dtmf = %d", bsat_dtmf);
3403 if (TRUE == bsat_dtmf) {
3404 /*Always get the status from the engine */
3405 _vc_core_engine_get_sat_dtmf_hidden_mode(pcall_core->pcall_engine, &bhidden_mode);
3406 CALL_ENG_DEBUG(ENG_DEBUG, "SAT Hidden Mode : %d", bhidden_mode);
3409 /*Check for the validity of the DTMF String */
3410 if (FALSE == _vc_core_util_isvalid_full_dtmf_number(dtmf_string)) {
3411 if (TRUE == bsat_dtmf) {
3412 voicecall_core_send_sat_response(pcall_core->pcall_engine, SAT_RQST_SEND_DTMF, CALL_VC_ME_UNABLE_TO_PROCESS_COMMAND);
3415 if (!((TRUE == bsat_dtmf) && (TRUE == bhidden_mode))) {
3416 memset(&event_data, 0, sizeof(event_data));
3417 event_data.bstatus = FALSE;
3418 event_data.string_id = IDS_CALL_POP_INVALID_DTMF;
3419 vcall_engine_send_event_to_client(VC_ENGINE_MSG_DTMF_ACK_TO_UI, (void *)&event_data);
3424 /*Reset DTMF Values */
3425 pdtmf_info->bdtmf_queue = FALSE;
3426 pdtmf_info->dtmf_index = 0;
3427 pdtmf_info->bsat_dtmf = bsat_dtmf;
3429 if (TRUE == bsat_dtmf) {
3431 pdtmf_info->bsat_hidden = bhidden_mode;
3434 /* Check: It takes only 40 characters from the source, rest of the characters are ignored */
3435 memset(pdtmf_info->dtmf_number, 0, sizeof(pdtmf_info->dtmf_number));
3436 if (1 < sizeof(pdtmf_info->dtmf_number))
3437 _vc_core_util_strcpy(pdtmf_info->dtmf_number, VC_PHONE_NUMBER_LENGTH_MAX, "P");
3439 strncat(pdtmf_info->dtmf_number, dtmf_string, min((sizeof(pdtmf_info->dtmf_number) - 2), strlen(dtmf_string)));
3441 pdtmf_info->dtmf_max_length = strlen(pdtmf_info->dtmf_number);
3443 CALL_ENG_DEBUG(ENG_DEBUG, "Dtmf Number:%s ,dtmf_max_length:%d", pdtmf_info->dtmf_number, pdtmf_info->dtmf_max_length);
3445 dtmf_digit[0] = pdtmf_info->dtmf_number[pdtmf_info->dtmf_index];
3446 dtmf_digit[1] = '\0';
3449 if (0 == strcasecmp(dtmf_digit, "p")) {
3450 int dtmf_interval = 0;
3452 if (FALSE == _vc_core_util_check_gcf_status()) {
3453 dtmf_interval = (pdtmf_info->dtmf_index == 0) ? DTMF_PAUSE_TIMER_INTERVAL_FIRST : DTMF_PAUSE_TIMER_INTERVAL_REST;
3455 #ifdef GCONF_GCF_SAT_TEST
3456 int start_interval = DTMF_PAUSE_TIMER_INTERVAL_GCF_FIRST;
3457 int rest_interval = DTMF_PAUSE_TIMER_INTERVAL_GCF_REST;
3460 GConfClient *client = NULL;
3461 client = gconf_client_get_default();
3462 if (NULL == client) {
3463 CALL_ENG_DEBUG(ENG_DEBUG, "gconf_client_get_default failed..");
3466 start_interval = gconf_client_get_int(client, PATH_DTMF_INTERVAL_GCF_FIRST, NULL);
3468 rest_interval = gconf_client_get_int(client, PATH_DTMF_INTERVAL_GCF_REST, NULL);
3469 g_object_unref(client);
3473 CALL_ENG_DEBUG(ENG_DEBUG, "start_interval:%d, rest_interval = %d", start_interval, rest_interval);
3474 dtmf_interval = (pdtmf_info->dtmf_index == 0) ? start_interval : rest_interval;
3476 dtmf_interval = (pdtmf_info->dtmf_index == 0) ? DTMF_PAUSE_TIMER_INTERVAL_GCF_FIRST : DTMF_PAUSE_TIMER_INTERVAL_GCF_REST;
3478 CALL_ENG_DEBUG(ENG_DEBUG, "updated dtmf_interval:%d", dtmf_interval);
3480 pdtmf_info->dtmf_pause_timer = g_timeout_add(dtmf_interval, __voicecall_core_dtmf_pause_timer_cb, pcall_core);
3481 } else if ((ERROR_VOICECALL_NONE != _vc_core_engine_send_dtmf(pcall_core->pcall_engine, dtmf_digit))) {
3482 if (!((TRUE == pdtmf_info->bsat_dtmf) && (TRUE == pdtmf_info->bsat_hidden))) {
3483 memset(&event_data, 0, sizeof(event_data));
3484 event_data.bstatus = FALSE;
3485 event_data.string_id = IDS_CALL_POP_DTMFSENDING_FAIL;
3486 vcall_engine_send_event_to_client(VC_ENGINE_MSG_DTMF_ACK_TO_UI, (void *)&event_data);
3488 if (TRUE == pdtmf_info->bsat_dtmf) {
3489 voicecall_core_send_sat_response(pcall_core->pcall_engine, SAT_RQST_SEND_DTMF, CALL_VC_ME_UNABLE_TO_PROCESS_COMMAND);
3493 pdtmf_info->bdtmf_queue = TRUE;
3495 /*Create Progressbar popup */
3496 if (!((TRUE == pdtmf_info->bsat_dtmf) && (TRUE == pdtmf_info->bsat_hidden))) {
3497 memset(&event_data, 0, sizeof(event_data));
3498 event_data.bstatus = TRUE;
3499 event_data.string_id = IDS_CALL_POP_SENDING;
3500 _vc_core_util_strcpy(event_data.display_string, VC_PHONE_NUMBER_LENGTH_MAX, pdtmf_info->dtmf_number);
3501 vcall_engine_send_event_to_client(VC_ENGINE_MSG_DTMF_ACK_TO_UI, (void *)&event_data);
3503 CALL_ENG_DEBUG(ENG_DEBUG, "SAT DTMF Hidden Mode, not showing UI");
3509 gboolean voicecall_core_change_sound_path(call_vc_core_state_t *pcall_core, voicecall_snd_audio_type_t sound_path)
3511 voicecall_snd_mgr_t *papp_snd = pcall_core->papp_snd;
3513 int total_call_member = -1;
3515 CALL_ENG_DEBUG(ENG_DEBUG, "sound_path:[%d]", sound_path);
3517 voicecall_core_get_total_call_member(pcall_core->pcall_engine, &total_call_member);
3518 if (total_call_member == 0) {
3519 CALL_ENG_DEBUG(ENG_DEBUG, "There are not active calls hence it should not work");
3523 switch (sound_path) {
3524 case VOICE_CALL_AUDIO_SPEAKER:
3527 if (voicecall_snd_get_path_status(pcall_core->papp_snd) == VOICE_CALL_SND_PATH_BT) {
3528 /*_vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_SWITCH_TO_PHONE, -1, NULL);*/
3529 _vc_bt_request_switch_headset_path(pcall_core, FALSE);
3531 voicecall_snd_set_path_status(pcall_core->papp_snd, VOICE_CALL_SND_PATH_SPEAKER);
3533 if (TRUE == voicecall_snd_get_status(papp_snd, VOICE_CALL_AUDIO_HEADSET)) {
3534 voicecall_snd_set_status(papp_snd, VOICE_CALL_AUDIO_HEADSET, FALSE);
3535 /*_vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_SWITCH_TO_PHONE, -1, NULL);*/
3536 _vc_bt_request_switch_headset_path(pcall_core, FALSE);
3539 voicecall_snd_set_status(papp_snd, VOICE_CALL_AUDIO_SPEAKER, TRUE);
3545 case VOICE_CALL_AUDIO_HEADSET:
3548 voicecall_snd_set_path_status(pcall_core->papp_snd, VOICE_CALL_SND_PATH_BT);
3550 voicecall_snd_set_status(papp_snd, VOICE_CALL_AUDIO_SPEAKER, FALSE);
3551 voicecall_snd_set_status(papp_snd, VOICE_CALL_AUDIO_HEADSET, TRUE);
3553 /* _vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_SWITCH_TO_HEADSET, -1, NULL);*/
3554 _vc_bt_request_switch_headset_path(pcall_core, TRUE);
3560 case VOICE_CALL_AUDIO_EARJACK:
3563 if (voicecall_snd_get_path_status(pcall_core->papp_snd) == VOICE_CALL_SND_PATH_BT) {
3564 /*_vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_SWITCH_TO_PHONE, -1, NULL);*/
3565 _vc_bt_request_switch_headset_path(pcall_core, FALSE);
3567 voicecall_snd_set_path_status(pcall_core->papp_snd, VOICE_CALL_SND_PATH_EARJACK);
3569 voicecall_snd_set_status(papp_snd, VOICE_CALL_AUDIO_SPEAKER, FALSE);
3571 if (TRUE == voicecall_snd_get_status(papp_snd, VOICE_CALL_AUDIO_HEADSET)) {
3572 voicecall_snd_set_status(papp_snd, VOICE_CALL_AUDIO_HEADSET, FALSE);
3573 /*_vc_bt_send_response_to_bt(pcall_core, BT_AG_RES_SWITCH_TO_PHONE, -1, NULL);*/
3574 _vc_bt_request_switch_headset_path(pcall_core, FALSE);
3583 CALL_ENG_DEBUG(ENG_DEBUG, "Unknown type!!");
3589 /* Change Audio Path according to the current status */
3590 voicecall_snd_change_path(papp_snd);
3595 gboolean voicecall_core_get_sound_path(call_vc_core_state_t *pcall_core, int *sound_path)
3597 voicecall_snd_mgr_t *papp_snd = pcall_core->papp_snd;
3599 CALL_ENG_DEBUG(ENG_DEBUG, "..");
3602 switch (voicecall_snd_get_path_status(papp_snd))
3604 case VOICE_CALL_SND_PATH_SPEAKER:
3606 *sound_path = VOICE_CALL_AUDIO_SPEAKER;
3610 case VOICE_CALL_SND_PATH_BT:
3612 *sound_path = VOICE_CALL_AUDIO_HEADSET;
3616 case VOICE_CALL_SND_PATH_EARJACK:
3618 *sound_path = VOICE_CALL_AUDIO_EARJACK;
3622 case VOICE_CALL_SND_PATH_RECEIVER:
3625 *sound_path = VOICE_CALL_AUDIO_RECEIVER;
3631 if (TRUE == voicecall_snd_get_status(papp_snd, VOICE_CALL_AUDIO_SPEAKER)) {
3632 *sound_path = VOICE_CALL_AUDIO_SPEAKER;
3633 } else if (TRUE == voicecall_snd_get_status(papp_snd, VOICE_CALL_AUDIO_HEADSET)) {
3634 *sound_path = VOICE_CALL_AUDIO_HEADSET;
3636 *sound_path = VOICE_CALL_AUDIO_EARJACK;
3643 static gboolean __voicecall_core_is_redial_cuase(int end_cause)
3645 CALL_ENG_DEBUG(ENG_DEBUG, "end_cause(%d)",end_cause);
3649 case VC_ENDCAUSE_CALL_BARRED:
3650 case VC_ENDCAUSE_NO_SERVICE:
3651 case VC_ENDCAUSE_USER_UNAVAILABLE:
3652 case VC_ENDCAUSE_INVALID_NUMBER_FORMAT:
3653 case VC_ENDCAUSE_NUMBER_CHANGED:
3654 case VC_ENDCAUSE_NO_CREDIT:
3655 case VC_ENDCAUSE_UNASSIGNED_NUMBER:
3658 case VC_ENDCAUSE_CALL_ENDED:
3659 case VC_ENDCAUSE_CALL_DISCONNECTED:
3660 case VC_ENDCAUSE_NO_ANSWER:
3661 case VC_ENDCAUSE_NW_BUSY:
3662 case VC_ENDCAUSE_CALL_SERVICE_NOT_ALLOWED:
3663 case VC_ENDCAUSE_NW_FAILED:
3664 case VC_ENDCAUSE_REJECTED:
3665 case VC_ENDCAUSE_USER_BUSY:
3666 case VC_ENDCAUSE_WRONG_GROUP:
3667 case VC_ENDCAUSE_CALL_NOT_ALLOWED:
3668 case VC_ENDCAUSE_CALL_FAILED:
3669 case VC_ENDCAUSE_NO_USER_RESPONDING:
3670 case VC_ENDCAUSE_USER_ALERTING_NO_ANSWER:
3671 case VC_ENDCAUSE_SERVICE_TEMP_UNAVAILABLE:
3672 case VC_ENDCAUSE_USER_DOESNOT_RESPOND:
3673 case VC_ENDCAUSE_IMEI_REJECTED:
3674 case VC_ENDCAUSE_TAPI_ERROR: