return 0;
}
-static void __callmgr_core_process_telephony_events(cm_telephony_event_type_e event_type, void *event_data, void *user_data)
+static void __callmgr_core_process_telephony_event_IDLE(callmgr_core_data_t *core_data, void *event_data, cm_telepony_sim_slot_type_e active_sim_slot)
{
- callmgr_core_data_t *core_data = (callmgr_core_data_t *)user_data;
callmgr_audio_route_e route = CALLMGR_AUDIO_ROUTE_NONE_E;
- cm_telepony_sim_slot_type_e active_sim_slot = 0;
- gboolean is_bt_connected = FALSE;
gboolean is_earjack_connected = FALSE;
cm_telephony_end_cause_type_e end_cause = CM_TELEPHONY_ENDCAUSE_MAX;
- dbg("event_type[%d]", event_type);
- CM_RETURN_IF_FAIL(core_data);
-
- if ((event_type > CM_TELEPHONY_EVENT_IDLE) && (event_type <= CM_TELEPHONY_EVENT_RETRIEVED)) {
- /* Update call data for status event*/
- __callmgr_core_update_all_call_data(core_data);
- }
-
- _callmgr_telephony_get_active_sim_slot(core_data->telephony_handle, &active_sim_slot);
- switch (event_type) {
- case CM_TELEPHONY_EVENT_IDLE:
- {
- unsigned int call_id = GPOINTER_TO_UINT(event_data);
- callmgr_call_type_e cm_call_type = CALL_TYPE_INVALID_E;
- cm_telephony_call_data_t *call_data_out = NULL;
- cm_telephony_call_direction_e call_direction;
- cm_telephony_call_state_e call_state = CM_TEL_CALL_STATE_MAX;
- cm_telephony_call_type_e call_type = CM_TEL_CALL_TYPE_INVALID;
- cm_ct_plog_reject_type_e reject_type = 0;
- cm_ct_plog_data_t *log_data = NULL;
- int call_duration = 0;
- long start_time = 0;
- gboolean is_ecc = FALSE;
- gboolean b_play_effect_tone = TRUE;
- int call_cnt = 0;
- callmgr_call_data_t *end_call_data = NULL;
-
- __callmgr_core_cancel_auto_answer(core_data);
- __callmgr_core_stop_incom_noti(core_data);
- /* Destroy ringtone stream if MT call is terminated */
- _callmgr_ringer_destroy_ringtone_stream(core_data->ringer_handle);
- _callmgr_ringer_stop_local_ringback_tone(core_data->ringer_handle);
+ unsigned int call_id = GPOINTER_TO_UINT(event_data);
+ callmgr_call_type_e cm_call_type = CALL_TYPE_INVALID_E;
+ cm_telephony_call_data_t *call_data_out = NULL;
+ cm_telephony_call_direction_e call_direction;
+ cm_telephony_call_state_e call_state = CM_TEL_CALL_STATE_MAX;
+ cm_telephony_call_type_e call_type = CM_TEL_CALL_TYPE_INVALID;
+ cm_ct_plog_reject_type_e reject_type = 0;
+ cm_ct_plog_data_t *log_data = NULL;
+ int call_duration = 0;
+ long start_time = 0;
+ gboolean is_ecc = FALSE;
+ gboolean b_play_effect_tone = TRUE;
+ int call_cnt = 0;
+ callmgr_call_data_t *end_call_data = NULL;
- info("Call[%d] is ended", call_id);
- _callmgr_telephony_get_call_by_call_id(core_data->telephony_handle, call_id, &call_data_out);
- CM_RETURN_IF_FAIL(call_data_out);
+ CM_RETURN_IF_FAIL(core_data);
- _callmgr_telephony_get_call_start_time(call_data_out, &start_time);
- _callmgr_util_get_time_diff(start_time, &call_duration);
- _callmgr_telephony_get_call_direction(call_data_out, &call_direction);
- _callmgr_telephony_get_call_state(call_data_out, &call_state);
- _callmgr_telephony_get_call_type(call_data_out, &call_type);
- __callmgr_core_convert_tel_call_type(call_type, &cm_call_type);
- _callmgr_ct_get_log_reject_type(call_id, &reject_type);
- _callmgr_telephony_get_call_end_cause(call_data_out, &end_cause);
- _callmgr_telephony_get_is_ecc(call_data_out, &is_ecc);
-
- log_data = (cm_ct_plog_data_t*)calloc(1, sizeof(cm_ct_plog_data_t));
- CM_RETURN_IF_FAIL(log_data);
- log_data->call_id = call_id;
- log_data->sim_slot = active_sim_slot;
- log_data->call_duration = call_duration;
- log_data->presentation = CM_CT_PLOG_PRESENT_DEFAULT;
-
- if (core_data->incom && core_data->incom->call_id == call_id) {
- end_call_data = core_data->incom;
- } else if (core_data->active_dial && core_data->active_dial->call_id == call_id) {
- end_call_data = core_data->active_dial;
- } else if (core_data->held && core_data->held->call_id == call_id) {
- end_call_data = core_data->held;
- }
-
- /* Set log presentation */
- if (is_ecc) {
- log_data->presentation = CM_CT_PLOG_PRESENT_EMERGENCY;
- } else if (end_call_data && end_call_data->is_voicemail_number) {
- log_data->presentation = CM_CT_PLOG_PRESENT_VOICEMAIL;
+ __callmgr_core_cancel_auto_answer(core_data);
+ __callmgr_core_stop_incom_noti(core_data);
+ /* Destroy ringtone stream if MT call is terminated */
+ _callmgr_ringer_destroy_ringtone_stream(core_data->ringer_handle);
+ _callmgr_ringer_stop_local_ringback_tone(core_data->ringer_handle);
+
+ info("Call[%d] is ended", call_id);
+ _callmgr_telephony_get_call_by_call_id(core_data->telephony_handle, call_id, &call_data_out);
+ CM_RETURN_IF_FAIL(call_data_out);
+
+ _callmgr_telephony_get_call_start_time(call_data_out, &start_time);
+ _callmgr_util_get_time_diff(start_time, &call_duration);
+ _callmgr_telephony_get_call_direction(call_data_out, &call_direction);
+ _callmgr_telephony_get_call_state(call_data_out, &call_state);
+ _callmgr_telephony_get_call_type(call_data_out, &call_type);
+ __callmgr_core_convert_tel_call_type(call_type, &cm_call_type);
+ _callmgr_ct_get_log_reject_type(call_id, &reject_type);
+ _callmgr_telephony_get_call_end_cause(call_data_out, &end_cause);
+ _callmgr_telephony_get_is_ecc(call_data_out, &is_ecc);
+
+ log_data = (cm_ct_plog_data_t*)calloc(1, sizeof(cm_ct_plog_data_t));
+ CM_RETURN_IF_FAIL(log_data);
+ log_data->call_id = call_id;
+ log_data->sim_slot = active_sim_slot;
+ log_data->call_duration = call_duration;
+ log_data->presentation = CM_CT_PLOG_PRESENT_DEFAULT;
+
+ if (core_data->incom && core_data->incom->call_id == call_id) {
+ end_call_data = core_data->incom;
+ } else if (core_data->active_dial && core_data->active_dial->call_id == call_id) {
+ end_call_data = core_data->active_dial;
+ } else if (core_data->held && core_data->held->call_id == call_id) {
+ end_call_data = core_data->held;
+ }
+
+ /* Set log presentation */
+ if (is_ecc) {
+ log_data->presentation = CM_CT_PLOG_PRESENT_EMERGENCY;
+ } else if (end_call_data && end_call_data->is_voicemail_number) {
+ log_data->presentation = CM_CT_PLOG_PRESENT_VOICEMAIL;
+ } else {
+ cm_telephony_name_mode_e name_mode = CM_TEL_NAME_MODE_NONE;
+ _callmgr_telephony_get_call_name_mode(call_data_out, &name_mode);
+ if (name_mode == CM_TEL_NAME_MODE_UNKNOWN) {
+ log_data->presentation = CM_CT_PLOG_PRESENT_UNAVAILABLE;
+ } else if (name_mode == CM_TEL_NAME_MODE_PRIVATE) {
+ log_data->presentation = CM_CT_PLOG_PRESENT_REJECT_BY_USER;
+ } else if (name_mode == CM_TEL_NAME_MODE_PAYPHONE) {
+ log_data->presentation = CM_CT_PLOG_PRESENT_PAYPHONE;
} else {
- cm_telephony_name_mode_e name_mode = CM_TEL_NAME_MODE_NONE;
- _callmgr_telephony_get_call_name_mode(call_data_out, &name_mode);
- if (name_mode == CM_TEL_NAME_MODE_UNKNOWN) {
- log_data->presentation = CM_CT_PLOG_PRESENT_UNAVAILABLE;
- } else if (name_mode == CM_TEL_NAME_MODE_PRIVATE) {
- log_data->presentation = CM_CT_PLOG_PRESENT_REJECT_BY_USER;
- } else if (name_mode == CM_TEL_NAME_MODE_PAYPHONE) {
- log_data->presentation = CM_CT_PLOG_PRESENT_PAYPHONE;
- } else {
- log_data->presentation = CM_CT_PLOG_PRESENT_DEFAULT;
- }
+ log_data->presentation = CM_CT_PLOG_PRESENT_DEFAULT;
}
+ }
- /* Set log type */
- if (call_direction == CM_TEL_CALL_DIRECTION_MT) {
- if (call_state == CM_TEL_CALL_STATE_INCOMING) {
- if (reject_type == CM_CT_PLOG_REJECT_TYPE_NORMAL_E) {
- if (cm_call_type == CALL_TYPE_VIDEO_E) {
- log_data->log_type = CM_CT_PLOG_TYPE_VIDEO_REJECT_E;
- } else {
- log_data->log_type = CM_CT_PLOG_TYPE_VOICE_REJECT_E;
- }
- } else if (reject_type == CM_CT_PLOG_REJECT_TYPE_BLOCKED_E) {
- if (cm_call_type == CALL_TYPE_VIDEO_E) {
- log_data->log_type = CM_CT_PLOG_TYPE_VIDEO_BLOCKED_E;
- } else {
- log_data->log_type = CM_CT_PLOG_TYPE_VOICE_BLOCKED_E;
- }
- } else if (reject_type == CM_CT_PLOG_REJECT_TYPE_SETTING_REJECT_E) {
- if (cm_call_type == CALL_TYPE_VIDEO_E) {
- log_data->log_type = CM_CT_PLOG_TYPE_VIDEO_BLOCKED_E;
- } else {
- log_data->log_type = CM_CT_PLOG_TYPE_VOICE_BLOCKED_E;
- }
- } else if (reject_type == CM_CT_PLOG_REJECT_TYPE_REC_REJECT_E) {
- if (cm_call_type == CALL_TYPE_VIDEO_E) {
- log_data->log_type = CM_CT_PLOG_TYPE_VIDEO_BLOCKED_E;
- } else {
- log_data->log_type = CM_CT_PLOG_TYPE_VOICE_BLOCKED_E;
- }
+ /* Set log type */
+ if (call_direction == CM_TEL_CALL_DIRECTION_MT) {
+ if (call_state == CM_TEL_CALL_STATE_INCOMING) {
+ if (reject_type == CM_CT_PLOG_REJECT_TYPE_NORMAL_E) {
+ if (cm_call_type == CALL_TYPE_VIDEO_E) {
+ log_data->log_type = CM_CT_PLOG_TYPE_VIDEO_REJECT_E;
} else {
- if (cm_call_type == CALL_TYPE_VIDEO_E) {
- log_data->log_type = CM_CT_PLOG_TYPE_VIDEO_INCOMING_UNSEEN_E;
- } else {
- log_data->log_type = CM_CT_PLOG_TYPE_VOICE_INCOMING_UNSEEN_E;
- }
+ log_data->log_type = CM_CT_PLOG_TYPE_VOICE_REJECT_E;
+ }
+ } else if (reject_type == CM_CT_PLOG_REJECT_TYPE_BLOCKED_E) {
+ if (cm_call_type == CALL_TYPE_VIDEO_E) {
+ log_data->log_type = CM_CT_PLOG_TYPE_VIDEO_BLOCKED_E;
+ } else {
+ log_data->log_type = CM_CT_PLOG_TYPE_VOICE_BLOCKED_E;
+ }
+ } else if (reject_type == CM_CT_PLOG_REJECT_TYPE_SETTING_REJECT_E) {
+ if (cm_call_type == CALL_TYPE_VIDEO_E) {
+ log_data->log_type = CM_CT_PLOG_TYPE_VIDEO_BLOCKED_E;
+ } else {
+ log_data->log_type = CM_CT_PLOG_TYPE_VOICE_BLOCKED_E;
+ }
+ } else if (reject_type == CM_CT_PLOG_REJECT_TYPE_REC_REJECT_E) {
+ if (cm_call_type == CALL_TYPE_VIDEO_E) {
+ log_data->log_type = CM_CT_PLOG_TYPE_VIDEO_BLOCKED_E;
+ } else {
+ log_data->log_type = CM_CT_PLOG_TYPE_VOICE_BLOCKED_E;
}
- b_play_effect_tone = FALSE;
} else {
if (cm_call_type == CALL_TYPE_VIDEO_E) {
- log_data->log_type = CM_CT_PLOG_TYPE_VIDEO_INCOMING_E;
+ log_data->log_type = CM_CT_PLOG_TYPE_VIDEO_INCOMING_UNSEEN_E;
} else {
- log_data->log_type = CM_CT_PLOG_TYPE_VOICE_INCOMING_E;
+ log_data->log_type = CM_CT_PLOG_TYPE_VOICE_INCOMING_UNSEEN_E;
}
}
+ b_play_effect_tone = FALSE;
} else {
if (cm_call_type == CALL_TYPE_VIDEO_E) {
- log_data->log_type = CM_CT_PLOG_TYPE_VIDEO_OUTGOING_E;
+ log_data->log_type = CM_CT_PLOG_TYPE_VIDEO_INCOMING_E;
} else {
- log_data->log_type = CM_CT_PLOG_TYPE_VOICE_OUTGOING_E;
+ log_data->log_type = CM_CT_PLOG_TYPE_VOICE_INCOMING_E;
}
}
- _callmgr_ct_add_log(log_data);
- g_free(log_data);
+ } else {
+ if (cm_call_type == CALL_TYPE_VIDEO_E) {
+ log_data->log_type = CM_CT_PLOG_TYPE_VIDEO_OUTGOING_E;
+ } else {
+ log_data->log_type = CM_CT_PLOG_TYPE_VOICE_OUTGOING_E;
+ }
+ }
+ _callmgr_ct_add_log(log_data);
+ g_free(log_data);
- /* Delete the callData */
- _callmgr_telephony_call_delete(core_data->telephony_handle, call_id);
- _callmgr_ct_delete_ct_info(call_id);
- __callmgr_core_update_all_call_data(core_data);
+ /* Delete the callData */
+ _callmgr_telephony_call_delete(core_data->telephony_handle, call_id);
+ _callmgr_ct_delete_ct_info(call_id);
+ __callmgr_core_update_all_call_data(core_data);
- _callmgr_dbus_send_call_event(core_data, CALL_MANAGER_CALL_EVENT_IDLE_E, call_id, active_sim_slot, end_cause);
- __callmgr_core_send_bt_events(core_data, call_id);
+ _callmgr_dbus_send_call_event(core_data, CALL_MANAGER_CALL_EVENT_IDLE_E, call_id, active_sim_slot, end_cause);
+ __callmgr_core_send_bt_events(core_data, call_id);
- if (core_data->answer_msg_handle) {
- _callmgr_answer_msg_deinit(core_data->answer_msg_handle);
- core_data->answer_msg_handle = NULL;
- }
- _callmgr_telephony_get_call_count(core_data->telephony_handle, &call_cnt);
+ if (core_data->answer_msg_handle) {
+ _callmgr_answer_msg_deinit(core_data->answer_msg_handle);
+ core_data->answer_msg_handle = NULL;
+ }
+ _callmgr_telephony_get_call_count(core_data->telephony_handle, &call_cnt);
- /* Destroy call session */
- if (call_cnt == 0) {
- int ret = -1;
- callmgr_vr_state_e record_state = CALLMGR_VR_NONE;
- cm_ringer_status_e ringer_status = CM_RINGER_STATUS_IDLE_E;
-
- __callmgr_core_set_call_status(core_data, CALL_MANAGER_CALL_STATUS_IDLE_E, cm_call_type, NULL);
-
- _callmgr_audio_set_media_mode_with_current_device();
- if (call_direction == CM_TEL_CALL_DIRECTION_MO) {
- callmgr_play_signal_type_e signal_type = CALL_SIGNAL_NONE_E;
- __callmgr_core_get_signal_type(end_cause, &signal_type);
- if (_callmgr_ringer_play_signal(core_data->ringer_handle, signal_type, __callmgr_core_signal_tone_finished_cb, core_data) == 0) {
- err("_callmgr_ringer_play_signal() success");
- b_play_effect_tone = FALSE;
- }
+ /* Destroy call session */
+ if (call_cnt == 0) {
+ int ret = -1;
+ callmgr_vr_state_e record_state = CALLMGR_VR_NONE;
+ cm_ringer_status_e ringer_status = CM_RINGER_STATUS_IDLE_E;
+
+ __callmgr_core_set_call_status(core_data, CALL_MANAGER_CALL_STATUS_IDLE_E, cm_call_type, NULL);
+
+ _callmgr_audio_set_media_mode_with_current_device();
+ if (call_direction == CM_TEL_CALL_DIRECTION_MO) {
+ callmgr_play_signal_type_e signal_type = CALL_SIGNAL_NONE_E;
+ __callmgr_core_get_signal_type(end_cause, &signal_type);
+ if (_callmgr_ringer_play_signal(core_data->ringer_handle, signal_type, __callmgr_core_signal_tone_finished_cb, core_data) == 0) {
+ err("_callmgr_ringer_play_signal() success");
+ b_play_effect_tone = FALSE;
}
+ }
- _callmgr_audio_get_audio_route(core_data->audio_handle, &route);
- if ((b_play_effect_tone) && (route != CALLMGR_AUDIO_ROUTE_BT_E)) {
- if (_callmgr_ringer_play_effect(core_data->ringer_handle, CM_RINGER_EFFECT_DISCONNECT_TONE_E, __callmgr_core_disconnect_tone_finished_cb, core_data) < 0) {
- err("_callmgr_ringer_play_effect() is failed");
- }
+ _callmgr_audio_get_audio_route(core_data->audio_handle, &route);
+ if ((b_play_effect_tone) && (route != CALLMGR_AUDIO_ROUTE_BT_E)) {
+ if (_callmgr_ringer_play_effect(core_data->ringer_handle, CM_RINGER_EFFECT_DISCONNECT_TONE_E, __callmgr_core_disconnect_tone_finished_cb, core_data) < 0) {
+ err("_callmgr_ringer_play_effect() is failed");
}
+ }
- _callmgr_ringer_get_ringer_status(core_data->ringer_handle, &ringer_status);
- if (ringer_status == CM_RINGER_STATUS_IDLE_E) {
- _callmgr_audio_destroy_call_sound_session(core_data->audio_handle);
- }
+ _callmgr_ringer_get_ringer_status(core_data->ringer_handle, &ringer_status);
+ if (ringer_status == CM_RINGER_STATUS_IDLE_E) {
+ _callmgr_audio_destroy_call_sound_session(core_data->audio_handle);
+ }
- /* When we make a call and switch on mute and then end the call, the next time we call the mute should be reset to off. So the below API is called here.*/
- _callmgr_telephony_set_audio_tx_mute(core_data->telephony_handle, FALSE);
- core_data->is_mute_on = FALSE;
- _callmgr_dbus_send_mute_status(core_data, 0);
- _callmgr_dbus_send_audio_status(core_data, CALL_AUDIO_PATH_NONE_E);
-
- _callmgr_vr_get_recording_state(core_data->vr_handle, &record_state);
- if (record_state == CALLMGR_VR_RECORD_REQUESTED ||
- record_state == CALLMGR_VR_RECORDING ||
- record_state == CALLMGR_VR_PAUSED) {
- ret = _callmgr_core_process_record_stop(core_data);
- if (ret < 0) {
- err("_callmgr_core_process_record_stop() failed[%d]", ret);
- }
+ /* When we make a call and switch on mute and then end the call, the next time we call the mute should be reset to off. So the below API is called here.*/
+ _callmgr_telephony_set_audio_tx_mute(core_data->telephony_handle, FALSE);
+ core_data->is_mute_on = FALSE;
+ _callmgr_dbus_send_mute_status(core_data, 0);
+ _callmgr_dbus_send_audio_status(core_data, CALL_AUDIO_PATH_NONE_E);
+
+ _callmgr_vr_get_recording_state(core_data->vr_handle, &record_state);
+ if (record_state == CALLMGR_VR_RECORD_REQUESTED ||
+ record_state == CALLMGR_VR_RECORDING ||
+ record_state == CALLMGR_VR_PAUSED) {
+ ret = _callmgr_core_process_record_stop(core_data);
+ if (ret < 0) {
+ err("_callmgr_core_process_record_stop() failed[%d]", ret);
}
- core_data->is_auto_answered = FALSE;
- _callmgr_telephony_set_active_sim_slot(core_data->telephony_handle, CM_TELEPHONY_SIM_UNKNOWN);
- } else if (call_cnt > 0) {
- call_data_out = NULL;
- _callmgr_telephony_get_call_by_state(core_data->telephony_handle, CM_TEL_CALL_STATE_INCOMING, &call_data_out);
- if ((call_data_out == NULL) && (core_data->call_status != CALL_MANAGER_CALL_STATUS_OFFHOOK_E)) {
- __callmgr_core_set_call_status(core_data, CALL_MANAGER_CALL_STATUS_OFFHOOK_E, cm_call_type, NULL);
+ }
+ core_data->is_auto_answered = FALSE;
+ _callmgr_telephony_set_active_sim_slot(core_data->telephony_handle, CM_TELEPHONY_SIM_UNKNOWN);
+ } else if (call_cnt > 0) {
+ call_data_out = NULL;
+ _callmgr_telephony_get_call_by_state(core_data->telephony_handle, CM_TEL_CALL_STATE_INCOMING, &call_data_out);
+ if ((call_data_out == NULL) && (core_data->call_status != CALL_MANAGER_CALL_STATUS_OFFHOOK_E)) {
+ __callmgr_core_set_call_status(core_data, CALL_MANAGER_CALL_STATUS_OFFHOOK_E, cm_call_type, NULL);
+ }
+ gboolean answer_requesting = FALSE;
+ _callmgr_telephony_is_answer_requesting(core_data->telephony_handle, &answer_requesting);
+ if ((call_cnt == 1) && (call_data_out)) {
+ // All other call is ended except incoming call. Restart to play ringtone
+ if (!answer_requesting) {
+ /* Release and Accept request is not done */
+ char *caller_ringtone_path = NULL;
+ unsigned int call_id = 0;
+ _callmgr_telephony_get_call_id(call_data_out, &call_id);
+
+ _callmgr_ct_get_caller_ringtone_path(call_id, &caller_ringtone_path);
+ _callmgr_audio_is_sound_device_available(core_data->audio_handle, CALLMGR_AUDIO_DEVICE_EARJACK_E, &is_earjack_connected);
+ _callmgr_ringer_start_alert(core_data->ringer_handle, caller_ringtone_path, is_earjack_connected);
+ CM_SAFE_FREE(caller_ringtone_path);
+ } else {
+ dbg("Stop virtual stream in call replace scenario");
+ _callmgr_audio_stop_virtual_stream(core_data->audio_handle);
}
- gboolean answer_requesting = FALSE;
- _callmgr_telephony_is_answer_requesting(core_data->telephony_handle, &answer_requesting);
- if ((call_cnt == 1) && (call_data_out)) {
- // All other call is ended except incoming call. Restart to play ringtone
- if (!answer_requesting) {
- /* Release and Accept request is not done */
- char *caller_ringtone_path = NULL;
- unsigned int call_id = 0;
- _callmgr_telephony_get_call_id(call_data_out, &call_id);
-
- _callmgr_ct_get_caller_ringtone_path(call_id, &caller_ringtone_path);
- _callmgr_audio_is_sound_device_available(core_data->audio_handle, CALLMGR_AUDIO_DEVICE_EARJACK_E, &is_earjack_connected);
- _callmgr_ringer_start_alert(core_data->ringer_handle, caller_ringtone_path, is_earjack_connected);
- CM_SAFE_FREE(caller_ringtone_path);
- } else {
- dbg("Stop virtual stream in call replace scenario");
- _callmgr_audio_stop_virtual_stream(core_data->audio_handle);
- }
- } else if (answer_requesting && (call_cnt > 1) && (call_data_out)) {
- /* Incoming + Other Calls Are Present. */
- gboolean is_held_call = FALSE;
- _callmgr_telephony_has_call_by_state(core_data->telephony_handle, CM_TEL_CALL_STATE_HELD, &is_held_call);
- if (FALSE == is_held_call) {
- /* All held call is ended... */
- cm_telephony_answer_request_type_e end_active_after_held_end = CM_TEL_INVALID;
- _callmgr_telephony_get_answer_request_type(core_data->telephony_handle, &end_active_after_held_end);
- if (CM_TEL_END_ACTIVE_AFTER_HELD_END == end_active_after_held_end) {
- info("End active call and accept incoming call...");
- _callmgr_core_process_answer_call(core_data, CM_TEL_CALL_ANSWER_TYPE_RELEASE_ACTIVE_AND_ACCEPT);
- } else if (CM_TEL_HOLD_ACTIVE_AFTER_HELD_END == end_active_after_held_end) {
- info("Hold active call and accept incoming call...");
- _callmgr_core_process_answer_call(core_data, CM_TEL_CALL_ANSWER_TYPE_HOLD_ACTIVE_AND_ACCEPT);
- }
- _callmgr_telephony_set_answer_request_type(core_data->telephony_handle, CM_TEL_INVALID);
+ } else if (answer_requesting && (call_cnt > 1) && (call_data_out)) {
+ /* Incoming + Other Calls Are Present. */
+ gboolean is_held_call = FALSE;
+ _callmgr_telephony_has_call_by_state(core_data->telephony_handle, CM_TEL_CALL_STATE_HELD, &is_held_call);
+ if (FALSE == is_held_call) {
+ /* All held call is ended... */
+ cm_telephony_answer_request_type_e end_active_after_held_end = CM_TEL_INVALID;
+ _callmgr_telephony_get_answer_request_type(core_data->telephony_handle, &end_active_after_held_end);
+ if (CM_TEL_END_ACTIVE_AFTER_HELD_END == end_active_after_held_end) {
+ info("End active call and accept incoming call...");
+ _callmgr_core_process_answer_call(core_data, CM_TEL_CALL_ANSWER_TYPE_RELEASE_ACTIVE_AND_ACCEPT);
+ } else if (CM_TEL_HOLD_ACTIVE_AFTER_HELD_END == end_active_after_held_end) {
+ info("Hold active call and accept incoming call...");
+ _callmgr_core_process_answer_call(core_data, CM_TEL_CALL_ANSWER_TYPE_HOLD_ACTIVE_AND_ACCEPT);
}
+ _callmgr_telephony_set_answer_request_type(core_data->telephony_handle, CM_TEL_INVALID);
}
}
}
- break;
- case CM_TELEPHONY_EVENT_ACTIVE:
- {
- unsigned int call_id = GPOINTER_TO_UINT(event_data);
- cm_telephony_call_data_t *call_data_out = NULL;
- callmgr_call_type_e cm_call_type = CALL_TYPE_INVALID_E;
- cm_telephony_call_type_e call_type = CM_TEL_CALL_TYPE_INVALID;
- gboolean is_bike_mode_enabled = FALSE;
+}
- _callmgr_telephony_get_call_by_call_id(core_data->telephony_handle, call_id, &call_data_out);
- _callmgr_telephony_get_call_type(call_data_out, &call_type);
- __callmgr_core_convert_tel_call_type(call_type, &cm_call_type);
- /********setting the mute status to off initially which treats every call as new call ***/
- /*****and sets the mute status to off initially********/
- _callmgr_core_process_set_mute_state(core_data, 0);
+static void __callmgr_core_process_telephony_event_ACTIVE(callmgr_core_data_t *core_data, void *event_data, cm_telepony_sim_slot_type_e active_sim_slot)
+{
+ callmgr_audio_route_e route = CALLMGR_AUDIO_ROUTE_NONE_E;
+ gboolean is_bt_connected = FALSE;
+ cm_telephony_end_cause_type_e end_cause = CM_TELEPHONY_ENDCAUSE_MAX;
- /* Set call domain for call parameter handling */
- if (CM_TEL_CALL_TYPE_CS_VOICE == call_type || CM_TEL_CALL_TYPE_CS_VIDEO == call_type || CM_TEL_CALL_TYPE_E911 == call_type)
- _callmgr_audio_set_calldomain(core_data->audio_handle, CM_AUDIO_CALL_DOMAIN_CS);
+ unsigned int call_id = GPOINTER_TO_UINT(event_data);
+ cm_telephony_call_data_t *call_data_out = NULL;
+ callmgr_call_type_e cm_call_type = CALL_TYPE_INVALID_E;
+ cm_telephony_call_type_e call_type = CM_TEL_CALL_TYPE_INVALID;
+ gboolean is_bike_mode_enabled = FALSE;
+
+ _callmgr_telephony_get_call_by_call_id(core_data->telephony_handle, call_id, &call_data_out);
+ _callmgr_telephony_get_call_type(call_data_out, &call_type);
+ __callmgr_core_convert_tel_call_type(call_type, &cm_call_type);
+ /********setting the mute status to off initially which treats every call as new call ***/
+ /*****and sets the mute status to off initially********/
+ _callmgr_core_process_set_mute_state(core_data, 0);
+
+ /* Set call domain for call parameter handling */
+ if (CM_TEL_CALL_TYPE_CS_VOICE == call_type || CM_TEL_CALL_TYPE_CS_VIDEO == call_type || CM_TEL_CALL_TYPE_E911 == call_type)
+ _callmgr_audio_set_calldomain(core_data->audio_handle, CM_AUDIO_CALL_DOMAIN_CS);
+ else
+ _callmgr_audio_set_calldomain(core_data->audio_handle, CM_AUDIO_CALL_DOMAIN_PS);
+
+ _callmgr_dbus_send_call_event(core_data, CALL_MANAGER_CALL_EVENT_ACTIVE_E, call_id, active_sim_slot, end_cause);
+ __callmgr_core_stop_incom_noti(core_data);
+ _callmgr_ringer_destroy_ringtone_stream(core_data->ringer_handle);
+ _callmgr_ringer_stop_local_ringback_tone(core_data->ringer_handle);
+
+ _callmgr_vconf_is_bike_mode_enabled(&is_bike_mode_enabled);
+ if ((core_data->is_auto_answered) && (is_bike_mode_enabled)) {
+ warn("Auto-answered call!![Bike Mode]");
+ _callmgr_audio_set_link_direction_uplink();
+ }
+
+ _callmgr_audio_get_audio_route(core_data->audio_handle, &route);
+ if (route == CALLMGR_AUDIO_ROUTE_NONE_E) {
+ _callmgr_audio_is_sound_device_available(core_data->audio_handle, CALLMGR_AUDIO_DEVICE_BT_E, &is_bt_connected);
+ if (is_bt_connected)
+ _callmgr_audio_set_audio_route(core_data->audio_handle, CALLMGR_AUDIO_ROUTE_BT_E);
else
- _callmgr_audio_set_calldomain(core_data->audio_handle, CM_AUDIO_CALL_DOMAIN_PS);
+ __callmgr_core_set_default_audio_route(core_data);
+ } else {
+ gboolean is_ringtone_mode = FALSE;
+
+ _callmgr_audio_is_ringtone_mode(core_data->audio_handle, &is_ringtone_mode);
+ if (is_ringtone_mode) {
+ /* Active > 2nd incoming > End active > Incoming > Active */
+ /* We need to set previous audio route */
+ warn("Set prev route");
+ int ret = _callmgr_audio_set_audio_route(core_data->audio_handle, route);
+ if (ret < 0) {
+ err("_callmgr_audio_set_audio_route() fails");
+ }
+ }
+ }
- _callmgr_dbus_send_call_event(core_data, CALL_MANAGER_CALL_EVENT_ACTIVE_E, call_id, active_sim_slot, end_cause);
- __callmgr_core_stop_incom_noti(core_data);
- _callmgr_ringer_destroy_ringtone_stream(core_data->ringer_handle);
- _callmgr_ringer_stop_local_ringback_tone(core_data->ringer_handle);
+ if (core_data->call_status != CALL_MANAGER_CALL_STATUS_OFFHOOK_E) {
+ __callmgr_core_set_call_status(core_data, CALL_MANAGER_CALL_STATUS_OFFHOOK_E, cm_call_type, NULL);
+ }
- _callmgr_vconf_is_bike_mode_enabled(&is_bike_mode_enabled);
- if ((core_data->is_auto_answered) && (is_bike_mode_enabled)) {
- warn("Auto-answered call!![Bike Mode]");
- _callmgr_audio_set_link_direction_uplink();
+ __callmgr_core_send_bt_events(core_data, 0);
+
+ __callmgr_core_process_dtmf_number(core_data);
+
+ if ((core_data->is_auto_answered) && (is_bike_mode_enabled)) {
+ warn("Auto-answered call!![Bike Mode]");
+ // Play answer msg
+ if (_callmgr_answer_msg_init(&core_data->answer_msg_handle) < 0) {
+ err("_callmgr_answer_msg_init() failed");
+ _callmgr_core_process_end_call(core_data, call_id, CM_TEL_CALL_RELEASE_TYPE_BY_CALL_HANDLE);
+ core_data->is_auto_answered = FALSE;
+ } else if (_callmgr_answer_msg_play_msg(core_data->answer_msg_handle, __callmgr_core_answer_msg_finished_cb, core_data) < 0) {
+ _callmgr_core_process_end_call(core_data, call_id, CM_TEL_CALL_RELEASE_TYPE_BY_CALL_HANDLE);
+ _callmgr_answer_msg_deinit(core_data->answer_msg_handle);
+ core_data->answer_msg_handle = NULL;
+ core_data->is_auto_answered = FALSE;
+ }
+ }
+}
+
+static void __callmgr_core_process_telephony_event_DIALING(callmgr_core_data_t *core_data, void *event_data, cm_telepony_sim_slot_type_e active_sim_slot)
+{
+ callmgr_audio_route_e route = CALLMGR_AUDIO_ROUTE_NONE_E;
+ gboolean is_bt_connected = FALSE;
+ cm_telephony_end_cause_type_e end_cause = CM_TELEPHONY_ENDCAUSE_MAX;
+
+ int ret = 0;
+ unsigned int call_id = GPOINTER_TO_UINT(event_data);
+ char *number = NULL;
+ callmgr_contact_info_t *contact_out_info = NULL;
+ cm_telephony_call_data_t *call_data_out = NULL;
+ cm_telephony_call_type_e tel_call_type = CM_TEL_CALL_TYPE_INVALID;
+ callmgr_call_type_e cm_call_type = CALL_TYPE_INVALID_E;
+ callmgr_audio_session_mode_e sound_mode = CALLMGR_AUDIO_SESSION_NONE_E;
+
+ _callmgr_telephony_get_call_by_call_id(core_data->telephony_handle, call_id, &call_data_out);
+ /*Update Contact Info in contact list*/
+ if (call_data_out) {
+ _callmgr_telephony_get_call_type(call_data_out, &tel_call_type);
+ _callmgr_telephony_get_call_number(call_data_out, &number);
+ _callmgr_ct_add_ct_info((const char *)number, call_id, &contact_out_info);
+ if (contact_out_info) {
+ int person_id = -1;
+ _callmgr_ct_get_person_id(call_id, &person_id);
+ dbg("Contact Info added successfully for CallId : %d, ContactIdx : %d", call_id, person_id);
+ } else {
+ err("Failed to add contact object");
}
+ g_free(number);
+ }
+
+ _callmgr_dbus_send_call_event(core_data, CALL_MANAGER_CALL_EVENT_DIALING_E, call_id, active_sim_slot, end_cause);
+ __callmgr_core_send_bt_events(core_data, 0);
+
+ __callmgr_core_convert_tel_call_type(tel_call_type, &cm_call_type);
+ if (CALL_TYPE_VOICE_E == cm_call_type) {
+ sound_mode = CALLMGR_AUDIO_SESSION_VOICE_E;
+ } else {
+ sound_mode = CALLMGR_AUDIO_SESSION_VIDEO_E;
+ }
+
+ /* Set call domain for call parameter handling */
+ if (CM_TEL_CALL_TYPE_CS_VOICE == tel_call_type || CM_TEL_CALL_TYPE_CS_VIDEO == tel_call_type || CM_TEL_CALL_TYPE_E911 == tel_call_type)
+ _callmgr_audio_set_calldomain(core_data->audio_handle, CM_AUDIO_CALL_DOMAIN_CS);
+ else
+ _callmgr_audio_set_calldomain(core_data->audio_handle, CM_AUDIO_CALL_DOMAIN_PS);
+
+ _callmgr_ringer_stop_signal(core_data->ringer_handle);
+ _callmgr_ringer_stop_effect(core_data->ringer_handle);
+
+ ret = _callmgr_audio_create_call_sound_session(core_data->audio_handle, sound_mode);
+ if (ret < 0) {
+ err("_callmgr_audio_create_call_sound_session() failed");
+ }
+
+ /*
+ * Callmgr need to acquire the sound stream focus in MO call dialing state.
+ * In case of dialing when media is playing, media stream will be paused quickly.
+ */
+ ret = _callmgr_audio_acquire_sound_stream_focus(core_data->audio_handle);
+ if (ret < 0) {
+ err("_callmgr_audio_acquire_sound_stream_focus() failed");
+ }
+
+ /*
+ * In case of TM1 device, audio routing logic should be handled
+ * by multimedia framework not telephony to support local ringback tone play
+ * during call establishment. In this case, "START" signal will be invoked from multimedia.
+ * so, audio routing logic will be triggered not here.
+ */
+ if (!g_strcmp0(core_data->model_name, "TM1")) {
+ dbg("Should not start virtual stream in here in TM1 device. START signal will be invoked");
+ } else {
_callmgr_audio_get_audio_route(core_data->audio_handle, &route);
if (route == CALLMGR_AUDIO_ROUTE_NONE_E) {
_callmgr_audio_is_sound_device_available(core_data->audio_handle, CALLMGR_AUDIO_DEVICE_BT_E, &is_bt_connected);
_callmgr_audio_set_audio_route(core_data->audio_handle, CALLMGR_AUDIO_ROUTE_BT_E);
else
__callmgr_core_set_default_audio_route(core_data);
- } else {
- gboolean is_ringtone_mode = FALSE;
-
- _callmgr_audio_is_ringtone_mode(core_data->audio_handle, &is_ringtone_mode);
- if (is_ringtone_mode) {
- /* Active > 2nd incoming > End active > Incoming > Active */
- /* We need to set previous audio route */
- warn("Set prev route");
- int ret = _callmgr_audio_set_audio_route(core_data->audio_handle, route);
- if (ret < 0) {
- err("_callmgr_audio_set_audio_route() fails");
- }
- }
}
+ }
- if (core_data->call_status != CALL_MANAGER_CALL_STATUS_OFFHOOK_E) {
- __callmgr_core_set_call_status(core_data, CALL_MANAGER_CALL_STATUS_OFFHOOK_E, cm_call_type, NULL);
+ if (core_data->call_status != CALL_MANAGER_CALL_STATUS_OFFHOOK_E) {
+ __callmgr_core_set_call_status(core_data, CALL_MANAGER_CALL_STATUS_OFFHOOK_E, cm_call_type, NULL);
+ }
+}
+
+static void __callmgr_core_process_telephony_event_INCOMING(callmgr_core_data_t *core_data, void *event_data, cm_telepony_sim_slot_type_e active_sim_slot)
+{
+ cm_telephony_call_data_t *call = (cm_telephony_call_data_t *)event_data;
+ callmgr_call_type_e cm_call_type = CALL_TYPE_INVALID_E;
+ cm_telephony_call_type_e call_type = CM_TEL_CALL_TYPE_INVALID;
+
+ if (call) {
+ char *number = NULL;
+ _callmgr_telephony_get_call_number(call, &number);
+ gboolean is_rec_blocked = FALSE;
+ gboolean is_bike_mode_enabled = FALSE;
+ gboolean is_low_battery = FALSE;
+ int call_cnt = -1;
+ gboolean is_do_not_disturb = FALSE;
+ gboolean is_blocked = FALSE;
+
+ _callmgr_telephony_get_call_type(call, &call_type);
+ __callmgr_core_convert_tel_call_type(call_type, &cm_call_type);
+
+ /* Video call does not support on SPIN. Reject video call */
+ if (cm_call_type == CALL_TYPE_VIDEO_E) {
+ warn("Video call does not support currently! Rejecting incoming call");
+ _callmgr_telephony_reject_call(core_data->telephony_handle);
+ g_free(number);
+ return;
}
- __callmgr_core_send_bt_events(core_data, 0);
+ _callmgr_util_check_blocking_number(number, &is_blocked);
+ _callmgr_vconf_is_recording_reject_enabled(&is_rec_blocked);
+ _callmgr_vconf_is_bike_mode_enabled(&is_bike_mode_enabled);
+ _callmgr_vconf_is_low_battery(&is_low_battery);
- __callmgr_core_process_dtmf_number(core_data);
+ _callmgr_util_check_disturbing_setting(number, &is_do_not_disturb);
+ _callmgr_telephony_get_call_count(core_data->telephony_handle, &call_cnt);
+ if ((is_blocked == TRUE)
+ || (is_rec_blocked == TRUE)
+ || (is_do_not_disturb == TRUE)
+ || ((is_bike_mode_enabled == TRUE) && (call_cnt > 1)) // if 2nd incoming call
+ || ((is_bike_mode_enabled == TRUE) && (cm_call_type == CALL_TYPE_VIDEO_E))) {
+ warn("Auto reject incoming call");
+ callmgr_contact_info_t *contact_out_info = NULL;
+
+ int ret = _callmgr_telephony_reject_call(core_data->telephony_handle);
+ if (ret < 0) {
+ err("_callmgr_telephony_reject_call() get failed");
+ }
+ /* Add contact info for blocked number */
+ _callmgr_ct_add_ct_info((const char *)number, core_data->incom->call_id, &contact_out_info);
- if ((core_data->is_auto_answered) && (is_bike_mode_enabled)) {
- warn("Auto-answered call!![Bike Mode]");
- // Play answer msg
- if (_callmgr_answer_msg_init(&core_data->answer_msg_handle) < 0) {
- err("_callmgr_answer_msg_init() failed");
- _callmgr_core_process_end_call(core_data, call_id, CM_TEL_CALL_RELEASE_TYPE_BY_CALL_HANDLE);
- core_data->is_auto_answered = FALSE;
- } else if (_callmgr_answer_msg_play_msg(core_data->answer_msg_handle, __callmgr_core_answer_msg_finished_cb, core_data) < 0) {
- _callmgr_core_process_end_call(core_data, call_id, CM_TEL_CALL_RELEASE_TYPE_BY_CALL_HANDLE);
- _callmgr_answer_msg_deinit(core_data->answer_msg_handle);
- core_data->answer_msg_handle = NULL;
- core_data->is_auto_answered = FALSE;
+ if (is_rec_blocked) {
+ _callmgr_ct_set_log_reject_type(core_data->incom->call_id, CM_CT_PLOG_REJECT_TYPE_REC_REJECT_E);
+ } else if (is_do_not_disturb) {
+ _callmgr_ct_set_log_reject_type(core_data->incom->call_id, CM_CT_PLOG_REJECT_TYPE_SETTING_REJECT_E);
+ } else {
+ _callmgr_ct_set_log_reject_type(core_data->incom->call_id, CM_CT_PLOG_REJECT_TYPE_BLOCKED_E);
}
+ } else if ((is_low_battery == TRUE) && (cm_call_type == CALL_TYPE_VIDEO_E)) {
+ warn("Low battery video call");
+ /* Low battery is lower priority than other block cause */
+ callmgr_contact_info_t *contact_out_info = NULL;
+
+ int ret = _callmgr_telephony_reject_call(core_data->telephony_handle);
+ if (ret < 0) {
+ err("_callmgr_telephony_reject_call() get failed");
+ }
+ _callmgr_ct_add_ct_info((const char *)number, core_data->incom->call_id, &contact_out_info);
+ _callmgr_ct_set_log_reject_type(core_data->incom->call_id, CM_CT_PLOG_REJECT_TYPE_BLOCKED_E);
+
+ _callmgr_util_launch_popup(CALL_POPUP_CALL_ERR, CALL_ERR_LOW_BATTERY_INCOMING, NULL, 0, NULL, NULL);
+ } else {
+ __callmgr_core_process_incoming_call(core_data, call, active_sim_slot);
+ __callmgr_core_set_call_status(core_data, CALL_MANAGER_CALL_STATUS_RINGING_E, cm_call_type, number);
}
+ g_free(number);
}
- break;
- case CM_TELEPHONY_EVENT_HELD:
- {
- unsigned int call_id = GPOINTER_TO_UINT(event_data);
+}
- _callmgr_dbus_send_call_event(core_data, CALL_MANAGER_CALL_EVENT_HELD_E, call_id, active_sim_slot, end_cause);
- __callmgr_core_send_bt_events(core_data, 0);
+static void __callmgr_core_process_telephony_event_SAT_SETUP_CALL(callmgr_core_data_t *core_data, cm_telepony_sim_slot_type_e active_sim_slot)
+{
+ int ret = 0;
+ char *number = NULL;
+ cm_telephony_sat_setup_call_type_e sat_setup_call_type = CM_TELEPHONY_SAT_SETUP_CALL_RESERVED;
+ int call_cnt = 0;
+
+ CM_RETURN_IF_FAIL(core_data);
+
+ _callmgr_telephony_get_sat_setup_call_number(core_data->telephony_handle, &number);
+ _callmgr_telephony_get_sat_setup_call_type(core_data->telephony_handle, &sat_setup_call_type);
+ _callmgr_telephony_get_call_count(core_data->telephony_handle, &call_cnt);
+
+ if (!number) {
+ err("number is NULL.");
+ goto SAT_SETUP_CALL_FAIL_EXIT;
}
- break;
- case CM_TELEPHONY_EVENT_DIALING:
- {
- int ret = 0;
- unsigned int call_id = GPOINTER_TO_UINT(event_data);
- char *number = NULL;
- callmgr_contact_info_t *contact_out_info = NULL;
- cm_telephony_call_data_t *call_data_out = NULL;
- cm_telephony_call_type_e tel_call_type = CM_TEL_CALL_TYPE_INVALID;
- callmgr_call_type_e cm_call_type = CALL_TYPE_INVALID_E;
- callmgr_audio_session_mode_e sound_mode = CALLMGR_AUDIO_SESSION_NONE_E;
-
- _callmgr_telephony_get_call_by_call_id(core_data->telephony_handle, call_id, &call_data_out);
- /*Update Contact Info in contact list*/
- if (call_data_out) {
- _callmgr_telephony_get_call_type(call_data_out, &tel_call_type);
- _callmgr_telephony_get_call_number(call_data_out, &number);
- _callmgr_ct_add_ct_info((const char *)number, call_id, &contact_out_info);
- if (contact_out_info) {
- int person_id = -1;
- _callmgr_ct_get_person_id(call_id, &person_id);
- dbg("Contact Info added successfully for CallId : %d, ContactIdx : %d", call_id, person_id);
- } else {
- err("Failed to add contact object");
- }
+ info("setup_call_type(%d), number(%s), current call_cnt(%d)", sat_setup_call_type, number, call_cnt);
+
+ if (call_cnt > 0) {
+ switch (sat_setup_call_type) {
+ case CM_TELEPHONY_SAT_SETUP_CALL_IF_ANOTHER_CALL_NOT_BUSY_WITH_REDIAL:
+ case CM_TELEPHONY_SAT_SETUP_CALL_IF_ANOTHER_CALL_NOT_BUSY:
+ warn("There is another call. send fail TR.");
+ goto SAT_SETUP_CALL_FAIL_EXIT;
+ break;
+ case CM_TELEPHONY_SAT_SETUP_CALL_PUT_ALL_OTHER_CALLS_ON_HOLD_WITH_REDIAL:
+ case CM_TELEPHONY_SAT_SETUP_CALL_PUT_ALL_OTHER_CALLS_ON_HOLD:
+ if (core_data->incom) {
+ warn("There is incoming call.");
+ goto SAT_SETUP_CALL_FAIL_EXIT;
+ } else if (core_data->active_dial) {
+ if (core_data->active_dial->call_state == CM_TEL_CALL_STATE_DIALING
+ || core_data->active_dial->call_state == CM_TEL_CALL_STATE_ALERT) {
+ warn("Call is dialing or alerting.");
+ goto SAT_SETUP_CALL_FAIL_EXIT;
+ } else if (core_data->held) {
+ warn("There are already 2 calls which active & held.");
+ goto SAT_SETUP_CALL_FAIL_EXIT;
+ }
+
+ info("Put all other calls on hold. after that request setup call.")
+ ret = _callmgr_telephony_hold_call(core_data->telephony_handle);
+ if (ret < 0) {
+ err("_callmgr_telephony_hold_call[%d] failed.", ret);
+ goto SAT_SETUP_CALL_FAIL_EXIT;
+ }
+ g_free(number);
+ return;
+ }
+ break;
+ case CM_TELEPHONY_SAT_SETUP_CALL_DISCONN_ALL_OTHER_CALLS_WITH_REDIAL:
+ case CM_TELEPHONY_SAT_SETUP_CALL_DISCONN_ALL_OTHER_CALLS:
+ info("Disconnect all other calls. after that request setup call.")
+ ret = _callmgr_core_process_end_call(core_data, 0, CM_TEL_CALL_RELEASE_TYPE_ALL_CALLS);
+ if (ret < 0) {
+ err("_callmgr_core_process_end_call[%d] failed.", ret);
+ goto SAT_SETUP_CALL_FAIL_EXIT;
+ }
g_free(number);
+ return;
+ break;
+ default:
+ warn("Unhandled type[%d]", sat_setup_call_type);
+ goto SAT_SETUP_CALL_FAIL_EXIT;
+ break;
+ }
+ } else {
+ callmgr_audio_session_mode_e session_mode = CALLMGR_AUDIO_SESSION_NONE_E;
+ _callmgr_audio_get_session_mode(core_data->audio_handle, &session_mode);
+ if (session_mode == CALLMGR_AUDIO_SESSION_VIDEO_E) {
+ warn("VT remain");
+ /* VT session was not destroyed. Send fail response for SAT */
+ goto SAT_SETUP_CALL_FAIL_EXIT;
}
+ }
- _callmgr_dbus_send_call_event(core_data, CALL_MANAGER_CALL_EVENT_DIALING_E, call_id, active_sim_slot, end_cause);
- __callmgr_core_send_bt_events(core_data, 0);
+ ret = _callmgr_util_launch_callui_by_sat(active_sim_slot);
+ if (ret != 0) {
+ err("_callmgr_util_launch_callui_by_sat() is failed[%d].", ret);
+ goto SAT_SETUP_CALL_FAIL_EXIT;
+ }
- __callmgr_core_convert_tel_call_type(tel_call_type, &cm_call_type);
- if (CALL_TYPE_VOICE_E == cm_call_type) {
- sound_mode = CALLMGR_AUDIO_SESSION_VOICE_E;
- } else {
- sound_mode = CALLMGR_AUDIO_SESSION_VIDEO_E;
- }
+ ret = _callmgr_core_process_dial(core_data, number, CALL_TYPE_VOICE_E,
+ active_sim_slot, 0, FALSE, TRUE);
+ if (ret != 0) {
+ err("_callmgr_core_process_dial() is failed[%d].", ret);
+ goto SAT_SETUP_CALL_FAIL_EXIT;
+ }
- /* Set call domain for call parameter handling */
- if (CM_TEL_CALL_TYPE_CS_VOICE == tel_call_type || CM_TEL_CALL_TYPE_CS_VIDEO == tel_call_type || CM_TEL_CALL_TYPE_E911 == tel_call_type)
- _callmgr_audio_set_calldomain(core_data->audio_handle, CM_AUDIO_CALL_DOMAIN_CS);
- else
- _callmgr_audio_set_calldomain(core_data->audio_handle, CM_AUDIO_CALL_DOMAIN_PS);
+ // will send sat response when setup call is succesfull.
+ g_free(number);
+ return;
- _callmgr_ringer_stop_signal(core_data->ringer_handle);
- _callmgr_ringer_stop_effect(core_data->ringer_handle);
+SAT_SETUP_CALL_FAIL_EXIT:
+ _callmgr_telephony_send_sat_response(core_data->telephony_handle,
+ CM_TELEPHONY_SAT_EVENT_SETUP_CALL, CM_TELEPHONY_SAT_RESPONSE_ME_UNABLE_TO_PROCESS_COMMAND, CM_TELEPHONY_SIM_UNKNOWN);
+ g_free(number);
+ return;
+}
- ret = _callmgr_audio_create_call_sound_session(core_data->audio_handle, sound_mode);
- if (ret < 0) {
- err("_callmgr_audio_create_call_sound_session() failed");
- }
- /*
- * Callmgr need to acquire the sound stream focus in MO call dialing state.
- * In case of dialing when media is playing, media stream will be paused quickly.
- */
- ret = _callmgr_audio_acquire_sound_stream_focus(core_data->audio_handle);
- if (ret < 0) {
- err("_callmgr_audio_acquire_sound_stream_focus() failed");
- }
+static void __callmgr_core_process_telephony_events(cm_telephony_event_type_e event_type, void *event_data, void *user_data)
+{
+ callmgr_core_data_t *core_data = (callmgr_core_data_t *)user_data;
+ cm_telepony_sim_slot_type_e active_sim_slot = 0;
+ cm_telephony_end_cause_type_e end_cause = CM_TELEPHONY_ENDCAUSE_MAX;
+ dbg("event_type[%d]", event_type);
+ CM_RETURN_IF_FAIL(core_data);
- /*
- * In case of TM1 device, audio routing logic should be handled
- * by multimedia framework not telephony to support local ringback tone play
- * during call establishment. In this case, "START" signal will be invoked from multimedia.
- * so, audio routing logic will be triggered not here.
- */
- if (!g_strcmp0(core_data->model_name, "TM1")) {
- dbg("Should not start virtual stream in here in TM1 device. START signal will be invoked");
- } else {
- _callmgr_audio_get_audio_route(core_data->audio_handle, &route);
- if (route == CALLMGR_AUDIO_ROUTE_NONE_E) {
- _callmgr_audio_is_sound_device_available(core_data->audio_handle, CALLMGR_AUDIO_DEVICE_BT_E, &is_bt_connected);
- if (is_bt_connected)
- _callmgr_audio_set_audio_route(core_data->audio_handle, CALLMGR_AUDIO_ROUTE_BT_E);
- else
- __callmgr_core_set_default_audio_route(core_data);
- }
- }
+ if ((event_type > CM_TELEPHONY_EVENT_IDLE) && (event_type <= CM_TELEPHONY_EVENT_RETRIEVED)) {
+ /* Update call data for status event*/
+ __callmgr_core_update_all_call_data(core_data);
+ }
- if (core_data->call_status != CALL_MANAGER_CALL_STATUS_OFFHOOK_E) {
- __callmgr_core_set_call_status(core_data, CALL_MANAGER_CALL_STATUS_OFFHOOK_E, cm_call_type, NULL);
- }
+ _callmgr_telephony_get_active_sim_slot(core_data->telephony_handle, &active_sim_slot);
+
+ switch (event_type) {
+ case CM_TELEPHONY_EVENT_IDLE:
+ {
+ __callmgr_core_process_telephony_event_IDLE(core_data, event_data, active_sim_slot);
+ }
+ break;
+ case CM_TELEPHONY_EVENT_ACTIVE:
+ {
+ __callmgr_core_process_telephony_event_ACTIVE(core_data, event_data, active_sim_slot);
+ }
+ break;
+ case CM_TELEPHONY_EVENT_HELD:
+ {
+ unsigned int call_id = GPOINTER_TO_UINT(event_data);
+
+ _callmgr_dbus_send_call_event(core_data, CALL_MANAGER_CALL_EVENT_HELD_E, call_id, active_sim_slot, end_cause);
+ __callmgr_core_send_bt_events(core_data, 0);
+ }
+ break;
+ case CM_TELEPHONY_EVENT_DIALING:
+ {
+ __callmgr_core_process_telephony_event_DIALING(core_data, event_data, active_sim_slot);
}
break;
case CM_TELEPHONY_EVENT_ALERT:
break;
case CM_TELEPHONY_EVENT_INCOMING:
{
- cm_telephony_call_data_t *call = (cm_telephony_call_data_t *)event_data;
- callmgr_call_type_e cm_call_type = CALL_TYPE_INVALID_E;
- cm_telephony_call_type_e call_type = CM_TEL_CALL_TYPE_INVALID;
-
- if (call) {
- char *number = NULL;
- _callmgr_telephony_get_call_number(call, &number);
- gboolean is_rec_blocked = FALSE;
- gboolean is_bike_mode_enabled = FALSE;
- gboolean is_low_battery = FALSE;
- int call_cnt = -1;
- gboolean is_do_not_disturb = FALSE;
- gboolean is_blocked = FALSE;
-
- _callmgr_telephony_get_call_type(call, &call_type);
- __callmgr_core_convert_tel_call_type(call_type, &cm_call_type);
-
- /* Video call does not support on SPIN. Reject video call */
- if (cm_call_type == CALL_TYPE_VIDEO_E) {
- warn("Video call does not support currently! Rejecting incoming call");
- _callmgr_telephony_reject_call(core_data->telephony_handle);
- g_free(number);
- return;
- }
-
- _callmgr_util_check_blocking_number(number, &is_blocked);
- _callmgr_vconf_is_recording_reject_enabled(&is_rec_blocked);
- _callmgr_vconf_is_bike_mode_enabled(&is_bike_mode_enabled);
- _callmgr_vconf_is_low_battery(&is_low_battery);
-
- _callmgr_util_check_disturbing_setting(number, &is_do_not_disturb);
- _callmgr_telephony_get_call_count(core_data->telephony_handle, &call_cnt);
- if ((is_blocked == TRUE)
- || (is_rec_blocked == TRUE)
- || (is_do_not_disturb == TRUE)
- || ((is_bike_mode_enabled == TRUE) && (call_cnt > 1)) // if 2nd incoming call
- || ((is_bike_mode_enabled == TRUE) && (cm_call_type == CALL_TYPE_VIDEO_E))) {
- warn("Auto reject incoming call");
- callmgr_contact_info_t *contact_out_info = NULL;
-
- int ret = _callmgr_telephony_reject_call(core_data->telephony_handle);
- if (ret < 0) {
- err("_callmgr_telephony_reject_call() get failed");
- }
- /* Add contact info for blocked number */
- _callmgr_ct_add_ct_info((const char *)number, core_data->incom->call_id, &contact_out_info);
-
- if (is_rec_blocked) {
- _callmgr_ct_set_log_reject_type(core_data->incom->call_id, CM_CT_PLOG_REJECT_TYPE_REC_REJECT_E);
- } else if (is_do_not_disturb) {
- _callmgr_ct_set_log_reject_type(core_data->incom->call_id, CM_CT_PLOG_REJECT_TYPE_SETTING_REJECT_E);
- } else {
- _callmgr_ct_set_log_reject_type(core_data->incom->call_id, CM_CT_PLOG_REJECT_TYPE_BLOCKED_E);
- }
- } else if ((is_low_battery == TRUE) && (cm_call_type == CALL_TYPE_VIDEO_E)) {
- warn("Low battery video call");
- /* Low battery is lower priority than other block cause */
- callmgr_contact_info_t *contact_out_info = NULL;
-
- int ret = _callmgr_telephony_reject_call(core_data->telephony_handle);
- if (ret < 0) {
- err("_callmgr_telephony_reject_call() get failed");
- }
- _callmgr_ct_add_ct_info((const char *)number, core_data->incom->call_id, &contact_out_info);
- _callmgr_ct_set_log_reject_type(core_data->incom->call_id, CM_CT_PLOG_REJECT_TYPE_BLOCKED_E);
-
- _callmgr_util_launch_popup(CALL_POPUP_CALL_ERR, CALL_ERR_LOW_BATTERY_INCOMING, NULL, 0, NULL, NULL);
- } else {
- __callmgr_core_process_incoming_call(core_data, call, active_sim_slot);
- __callmgr_core_set_call_status(core_data, CALL_MANAGER_CALL_STATUS_RINGING_E, cm_call_type, number);
- }
- g_free(number);
- break;
- }
+ __callmgr_core_process_telephony_event_INCOMING(core_data, event_data, active_sim_slot);
}
break;
case CM_TELEPHONY_EVENT_WAITING:
break;
case CM_TELEPHONY_EVENT_SAT_SETUP_CALL:
{
- int ret = 0;
- char *number = NULL;
- cm_telephony_sat_setup_call_type_e sat_setup_call_type = CM_TELEPHONY_SAT_SETUP_CALL_RESERVED;
- int call_cnt = 0;
-
- _callmgr_telephony_get_sat_setup_call_number(core_data->telephony_handle, &number);
- _callmgr_telephony_get_sat_setup_call_type(core_data->telephony_handle, &sat_setup_call_type);
- _callmgr_telephony_get_call_count(core_data->telephony_handle, &call_cnt);
-
- if (!number) {
- err("number is NULL.");
- goto SAT_SETUP_CALL_FAIL_EXIT;
- }
-
- info("setup_call_type(%d), number(%s), current call_cnt(%d)", sat_setup_call_type, number, call_cnt);
-
- if (call_cnt > 0) {
- switch (sat_setup_call_type) {
- case CM_TELEPHONY_SAT_SETUP_CALL_IF_ANOTHER_CALL_NOT_BUSY_WITH_REDIAL:
- case CM_TELEPHONY_SAT_SETUP_CALL_IF_ANOTHER_CALL_NOT_BUSY:
- warn("There is another call. send fail TR.");
- goto SAT_SETUP_CALL_FAIL_EXIT;
- break;
- case CM_TELEPHONY_SAT_SETUP_CALL_PUT_ALL_OTHER_CALLS_ON_HOLD_WITH_REDIAL:
- case CM_TELEPHONY_SAT_SETUP_CALL_PUT_ALL_OTHER_CALLS_ON_HOLD:
- if (core_data->incom) {
- warn("There is incoming call.");
- goto SAT_SETUP_CALL_FAIL_EXIT;
- } else if (core_data->active_dial) {
- if (core_data->active_dial->call_state == CM_TEL_CALL_STATE_DIALING
- || core_data->active_dial->call_state == CM_TEL_CALL_STATE_ALERT) {
- warn("Call is dialing or alerting.");
- goto SAT_SETUP_CALL_FAIL_EXIT;
- } else if (core_data->held) {
- warn("There are already 2 calls which active & held.");
- goto SAT_SETUP_CALL_FAIL_EXIT;
- }
-
- info("Put all other calls on hold. after that request setup call.")
- ret = _callmgr_telephony_hold_call(core_data->telephony_handle);
- if (ret < 0) {
- err("_callmgr_telephony_hold_call[%d] failed.", ret);
- goto SAT_SETUP_CALL_FAIL_EXIT;
- }
- g_free(number);
- return;
- }
- break;
- case CM_TELEPHONY_SAT_SETUP_CALL_DISCONN_ALL_OTHER_CALLS_WITH_REDIAL:
- case CM_TELEPHONY_SAT_SETUP_CALL_DISCONN_ALL_OTHER_CALLS:
- info("Disconnect all other calls. after that request setup call.")
- ret = _callmgr_core_process_end_call(core_data, 0, CM_TEL_CALL_RELEASE_TYPE_ALL_CALLS);
- if (ret < 0) {
- err("_callmgr_core_process_end_call[%d] failed.", ret);
- goto SAT_SETUP_CALL_FAIL_EXIT;
- }
- g_free(number);
- return;
- break;
- default:
- warn("Unhandled type[%d]", sat_setup_call_type);
- goto SAT_SETUP_CALL_FAIL_EXIT;
- break;
- }
- } else {
- callmgr_audio_session_mode_e session_mode = CALLMGR_AUDIO_SESSION_NONE_E;
- _callmgr_audio_get_session_mode(core_data->audio_handle, &session_mode);
- if (session_mode == CALLMGR_AUDIO_SESSION_VIDEO_E) {
- warn("VT remain");
- /* VT session was not destroyed. Send fail response for SAT */
- goto SAT_SETUP_CALL_FAIL_EXIT;
- }
- }
-
- ret = _callmgr_util_launch_callui_by_sat(active_sim_slot);
- if (ret != 0) {
- err("_callmgr_util_launch_callui_by_sat() is failed[%d].", ret);
- goto SAT_SETUP_CALL_FAIL_EXIT;
- }
-
- ret = _callmgr_core_process_dial(core_data, number, CALL_TYPE_VOICE_E,
- active_sim_slot, 0, FALSE, TRUE);
- if (ret != 0) {
- err("_callmgr_core_process_dial() is failed[%d].", ret);
- goto SAT_SETUP_CALL_FAIL_EXIT;
- }
-
- // will send sat response when setup call is succesfull.
- g_free(number);
- return;
-
-SAT_SETUP_CALL_FAIL_EXIT:
- _callmgr_telephony_send_sat_response(core_data->telephony_handle,
- CM_TELEPHONY_SAT_EVENT_SETUP_CALL, CM_TELEPHONY_SAT_RESPONSE_ME_UNABLE_TO_PROCESS_COMMAND, CM_TELEPHONY_SIM_UNKNOWN);
- g_free(number);
- return;
+ __callmgr_core_process_telephony_event_SAT_SETUP_CALL(core_data, active_sim_slot);
}
break;
case CM_TELEPHONY_EVENT_SAT_SEND_DTMF: