Code sync from SPIN 84/51984/1 accepted/tizen/mobile/20151119.033620 accepted/tizen/tv/20151119.033626 accepted/tizen/wearable/20151119.033643 submit/tizen/20151119.015154
authordc7.lim <dc7.lim@samsung.com>
Wed, 18 Nov 2015 02:46:50 +0000 (11:46 +0900)
committerdc7.lim <dc7.lim@samsung.com>
Wed, 18 Nov 2015 02:46:50 +0000 (11:46 +0900)
Change-Id: Ide42c02d2c4db8c8d9ab31bdb6cbc31a9fc51832

27 files changed:
callmgr-popup/include/callmgr-popup-common.h
callmgr-popup/src/callmgr-popup-main.c
callmgr-popup/src/callmgr-popup-util.c
callmgr-popup/src/callmgr-popup-widget.c
common/include/callmgr-log.h
common/include/callmgr-util.h
common/include/callmgr-vconf.h
common/src/callmgr-util-dummy.c
common/src/callmgr-util-ext.c
common/src/callmgr-util.c
common/src/callmgr-vconf-ext.c
common/src/callmgr-vconf.c
introspection/call-manager.xml
module/include/callmgr-audio.h
module/include/callmgr-telephony.h
module/src/callmgr-answer-msg.c
module/src/callmgr-audio.c
module/src/callmgr-bt.c
module/src/callmgr-contact.c
module/src/callmgr-ringer.c
module/src/callmgr-sensor.c
module/src/callmgr-telephony.c
module/src/callmgr-vr.c
packaging/call-manager.spec
service/include/callmgr-core.h
service/src/callmgr-core.c
service/src/callmgr-dbus.c

index e928458..ce96d57 100755 (executable)
@@ -81,6 +81,7 @@ typedef enum {
 
 typedef enum {
        CALLMGR_POPUP_TOAST_SWAP_CALL,
+       CALLMGR_POPUP_TOAST_CUSTOM,
        CALLMGR_POPUP_TOAST_MAX,
 } callmgr_call_popup_toast_type_e;
 
@@ -90,6 +91,7 @@ typedef enum {
        CALLMGR_POPUP_REC_STATUS_STOP_BY_NORMAL_E,
        CALLMGR_POPUP_REC_STATUS_STOP_BY_MEMORY_FULL_E,
        CALLMGR_POPUP_REC_STATUS_STOP_BY_TIME_SHORT_E,
+       CALLMGR_POPUP_REC_STATUS_STOP_BY_NO_ENOUGH_MEMORY_E,
 } callmgr_popup_rec_status_sub_info_e;
 
 typedef enum {
@@ -104,11 +106,13 @@ typedef enum {
        ERR_NOT_REGISTERED_ON_NETWORK_E,
        ERR_PHONE_NOT_INITIALIZED_E,
        ERR_TRANSFER_CALL_FAIL_E,
+       ERR_LOW_BATTERY_INCOMING_E,
        ERR_JOIN_CALL_FAILED_E,
        ERR_HOLD_CALL_FAILED_E,
        ERR_SWAP_CALL_FAILED_E,
        ERR_RETREIVE_CALL_FAILED_E,
        ERR_ANSWER_CALL_FAILED_E,
+       ERR_NO_SIM_E,
 } callmgr_call_err_type_e;
 
 typedef struct appdata {
index be598b4..4876ff8 100755 (executable)
@@ -250,7 +250,7 @@ static void __callmgr_popup_app_service(app_control_h app_control, void *user_da
 
                ret = app_control_get_extra_data(app_control, "SUB_INFO", &sub_info);
                if (ret != 0 || !sub_info) {
-                       err("app_control_get_extra_data() failed[%d] or no extra_data");
+                       ERR("app_control_get_extra_data() failed[%d] or no extra_data");
                        elm_exit();
                }
                DBG("INFO: [%s]", sub_info);
@@ -267,6 +267,9 @@ static void __callmgr_popup_app_service(app_control_h app_control, void *user_da
                case CALLMGR_POPUP_REC_STATUS_STOP_BY_TIME_SHORT_E:
                        _callmgr_popup_create_toast_msg(_("IDS_VR_TPOP_UNABLE_TO_SAVE_RECORDING_RECORDING_TOO_SHORT"));
                        break;
+               case CALLMGR_POPUP_REC_STATUS_STOP_BY_NO_ENOUGH_MEMORY_E:
+                       _callmgr_popup_create_toast_msg(_("IDS_CALL_POP_UNABLE_TO_RECORD_NOT_ENOUGH_MEMORY"));
+                       break;
                default:
                        ERR("unhandled sub info[%d]", rec_status_sub_info);
                        break;
@@ -291,6 +294,10 @@ static void __callmgr_popup_app_service(app_control_h app_control, void *user_da
                case CALLMGR_POPUP_TOAST_SWAP_CALL:
                        _callmgr_popup_create_toast_msg(_("IDS_CALL_TPOP_SWAPPING_CALLS_ING"));
                        break;
+               case CALLMGR_POPUP_TOAST_CUSTOM:
+                       // show ad->dial_num string as it is.
+                       _callmgr_popup_create_toast_msg(_(ad->dial_num));
+                       break;
                default:
                        ERR("unhadled toast popup type(%d)", toast_popup_type);
                        elm_exit();
index a60e60f..501ae2b 100755 (executable)
@@ -101,53 +101,60 @@ char *_callmgr_popup_get_call_err_string(callmgr_call_err_type_e type, char *num
        switch (type) {
        case ERR_CALL_FAILED_E:
                string = _("IDS_CALL_POP_CALLFAILED");
-       break;
+               break;
        case ERR_CALL_NOT_ALLOWED_E:
                string = _("IDS_CALL_POP_CALLNOTCALLOWED");
-       break;
+               break;
        case ERR_EMERGENCY_ONLY_E:
                string = _("IDS_CALL_POP_CALLING_EMERG_ONLY");
-       break;
+               break;
        case ERR_IS_NOT_EMERGENCY_E:
                string = _("IDS_COM_BODY_UNABLE_TO_CALL_PS_IS_NOT_EMERGENCY_NUMBER");
-       break;
+               break;
        case ERR_WRONG_NUMBER_E:
                string = _("IDS_CALL_POP_CAUSE_WRONG_NUMBER");
-       break;
+               break;
        case ERR_FDN_CALL_ONLY_E:
                string = _("IDS_COM_BODY_OUTGOING_CALLS_ARE_RESTRICTED_BY_FDN");
-       break;
+               break;
        case ERR_OUT_OF_SERVICE_E:
                string = _("IDS_COM_BODY_OUT_OF_SERVICE_AREA");
-       break;
+               break;
        case ERR_FAILED_TO_ADD_CALL_E:
                string = _("IDS_CALL_BODY_FAILED_TO_ADD_CALL");
-       break;
+               break;
        case ERR_NOT_REGISTERED_ON_NETWORK_E:
                string = _("IDS_COM_BODY_NOT_REGISTERED_ON_NETWORK");
-       break;
+               break;
        case ERR_PHONE_NOT_INITIALIZED_E:
                string = _("IDS_VCALL_POP_PHONE_NOT_INITIALISED");
-       break;
+               break;
        case ERR_TRANSFER_CALL_FAIL_E:
                string = _("IDS_CALL_POP_TRANSFER_FAILED");
-       break;
+               break;
+       case ERR_LOW_BATTERY_INCOMING_E:
+               string = _("IDS_VCALL_TPOP_UNABLE_TO_CONNECT_VIDEO_CALL_BATTERY_POWER_LOW");
+               break;
        case ERR_JOIN_CALL_FAILED_E:
                string = _("IDS_CALL_POP_UNABLE_TO_MAKE_CONFERENCE_CALLS");
-       break;
+               break;
        case ERR_HOLD_CALL_FAILED_E:
                string = _("IDS_COM_BODY_UNABLE_TO_SWITCH_CALLS");
-       break;
+               break;
        case ERR_ANSWER_CALL_FAILED_E:
                string = _("IDS_CALL_POP_OPERATION_REFUSED");
-       break;
+               break;
        case ERR_SWAP_CALL_FAILED_E:
        case ERR_RETREIVE_CALL_FAILED_E:
                string = _("IDS_CALL_POP_SWAP_FAILED");
-       break;
+               break;
+       case ERR_NO_SIM_E:
+               string = _("IDS_CALL_TPOP_INSERT_SIM_CARD");
+               break;
        default:
                WARN("Invalid info");
                string = NULL;
+               break;
        }
 
        if (type == ERR_IS_NOT_EMERGENCY_E) {
@@ -167,7 +174,7 @@ void _callmgr_popup_reply_to_launch_request(CallMgrPopAppData_t *ad, char *key,
        }
        result = app_control_create(&reply);
        if(result != APP_CONTROL_ERROR_NONE) {
-               warn("app_control_create() return error : %d", result);
+               WARN("app_control_create() return error : %d", result);
                return;
        }
 
index ab13282..ec7cd28 100755 (executable)
@@ -262,13 +262,13 @@ void _callmgr_popup_create_flight_mode(void *data)
        elm_object_text_set(ad->popup, _("IDS_KPD_POP_FLIGHT_MODE_ON_TURN_FLIGHT_MODE_OFF_TO_MAKE_CALLS"));
 
        btn_cancel = elm_button_add(ad->popup);
-       elm_object_style_set(btn_cancel, "default");
+       elm_object_style_set(btn_cancel, "popup");
        elm_object_text_set(btn_cancel, _("IDS_COM_SK_CANCEL"));
        elm_object_part_content_set(ad->popup, "button1", btn_cancel);
        evas_object_smart_callback_add(btn_cancel, "clicked", __callmgr_popup_fm_popup_cancel_cb, ad);
 
        btn_ok = elm_button_add(ad->popup);
-       elm_object_style_set(btn_ok, "default");
+       elm_object_style_set(btn_ok, "popup");
        elm_object_text_set(btn_ok, _("IDS_COM_SK_OK"));
        elm_object_part_content_set(ad->popup, "button2", btn_ok);
        evas_object_smart_callback_add(btn_ok, "clicked", __callmgr_popup_fm_popup_ok_cb, ad);
@@ -556,13 +556,13 @@ void _callmgr_popup_create_try_voice_call(void *data)
        elm_object_text_set(ad->popup, _("IDS_VCALL_POP_TEXT_FALLBACK_VOICE_OUTOF3G"));
 
        btn_cancel = elm_button_add(ad->popup);
-       elm_object_style_set(btn_cancel, "default");
+       elm_object_style_set(btn_cancel, "popup");
        elm_object_text_set(btn_cancel, _("IDS_COM_SK_CANCEL"));
        elm_object_part_content_set(ad->popup, "button1", btn_cancel);
        evas_object_smart_callback_add(btn_cancel, "clicked", __callmgr_popup_try_voice_call_cancel_cb, ad);
 
        btn_ok = elm_button_add(ad->popup);
-       elm_object_style_set(btn_ok, "default");
+       elm_object_style_set(btn_ok, "popup");
        elm_object_text_set(btn_ok, _("IDS_COM_SK_OK"));
        elm_object_part_content_set(ad->popup, "button2", btn_ok);
        evas_object_smart_callback_add(btn_ok, "clicked", __callmgr_popup_try_voice_call_ok_cb, ad);
index 40fed2e..a54db0e 100755 (executable)
@@ -28,15 +28,29 @@ __BEGIN_DECLS
 #define CALLMGR_LOG_TAG "CALL_MGR"
 #endif
 
-#define dbg(fmt,args...)   do { RLOG(LOG_DEBUG, CALLMGR_LOG_TAG, fmt "\n", __func__, __LINE__, ##args); } while (0)
-#define info(fmt,args...)   do { RLOG(LOG_INFO, CALLMGR_LOG_TAG, fmt "\n", __func__, __LINE__, ##args); } while (0)
-#define warn(fmt,args...)   do { RLOG(LOG_WARN, CALLMGR_LOG_TAG, fmt "\n", __func__, __LINE__, ##args); } while (0)
-#define err(fmt,args...)   do { RLOG(LOG_ERROR, CALLMGR_LOG_TAG, fmt "\n", __func__, __LINE__, ##args); } while (0)
-#define fatal(fmt,args...)   do { RLOG(LOG_FATAL, CALLMGR_LOG_TAG, fmt "\n", __func__, __LINE__, ##args); } while (0)
+#define CALLMGR_RLOG_ENABLED 1
 
-#define sec_err(fmt, args...) do { SECURE_RLOG(LOG_ERROR, CALLMGR_LOG_TAG, fmt "\n", __func__, __LINE__, ##args); } while (0)
-#define sec_warn(fmt, args...) do { SECURE_RLOG(LOG_WARN, CALLMGR_LOG_TAG, fmt "\n", __func__, __LINE__, ##args); } while (0)
-#define sec_dbg(fmt, args...) do { SECURE_RLOG(LOG_DEBUG, CALLMGR_LOG_TAG, fmt "\n", __func__, __LINE__, ##args); } while (0)
+#ifdef CALLMGR_RLOG_ENABLED
+#define dbg(fmt,args...)   { RLOG(LOG_DEBUG, CALLMGR_LOG_TAG, fmt "\n", ##args); }
+#define info(fmt,args...)   { RLOG(LOG_INFO, CALLMGR_LOG_TAG, fmt "\n", ##args); }
+#define warn(fmt,args...)   { RLOG(LOG_WARN, CALLMGR_LOG_TAG, fmt "\n", ##args); }
+#define err(fmt,args...)   { RLOG(LOG_ERROR, CALLMGR_LOG_TAG, fmt "\n", ##args); }
+#define fatal(fmt,args...)   { RLOG(LOG_FATAL, CALLMGR_LOG_TAG, fmt "\n", ##args); }
+
+#define sec_err(fmt, arg...) {SECURE_RLOG(LOG_ERROR, CALLMGR_LOG_TAG, fmt"\n", ##arg); }
+#define sec_warn(fmt, arg...) {SECURE_RLOG(LOG_WARN, CALLMGR_LOG_TAG, fmt"\n", ##arg); }
+#define sec_dbg(fmt, arg...) {SECURE_RLOG(LOG_DEBUG, CALLMGR_LOG_TAG, fmt"\n", ##arg); }
+#else
+#define dbg(fmt,args...)   { __dlog_print(LOG_ID_MAIN, DLOG_DEBUG, CALLMGR_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); }
+#define info(fmt,args...)   { __dlog_print(LOG_ID_MAIN, DLOG_WARN, CALLMGR_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); }
+#define warn(fmt,args...)   { __dlog_print(LOG_ID_MAIN, DLOG_WARN, CALLMGR_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); }
+#define err(fmt,args...)   { __dlog_print(LOG_ID_MAIN, DLOG_ERROR, CALLMGR_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); }
+#define fatal(fmt,args...)   { __dlog_print(LOG_ID_MAIN, DLOG_FATAL, CALLMGR_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); }
+
+#define sec_err(fmt, arg...) {SECURE_LOGE(CALLMGR_LOG_TAG, fmt"\n", ##arg); }
+#define sec_warn(fmt, arg...) {SECURE_LOGW(CALLMGR_LOG_TAG, fmt"\n", ##arg); }
+#define sec_dbg(fmt, arg...) {SECURE_LOGD(CALLMGR_LOG_TAG, fmt"\n", ##arg); }
+#endif
 
 #define CM_RETURN_IF_FAIL(scalar_exp) {\
        if (!(scalar_exp)) \
index a92a7a7..1bd7efa 100755 (executable)
@@ -57,16 +57,19 @@ typedef enum {
        CALL_ERR_NOT_REGISTERED_ON_NETWORK,
        CALL_ERR_PHONE_NOT_INITIALIZED,
        CALL_ERR_TRANSFER_CALL_FAILED,
+       CALL_ERR_LOW_BATTERY_INCOMING,
        CALL_ERR_JOIN_CALL_FAILED,
        CALL_ERR_HOLD_CALL_FAILED,
        CALL_ERR_SWAP_CALL_FAILED,
        CALL_ERR_RETRIEVE_CALL_FAILED,
        CALL_ERR_ANSWER_CALL_FAILED,
+       CALL_ERR_NO_SIM,
        CALL_ERR_NONE,
 } call_err_type;
 
 typedef enum {
        CALL_POPUP_TOAST_SWAP_CALL,
+       CALL_POPUP_TOAST_CUSTOM,
        CALL_POPUP_TOAST_MAX,
 } call_popup_toast_type_e;
 
@@ -88,6 +91,7 @@ typedef enum {
        CM_UTIL_REC_STATUS_STOP_BY_NORMAL_E,
        CM_UTIL_REC_STATUS_STOP_BY_MEMORY_FULL_E,
        CM_UTIL_REC_STATUS_STOP_BY_TIME_SHORT,
+       CM_UTIL_REC_STATUS_STOP_BY_NO_ENOUGH_MEMORY,
 } cm_util_rec_status_sub_info_e;
 
 typedef void (*callmgr_util_popup_result_cb) (call_popup_type popup_type, void *result, void *user_data);
@@ -140,6 +144,7 @@ int _callmgr_util_is_incall_ss_string(const char *number, gboolean *o_is_incall_
 int _callmgr_util_launch_ciss(const char* number, int sim_slot);
 
 int _callmgr_util_is_recording_progress(gboolean *is_recording);
+int _callmgr_util_is_video_recording_progress(gboolean *is_recording);
 
 int _callmgr_util_check_disturbing_setting(gboolean *is_do_not_disturb);
 
index 319c21f..ba778fa 100644 (file)
@@ -44,6 +44,7 @@ typedef enum {
 
 int _callmgr_vconf_is_security_lock(gboolean *is_security_lock);
 int _callmgr_vconf_is_pwlock(gboolean *is_pwlock);
+int _callmgr_vconf_is_low_battery(gboolean *is_low_battery);
 int _callmgr_vconf_is_sound_setting_enabled(gboolean *is_sound_enabled);
 int _callmgr_vconf_is_vibration_setting_enabled(gboolean *is_vibration_enabled);
 int _callmgr_vconf_is_vibrate_when_ringing_enabled(gboolean *vibrate_when_ring_flag);
index 0f036aa..661391b 100644 (file)
@@ -24,6 +24,11 @@ int _callmgr_util_is_recording_progress(gboolean *is_recording)
        return -1;
 }
 
+int _callmgr_util_is_video_recording_progress(gboolean *is_recording)
+{
+       return -1;
+}
+
 int _callmgr_util_check_block_mode_num(const char *str_num, gboolean *is_blocked)
 {
        return -1;
index 0e26aac..630a7c3 100644 (file)
 int _callmgr_util_is_recording_progress(gboolean *is_recording)
 {
        bool b_is_voice_recording = FALSE;
-       bool b_is_video_recording = FALSE;
        recorder_is_in_recording(RECORDER_AUDIO_SOURCE, &b_is_voice_recording);
+
+#if 0
+       /* Do not check video recording because of performance */
+       bool b_is_video_recording = FALSE;
        recorder_is_in_recording(RECORDER_VIDEO_SOURCE, &b_is_video_recording);
        dbg("b_is_voice_recording = [%d] b_is_video_recording = [%d]", b_is_voice_recording, b_is_video_recording);
        *is_recording = b_is_voice_recording || b_is_video_recording;
+#else
+       *is_recording = b_is_voice_recording;
+#endif
+       return 0;
+}
+
+int _callmgr_util_is_video_recording_progress(gboolean *is_recording)
+{
+       bool b_is_video_recording = FALSE;
+
+       recorder_is_in_recording(RECORDER_VIDEO_SOURCE, &b_is_video_recording);
+       warn("b_is_video_recording = [%d]", b_is_video_recording);
+       *is_recording = b_is_video_recording;
+
        return 0;
 }
 
@@ -58,6 +75,6 @@ int _callmgr_util_check_block_mode_num(const char *str_num, gboolean *is_blocked
                phone_misc_disconnect(handle);
                handle = NULL;
        }
-       dbg("Call Log is_blocked value:[%d]", *is_blocked);
+       info("Call Log is_blocked value:[%d]", *is_blocked);
        return result;
 }
index 253b197..8f87c2e 100755 (executable)
@@ -35,6 +35,7 @@
 
 #include "callmgr-util.h"
 #include "callmgr-log.h"
+#include "callmgr-vconf.h"
 
 #define CALLUI_PKG_NAME "org.tizen.call-ui"
 #define SOUND_PATH_SILENT      "silent"
@@ -125,10 +126,11 @@ gboolean _callmgr_util_check_access_control(cynara *p_cynara, GDBusMethodInvocat
                privilege = TELEPHONY_ADMIN_PRIVILEGE;
 
        ret = cynara_check(p_cynara, client_smack, client_session, uid_string, privilege);
-       if (ret != CYNARA_API_ACCESS_ALLOWED)
+       if (ret != CYNARA_API_ACCESS_ALLOWED) {
                warn("pid(%u) access (%s - %s) denied(%d)", pid, label, perm, ret);
-       else
+       } else {
                result = TRUE;
+       }
 OUT:
        if (result == FALSE) {
                g_dbus_method_invocation_return_error(invoc,
@@ -361,7 +363,7 @@ int _callmgr_util_is_callui_running(gboolean *is_callui_running)
                dbg("call app is already running");
                *is_callui_running = TRUE;
        } else {
-               dbg("call app is not running");
+               info("call app is not running");
                *is_callui_running = FALSE;
        }
        return 0;
@@ -430,13 +432,13 @@ static void __callmgr_util_popup_reply_cb(app_control_h request, app_control_h r
                        ret = app_control_get_extra_data(reply, "RESULT", &ext_data);
                        if (APP_CONTROL_ERROR_NONE == ret) {
                                if (ext_data) {
-                                       dbg("popup result: [%s]", ext_data);
+                                       info("popup result: [%s]", ext_data);
                                        popup_result = atoi(ext_data);
                                        g_free(ext_data);
                                        popup_data->popup_result_cb(popup_data->popup_type, (void*)popup_result, popup_data->user_data);
                                }
                        } else {
-                               dbg("app_control_get_extra_data failed");
+                               err("app_control_get_extra_data failed");
                        }
                }
                g_free(popup_data);
@@ -487,7 +489,7 @@ int _callmgr_util_launch_popup(call_popup_type popup_type, int info, const char*
        if (result != APP_CONTROL_ERROR_NONE) {
                warn("Retry");
                result = app_control_send_launch_request(app_control, __callmgr_util_popup_reply_cb, popup_data);
-               dbg("retry : %d", result);
+               err("retry : %d", result);
        }
        app_control_destroy(app_control);
 
@@ -812,17 +814,17 @@ int _callmgr_util_check_disturbing_setting(gboolean *is_do_not_disturb)
        if (ret == -2) {
                err = notification_system_setting_load_system_setting(&system_setting);
                if (err!= NOTIFICATION_ERROR_NONE || system_setting == NULL) {
-                       dbg("notification_system_setting_load_system_setting failed [%d]\n", err);
+                       err("notification_system_setting_load_system_setting failed [%d]\n", err);
                        goto out;
                }
                notification_system_setting_get_do_not_disturb(system_setting, &do_not_disturb);
        }
 
-       dbg("do_not_disturb [%d]", do_not_disturb);
+       info("do_not_disturb [%d]", do_not_disturb);
 
        if(do_not_disturb) {
                err = notification_setting_get_setting_by_package_name(CALLUI_PKG_NAME, &setting);
-               if((err = NOTIFICATION_ERROR_NONE) || (setting == NULL)) {
+               if(err != NOTIFICATION_ERROR_NONE || setting == NULL) {
                        err("notification_setting_get_setting_by_package_name failed [%d]", err);
                        goto out;
                }
index 00c9820..f4e83cd 100755 (executable)
@@ -29,7 +29,7 @@ int _callmgr_vconf_is_data_lock(gboolean *is_datalock)
        char *data_lock = vconf_get_str(VCONFKEY_ODE_CRYPTO_STATE);
        if (data_lock) {
                if (g_strcmp0(data_lock, "encrypted") == 0) {
-                       dbg("Data lock state.");
+                       info("Data lock state.");
                        *is_datalock = TRUE;
                } else {
                        *is_datalock = FALSE;
@@ -149,7 +149,7 @@ int _callmgr_vconf_is_answer_mode_enabled(gboolean *is_answer_mode_enabled)
                return -1;
        }
 
-       dbg("answer_mode = [%d]", answer_mode);
+       info("answer_mode = [%d]", answer_mode);
        if (answer_mode == 1) {
                *is_answer_mode_enabled = TRUE;
        } else {
@@ -170,7 +170,7 @@ int _callmgr_vconf_get_auto_answer_time(int *auto_answer_time_in_sec)
                return -1;
        }
 
-       dbg("auto_answer_time = [%d]", auto_answer_time);
+       info("auto_answer_time = [%d]", auto_answer_time);
        *auto_answer_time_in_sec = auto_answer_time;
 
        return 0;
@@ -283,7 +283,7 @@ int _callmgr_vconf_is_do_not_disturb(gboolean *do_not_disturb)
                if (is_do_not_disturb == 0) {
                        *do_not_disturb = FALSE;
                } else {
-                       dbg("Do not disturb setting is on");
+                       info("Do not disturb setting is on");
                        *do_not_disturb = TRUE;
                }
        }
index 1efb094..c7d94f5 100755 (executable)
@@ -62,7 +62,7 @@ int _callmgr_vconf_is_pwlock(gboolean *is_pwlock)
                *is_pwlock = FALSE;
                return -1;
        }
-       dbg("pwlock_state:[%d]", pwlock_state);
+       info("pwlock_state:[%d]", pwlock_state);
        if ((pwlock_state == VCONFKEY_PWLOCK_BOOTING_LOCK) || (pwlock_state == VCONFKEY_PWLOCK_RUNNING_LOCK)) {
                *is_pwlock = TRUE;
        } else {
@@ -71,6 +71,36 @@ int _callmgr_vconf_is_pwlock(gboolean *is_pwlock)
        return 0;
 }
 
+int _callmgr_vconf_is_low_battery(gboolean *is_low_battery)
+{
+       dbg("_callmgr_vconf_is_low_battery()");
+       int low_status = -1;
+       int charger_status = -1;
+
+       if (!vconf_get_int(VCONFKEY_SYSMAN_BATTERY_STATUS_LOW, &low_status)) {
+               if (low_status <= VCONFKEY_SYSMAN_BAT_CRITICAL_LOW) {
+
+                       //check charger status
+                       if (vconf_get_int(VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW, &charger_status)) {
+                               err("vconf_get_int failed");
+                               *is_low_battery = FALSE;
+                               return -1;
+                       }
+
+                       if (charger_status == 1) {      // charging
+                               *is_low_battery = FALSE;
+                       } else {
+                               *is_low_battery = TRUE;
+                       }
+               }
+       } else {
+               warn("get setting failed %s", VCONFKEY_SYSMAN_BATTERY_STATUS_LOW);
+               *is_low_battery = FALSE;
+       }
+
+       return -1;
+}
+
 int _callmgr_vconf_is_sound_setting_enabled(gboolean *is_sound_enabled)
 {
        int sound_status = 0;
index 188a8c4..fe67073 100644 (file)
                <method name="GetAnsweringMachineStatus">
                        <arg direction="out" type="b" name="is_answering_machine_on" />
                </method>
+
+               <method name="GetVideoRecordingStatus">
+                       <arg direction="out" type="b" name="is_video_recording" />
+               </method>
+
                <!--signal list -->
 
                <signal name="CallEvent">
index 126a473..ca83eef 100755 (executable)
@@ -62,6 +62,7 @@ int _callmgr_audio_deinit(callmgr_audio_handle_h audio_handle);
 int _callmgr_audio_create_call_sound_session(callmgr_audio_handle_h audio_handle, callmgr_audio_session_mode_e session_mode);
 int _callmgr_audio_destroy_call_sound_session(callmgr_audio_handle_h audio_handle);
 int _callmgr_audio_set_audio_route(callmgr_audio_handle_h audio_handle, callmgr_audio_route_e route);
+int _callmgr_audio_get_audio_route(callmgr_audio_handle_h audio_handle, callmgr_audio_route_e *o_route);
 int _callmgr_audio_get_active_device(callmgr_audio_handle_h audio_handle, callmgr_audio_device_e *o_route);
 
 int _callmgr_audio_set_extra_vol(callmgr_audio_handle_h audio_handle, gboolean is_extra_vol);
@@ -81,6 +82,7 @@ int _callmgr_audio_set_link_direction_downlink(void);
 int _callmgr_audio_set_media_mode_with_current_device(void);
 
 int _callmgr_audio_get_current_volume(callmgr_audio_handle_h audio_handle, int *o_volume);
+int _callmgr_audio_get_session_mode(callmgr_audio_handle_h audio_handle, callmgr_audio_session_mode_e *o_session_mode);
 
 #endif //__CALLMGR_AUDIO_H__
 
index 83c780d..db74b79 100755 (executable)
@@ -160,6 +160,7 @@ typedef enum {
        CM_TEL_CALL_ERR_FDN_ONLY,
        CM_TEL_CALL_ERR_DIAL_FAIL,
        CM_TEL_CALL_ERR_FM_OFF_FAIL,            /* Fail to Flight Mode*/
+       CM_TEL_CALL_ERR_REJ_SAT_CALL_CTRL,
 }cm_telephony_call_err_cause_type_e;
 
 typedef enum {
@@ -199,8 +200,6 @@ typedef enum {
        CM_NETWORK_STATUS_EMERGENCY_ONLY,
 } cm_network_status_e;
 
-// TODO:
-//Add more events
 typedef enum {
        CM_TELEPHONY_EVENT_MIN, /* 0 */
 
@@ -350,6 +349,24 @@ typedef enum {
        CM_TELEPHONY_SAT_RESPONSE_ME_RET_SUCCESS                                                                                        /**< Return success */
 } cm_telephony_sat_response_type_e;
 
+typedef enum {
+       CM_TELEPHONY_SAT_CALL_CTRL_R_ALLOWED_NO_MOD = 0x00,
+       CM_TELEPHONY_SAT_CALL_CTRL_R_NOT_ALLOWED = 0x01,
+       CM_TELEPHONY_SAT_CALL_CTRL_R_ALLOWED_MOD = 0x02,
+       CM_TELEPHONY_SAT_CALL_CTRL_RESERVED = 0xFF,
+} cm_telephony_sat_call_ctrl_type_e;   // in sync with TelSatCallCtrlResultType_t in libslp-tapi
+
+typedef enum {
+       CM_TELEPHONY_SAT_SETUP_CALL_IF_ANOTHER_CALL_NOT_BUSY = 0x00, /**< command qualifier for SETUP CALL IF ANOTHER CALL IS NOT BUSY */
+       CM_TELEPHONY_SAT_SETUP_CALL_IF_ANOTHER_CALL_NOT_BUSY_WITH_REDIAL = 0x01, /**< command qualifier for SETUP CALL IF ANOTHER CALL IS NOT BUSY WITH REDIAL */
+       CM_TELEPHONY_SAT_SETUP_CALL_PUT_ALL_OTHER_CALLS_ON_HOLD = 0x02, /**< command qualifier for SETUP CALL PUTTING ALL OTHER CALLS ON HOLD */
+       CM_TELEPHONY_SAT_SETUP_CALL_PUT_ALL_OTHER_CALLS_ON_HOLD_WITH_REDIAL = 0x03, /**< command qualifier for SETUP CALL PUTTING ALL OTHER CALLS ON HOLD WITH REDIAL */
+       CM_TELEPHONY_SAT_SETUP_CALL_DISCONN_ALL_OTHER_CALLS = 0x04, /**< command qualifier for SETUP CALL DISCONNECTING ALL OTHER CALLS */
+       CM_TELEPHONY_SAT_SETUP_CALL_DISCONN_ALL_OTHER_CALLS_WITH_REDIAL = 0x05, /**< command qualifier for SETUP CALL DISCONNECTING ALL OTHER CALLS WITH REDIAL */
+       CM_TELEPHONY_SAT_SETUP_CALL_RESERVED = 0xFF /**< command qualifier for SETUP CALL RESERVED */
+} cm_telephony_sat_setup_call_type_e;  // in sync with TelSatCmdQualiSetupCall_t in libslp-tapi
+
+
 typedef void (*telephony_event_cb) (cm_telephony_event_type_e event_type, void *event_data, void *user_data);
 
 int _callmgr_telephony_init(callmgr_telephony_t *telephony_handle, telephony_event_cb cb_fn, void *user_data);
@@ -398,9 +415,10 @@ int _callmgr_telephony_get_call_name_mode(cm_telephony_call_data_t *call, cm_tel
 int _callmgr_telephony_set_ecc_category(cm_telephony_call_data_t *call, int ecc_category);
 int _callmgr_telephony_has_call_by_state(callmgr_telephony_t telephony_handle, cm_telephony_call_state_e state, gboolean *b_has_call);
 int _callmgr_telephony_get_call_by_state(callmgr_telephony_t telephony_handle, cm_telephony_call_state_e state, cm_telephony_call_data_t **call_data_out);
-int _callmgr_telephony_get_sat_event_type(callmgr_telephony_t telephony_handle, cm_telephony_sat_event_type_e *sat_event_type);
+int _callmgr_telephony_get_sat_event_status(callmgr_telephony_t telephony_handle, cm_telephony_sat_event_type_e event_type, gboolean *b_is_ongoing);
+int _callmgr_telephony_get_sat_setup_call_type(callmgr_telephony_t telephony_handle, cm_telephony_sat_setup_call_type_e *sat_setup_call_type);
 int _callmgr_telephony_get_sat_originated_call(callmgr_telephony_t telephony_handle, cm_telephony_call_data_t **call_data_out);
-int _callmgr_telephony_is_sat_originated_call(cm_telephony_call_data_t *call, gboolean *is_sat_originated_call);
+int _callmgr_telephony_get_sat_call_control_call(callmgr_telephony_t telephony_handle, cm_telephony_call_data_t **call_data_out);
 int _callmgr_telephony_set_sat_originated_call_flag(cm_telephony_call_data_t *call, gboolean is_sat_originated_call);
 int _callmgr_telephony_get_sat_setup_call_number(callmgr_telephony_t telephony_handle, char **call_number);
 int _callmgr_telephony_get_sat_setup_call_name(callmgr_telephony_t telephony_handle, char **call_name);
index 4100b13..43cd025 100644 (file)
 
 #include "callmgr-log.h"
 #include "callmgr-answer-msg.h"
+#include "callmgr-vconf.h"
 
 #define CALLMGR_ANSWERING_BEEP_PATH            MODULE_RES_DIR "/Beep.ogg"
 
-static void *g_finished_cb;
-static void *g_user_data;
-
 struct __answer_msg_data {
        player_h player_handle;         /**< Bike mode Handle to MM Player */
 
@@ -183,11 +181,11 @@ static gboolean __callmgr_answer_msg_play_beep_finish_idle_cb(gpointer user_data
        return FALSE;
 }
 
-static void __callmgr_answer_msg_play_beep_finish_cb(callmgr_answer_msg_h answer_msg_handle)
+static void __callmgr_answer_msg_play_beep_finish_cb(void *user_data)
 {
        dbg("..");
-       CM_RETURN_IF_FAIL(answer_msg_handle);
-
+       CM_RETURN_IF_FAIL(user_data);
+       callmgr_answer_msg_h answer_msg_handle = (callmgr_answer_msg_h)user_data;
        g_idle_add(__callmgr_answer_msg_play_beep_finish_idle_cb, answer_msg_handle);
 }
 
@@ -201,10 +199,11 @@ static gboolean __callmgr_answer_msg_play_ment_finish_idle_cb(gpointer user_data
        return FALSE;
 }
 
-static void __callmgr_answer_msg_play_ment_finish_cb(callmgr_answer_msg_h answer_msg_handle)
+static void __callmgr_answer_msg_play_ment_finish_cb(void *user_data)
 {
        dbg("..");
-       CM_RETURN_IF_FAIL(answer_msg_handle);
+       CM_RETURN_IF_FAIL(user_data);
+       callmgr_answer_msg_h answer_msg_handle = (callmgr_answer_msg_h)user_data;
        g_idle_add(__callmgr_answer_msg_play_ment_finish_idle_cb, answer_msg_handle);
 }
 
index afbb122..63472f7 100755 (executable)
@@ -44,6 +44,7 @@ int _callmgr_audio_init(callmgr_audio_handle_h *audio_handle, audio_event_cb cb_
 {
        struct __audio_data *handle = NULL;
        int b_noise_reduction = 0;
+
        handle = calloc(1, sizeof(struct __audio_data));
        CM_RETURN_VAL_IF_FAIL(handle, -1);
 
@@ -95,7 +96,6 @@ static void __callmgr_audio_available_route_changed_cb(sound_device_h device, bo
        }
 }
 
-
 static void __callmgr_audio_active_device_changed_cb(sound_device_h device, sound_device_changed_info_e changed_info, void *user_data)
 {
        CM_RETURN_IF_FAIL(user_data);
@@ -149,12 +149,13 @@ static void __callmgr_audio_active_device_changed_cb(sound_device_h device, soun
        if ((cm_device == audio_handle->current_device) || cm_device == CALLMGR_AUDIO_DEVICE_NONE_E) {
                warn("Do not update");
        } else {
-               audio_handle->current_device = cm_device;
-               audio_handle->cb_fn(CM_AUDIO_EVENT_PATH_CHANGED_E, (void*)cm_device, audio_handle->user_data);
+               //audio_handle->current_device = cm_device;
+               //audio_handle->cb_fn(CM_AUDIO_EVENT_PATH_CHANGED_E, (void*)cm_device, audio_handle->user_data);
        }
 }
 
-static void __callmgr_audio_call_stream_focus_state_cb(sound_stream_info_h stream_info, sound_stream_focus_change_reason_e reason_for_change, const char *additional_info, void *user_data)
+static void __callmgr_audio_call_stream_focus_state_cb(sound_stream_info_h stream_info,
+       sound_stream_focus_change_reason_e reason_for_change, const char *additional_info, void *user_data)
 {
        dbg("__callmgr_audio_call_stream_focus_state_cb");
        return;
@@ -169,22 +170,22 @@ static void __callmgr_audio_volume_changed_cb(sound_type_e type, unsigned int vo
        sound_type_e snd_type = type;
 
        if (snd_type == SOUND_TYPE_CALL) {
-               dbg("sound type : %d, volume : %d", snd_type, volume);
+               info("sound type : %d, volume : %d", snd_type, volume);
                audio_handle->cb_fn(CM_AUDIO_EVENT_VOLUME_CHANGED_E, GUINT_TO_POINTER(volume), audio_handle->user_data);
        }
        return;
 }
 
-int _callmgr_audio_create_call_sound_session(callmgr_audio_handle_h audio_handle, callmgr_audio_session_mode_e session_mode)
+int _callmgr_audio_create_call_sound_session(callmgr_audio_handle_h audio_handle, callmgr_audio_session_mode_e mode)
 {
        int ret = -1;
        sound_stream_type_internal_e stream_type = SOUND_STREAM_TYPE_VOICE_CALL;
-
-       dbg("_callmgr_audio_create_call_sound_session()");
        CM_RETURN_VAL_IF_FAIL(audio_handle, -1);
 
-       if (audio_handle->current_mode == session_mode) {
-               warn("already (%d) set ", session_mode);
+       info("_callmgr_audio_create_call_sound_session()");
+
+       if (audio_handle->current_mode == mode) {
+               warn("already (%d) set ", mode);
                return -2;
        }
 
@@ -194,26 +195,12 @@ int _callmgr_audio_create_call_sound_session(callmgr_audio_handle_h audio_handle
                return -1;
        }
 
-/*
-       if (CALLMGR_AUDIO_SESSION_VOICE_E == session_mode) {
-               ret = sound_manager_set_session_type_internal(SOUND_SESSION_TYPE_CALL);
-       } else {
-               ret = sound_manager_set_session_type_internal(SOUND_SESSION_TYPE_VIDEOCALL);
-       }
-
-       dbg("sound_manager_set_session_type_internal done");
-       if (ret != SOUND_MANAGER_ERROR_NONE) {
-               err("sound_manager_set_session_type_internal() failed for %d. [%d]", session_mode, ret);
-               return -1;
-       }
-       audio_handle->current_mode = session_mode;
-*/
        if (audio_handle->sound_stream_handle != NULL) {
                err("call sound stream already created.");
                return -1;
        }
 
-       switch (session_mode) {
+       switch (mode) {
                case CALLMGR_AUDIO_SESSION_VOICE_E:
                        stream_type = SOUND_STREAM_TYPE_VOICE_CALL;
                        break;
@@ -222,7 +209,7 @@ int _callmgr_audio_create_call_sound_session(callmgr_audio_handle_h audio_handle
                        break;
                case CALLMGR_AUDIO_SESSION_NONE_E:
                default:
-                       err("unhandled session mode: %d", session_mode);
+                       err("unhandled session mode: %d", mode);
                        return -1;
        }
 
@@ -237,7 +224,7 @@ int _callmgr_audio_create_call_sound_session(callmgr_audio_handle_h audio_handle
                err("sound_manager_acquire_focus() get failed with err[%d]", ret);
        }
 
-       /* Handle EP event  */
+       /* Handle EP event  */
        ret = sound_manager_set_device_connected_cb(SOUND_DEVICE_ALL_MASK, __callmgr_audio_available_route_changed_cb, audio_handle);
        if (ret != SOUND_MANAGER_ERROR_NONE) {
                err("sound_manager_set_device_connected_cb() failed. [%d]", ret);
@@ -257,7 +244,7 @@ int _callmgr_audio_create_call_sound_session(callmgr_audio_handle_h audio_handle
 int _callmgr_audio_destroy_call_sound_session(callmgr_audio_handle_h audio_handle)
 {
        int ret = -1;
-       dbg("_callmgr_audio_destroy_call_sound_session()");
+       info("_callmgr_audio_destroy_call_sound_session()");
        CM_RETURN_VAL_IF_FAIL(audio_handle, -1);
        CM_RETURN_VAL_IF_FAIL(audio_handle->vstream, -1);
        CM_RETURN_VAL_IF_FAIL(audio_handle->sound_stream_handle, -1);
@@ -283,19 +270,7 @@ int _callmgr_audio_destroy_call_sound_session(callmgr_audio_handle_h audio_handl
 
        audio_handle->vstream = NULL;
        audio_handle->sound_stream_handle = NULL;
-#if 0
-       audio_handle->current_mode = CALLMGR_AUDIO_SESSION_NONE_E;
 
-       ret = sound_manager_set_session_type(SOUND_SESSION_TYPE_MEDIA);
-       if (ret < 0) {
-               err("sound_manager_set_session_type() failed. error_code:[%d]", ret);
-               return -1;
-       } else {
-               info("sound_manager_set_session_type() success");
-               audio_handle->current_device = CALLMGR_AUDIO_DEVICE_NONE_E;
-               audio_handle->cb_fn(CM_AUDIO_EVENT_PATH_CHANGED_E, (void*)CALLMGR_AUDIO_DEVICE_NONE_E, audio_handle->user_data);
-       }
-#endif
        return 0;
 }
 
@@ -327,77 +302,79 @@ static int __callmgr_audio_get_device_type_string(sound_device_type_e device_typ
        return 0;
 }
 
-int _callmgr_audio_is_sound_device_available(callmgr_audio_device_e device_type, gboolean *is_available)
+static int __callmgr_audio_get_sound_device(sound_device_type_e device_type, sound_device_h *sound_device)
 {
        sound_device_list_h device_list = NULL;
        sound_device_h  device = NULL;
        sound_device_type_e o_device_type;
        int ret = -1;
+       int index = 0;
 
-       ret = sound_manager_get_current_device_list(SOUND_DEVICE_ALL_MASK, &device_list);
+       ret = sound_manager_get_current_device_list (SOUND_DEVICE_ALL_MASK, &device_list);
        if (ret != SOUND_MANAGER_ERROR_NONE) {
                err("sound_manager_get_current_device_list() get failed");
                return -1;
        }
 
        while (1) {
-               ret = sound_manager_get_next_device(device_list, &device);
+               ret = sound_manager_get_next_device (device_list, &device);
                if (ret == SOUND_MANAGER_ERROR_NONE && device) {
                        sound_manager_get_device_type(device, &o_device_type);
-                       if ((device_type == CALLMGR_AUDIO_DEVICE_SPEAKER_E) && (o_device_type == SOUND_DEVICE_BUILTIN_SPEAKER)) {
-                               info("found SPEAKER!!");
-                               break;
-                       } else if ((device_type == CALLMGR_AUDIO_DEVICE_RECEIVER_E) && (o_device_type == SOUND_DEVICE_BUILTIN_RECEIVER)) {
-                               info("found RECEIVER!!");
-                               break;
-                       } else if ((device_type == CALLMGR_AUDIO_DEVICE_EARJACK_E) && (o_device_type == SOUND_DEVICE_AUDIO_JACK)) {
-                               info("found EARJACK!!");
-                               break;
-                       } else if ((device_type == CALLMGR_AUDIO_DEVICE_BT_E) && (o_device_type == SOUND_DEVICE_BLUETOOTH)) {
-                               info("found BLUETOOTH!!");
+                       if (o_device_type == device_type) {
+                               info("found device!!");
                                break;
                        }
-               } else {
+               }
+               else {
                        err("sound_manager_get_next_device() failed with err[%d]", ret);
                        return -1;
                }
        }
 
-       *is_available = TRUE;
+       *sound_device = device;
        return 0;
 }
 
-static int __callmgr_audio_get_sound_device(sound_device_type_e device_type, sound_device_h *sound_device)
+int _callmgr_audio_is_sound_device_available(callmgr_audio_device_e device_type, gboolean *is_available)
 {
        sound_device_list_h device_list = NULL;
        sound_device_h  device = NULL;
        sound_device_type_e o_device_type;
        int ret = -1;
 
-       ret = sound_manager_get_current_device_list (SOUND_DEVICE_ALL_MASK, &device_list);
+       ret = sound_manager_get_current_device_list(SOUND_DEVICE_ALL_MASK, &device_list);
        if (ret != SOUND_MANAGER_ERROR_NONE) {
                err("sound_manager_get_current_device_list() get failed");
                return -1;
        }
 
        while (1) {
-               ret = sound_manager_get_next_device (device_list, &device);
+               ret = sound_manager_get_next_device(device_list, &device);
                if (ret == SOUND_MANAGER_ERROR_NONE && device) {
                        sound_manager_get_device_type(device, &o_device_type);
-                       if (o_device_type == device_type) {
-                               info("found device!!");
+                       if ((device_type == CALLMGR_AUDIO_DEVICE_SPEAKER_E) && (o_device_type == SOUND_DEVICE_BUILTIN_SPEAKER)) {
+                               info("found SPEAKER!!");
+                               break;
+                       } else if ((device_type == CALLMGR_AUDIO_DEVICE_RECEIVER_E) && (o_device_type == SOUND_DEVICE_BUILTIN_RECEIVER)) {
+                               info("found RECEIVER!!");
+                               break;
+                       } else if ((device_type == CALLMGR_AUDIO_DEVICE_EARJACK_E) && (o_device_type == SOUND_DEVICE_AUDIO_JACK)) {
+                               info("found EARJACK!!");
+                               break;
+                       } else if ((device_type == CALLMGR_AUDIO_DEVICE_BT_E) && (o_device_type == SOUND_DEVICE_BLUETOOTH)) {
+                               info("found BLUETOOTH!!");
                                break;
                        }
-               }
-               else {
+               } else {
                        err("sound_manager_get_next_device() failed with err[%d]", ret);
                        return -1;
                }
        }
 
-       *sound_device = device;
+       *is_available = TRUE;
        return 0;
 }
+
 #if 0
 static int __callmgr_audio_get_sound_route(callmgr_audio_handle_h audio_handle, callmgr_audio_route_e route, sound_session_call_mode_e *sound_route, callmgr_audio_device_e *active_device)
 {
@@ -440,12 +417,14 @@ static int __callmgr_audio_get_sound_route(callmgr_audio_handle_h audio_handle,
        err("No available route");
        return -1;
 }
+#endif
 
-static int __callmgr_audio_set_audio_control_state(callmgr_audio_handle_h audio_handle, sound_session_call_mode_e route)
+static int __callmgr_audio_set_audio_control_state(callmgr_audio_handle_h audio_handle, sound_device_h route)
 {
        CM_RETURN_VAL_IF_FAIL(audio_handle, -1);
+#if 0
        int is_noise_reduction = 0;
-#if 0 
        /* ToDo : vconf will be changed to MM API */
        switch (route) {
        case SOUND_SESSION_CALL_MODE_VOICE_WITH_BLUETOOTH:
@@ -509,7 +488,7 @@ static int __callmgr_audio_set_audio_control_state(callmgr_audio_handle_h audio_
 
        return 0;
 }
-#endif
+
 int _callmgr_audio_set_audio_route(callmgr_audio_handle_h audio_handle, callmgr_audio_route_e route)
 {
        int ret = -1;
@@ -566,7 +545,7 @@ int _callmgr_audio_set_audio_route(callmgr_audio_handle_h audio_handle, callmgr_
        }
 
        __callmgr_audio_get_sound_device(device_type, &sound_device);
-       //__callmgr_audio_set_audio_control_state(audio_handle, sound_device);
+       __callmgr_audio_set_audio_control_state(audio_handle, sound_device);
        ret = sound_manager_add_device_for_stream_routing (audio_handle->sound_stream_handle, sound_device);
        if (ret != SOUND_MANAGER_ERROR_NONE) {
                err("sound_manager_add_device_for_stream_routing() failed:[%d]", ret);
@@ -610,27 +589,6 @@ int _callmgr_audio_set_audio_route(callmgr_audio_handle_h audio_handle, callmgr_
        audio_handle->current_route = device_type;
        audio_handle->cb_fn(CM_AUDIO_EVENT_PATH_CHANGED_E, (void*)route, audio_handle->user_data);
        info("Success set route");
-#if 0
-       callmgr_audio_device_e active_device = CALLMGR_AUDIO_DEVICE_NONE_E;
-       sound_session_call_mode_e sound_route = SOUND_SESSION_CALL_MODE_VOICE_WITH_BUILTIN_RECEIVER;
-       CM_RETURN_VAL_IF_FAIL(audio_handle, -1);
-       dbg(">>");
-
-       __callmgr_audio_get_sound_route(audio_handle, route, &sound_route, &active_device);
-       __callmgr_audio_set_audio_control_state(audio_handle, sound_route);
-
-       info("set route : %d", sound_route);
-       ret = sound_manager_set_call_session_mode(sound_route);
-       if (ret != SOUND_MANAGER_ERROR_NONE) {
-               err("callmgr_audio_set_audio_route() failed:[%d]", ret);
-               return -1;
-       }
-       info("Success set route");
-
-       audio_handle->current_device = active_device;
-       audio_handle->cb_fn(CM_AUDIO_EVENT_PATH_CHANGED_E, (void*)active_device, audio_handle->user_data);
-#endif
-
        return 0;
 }
 
@@ -717,7 +675,7 @@ int _callmgr_audio_set_audio_tx_mute(callmgr_audio_handle_h audio_handle, gboole
                return -1;
        }
        audio_handle->is_mute_state = is_mute_state;
-       dbg("updated mute state : %d", audio_handle->is_mute_state);
+       info("updated mute state : %d", audio_handle->is_mute_state);
 #endif
        return 0;
 }
@@ -756,24 +714,23 @@ int _callmgr_audio_get_noise_reduction(callmgr_audio_handle_h audio_handle, gboo
        return 0;
 }
 
-
 int _callmgr_audio_is_ringtone_mode(callmgr_audio_handle_h audio_handle, gboolean *o_is_ringtone_mode)
 {
        CM_RETURN_VAL_IF_FAIL(audio_handle, -1);
        CM_RETURN_VAL_IF_FAIL(o_is_ringtone_mode, -1);
 
-       //sound_session_call_mode_e sound_route = SOUND_SESSION_CALL_MODE_RINGTONE;
+       sound_type_e sound_type = SOUND_TYPE_SYSTEM;
        *o_is_ringtone_mode = FALSE;
 
-       //int ret = sound_manager_get_call_session_mode(&sound_route);
-       //if (ret != SOUND_MANAGER_ERROR_NONE) {
-       //      err("callmgr_audio_set_audio_route() failed:[%d]", ret);
-       //      return -1;
-       //}
+       int ret = sound_manager_get_sound_type(audio_handle, &sound_type);
+       if (ret != SOUND_MANAGER_ERROR_NONE) {
+               err("callmgr_audio_set_audio_route() failed:[%d]", ret);
+               return -1;
+       }
 
-       //if (sound_route == SOUND_SESSION_CALL_MODE_RINGTONE) {
-       //      *o_is_ringtone_mode = TRUE;
-       //}
+       if (sound_type == SOUND_TYPE_RINGTONE) {
+               *o_is_ringtone_mode = TRUE;
+       }
 
        return 0;
 }
@@ -796,3 +753,15 @@ int _callmgr_audio_get_current_volume(callmgr_audio_handle_h audio_handle, int *
        return 0;
 }
 
+int _callmgr_audio_get_session_mode(callmgr_audio_handle_h audio_handle, callmgr_audio_session_mode_e *o_session_mode)
+{
+       int ret = -1;
+       info(">>");
+       CM_RETURN_VAL_IF_FAIL(audio_handle, -1);
+       CM_RETURN_VAL_IF_FAIL(o_session_mode, -1);
+
+       *o_session_mode = audio_handle->current_mode;
+
+       return 0;
+}
+
index 9714222..bb7d404 100755 (executable)
@@ -40,7 +40,7 @@ static void __callmgr_bt_ag_audio_connection_state_changed_cb(int result,
        callmgr_bt_handle_h bt_handle = (callmgr_bt_handle_h)user_data;
        CM_RETURN_IF_FAIL(bt_handle);
 
-       dbg("type : %d, connected : %d", type, connected);
+       info("type : %d, connected : %d", type, connected);
        if (type == BT_AUDIO_PROFILE_TYPE_HSP_HFP) {
                /* Handle HFP connection */
                bt_handle->is_connected = connected;
@@ -71,7 +71,7 @@ static void __callmgr_bt_ag_call_handling_event_cb(bt_ag_call_handling_event_e e
        cm_bt_event_type_e bt_event = CM_BT_EVENT_CALL_HANDLE_ACCEPT_E;
        CM_RETURN_IF_FAIL(bt_handle);
 
-       dbg("event : %d , id : %d", event, call_id);
+       info("event : %d , id : %d", event, call_id);
        switch (event) {
                case BT_AG_CALL_HANDLING_EVENT_ANSWER:
                        bt_event = CM_BT_EVENT_CALL_HANDLE_ACCEPT_E;
@@ -97,7 +97,7 @@ static void __callmgr_bt_ag_multi_call_handling_event_cb(bt_ag_multi_call_handli
        cm_bt_event_type_e bt_event = CM_BT_EVENT_CALL_HANDLE_0_SEND_E;
        CM_RETURN_IF_FAIL(bt_handle);
 
-       dbg("event : %d", event);
+       info("event : %d", event);
        switch (event) {
                case BT_AG_MULTI_CALL_HANDLING_EVENT_RELEASE_HELD_CALLS:
                        bt_event = CM_BT_EVENT_CALL_HANDLE_0_SEND_E;
@@ -192,7 +192,7 @@ static int __callmgr_bt_is_headset_connected(gboolean *o_is_connected)
                err("err : 0x%x", ret);
                return -1;
        } else {
-               dbg("BT headset is %s", (is_connected ? "CONNECTED" : "DISCONNECTED"));
+               info("BT headset is %s", (is_connected ? "CONNECTED" : "DISCONNECTED"));
        }
 
        *o_is_connected = is_connected;
@@ -362,7 +362,7 @@ int _callmgr_bt_add_call_list(callmgr_bt_handle_h bt_handle, int call_id, int ca
                }
        }
 
-       dbg("id : %d, state : %d", call_id, call_status);
+       info("id : %d, state : %d", call_id, call_status);
 
        /* Can not send NULL number */
        if (phone_num) {
index 456deba..7ae5a53 100755 (executable)
@@ -204,7 +204,7 @@ static int __callmgr_ct_get_caller_ringtone(int person_id, callmgr_contact_info_
                if (CONTACTS_ERROR_NONE != err) {
                        err("contacts_record_get_str(ringtone path) error %d", err);
                } else {
-                       dbg("Caller ringtone");
+                       info("Caller ringtone");
                        contact_info->caller_ringtone_path = g_strdup(ringtone_path);
                        free(ringtone_path);
                }
@@ -287,7 +287,7 @@ int _callmgr_ct_add_ct_info(const char *phone_number, unsigned int call_id, call
 
        __callmgr_ct_get_person_id_by_num(phone_number, &person_id);
        if (-1 == person_id) {
-               dbg("no contact saved for this number in db");
+               err("no contact saved for this number in db");
        } else {
                info("contact saved with index : %d", person_id);
                __callmgr_ct_get_caller_ringtone(person_id, contact_info);
@@ -445,7 +445,7 @@ int _callmgr_ct_add_log(cm_ct_plog_data_t *log_data)
                        err("contacts_record_create is failed");
                } else if (contacts_record_set_str(log_record, _contacts_phone_log.address, contact_info->number) != CONTACTS_ERROR_NONE) {
                        err("contacts_record_set_str(Number) is failed");
-               } else if (contacts_record_set_int(log_record, _contacts_phone_log.log_time, (current_time-log_data->call_duration)) != CONTACTS_ERROR_NONE) {
+               } else if (contacts_record_set_int(log_record, _contacts_phone_log.log_time, (current_time)) != CONTACTS_ERROR_NONE) {  /* Log time is call end time*/
                        err("contacts_record_set_int(Time) is failed");
                } else if (contacts_record_set_int(log_record, _contacts_phone_log.log_type, log_data->log_type) != CONTACTS_ERROR_NONE) {
                        err("contacts_record_set_int(Type) is failed");
@@ -460,7 +460,7 @@ int _callmgr_ct_add_log(cm_ct_plog_data_t *log_data)
                } else if (contacts_db_insert_record(log_record, NULL) != CONTACTS_ERROR_NONE) {
                        err("contacts_db_insert_record is failed");
                } else {
-                       dbg("Call log is added successfully");
+                       info("Call log is added successfully");
                }
                contacts_record_destroy(log_record, TRUE);
        }
@@ -479,6 +479,7 @@ int _callmgr_ct_add_log(cm_ct_plog_data_t *log_data)
                        __callmgr_ct_add_rec_reject_notification(contact_info->number, contact_info->person_id, log_data->presentation);
                }
        }
+
        return 0;
 }
 
@@ -697,7 +698,7 @@ static void __callmgr_ct_add_notification(int missed_cnt)
        }
 
        g_snprintf(str_cnt, sizeof(str_cnt), "%d", missed_cnt);
-       dbg("Notification string :[%s] [%s]", str_buf, str_cnt);
+       info("Notification string :[%s] [%s]", str_buf, str_cnt);
 
        noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, str_buf, str_id, NOTIFICATION_VARIABLE_TYPE_NONE);
        if (noti_err != NOTIFICATION_ERROR_NONE) {
@@ -846,14 +847,23 @@ static void __callmgr_ct_add_notification(int missed_cnt)
                                }
 
                                if (strstr(disp_name_str, disp_str) == NULL) {
-                                       if (strlen((const char *)disp_name_str) >= 1) {
+                                       int remain_max = sizeof(disp_name_str) - strlen((const char *)disp_name_str) - 1;
+
+                                       if ((remain_max > 0) && (strlen((const char *)disp_name_str) >= 1)) {
                                                strncat(disp_name_str, ",", sizeof(char));
                                                b_is_single = false;
+                                               remain_max = remain_max - sizeof(char);
                                        }
-                                       if (strlen(disp_str) > 0) {
-                                               strncat(disp_name_str, disp_str, strlen(disp_str));
+
+                                       if ((remain_max > 0) && (strlen(disp_str) > 0)) {
+                                               if (strlen(disp_str) < remain_max) {
+                                                       strncat(disp_name_str, disp_str, strlen(disp_str));
+                                               }
+                                               else {
+                                                       strncat(disp_name_str, disp_str, remain_max);
+                                               }
                                        }
-                                       dbg("disp_str %s  disp_name_str %s", disp_str, disp_name_str);
+                                       sec_dbg("disp_str(%s), disp_name_str(%s)", disp_str, disp_name_str);
 
                                        g_free(disp_str);
                                        disp_str = NULL;
index cfdd36b..843a261 100644 (file)
@@ -23,6 +23,7 @@
 #include <vconf.h>
 #include <device/haptic.h>
 #include <mm_sound.h>
+#include <stdlib.h>
 
 #include "callmgr-ringer.h"
 #include "callmgr-util.h"
@@ -282,14 +283,14 @@ static int __callmgr_ringer_create_ringtone_stream(callmgr_ringer_handle_h ringe
        ret = sound_manager_create_stream_information_internal(SOUND_STREAM_TYPE_RINGTONE_CALL, __callmgr_ringer_ringtone_stream_focus_state_cb,
                NULL, &ringer_handle->ringtone_stream_handle);
        if (ret != SOUND_MANAGER_ERROR_NONE) {
-             err("sound_manager_create_stream_information_internal() get failed with err[%d]", ret);
-             return -1;
+               err("sound_manager_create_stream_information_internal() get failed with err[%d]", ret);
+               return -1;
        }
 
        ret = sound_manager_acquire_focus(ringer_handle->ringtone_stream_handle, SOUND_STREAM_FOCUS_FOR_PLAYBACK|SOUND_STREAM_FOCUS_FOR_RECORDING, NULL);
        if (ret != SOUND_MANAGER_ERROR_NONE) {
-             err("sound_manager_acquire_focus() get failed with err[%d]", ret);
-             return -1;
+               err("sound_manager_acquire_focus() get failed with err[%d]", ret);
+               return -1;
        }
        return 0;
 }
@@ -317,23 +318,25 @@ static int __callmgr_ringer_play_melody(callmgr_ringer_handle_h ringer_handle, c
        gboolean increasing_vol = FALSE;
        gboolean is_ringtone_playable = FALSE;
        gboolean is_silent_ringtone = FALSE;
+       gboolean is_default_ringtone = FALSE;
        float adjusted_val = 0.0;
        char *ringtone_path = NULL;
        char *default_ringtone_path = NULL;
+       char *position = NULL;
+       int startposition = 0;
        CM_RETURN_VAL_IF_FAIL(ringer_handle, -1);
 
+       if (ringer_handle->player_handle) {
+               warn("Already playing melody. Ignore this request");
+               return -1;
+       }
+
        ret = __callmgr_ringer_create_ringtone_stream(ringer_handle);
        if (ret < 0) {
                err("__callmgr_ringer_create_ringtone_stream() get failed");
                return -1;
        }
-/*
-       ret = sound_manager_set_call_session_mode(SOUND_SESSION_CALL_MODE_RINGTONE);
-       if (SOUND_MANAGER_ERROR_NONE != ret) {
-               err("sound_manager_set_call_session_mode() Error: [0x%x]", ret);
-               return -1;
-       }
-*/
+
        ret = sound_manager_get_volume(SOUND_TYPE_RINGTONE, &ringtone_volume);
        if (SOUND_MANAGER_ERROR_NONE != ret) {
                err("sound_manager_get_volume() Error: [0x%x]", ret);
@@ -361,6 +364,7 @@ static int __callmgr_ringer_play_melody(callmgr_ringer_handle_h ringer_handle, c
                        err("_callmgr_vconf_get_ringtone_path() failed");
                        ringtone_path = g_strdup(default_ringtone_path);
                }
+               is_default_ringtone = TRUE;
        }
 
        if ((_callmgr_util_is_silent_ringtone(ringtone_path, &is_silent_ringtone) == 0) && (is_silent_ringtone == TRUE)) {
@@ -404,6 +408,7 @@ static int __callmgr_ringer_play_melody(callmgr_ringer_handle_h ringer_handle, c
 
                        return -1;
                }
+               is_default_ringtone = TRUE;
        }
 
        ret = _callmgr_vconf_get_increasing_volume_setting(&increasing_vol);
@@ -429,6 +434,32 @@ static int __callmgr_ringer_play_melody(callmgr_ringer_handle_h ringer_handle, c
 
                return -1;
        }
+
+       if (is_default_ringtone) {
+               info("default ringtone");
+
+               position = vconf_get_str(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_WITH_RECOMMENDATION_TIME_STR);
+               if (position != NULL) {
+                       startposition = atoi(position);
+                       info("highlight ringtone: startposition(%d)", startposition);
+
+                       g_free(position);
+               }
+               else {
+                       warn("position is NULL");
+               }
+       }
+       else {
+               // ToDo: in case of contact ringtone and group ringtone
+       }
+
+       if (startposition > 0) {
+               ret = player_set_play_position(ringer_handle->player_handle, startposition, true, NULL, NULL);
+               if (PLAYER_ERROR_NONE != ret) {
+                       err("player_set_play_position() failed, error: [%d]", ret);
+               }
+       }
+
        if (increasing_vol) {
                ringer_handle->increment_timer = g_timeout_add(CALLMGR_RINGTONE_INCREMENT_TIMER_INTERVAL, __callmgr_ringer_increasing_melody_cb, (gpointer)ringer_handle);
        }
@@ -459,7 +490,7 @@ static int __callmgr_ringer_stop_melody(callmgr_ringer_handle_h ringer_handle)
 
        player_get_state(ringer_handle->player_handle, &player_state);
 
-       dbg("current player state = %d", player_state);
+       info("current player state = %d", player_state);
 
        if (PLAYER_STATE_PLAYING == player_state || PLAYER_STATE_PAUSED == player_state) {
                ret = player_stop(ringer_handle->player_handle);
@@ -468,6 +499,9 @@ static int __callmgr_ringer_stop_melody(callmgr_ringer_handle_h ringer_handle)
 
                        return -1;
                }
+               else {
+                       info("player_stop done");
+               }
        }
 
        ret = player_unprepare(ringer_handle->player_handle);
@@ -476,13 +510,18 @@ static int __callmgr_ringer_stop_melody(callmgr_ringer_handle_h ringer_handle)
 
                return -1;
        }
+       else {
+               info("player_unprepare done");
+       }
 
        ret = player_destroy(ringer_handle->player_handle);
        if (PLAYER_ERROR_NONE != ret) {
                err("player_destroy() failed: [0x%x]", ret);
-
                return -1;
        }
+       else {
+               info("player_destroy done");
+       }
 
        ringer_handle->player_handle = NULL;
        ringer_handle->current_status = CM_RINGER_STATUS_IDLE_E;
@@ -567,7 +606,7 @@ static int __callmgr_ringer_stop_vibration(callmgr_ringer_handle_h ringer_handle
 
 static void __callmgr_ringer_play_effect_finish_cb(void *user_data, int id)
 {
-       dbg("__callmgr_ringer_play_effect_finish_cb");
+       info("__callmgr_ringer_play_effect_finish_cb");
        callmgr_ringer_handle_h ringer_handle = (callmgr_ringer_handle_h)user_data;
        CM_RETURN_IF_FAIL(ringer_handle);
 
@@ -616,7 +655,7 @@ int _callmgr_ringer_start_alert(callmgr_ringer_handle_h ringer_handle, char *cal
 
 int _callmgr_ringer_play_local_ringback_tone(callmgr_ringer_handle_h ringer_handle)
 {
-       dbg("_callmgr_ringer_play_local_ringback_tone");
+       info("_callmgr_ringer_play_local_ringback_tone");
 
        CM_RETURN_VAL_IF_FAIL(ringer_handle, -1);
 
@@ -632,7 +671,7 @@ int _callmgr_ringer_play_local_ringback_tone(callmgr_ringer_handle_h ringer_hand
 
 int _callmgr_ringer_stop_local_ringback_tone(callmgr_ringer_handle_h ringer_handle)
 {
-       dbg("_callmgr_ringer_stop_local_ringback_tone");
+       info("_callmgr_ringer_stop_local_ringback_tone");
 
        CM_RETURN_VAL_IF_FAIL(ringer_handle, -1);
 
@@ -647,6 +686,8 @@ int _callmgr_ringer_stop_local_ringback_tone(callmgr_ringer_handle_h ringer_hand
                return -1;
        }
 
+       info("tone_player_stop done");
+
        ringer_handle->ringback_tone_play_handle = -1;
        ringer_handle->current_status = CM_RINGER_STATUS_IDLE_E;
        return 0;
@@ -655,7 +696,7 @@ static gboolean __callmgr_waiting_tone_play_end_cb(gpointer pdata)
 {
        callmgr_ringer_handle_h ringer_handle = (callmgr_ringer_handle_h)pdata;
        CM_RETURN_VAL_IF_FAIL(ringer_handle, FALSE);
-       dbg("__callmgr_waiting_tone_play_end_cb");
+       info("__callmgr_waiting_tone_play_end_cb");
 
        if (ringer_handle->waiting_tone_timer != -1) {
                dbg("waiting_tone_timer removing..");
@@ -675,7 +716,7 @@ static gboolean __callmgr_waiting_tone_play_end_cb(gpointer pdata)
 int _callmgr_ringer_start_alternate_tone(callmgr_ringer_handle_h ringer_handle)
 {
        int ret = -1;
-       dbg("_callmgr_ringer_start_alternate_tone()");
+       info("_callmgr_ringer_start_alternate_tone()");
        CM_RETURN_VAL_IF_FAIL(ringer_handle, -1);
 
        ret = tone_player_start(TONE_TYPE_SUP_CALL_WAITING, SOUND_TYPE_CALL, 4000, &ringer_handle->alternate_tone_handle);
@@ -683,6 +724,9 @@ int _callmgr_ringer_start_alternate_tone(callmgr_ringer_handle_h ringer_handle)
                err("tone_player_start() failed");
                return -1;
        }
+
+       info("tone_player_start done");
+
        ringer_handle->current_status = CM_RINGER_STATUS_RINGING_E;
        ringer_handle->waiting_tone_timer = g_timeout_add(CALLMGR_2ND_CALL_BEEP_INTERVAL, __callmgr_waiting_tone_play_end_cb, (gpointer)ringer_handle);
 
@@ -796,7 +840,7 @@ static gboolean __callmgr_ringer_play_signal_end_cb(gpointer pdata)
 {
        callmgr_ringer_handle_h ringer_handle = (callmgr_ringer_handle_h)pdata;
        CM_RETURN_VAL_IF_FAIL(ringer_handle, FALSE);
-       dbg("__callmgr_ringer_play_signal_end_cb");
+       info("__callmgr_ringer_play_signal_end_cb");
 
        if (ringer_handle->signal_tone_timer != -1) {
                dbg("play signal end and signal_tone_timer removing..");
@@ -821,7 +865,7 @@ int _callmgr_ringer_play_signal(callmgr_ringer_handle_h ringer_handle, cm_ringer
        CM_RETURN_VAL_IF_FAIL(ringer_handle, -1);
 
        if (CM_RINGER_SIGNAL_NONE_E == signal_type) {
-               dbg("No Signal Type Assigned");
+               err("No Signal Type Assigned");
                return -1;
        }
 
@@ -847,7 +891,7 @@ int _callmgr_ringer_play_signal(callmgr_ringer_handle_h ringer_handle, cm_ringer
                ret = tone_player_start(TONE_TYPE_SUP_CONGESTION, SOUND_TYPE_CALL, 2000, &ringer_handle->signal_play_handle);
                break;
        default:
-               dbg("Invalid Signal Type");
+               err("Invalid Signal Type");
                break;
        }
 
index 5d6cc91..e187cd8 100755 (executable)
@@ -19,7 +19,6 @@
 #include <vconf.h>
 #include <dbus/dbus.h>
 #include <stdint.h>
-#include <device/display.h>
 #include <gesture_recognition.h>
 
 #include "callmgr-sensor.h"
index 4333e1a..bf03721 100755 (executable)
@@ -21,6 +21,7 @@
 #include <ITapiModem.h>
 #include <ITapiNetwork.h>
 #include <ITapiSat.h>
+#include <device/power.h>
 
 #include <vconf.h>
 #include <assert.h>
@@ -54,18 +55,18 @@ struct __cm_tel_call_data {
        cm_telephony_call_type_e call_type;                     /**< Specifies type of call (voice, data, emergency) */
        cm_telephony_call_state_e call_state;           /**< Current Call state */
        gboolean is_sat_originated_call;
+       gboolean is_in_sat_call_control;
        gboolean is_conference;                                         /**< Whether Call is in Conference or not*/
        int ecc_category;                       /**< emergency category(seethe TelSimEccEmergencyServiceInfo_t or TelCallEmergencyCategory_t)*/
        long start_time;        /**< start time of the Call*/
        cm_telephony_end_cause_type_e end_cause;                /* End cause of ended call*/
        cm_telephony_name_mode_e name_mode;
 
-       gboolean retreive_flag;
+       gboolean retrieve_flag;
+       gboolean is_canceled;           /* Call is canceled by user before connected */
 };
 
 struct __cm_tel_sat_data {
-       cm_telephony_sat_event_type_e event_type;
-
        TelSatSetupCallIndCallData_t *setup_call;
        TelSatSendDtmfIndDtmfData_t *send_dtmf;
        TelSatCallCtrlIndData_t *call_control_result;
@@ -76,6 +77,7 @@ struct __modem_info {
        gboolean is_sim_initialized;
        gboolean is_phone_initialized;
        gboolean is_cs_available;
+       gboolean is_sim_poweroff;
        cm_telephony_card_type_e card_type;                             /**< SIM Card Type */
        cm_network_status_e network_status;
        unsigned long net_mcc;
@@ -163,11 +165,13 @@ static int __callmgr_telephony_set_conference_call_state(cm_telephony_call_data_
 static int __callmgr_telephony_set_name_mode(cm_telephony_call_data_t *call, cm_telephony_name_mode_e name_mode);
 static int __callmgr_telephony_set_start_time(cm_telephony_call_data_t *call);
 static int __callmgr_telephony_get_all_call_list(callmgr_telephony_t telephony_handle);
-static int __callmgr_telephony_set_retreive_flag(cm_telephony_call_data_t *call, gboolean is_set);
-static int __callmgr_telephony_get_call_to_be_retreived(callmgr_telephony_t telephony_handle, cm_telephony_call_data_t **call_data_out);
+static int __callmgr_telephony_set_retrieve_flag(cm_telephony_call_data_t *call, gboolean is_set);
+static int __callmgr_telephony_set_call_canceled_flag(cm_telephony_call_data_t *call, gboolean is_set);
+static int __callmgr_telephony_get_call_to_be_retrieved(callmgr_telephony_t telephony_handle, cm_telephony_call_data_t **call_data_out);
 static int __callmgr_telephony_set_end_cause(cm_telephony_call_data_t *call, cm_telephony_end_cause_type_e cause);
 static int __callmgr_telephony_get_end_cause_type(TelCallCause_t call_cause, TelTapiEndCause_t cause, cm_telephony_end_cause_type_e *end_cause_type);
 static int __callmgr_telephony_end_all_call_by_state(callmgr_telephony_t telephony_handle, cm_telephony_call_state_e state);
+static int __callmgr_telephony_check_ecc_slot(callmgr_telephony_t telephony_handle, const char *pNumber, cm_telepony_sim_slot_type_e *sim_slot);
 
 static int __callmgr_telephony_create_wait_call_list(callmgr_telephony_t telephony_handle, cm_telephony_event_type_e event_type, cm_telephony_call_data_t *active_call, cm_telephony_call_data_t *held_call)
 {
@@ -186,7 +190,7 @@ static int __callmgr_telephony_create_wait_call_list(callmgr_telephony_t telepho
                err("The wait_event of modem_info = %d", modem_info->wait_event);
 
                if ((CM_TELEPHONY_EVENT_SWAP == event_type) && (CM_TELEPHONY_EVENT_SWAP == modem_info->wait_event)) {
-                       dbg("Waiting for swap_event..Request for swap_call...");
+                       warn("Waiting for swap_event..Request for swap_call...");
                        _callmgr_util_launch_popup(CALL_POPUP_TOAST, CALL_POPUP_TOAST_SWAP_CALL, NULL, 0 , NULL, NULL);
                }
 
@@ -392,10 +396,28 @@ static void __callmgr_telephony_handle_tapi_events(TapiHandle *handle, const cha
        callmgr_telephony_t telephony_handle = (callmgr_telephony_t)user_data;
        int ret_val = -1;
        unsigned int call_handle = -1;
+       cm_telephony_call_data_t *sat_call = NULL;
+
        struct __modem_info *modem_info = NULL;
+       int idx = 0;
+       int slot_id = 0;
+       int result = -1;
        CM_RETURN_IF_FAIL(telephony_handle);
+       CM_RETURN_IF_FAIL(data);
+
+       result = device_power_request_lock(POWER_LOCK_CPU, 0);
+       if (result != DEVICE_ERROR_NONE) {
+               err("device_power_request_lock() failed with err[%d]", result);
+       }
+
+       for (idx = 0; idx < telephony_handle->modem_cnt; idx++) {
+               if (telephony_handle->multi_handles[idx] == handle) {
+                       slot_id = idx;
+                       break;
+               }
+       }
 
-       info("event_type:[%s], sim_slot[%d]", noti_id, telephony_handle->active_sim_slot);
+       info("event_type:[%s] from SIM[%d]. Current active_sim_slot[%d]", noti_id, slot_id, telephony_handle->active_sim_slot);
 
        modem_info = &telephony_handle->modem_info[telephony_handle->active_sim_slot];
        /* Process TAPI events */
@@ -403,7 +425,6 @@ static void __callmgr_telephony_handle_tapi_events(TapiHandle *handle, const cha
                TelCallStatusIdleNoti_t *callIdleInfo = (TelCallStatusIdleNoti_t *)data;
                cm_telephony_call_data_t *held_call = NULL;
                cm_telephony_call_data_t *call_data = NULL;
-               CM_RETURN_IF_FAIL(callIdleInfo);
 
                _callmgr_telephony_get_call_by_call_id(telephony_handle, callIdleInfo->id, &call_data);
                if (call_data) {
@@ -411,50 +432,105 @@ static void __callmgr_telephony_handle_tapi_events(TapiHandle *handle, const cha
                        __callmgr_telephony_get_end_cause_type(TAPI_CAUSE_SUCCESS, callIdleInfo->cause, &end_cause_type);
                        __callmgr_telephony_set_end_cause(call_data, end_cause_type);
 
-                       if (end_cause_type == CM_TELEPHONY_ENDCAUSE_REJ_SAT_CALL_CTRL) {
-                               cm_telephony_call_data_t *call = NULL;
-                               if (_callmgr_telephony_get_sat_originated_call(telephony_handle, &call) == 0) {
+                       if (_callmgr_telephony_get_sat_originated_call(telephony_handle, &sat_call) == 0) {
+                               /*
+                               ** Qualcomm sends this event. But SPRD doesn't
+                               ** SPRD send SAT event for call not allowed
+                               */
+                               if (end_cause_type == CM_TELEPHONY_ENDCAUSE_REJ_SAT_CALL_CTRL) {
                                        _callmgr_telephony_send_sat_response(telephony_handle,
                                                        CM_TELEPHONY_SAT_EVENT_SETUP_CALL, CM_TELEPHONY_SAT_RESPONSE_ME_CONTROL_PERMANENT_PROBLEM, CM_TELEPHONY_SIM_UNKNOWN);
+                               } else if (call_data->is_canceled == TRUE) {
+                                       _callmgr_telephony_send_sat_response(telephony_handle,
+                                                       CM_TELEPHONY_SAT_EVENT_SETUP_CALL, CM_TELEPHONY_SAT_RESPONSE_ME_CLEAR_DOWN_BEFORE_CONN, CM_TELEPHONY_SIM_UNKNOWN);
+                               } else if (call_data->call_state == CM_TEL_CALL_STATE_DIALING || call_data->call_state == CM_TEL_CALL_STATE_ALERT) {
+                                       _callmgr_telephony_send_sat_response(telephony_handle,
+                                                       CM_TELEPHONY_SAT_EVENT_SETUP_CALL, CM_TELEPHONY_SAT_RESPONSE_NETWORK_UNABLE_TO_PROCESS_COMMAND, CM_TELEPHONY_SIM_UNKNOWN);
                                }
                        }
                }
 
                telephony_handle->cb_fn(CM_TELEPHONY_EVENT_IDLE, GUINT_TO_POINTER(callIdleInfo->id), telephony_handle->user_data);
 
-               __callmgr_telephony_get_call_to_be_retreived(telephony_handle, &held_call);
+               __callmgr_telephony_get_call_to_be_retrieved(telephony_handle, &held_call);
                if (held_call) {
                        _callmgr_telephony_active_call(telephony_handle);
                }
+
+               // If call is disconnected by SAT SETUP_CALL process
+               if (modem_info->sat_data.setup_call) {
+                       info("Process setup_call event continously.");
+                       if (telephony_handle->multi_handles[CM_TELEPHONY_SIM_1] == handle) {
+                               _callmgr_telephony_set_active_sim_slot(telephony_handle, CM_TELEPHONY_SIM_1);
+                       } else {
+                               _callmgr_telephony_set_active_sim_slot(telephony_handle, CM_TELEPHONY_SIM_2);
+                       }
+                       telephony_handle->cb_fn(CM_TELEPHONY_EVENT_SAT_SETUP_CALL, NULL, telephony_handle->user_data);
+               }
+
        } else if ((g_strcmp0(noti_id, TAPI_NOTI_VOICE_CALL_STATUS_ACTIVE) == 0) || (g_strcmp0(noti_id, TAPI_NOTI_VIDEO_CALL_STATUS_ACTIVE) == 0)) {
                cm_telephony_call_data_t *call_data = NULL;
                TelCallStatusActiveNoti_t *callActiveInfo = (TelCallStatusActiveNoti_t *)data;
-               CM_RETURN_IF_FAIL(callActiveInfo);
+
                if (_callmgr_telephony_get_call_by_call_id(telephony_handle, callActiveInfo->id, &call_data) < 0) {
-                       dbg("No call_data exists for this event...");
-                       return;
+                       err("No call_data exists for this event...");
+                       goto FINISHED;
                }
                __callmgr_telephony_set_call_state(call_data, CM_TEL_CALL_STATE_ACTIVE);
                __callmgr_telephony_set_start_time(call_data);
                __callmgr_telephony_remove_wait_call(telephony_handle, call_data);
-               __callmgr_telephony_set_retreive_flag(call_data, FALSE);
+               __callmgr_telephony_set_retrieve_flag(call_data, FALSE);
 
                /*If all wait calls are updated*/
                if (modem_info->wait_call_list == NULL) {
                        __callmgr_telephony_get_all_call_list(telephony_handle);
                        telephony_handle->cb_fn(modem_info->wait_event, GUINT_TO_POINTER(callActiveInfo->id), telephony_handle->user_data);
                }
+
+               // If there is call_control info not processed yet
+               if (modem_info->sat_data.call_control_result) {
+                       dbg("set call_number[%s], calling_name[%s]",
+                                       modem_info->sat_data.call_control_result->u.callCtrlCnfCallData.address.string,
+                                       modem_info->sat_data.call_control_result->dispData.string);
+
+                       _callmgr_telephony_set_call_number(call_data, (char*)modem_info->sat_data.call_control_result->u.callCtrlCnfCallData.address.string);
+                       _callmgr_telephony_set_calling_name(call_data, (char*)modem_info->sat_data.call_control_result->dispData.string);
+
+                       call_data->is_in_sat_call_control = TRUE;
+
+                       telephony_handle->cb_fn(CM_TELEPHONY_EVENT_SAT_CALL_CONTROL_RESULT,
+                                       &modem_info->sat_data.call_control_result->callCtrlResult, telephony_handle->user_data);
+
+                       call_data->is_in_sat_call_control = FALSE;
+                       g_free(modem_info->sat_data.call_control_result);
+                       modem_info->sat_data.call_control_result = NULL;
+               }
+
+               if (_callmgr_telephony_get_sat_originated_call(telephony_handle, &sat_call) == 0) {
+                       _callmgr_telephony_send_sat_response(telephony_handle,
+                                       CM_TELEPHONY_SAT_EVENT_SETUP_CALL, CM_TELEPHONY_SAT_RESPONSE_ME_RET_SUCCESS, CM_TELEPHONY_SIM_UNKNOWN);
+               }
+
        } else if (g_strcmp0(noti_id, TAPI_NOTI_VOICE_CALL_STATUS_HELD) == 0) {
                cm_telephony_call_data_t *call_data = NULL;
                TelCallStatusHeldNoti_t *callHeldInfo = (TelCallStatusHeldNoti_t *)data;
-               CM_RETURN_IF_FAIL(callHeldInfo);
+               cm_telephony_sat_setup_call_type_e sat_setup_call_type = CM_TELEPHONY_SAT_SETUP_CALL_RESERVED;
+
                if (_callmgr_telephony_get_call_by_call_id(telephony_handle, callHeldInfo->id, &call_data) < 0) {
-                       dbg("No call_data exists for this event...");
-                       return;
+                       err("No call_data exists for this event...");
+                       goto FINISHED;
                }
                __callmgr_telephony_set_call_state(call_data, CM_TEL_CALL_STATE_HELD);
                __callmgr_telephony_remove_wait_call(telephony_handle, call_data);
 
+               /* Retreive hold call after end sat call*/
+               _callmgr_telephony_get_sat_setup_call_type(telephony_handle, &sat_setup_call_type);
+               if (sat_setup_call_type == CM_TELEPHONY_SAT_SETUP_CALL_PUT_ALL_OTHER_CALLS_ON_HOLD
+                               || sat_setup_call_type == CM_TELEPHONY_SAT_SETUP_CALL_PUT_ALL_OTHER_CALLS_ON_HOLD_WITH_REDIAL) {
+                       info("Set retrieve for SAT");
+                       __callmgr_telephony_set_retrieve_flag(call_data, TRUE);
+               }
+
                /*If all wait calls are updated*/
                if (modem_info->wait_call_list == NULL) {
                        __callmgr_telephony_get_all_call_list(telephony_handle);
@@ -467,56 +543,85 @@ static void __callmgr_telephony_handle_tapi_events(TapiHandle *handle, const cha
                                _callmgr_telephony_dial(telephony_handle, call_data);
                        }
                }
+
+               // If call is held by SAT SETUP_CALL process
+               if (modem_info->sat_data.setup_call) {
+                       info("Process setup_call event continously.");
+                       if (telephony_handle->multi_handles[CM_TELEPHONY_SIM_1] == handle) {
+                               _callmgr_telephony_set_active_sim_slot(telephony_handle, CM_TELEPHONY_SIM_1);
+                       } else {
+                               _callmgr_telephony_set_active_sim_slot(telephony_handle, CM_TELEPHONY_SIM_2);
+                       }
+                       telephony_handle->cb_fn(CM_TELEPHONY_EVENT_SAT_SETUP_CALL, NULL, telephony_handle->user_data);
+               }
+
        } else if ((g_strcmp0(noti_id, TAPI_NOTI_VOICE_CALL_STATUS_DIALING) == 0) || (g_strcmp0(noti_id, TAPI_NOTI_VIDEO_CALL_STATUS_DIALING) == 0)) {
                TelCallStatusDialingNoti_t *callDialingInfo = NULL;
                cm_telephony_call_data_t *call_data = NULL;
-
                callDialingInfo = (TelCallStatusDialingNoti_t *)data;
-               CM_RETURN_IF_FAIL(callDialingInfo);
+
                if (_callmgr_telephony_get_call_by_call_id(telephony_handle, NO_CALL_HANDLE, &call_data) < 0) {
-                       dbg("No call_data exists for this event...");
-                       return;
+                       err("No call_data exists for this event...");
+                       goto FINISHED;
                }
                __callmgr_telephony_set_call_state(call_data, CM_TEL_CALL_STATE_DIALING);
                __callmgr_telephony_set_call_id(call_data, callDialingInfo->id);
-               telephony_handle->cb_fn(CM_TELEPHONY_EVENT_DIALING, GUINT_TO_POINTER(callDialingInfo->id), telephony_handle->user_data);
+
+
+               // If there is call_control info not processed yet
+               if (modem_info->sat_data.call_control_result) {
+                       dbg("set call_number[%s], calling_name[%s]",
+                                       modem_info->sat_data.call_control_result->u.callCtrlCnfCallData.address.string,
+                                       modem_info->sat_data.call_control_result->dispData.string);
+
+                       _callmgr_telephony_set_call_number(call_data, (char*)modem_info->sat_data.call_control_result->u.callCtrlCnfCallData.address.string);
+                       _callmgr_telephony_set_calling_name(call_data, (char*)modem_info->sat_data.call_control_result->dispData.string);
+
+                       call_data->is_in_sat_call_control = TRUE;
+
+                       telephony_handle->cb_fn(CM_TELEPHONY_EVENT_SAT_CALL_CONTROL_RESULT,
+                                       &modem_info->sat_data.call_control_result->callCtrlResult, telephony_handle->user_data);
+
+                       call_data->is_in_sat_call_control = FALSE;
+                       g_free(modem_info->sat_data.call_control_result);
+                       modem_info->sat_data.call_control_result = NULL;
+               }
+
+               telephony_handle->cb_fn(CM_TELEPHONY_EVENT_DIALING, (void *)callDialingInfo->id, telephony_handle->user_data);
+
        } else if ((g_strcmp0(noti_id, TAPI_NOTI_VOICE_CALL_STATUS_ALERT) == 0) || (g_strcmp0(noti_id, TAPI_NOTI_VIDEO_CALL_STATUS_ALERT) == 0)) {
                TelCallStatusAlertNoti_t *callAlertInfo = NULL;
                cm_telephony_call_data_t *call_data = NULL;
-
                callAlertInfo = (TelCallStatusAlertNoti_t *)data;
-               CM_RETURN_IF_FAIL(callAlertInfo);
 
                if (_callmgr_telephony_get_call_by_call_id(telephony_handle, callAlertInfo->id, &call_data) < 0) {
-                       dbg("No call_data exists for this event...");
-                       return;
+                       err("No call_data exists for this event...");
+                       goto FINISHED;
                }
                __callmgr_telephony_set_call_state(call_data, CM_TEL_CALL_STATE_ALERT);
                telephony_handle->cb_fn(CM_TELEPHONY_EVENT_ALERT, GUINT_TO_POINTER(callAlertInfo->id), telephony_handle->user_data);
        } else if ((g_strcmp0(noti_id, TAPI_NOTI_VOICE_CALL_STATUS_INCOMING) == 0) || (g_strcmp0(noti_id, TAPI_NOTI_VIDEO_CALL_STATUS_INCOMING) == 0)) {
-               TelCallIncomingCallInfo_t callIncomingInfo = {0,};
+               TelCallIncomingCallInfo_t *callIncomingInfo = NULL;
                cm_telephony_call_data_t *call = NULL;
                cm_telephony_call_type_e call_type = CM_TEL_CALL_TYPE_INVALID;
                cm_telephony_name_mode_e name_mode = CM_TEL_NAME_MODE_NONE;
                char *number = NULL;
+               callIncomingInfo = (TelCallIncomingCallInfo_t *)data;
 
-               if (data != NULL) {
-                       memcpy(&callIncomingInfo, data, sizeof(TelCallIncomingCallInfo_t));
-                       call_handle = callIncomingInfo.CallHandle;
-               }
+               call_handle = callIncomingInfo->CallHandle;
 
                if (telephony_handle->multi_handles[CM_TELEPHONY_SIM_1] == handle) {
                        _callmgr_telephony_set_active_sim_slot(telephony_handle, CM_TELEPHONY_SIM_1);
                } else {
                        _callmgr_telephony_set_active_sim_slot(telephony_handle, CM_TELEPHONY_SIM_2);
                }
-               sec_dbg("calling party number : [%s]", callIncomingInfo.szCallingPartyNumber);
-               sec_dbg("calling party name mode : [%d]", callIncomingInfo.CallingNameInfo.NameMode);
-               sec_dbg("calling party name : [%s]", callIncomingInfo.CallingNameInfo.szNameData);
+               sec_dbg("calling party number : [%s]", callIncomingInfo->szCallingPartyNumber);
+               sec_dbg("calling party name mode : [%d]", callIncomingInfo->CallingNameInfo.NameMode);
+               sec_dbg("calling party name : [%s]", callIncomingInfo->CallingNameInfo.szNameData);
 
-               __callmgr_telephony_get_name_mode(callIncomingInfo.szCallingPartyNumber, callIncomingInfo.CliMode, callIncomingInfo.CliCause, &name_mode);
+               __callmgr_telephony_get_name_mode(callIncomingInfo->szCallingPartyNumber, callIncomingInfo->CliMode, callIncomingInfo->CliCause, &name_mode);
                if (name_mode == CM_TEL_NAME_MODE_NONE) {
-                       number = callIncomingInfo.szCallingPartyNumber;
+                       number = callIncomingInfo->szCallingPartyNumber;
                }
                if ((g_strcmp0(noti_id, TAPI_NOTI_VOICE_CALL_STATUS_INCOMING) == 0)) {
                        call_type = CM_TEL_CALL_TYPE_CS_VOICE;
@@ -524,18 +629,22 @@ static void __callmgr_telephony_handle_tapi_events(TapiHandle *handle, const cha
                        call_type = CM_TEL_CALL_TYPE_CS_VIDEO;
                }
                _callmgr_telephony_call_new(telephony_handle, call_type, CM_TEL_CALL_DIRECTION_MT, number, &call);
-               CM_RETURN_IF_FAIL(call);
-               if (strlen(callIncomingInfo.CallingNameInfo.szNameData) > 0) {
-                       _callmgr_telephony_set_calling_name(call, callIncomingInfo.CallingNameInfo.szNameData);
+               if (call == NULL) {
+                       err("call data is NULL");
+                       goto FINISHED;
+               }
+
+               if (strlen(callIncomingInfo->CallingNameInfo.szNameData) > 0) {
+                       _callmgr_telephony_set_calling_name(call, callIncomingInfo->CallingNameInfo.szNameData);
                }
                __callmgr_telephony_set_call_state(call, CM_TEL_CALL_STATE_INCOMING);
                __callmgr_telephony_set_call_id(call, call_handle);
-               __callmgr_telephony_check_special_string(callIncomingInfo.szCallingPartyNumber, &name_mode);
+               __callmgr_telephony_check_special_string(callIncomingInfo->szCallingPartyNumber, &name_mode);
                __callmgr_telephony_set_name_mode(call, name_mode);
                ret_val = __callmgr_telephony_create_wait_call_list(telephony_handle, CM_TELEPHONY_EVENT_ACTIVE, call, NULL);
                if (ret_val < 0) {
                        err("__callmgr_telephony_create_wait_call_list() failed");
-                       return;
+                       goto FINISHED;
                }
                info("Incoming call[%d]", call_handle);
                telephony_handle->cb_fn(CM_TELEPHONY_EVENT_INCOMING, (void *)call, telephony_handle->user_data);
@@ -543,6 +652,12 @@ static void __callmgr_telephony_handle_tapi_events(TapiHandle *handle, const cha
                err("ERROR!! Noti is not defined");
        }
 
+FINISHED:
+       result = device_power_release_lock(POWER_LOCK_CPU);
+       if (result != DEVICE_ERROR_NONE) {
+               err("device_power_release_lock() failed with err[%d]", result);
+       }
+
        info("tapi noti(%s) processed done.", noti_id);
 
        return;
@@ -551,9 +666,24 @@ static void __callmgr_telephony_handle_tapi_events(TapiHandle *handle, const cha
 static void __callmgr_telephony_handle_info_tapi_events(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
 {
        callmgr_telephony_t telephony_handle = (callmgr_telephony_t)user_data;
+       int idx = 0;
+       int slot_id = 0;
+       int result = -1;
        CM_RETURN_IF_FAIL(telephony_handle);
 
-       info("event_type:[%s]", noti_id);
+       result = device_power_request_lock(POWER_LOCK_CPU, 0);
+       if (result != DEVICE_ERROR_NONE) {
+               err("device_power_request_lock() failed with err[%d]", result);
+       }
+
+       for (idx = 0; idx < telephony_handle->modem_cnt; idx++) {
+               if (telephony_handle->multi_handles[idx] == handle) {
+                       slot_id = idx;
+                       break;
+               }
+       }
+
+       info("event_type:[%s] from SIM[%d]. Current active_sim_slot[%d]", noti_id, slot_id, telephony_handle->active_sim_slot);
        if (g_strcmp0(noti_id, TAPI_NOTI_CALL_INFO_FORWARDED) == 0) {
                telephony_handle->cb_fn(CM_TELEPHONY_EVENT_SS_INFO, (void *)CM_MO_CODE_CALL_FORWARDED, telephony_handle->user_data);
        } else if (g_strcmp0(noti_id, TAPI_NOTI_CALL_INFO_BARRED_INCOMING) == 0) {
@@ -587,14 +717,34 @@ static void __callmgr_telephony_handle_info_tapi_events(TapiHandle *handle, cons
        } else {
                err("ERROR!! Noti is not defined");
        }
+
+       result = device_power_release_lock(POWER_LOCK_CPU);
+       if (result != DEVICE_ERROR_NONE) {
+               err("device_power_release_lock() failed with err[%d]", result);
+       }
 }
 
 static void __callmgr_telephony_handle_sound_tapi_events(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
 {
        callmgr_telephony_t telephony_handle = (callmgr_telephony_t)user_data;
-       CM_RETURN_IF_FAIL(telephony_handle);
+       int idx = 0;
+       int sim_slot = -1;
+       int result = -1;
+
+       result = device_power_request_lock(POWER_LOCK_CPU, 0);
+       if (result != DEVICE_ERROR_NONE) {
+               err("device_power_request_lock() failed with err[%d]", result);
+       }
+
+       for (idx = 0; idx < telephony_handle->modem_cnt; idx++) {
+               if ((telephony_handle->multi_handles[idx] != NULL) && (telephony_handle->multi_handles[idx] == handle)) {
+                       sim_slot = idx;
+                       break;
+               }
+       }
+
+       info("event_type:[%s] from SIM[%d]. Current active_sim_slot[%d]", noti_id, sim_slot, telephony_handle->active_sim_slot);
 
-       info("event_type:[%s]", noti_id);
        if (g_strcmp0(noti_id, TAPI_NOTI_CALL_SOUND_WBAMR) == 0) {
                dbg("TAPI_NOTI_CALL_SOUND_WBAMR");
                TelCallSoundWbamrNoti_t wbamrInfo = TAPI_CALL_SOUND_WBAMR_STATUS_OFF;
@@ -628,7 +778,12 @@ static void __callmgr_telephony_handle_sound_tapi_events(TapiHandle *handle, con
 
                telephony_handle->cb_fn(CM_TELEPHONY_EVENT_SOUND_RINGBACK_TONE, (void *)ringbacktone_info, telephony_handle->user_data);
        } else {
-               dbg("ERROR!! Noti is not defined");
+               err("ERROR!! Noti is not defined");
+       }
+
+       result = device_power_release_lock(POWER_LOCK_CPU);
+       if (result != DEVICE_ERROR_NONE) {
+               err("device_power_release_lock() failed with err[%d]", result);
        }
 }
 
@@ -647,7 +802,7 @@ static int __callmgr_telephony_check_no_sim_state(callmgr_telephony_t telephony_
                *is_no_sim = FALSE;
                return -1;
        } else {
-               dbg("card_status = %d", sim_status);
+               info("card_status = %d", sim_status);
                switch (sim_status) {
                case TAPI_SIM_STATUS_CARD_NOT_PRESENT:
                case TAPI_SIM_STATUS_CARD_REMOVED:
@@ -666,6 +821,36 @@ static int __callmgr_telephony_check_no_sim_state(callmgr_telephony_t telephony_
        return 0;
 }
 
+static int __callmgr_telephony_check_sim_poweroff_state(callmgr_telephony_t telephony_handle, int slot_id, gboolean *is_power_off)
+{
+       int ret = -1;
+       int sim_changed = 0;
+       TelSimCardStatus_t sim_status = TAPI_SIM_STATUS_UNKNOWN;
+       CM_RETURN_VAL_IF_FAIL(telephony_handle, -1);
+       CM_RETURN_VAL_IF_FAIL(slot_id < telephony_handle->modem_cnt, -1);
+       dbg("__callmgr_telephony_check_sim_poweroff_state()");
+
+       ret = tel_get_sim_init_info(telephony_handle->multi_handles[slot_id], &sim_status, &sim_changed);
+       if (TAPI_API_SUCCESS != ret) {
+               err("tel_get_sim_init_info() failed with err[%d]", ret);
+               *is_power_off = FALSE;
+               return -1;
+       } else {
+               info("card_status = %d", sim_status);
+               switch (sim_status) {
+               case TAPI_SIM_STATUS_CARD_POWEROFF:
+                       *is_power_off = TRUE;
+                       break;
+               default:
+                       warn("Unknown Card_status[%d]", sim_status);
+                       *is_power_off = FALSE;
+                       break;
+               }
+       }
+       return 0;
+}
+
+
 static int __callmgr_telephony_get_card_type(callmgr_telephony_t telephony_handle, int slot_id, cm_telephony_card_type_e *card_type_out)
 {
        int ret = -1;
@@ -696,7 +881,7 @@ static int __callmgr_telephony_get_card_type(callmgr_telephony_t telephony_handl
                        cm_card_type = CM_CARD_TYPE_UNKNOWN;
                        break;
        }
-       dbg("card_type = %d", cm_card_type);
+       info("card_type = %d", cm_card_type);
        *card_type_out = cm_card_type;
        return 0;
 }
@@ -709,6 +894,12 @@ static void __callmgr_telephony_handle_sim_status_events(TapiHandle *handle, con
        int idx = 0;
        int sim_slot = -1;
        struct __modem_info *modem_info = NULL;
+       int result = -1;
+
+       result = device_power_request_lock(POWER_LOCK_CPU, 0);
+       if (result != DEVICE_ERROR_NONE) {
+               err("device_power_request_lock() failed with err[%d]", result);
+       }
 
        for (idx = 0; idx < telephony_handle->modem_cnt; idx++) {
                if ((telephony_handle->multi_handles[idx] != NULL) && (telephony_handle->multi_handles[idx] == handle)) {
@@ -717,6 +908,8 @@ static void __callmgr_telephony_handle_sim_status_events(TapiHandle *handle, con
                }
        }
 
+       info("event_type:[%s] from SIM[%d]. Current active_sim_slot[%d]", noti_id, sim_slot, telephony_handle->active_sim_slot);
+
        if (sim_slot != -1) {
                TapiResult_t tapi_err = TAPI_API_SUCCESS;
                modem_info = &telephony_handle->modem_info[sim_slot];
@@ -725,9 +918,15 @@ static void __callmgr_telephony_handle_sim_status_events(TapiHandle *handle, con
                        || (*status == TAPI_SIM_STATUS_CARD_CRASHED)) {
                        info("SIM slot[%d] is empty", sim_slot);
                        modem_info->is_no_sim = TRUE;
+                       modem_info->is_sim_poweroff = FALSE;
                        modem_info->is_sim_initialized = FALSE;
-               } else {
+               } else if((*status == TAPI_SIM_STATUS_CARD_POWEROFF)){
+                       info("SIM slot[%d] is powered-off", sim_slot);
+                       modem_info->is_sim_poweroff = TRUE;
+                       modem_info->is_sim_initialized = FALSE;
+               }else {
                        modem_info->is_no_sim = FALSE;
+                       modem_info->is_sim_poweroff = FALSE;
                        if (*status == TAPI_SIM_STATUS_SIM_INIT_COMPLETED) {
                                modem_info->is_sim_initialized = TRUE;
                        } else {
@@ -747,9 +946,15 @@ static void __callmgr_telephony_handle_sim_status_events(TapiHandle *handle, con
                                warn("tel_get_sim_ecc failed, tapi_err=%d", tapi_err);
                        }
                } else {
-                       dbg("Already Fetched tel_get_sim_ecc for SIM slot[%d]", idx);
+                       warn("Already Fetched tel_get_sim_ecc for SIM slot[%d]", idx);
                }
        }
+
+       result = device_power_release_lock(POWER_LOCK_CPU);
+       if (result != DEVICE_ERROR_NONE) {
+               err("device_power_release_lock() failed with err[%d]", result);
+       }
+
        return;
 }
 
@@ -761,6 +966,12 @@ static void __callmgr_telephony_handle_modem_power_status_events(TapiHandle *han
        int idx = 0;
        int sim_slot = -1;
        struct __modem_info *modem_info = NULL;
+       int result = -1;
+
+       result = device_power_request_lock(POWER_LOCK_CPU, 0);
+       if (result != DEVICE_ERROR_NONE) {
+               err("device_power_request_lock() failed with err[%d]", result);
+       }
 
        for (idx = 0; idx < telephony_handle->modem_cnt; idx++) {
                if ((telephony_handle->multi_handles[idx] != NULL) && (telephony_handle->multi_handles[idx] == handle)) {
@@ -769,6 +980,8 @@ static void __callmgr_telephony_handle_modem_power_status_events(TapiHandle *han
                }
        }
 
+       info("event_type:[%s] from SIM[%d]. Current active_sim_slot[%d]", noti_id, sim_slot, telephony_handle->active_sim_slot);
+
        if (sim_slot != -1) {
                modem_info = &telephony_handle->modem_info[sim_slot];
                if (1 /* offline */ == *status || 2 /* Error */== *status) {
@@ -780,6 +993,12 @@ static void __callmgr_telephony_handle_modem_power_status_events(TapiHandle *han
        } else {
                err("Invalid handle");
        }
+
+       result = device_power_release_lock(POWER_LOCK_CPU);
+       if (result != DEVICE_ERROR_NONE) {
+               err("device_power_release_lock() failed with err[%d]", result);
+       }
+
        return;
 }
 
@@ -791,6 +1010,12 @@ static void __callmgr_telephony_handle_network_events(TapiHandle *handle, const
        int idx = -1;
        struct __modem_info *modem_info = NULL;
        info("event_type:[%s]", noti_id);
+       int result = -1;
+
+       result = device_power_request_lock(POWER_LOCK_CPU, 0);
+       if (result != DEVICE_ERROR_NONE) {
+               err("device_power_request_lock() failed with err[%d]", result);
+       }
 
        for (idx = 0; idx < telephony_handle->modem_cnt; idx++) {
                if (telephony_handle->multi_handles[idx] == handle) {
@@ -799,13 +1024,15 @@ static void __callmgr_telephony_handle_network_events(TapiHandle *handle, const
                }
        }
 
+       info("sim[%d], event_type:[%s]",slot_id, noti_id);
+
        if (slot_id != -1) {
                modem_info = &telephony_handle->modem_info[slot_id];
                if (g_strcmp0(noti_id, TAPI_PROP_NETWORK_PLMN) == 0) {
                        char *plmn = (char *)data;
                        char mcc_value[4] = {0,};
                        char mnc_value[4] = {0,};
-                       dbg("plmn_value = [%s]", plmn);
+                       info("plmn_value = [%s]", plmn);
 
                        g_strlcpy(mcc_value, plmn, 4);
                        g_strlcpy(mnc_value, plmn+3, 4);
@@ -851,6 +1078,11 @@ static void __callmgr_telephony_handle_network_events(TapiHandle *handle, const
        } else {
                err("Invalid handle");
        }
+
+       result = device_power_release_lock(POWER_LOCK_CPU);
+       if (result != DEVICE_ERROR_NONE) {
+               err("device_power_release_lock() failed with err[%d]", result);
+       }
        return;
 }
 
@@ -862,6 +1094,12 @@ static void __callmgr_telephony_handle_sat_events(TapiHandle *handle, const char
        cm_telepony_sim_slot_type_e request_sim_slot = CM_TELEPHONY_SIM_UNKNOWN;
        struct __cm_tel_sat_data *sat_data = NULL;
        info("event_type:[%s]", noti_id);
+       int result = -1;
+
+       result = device_power_request_lock(POWER_LOCK_CPU, 0);
+       if (result != DEVICE_ERROR_NONE) {
+               err("device_power_request_lock() failed with err[%d]", result);
+       }
 
        _callmgr_telephony_get_active_sim_slot(telephony_handle, &active_sim_slot);
        if (telephony_handle->multi_handles[CM_TELEPHONY_SIM_1] == handle) {
@@ -870,7 +1108,7 @@ static void __callmgr_telephony_handle_sat_events(TapiHandle *handle, const char
                request_sim_slot = CM_TELEPHONY_SIM_2;
        }
 
-       dbg("active_sim_slot: %d sat_req_for_sim_slot: %d", active_sim_slot, request_sim_slot);
+       info("active_sim_slot[%d], request_sim_slot[%d]", active_sim_slot, request_sim_slot);
 
        if(CM_TELEPHONY_SIM_UNKNOWN == active_sim_slot) {
                _callmgr_telephony_set_active_sim_slot(telephony_handle, request_sim_slot);
@@ -882,69 +1120,146 @@ static void __callmgr_telephony_handle_sat_events(TapiHandle *handle, const char
        if (g_strcmp0(noti_id, TAPI_NOTI_SAT_SETUP_CALL) == 0) {
                TelSatSetupCallIndCallData_t *ind_data = data;
 
-               dbg("cmdId[%d], dispText[%s], callNumber[%s], duration[%d], icon[%d]",
-                               ind_data->commandId, ind_data->dispText.string, ind_data->callNumber.string,
+               dbg("cmdId[%d], call_type[%d], dispText[%s], callNumber[%s], duration[%d], icon[%d]",
+                               ind_data->commandId, ind_data->calltype, ind_data->dispText.string, ind_data->callNumber.string,
                                ind_data->duration, ind_data->iconId.bIsPresent);
 
-               sat_data->event_type = CM_TELEPHONY_SAT_EVENT_SETUP_CALL;
                if ((sat_data->setup_call = g_malloc0(sizeof(TelSatSetupCallIndCallData_t) + 1)))
                        memcpy(sat_data->setup_call, ind_data, sizeof(TelSatSetupCallIndCallData_t));
                else
                        err("g_malloc0() failed.");
 
-               if(request_sim_slot == active_sim_slot) {
-                       telephony_handle->cb_fn(CM_TELEPHONY_EVENT_SAT_SETUP_CALL, NULL, telephony_handle->user_data);
-               } else {
-                       err("SAT request came for wrong sim_slot");
-                       _callmgr_telephony_send_sat_response(telephony_handle,
-                                       CM_TELEPHONY_SAT_EVENT_SETUP_CALL, CM_TELEPHONY_SAT_RESPONSE_ME_UNABLE_TO_PROCESS_COMMAND, request_sim_slot);
+               if (ind_data->dispText.stringLen > 0) {
+                       // display second alpha ID with popup
+                       // according to spec, 3GPP 51.010-4 / 31.124
+                       // 27.22.4.13 SEQ 2.1 (SET UP CALL, two alpha identifiers)
+                       _callmgr_util_launch_popup(CALL_POPUP_TOAST, CALL_POPUP_TOAST_CUSTOM, (const char*)ind_data->dispText.string, 0 , NULL, NULL);
+               }
+
+               if (request_sim_slot != active_sim_slot) {
+                       int ret = 0, call_count = 0;
+                       ret = _callmgr_telephony_get_call_count(telephony_handle, &call_count);
+                       if ( ret == 0 && call_count == 0) {
+                               // change active_sim_slot only when there is no other call
+                               _callmgr_telephony_set_active_sim_slot(telephony_handle, request_sim_slot);
+                       } else {
+                               err("there is another call in other SIM slot or _callmgr_telephony_get_call_count() failed[%d].", ret);
+                               _callmgr_telephony_send_sat_response(telephony_handle,
+                                               CM_TELEPHONY_SAT_EVENT_SETUP_CALL, CM_TELEPHONY_SAT_RESPONSE_ME_UNABLE_TO_PROCESS_COMMAND, request_sim_slot);
+                               goto FINISHED;
+                       }
                }
 
+               telephony_handle->cb_fn(CM_TELEPHONY_EVENT_SAT_SETUP_CALL, NULL, telephony_handle->user_data);
+
        } else if (g_strcmp0(noti_id, TAPI_NOTI_SAT_SEND_DTMF) == 0) {
                TelSatSendDtmfIndDtmfData_t *ind_data = data;
 
                dbg("cmdId[%d], bIsHiddenMode[%d], dtmfString[%s]",
                                ind_data->commandId, ind_data->bIsHiddenMode, ind_data->dtmfString.string);
 
-               sat_data->event_type = CM_TELEPHONY_SAT_EVENT_SEND_DTMF;
                if ((sat_data->send_dtmf = g_malloc0(sizeof(TelSatSendDtmfIndDtmfData_t) + 1)))
                        memcpy(sat_data->send_dtmf, ind_data, sizeof(TelSatSendDtmfIndDtmfData_t));
                else
                        err("g_malloc0() failed.");
-               if(request_sim_slot == active_sim_slot) {
+
+               if (request_sim_slot == active_sim_slot) {
                        telephony_handle->cb_fn(CM_TELEPHONY_EVENT_SAT_SEND_DTMF, (void *)ind_data->dtmfString.string, telephony_handle->user_data);
                } else {
-                       err("SAT request came for wrong sim_slot");
+                       err("request came for wrong sim_slot");
                        _callmgr_telephony_send_sat_response(telephony_handle,
                                        CM_TELEPHONY_EVENT_SAT_SEND_DTMF, CM_TELEPHONY_SAT_RESPONSE_ME_UNABLE_TO_PROCESS_COMMAND, request_sim_slot);
                }
 
        } else if (g_strcmp0(noti_id, TAPI_NOTI_SAT_CALL_CONTROL_RESULT) == 0) {
                TelSatCallCtrlIndData_t *ind_data = data;
-               gboolean b_ui_update = FALSE;
+               cm_telephony_sat_call_ctrl_type_e call_ctrl_type = CM_TELEPHONY_SAT_CALL_CTRL_RESERVED;
+               cm_telephony_call_data_t *call = NULL;
 
                dbg("callCtrlCnfType[%d], callCtrlResult[%d], dispData[%s], bIsUserInfoDisplayEnabled[%d]",
                                ind_data->callCtrlCnfType, ind_data->callCtrlResult, ind_data->dispData.string,
                                ind_data->bIsUserInfoDisplayEnabled);
 
-               sat_data->event_type = CM_TELEPHONY_SAT_EVENT_CALL_CONTROL_RESULT;
+               if (ind_data->callCtrlCnfType == TAPI_SAT_CALL_TYPE_MO_VOICE &&
+                               ind_data->u.callCtrlCnfCallData.address.stringLen > 0) {
+                       dbg("MO_VOICE call control call address[%s]", ind_data->u.callCtrlCnfCallData.address.string);
+               }
+
+               if(request_sim_slot != active_sim_slot) {
+                       err("request came for wrong sim_slot");
+               }
+
                if ((sat_data->call_control_result = g_malloc0(sizeof(TelSatCallCtrlIndData_t) + 1))) {
+                       char popup[128] = {0,};
+                       char *number = NULL;
+
                        memcpy(sat_data->call_control_result, ind_data, sizeof(TelSatCallCtrlIndData_t));
-                       if (sat_data->call_control_result->callCtrlResult == TAPI_SAT_CALL_CTRL_R_ALLOWED_WITH_MOD)
-                               b_ui_update = TRUE;
-               }
-               else
-                       err("g_malloc0() failed.");
+                       switch (sat_data->call_control_result->callCtrlResult) {
+                       case TAPI_SAT_CALL_CTRL_R_ALLOWED_NO_MOD:
+                               call_ctrl_type = CM_TELEPHONY_SAT_CALL_CTRL_R_ALLOWED_NO_MOD;
+                               break;
+                       case TAPI_SAT_CALL_CTRL_R_NOT_ALLOWED:
+                               call_ctrl_type = CM_TELEPHONY_SAT_CALL_CTRL_R_NOT_ALLOWED;
+                               break;
+                       case TAPI_SAT_CALL_CTRL_R_ALLOWED_WITH_MOD:
+                               call_ctrl_type = CM_TELEPHONY_SAT_CALL_CTRL_R_ALLOWED_MOD;
+
+                               /* Fetch the Sat / Dial / Active call data for */
+                               _callmgr_telephony_get_sat_originated_call(telephony_handle, &call);
+                               if (call == NULL) {
+                                       warn("There is no sat originated call. trying to get a call with NO_CALL_HANDLE id");
+                                       _callmgr_telephony_get_call_by_call_id(telephony_handle, NO_CALL_HANDLE, &call);
+                                       if (call == NULL) {
+                                               warn("There is no NO_CALL_HANDLE call. trying to get a call in DIALING status");
+                                               _callmgr_telephony_get_call_by_state(telephony_handle, CM_TEL_CALL_STATE_DIALING, &call);
+                                               if (call == NULL) {
+                                                       warn("There is no call in DIALING status. trying to get a call in ACTIVE status");
+                                                       _callmgr_telephony_get_call_by_state(telephony_handle, CM_TEL_CALL_STATE_ACTIVE, &call);
+                                                       if (call == NULL) {
+                                                               err("There is no call in ACTIVE status. apply this to next DIALING/ACTIVE call.");
+                                                               goto FINISHED;
+                                                       }
+                                               }
+                                       }
+                               }
+
+                               dbg("current call_name[%s], call_num[%s]", call->calling_name, call->call_number);
+                               // update call number & calling name using call control result info
+                               _callmgr_telephony_set_call_number(call, (char*)ind_data->u.callCtrlCnfCallData.address.string);
+                               _callmgr_telephony_set_calling_name(call, (char*)ind_data->dispData.string);
+                               dbg("updated call_name[%s], call_num[%s] by call controll", call->calling_name, call->call_number);
+
+                               _callmgr_telephony_get_call_number(call, &number);
+                               if (number) {
+                                       // display "Number changed by SIM: XXXX" with popup
+                                       // according to SMC lab. requirement (P150909-00591)
+                                       g_snprintf(popup, 127, "Number changed by SIM: %s", number);
+                                       _callmgr_util_launch_popup(CALL_POPUP_TOAST, CALL_POPUP_TOAST_CUSTOM, popup, 0 , NULL, NULL);
+
+                                       g_free(number);
+                               }
+                               break;
+                       default:
+                               warn("invalid call control result[%d]", ind_data->callCtrlResult);
+                               break;
+                       }
+
+                       telephony_handle->cb_fn(CM_TELEPHONY_EVENT_SAT_CALL_CONTROL_RESULT, &call_ctrl_type, telephony_handle->user_data);
+
+                       g_free(sat_data->call_control_result);
+                       sat_data->call_control_result = NULL;
 
-               if(request_sim_slot == active_sim_slot) {
-                       telephony_handle->cb_fn(CM_TELEPHONY_EVENT_SAT_CALL_CONTROL_RESULT, &b_ui_update, telephony_handle->user_data);
                } else {
-                       err("SAT request came for wrong sim_slot");
-                       _callmgr_telephony_send_sat_response(telephony_handle,
-                                       CM_TELEPHONY_EVENT_SAT_CALL_CONTROL_RESULT, TAPI_SAT_CALL_CTRL_R_NOT_ALLOWED, request_sim_slot);
+                       err("g_malloc0() failed.");
                }
        }
 
+FINISHED:
+       result = device_power_release_lock(POWER_LOCK_CPU);
+       if (result != DEVICE_ERROR_NONE) {
+               err("device_power_release_lock() failed with err[%d]", result);
+       }
+
        return;
 }
 
@@ -1036,7 +1351,6 @@ void _callmgr_telephony_send_sat_response(callmgr_telephony_t telephony_handle,
                                err("tel_send_sat_app_exec_result() is failed[%d].", error_code);
                        }
 
-                       sat_data->event_type = CM_TELEPHONY_SAT_EVENT_NONE;
                        g_free(sat_data->setup_call);
                        sat_data->setup_call = NULL;
                }
@@ -1079,47 +1393,13 @@ void _callmgr_telephony_send_sat_response(callmgr_telephony_t telephony_handle,
                                err("tel_send_sat_app_exec_result() is failed[%d].", error_code);
                        }
 
-                       sat_data->event_type = CM_TELEPHONY_SAT_EVENT_NONE;
                        g_free(sat_data->send_dtmf);
                        sat_data->send_dtmf = NULL;
                }
                break;
        case CM_TELEPHONY_SAT_EVENT_CALL_CONTROL_RESULT:
-               {
-                       cm_telephony_call_data_t *sat_dial_active_call = NULL;
-                       CM_RETURN_IF_FAIL(sat_data->call_control_result);
-
-                       switch(sat_data->call_control_result->callCtrlResult) {
-                       case TAPI_SAT_CALL_CTRL_R_ALLOWED_NO_MOD:
-                               break;
-                       case TAPI_SAT_CALL_CTRL_R_NOT_ALLOWED:
-                               _callmgr_telephony_send_sat_response(telephony_handle,
-                                               CM_TELEPHONY_SAT_EVENT_SETUP_CALL, CM_TELEPHONY_SAT_RESPONSE_ME_CONTROL_PERMANENT_PROBLEM, current_active_sim_slot);
-                               break;
-                       case TAPI_SAT_CALL_CTRL_R_ALLOWED_WITH_MOD:
-                               /* Fetch the Sat / Dial / Active call data for */
-                               _callmgr_telephony_get_sat_originated_call(telephony_handle, &sat_dial_active_call);
-                               if (!sat_dial_active_call)
-                                       _callmgr_telephony_get_call_by_state(telephony_handle, CM_TEL_CALL_STATE_DIALING, &sat_dial_active_call);
-                               if (!sat_dial_active_call)
-                                       _callmgr_telephony_get_call_by_state(telephony_handle, CM_TEL_CALL_STATE_ACTIVE, &sat_dial_active_call);
-
-                               _callmgr_telephony_set_call_number(sat_dial_active_call, sat_data->call_control_result->u.callCtrlCnfCallData.address.string);
-                               _callmgr_telephony_set_calling_name(sat_dial_active_call, sat_data->call_control_result->dispData.string);
-                               break;
-                       default:
-                               warn("unhandled resp_type[%d].", sat_data->call_control_result->callCtrlResult);
-                               break;
-
-                       }
-
-                       sat_data->event_type = CM_TELEPHONY_SAT_EVENT_NONE;
-                       g_free(sat_data->call_control_result);
-                       sat_data->call_control_result = NULL;
-               }
-               break;
        default:
-               warn("invalid event_type[%d]", event_type);
+               warn("unhandled event_type[%d]", event_type);
                break;
        }
 
@@ -1132,8 +1412,20 @@ static void __callmgr_telephony_handle_preferred_sim_events(TapiHandle *handle,
        TelCallPreferredVoiceSubs_t *preferred_sim = (TelCallPreferredVoiceSubs_t *)data;
        callmgr_telephony_t telephony_handle = (callmgr_telephony_t)user_data;
        CM_RETURN_IF_FAIL(telephony_handle);
+       int result = -1;
+
+       result = device_power_request_lock(POWER_LOCK_CPU, 0);
+       if (result != DEVICE_ERROR_NONE) {
+               err("device_power_request_lock() failed with err[%d]", result);
+       }
+
        warn("preferred SIM changed to [%d]", *preferred_sim);
        telephony_handle->cb_fn(CM_TELEPHONY_EVENT_PREFERRED_SIM_CHANGED, (void *)*preferred_sim, telephony_handle->user_data);
+
+       result = device_power_release_lock(POWER_LOCK_CPU);
+       if (result != DEVICE_ERROR_NONE) {
+               err("device_power_release_lock() failed with err[%d]", result);
+       }
        return;
 }
 
@@ -1259,7 +1551,7 @@ static int __callmgr_telephony_check_service_status(callmgr_telephony_t telephon
 
        ret = tel_get_property_int(telephony_handle->multi_handles[slot_id], TAPI_PROP_NETWORK_SERVICE_TYPE, &svc_type);
        if (TAPI_API_SUCCESS == ret) {
-               dbg("svc_type = [%d]", svc_type);
+               info("svc_type = [%d]", svc_type);
                switch (svc_type) {
                        case TAPI_NETWORK_SERVICE_TYPE_UNKNOWN:
                        case TAPI_NETWORK_SERVICE_TYPE_NO_SERVICE:
@@ -1331,7 +1623,7 @@ static int __callmgr_telephony_check_cs_status(callmgr_telephony_t telephony_han
                err("tel_get_property_int() failed");
                return -1;
        } else {
-               dbg("CS network state : %d", cs_type);
+               info("CS network state : %d", cs_type);
                if (cs_type == VCONFKEY_TELEPHONY_SVC_CS_ON) {
                        is_cs_on = TRUE;
                }
@@ -1353,7 +1645,7 @@ static int __callmgr_telephony_get_imsi_mcc_mnc(callmgr_telephony_t telephony_ha
 
        ret = tel_get_sim_imsi(telephony_handle->multi_handles[slot_id], &sim_imsi_info);
        if (0 == ret) {
-               dbg("mcc = [%s], mnc = [%s]", sim_imsi_info.szMcc, sim_imsi_info.szMnc);
+               info("mcc = [%s], mnc = [%s]", sim_imsi_info.szMcc, sim_imsi_info.szMnc);
                *mcc = (unsigned long)atoi(sim_imsi_info.szMcc);
                *mnc = (unsigned long)atoi(sim_imsi_info.szMnc);
        } else {
@@ -1385,7 +1677,7 @@ static int __callmgr_telephony_get_network_mcc_mnc(callmgr_telephony_t telephony
                char mcc_value[4] = {0,};
                char mnc_value[4] = {0,};
 
-               dbg("plmn_value = [%s]", plmn);
+               info("plmn_value = [%s]", plmn);
 
                g_strlcpy(mcc_value, plmn, 4);
                g_strlcpy(mnc_value, plmn+3, 4);
@@ -1399,7 +1691,7 @@ static int __callmgr_telephony_get_network_mcc_mnc(callmgr_telephony_t telephony
                *mcc = CALL_NETWORK_MCC_UK;
                *mnc = CALL_NETWORK_MNC_01;
        }
-       dbg("mcc = %ld,mnc = %ld", *mcc, *mnc);
+       info("mcc = %ld,mnc = %ld", *mcc, *mnc);
 
        return 0;
 }
@@ -1452,6 +1744,8 @@ static int __callmgr_telephony_init(callmgr_telephony_t telephony_handle)
                        __callmgr_telephony_check_cs_status(telephony_handle, idx, &modem_info->is_cs_available);
                        /* Get network status */
                        __callmgr_telephony_check_service_status(telephony_handle, idx, &modem_info->network_status);
+                       /* Get SIM power status*/
+                       __callmgr_telephony_check_sim_poweroff_state(telephony_handle, idx, &modem_info->is_sim_poweroff);
 
                        memset(&modem_info->sim_ecc_list, 0x00, sizeof(TelSimEccList_t));
                        tapi_err = tel_get_sim_ecc(telephony_handle->multi_handles[idx], &modem_info->sim_ecc_list);
@@ -1549,7 +1843,7 @@ int _callmgr_telephony_call_new(callmgr_telephony_t telephony_handle, cm_telepho
                _callmgr_telephony_call_delete(telephony_handle, NO_CALL_HANDLE);
                call = NULL;
        } else {
-               dbg("No call data exists...");
+               err("No call data exists...");
        }
 
        call = (cm_telephony_call_data_t*)calloc(1, sizeof(cm_telephony_call_data_t));
@@ -1600,7 +1894,7 @@ int _callmgr_telephony_call_delete(callmgr_telephony_t telephony_handle, unsigne
 int _callmgr_telephony_set_active_sim_slot(callmgr_telephony_t telephony_handle, cm_telepony_sim_slot_type_e active_slot)
 {
        CM_RETURN_VAL_IF_FAIL(telephony_handle, -1);
-       warn("_callmgr_telephony_set_active_sim_slot(), active_slot[%d]", active_slot);
+       info("active_slot[%d]", active_slot);
        telephony_handle->active_sim_slot = active_slot;
 
        return 0;
@@ -1609,9 +1903,8 @@ int _callmgr_telephony_set_active_sim_slot(callmgr_telephony_t telephony_handle,
 int _callmgr_telephony_get_active_sim_slot(callmgr_telephony_t telephony_handle, cm_telepony_sim_slot_type_e *active_slot)
 {
        CM_RETURN_VAL_IF_FAIL(telephony_handle, -1);
-       dbg("_callmgr_telephony_get_active_sim_slot()");
        *active_slot = telephony_handle->active_sim_slot;
-       dbg("active_slot[%d]", *active_slot);
+       info("active_slot[%d]", *active_slot);
        return 0;
 }
 
@@ -1623,10 +1916,12 @@ static void __callmgr_telephony_dial_call_resp_cb(TapiHandle *handle, int result
        telephony_handle = (callmgr_telephony_t)user_data;
 
        if (TAPI_CAUSE_SUCCESS != result) {
-               dbg("MO Call Dial call Failed with error cause: %d", result);
+               err("MO Call Dial call Failed with error cause: %d", result);
 
                if (result == TAPI_CAUSE_FIXED_DIALING_NUMBER_ONLY) {
                        telephony_handle->cb_fn(CM_TELEPHONY_EVENT_NETWORK_ERROR, (void *)CM_TEL_CALL_ERR_FDN_ONLY, telephony_handle->user_data);
+               } else if (result == TAPI_CAUSE_REJ_SAT_CALL_CTRL) {
+                       telephony_handle->cb_fn(CM_TELEPHONY_EVENT_NETWORK_ERROR, (void *)CM_TEL_CALL_ERR_REJ_SAT_CALL_CTRL, telephony_handle->user_data);
                } else {
                        telephony_handle->cb_fn(CM_TELEPHONY_EVENT_NETWORK_ERROR, (void *)CM_TEL_CALL_ERR_DIAL_FAIL, telephony_handle->user_data);
                }
@@ -1693,10 +1988,10 @@ int _callmgr_telephony_dial(callmgr_telephony_t telephony_handle, cm_telephony_c
 static void __callmgr_telephony_hold_call_resp_cb(TapiHandle *handle, int result, void *tapi_data, void *user_data)
 {
        callmgr_telephony_t telephony_handle = (callmgr_telephony_t)user_data;
-       dbg("__callmgr_telephony_hold_call_resp_cb() Result : %d", result);
+       cm_telepony_sim_slot_type_e requested_sim_slot = CM_TELEPHONY_SIM_UNKNOWN;
 
        if (TAPI_CAUSE_SUCCESS != result) {
-               err("tel_hold_call() failed");
+               err("tel_hold_call() failed[%d]", result);
                cm_telephony_call_data_t *call_data = NULL;
                _callmgr_telephony_get_call_by_call_id(telephony_handle, NO_CALL_HANDLE, &call_data);
                if (call_data) {
@@ -1705,9 +2000,22 @@ static void __callmgr_telephony_hold_call_resp_cb(TapiHandle *handle, int result
                }
                _callmgr_util_launch_popup(CALL_POPUP_CALL_ERR, CALL_ERR_HOLD_CALL_FAILED, NULL, 0, NULL, NULL);
                __callmgr_telephony_remove_wait_call_list(telephony_handle);
+
+               // If it's tried to hold call by SAT SETUP_CALL process
+               if (telephony_handle->multi_handles[CM_TELEPHONY_SIM_1] == handle) {
+                       requested_sim_slot = CM_TELEPHONY_SIM_1;
+               } else {
+                       requested_sim_slot = CM_TELEPHONY_SIM_2;
+               }
+               if (telephony_handle->modem_info[requested_sim_slot].sat_data.setup_call) {
+                       info("send fail TR since holding call is failed.");
+                       _callmgr_telephony_send_sat_response(telephony_handle,
+                                       CM_TELEPHONY_SAT_EVENT_SETUP_CALL, CM_TELEPHONY_SAT_RESPONSE_NETWORK_UNABLE_TO_PROCESS_COMMAND_WITHOUT_CAUSE, CM_TELEPHONY_SIM_UNKNOWN);
+               }
        } else {
-               dbg("tel_hold_call success");
+               info("tel_hold_call success");
        }
+
        return;
 }
 
@@ -1740,7 +2048,7 @@ int _callmgr_telephony_hold_call(callmgr_telephony_t telephony_handle)
 static void __callmgr_telephony_join_call_resp_cb(TapiHandle *handle, int result, void *tapi_data, void *user_data)
 {
        callmgr_telephony_t telephony_handle = (callmgr_telephony_t)user_data;
-       dbg("__callmgr_telephony_join_call_resp_cb() Result : %d", result);
+       info("__callmgr_telephony_join_call_resp_cb() Result : %d", result);
 
        if (TAPI_CAUSE_SUCCESS != result) {
                err("_callmgr_telephony_join_call() get failed ");
@@ -1789,7 +2097,7 @@ int _callmgr_telephony_join_call(callmgr_telephony_t telephony_handle)
 static void __callmgr_telephony_split_call_resp_cb(TapiHandle *handle, int result, void *tapi_data, void *user_data)
 {
        callmgr_telephony_t telephony_handle = (callmgr_telephony_t)user_data;
-       dbg("__callmgr_telephony_split_call_resp_cb() Result : %d", result);
+       info("__callmgr_telephony_split_call_resp_cb() Result : %d", result);
 
        if (TAPI_CAUSE_SUCCESS != result) {
                err("tel_split_call() is failed");
@@ -1849,7 +2157,7 @@ int _callmgr_telephony_set_answer_request_type(callmgr_telephony_t telephony_han
 
 static void __callmgr_telephony_answer_call_resp_cb(TapiHandle *handle, int result, void *tapi_data, void *user_data)
 {
-       dbg("__callmgr_telephony_answer_call_resp_cb() Result : %d", result);
+       info("__callmgr_telephony_answer_call_resp_cb() Result : %d", result);
 
        callmgr_telephony_t telephony_handle = (callmgr_telephony_t)user_data;
 
@@ -1857,7 +2165,7 @@ static void __callmgr_telephony_answer_call_resp_cb(TapiHandle *handle, int resu
 
        if (TAPI_CAUSE_SUCCESS != result) {
                err("tel_answer_call() failed");
-               _callmgr_util_launch_popup(CALL_POPUP_CALL_ERR, CALL_ERR_ANSWER_CALL_FAILED, NULL, 0, NULL, NULL);
+//             _callmgr_util_launch_popup(CALL_POPUP_CALL_ERR, CALL_ERR_ANSWER_CALL_FAILED, NULL, 0, NULL, NULL);
        }
        return;
 }
@@ -1869,7 +2177,7 @@ int _callmgr_telephony_answer_call(callmgr_telephony_t telephony_handle, int ans
        unsigned int incoming_call_id = NO_CALL_HANDLE;
        CM_RETURN_VAL_IF_FAIL(telephony_handle, -1);
        CM_RETURN_VAL_IF_FAIL(telephony_handle->active_sim_slot < telephony_handle->modem_cnt, -1);
-       dbg("_callmgr_telephony_answer_call() with answer type[%d]", ans_type);
+       info("_callmgr_telephony_answer_call() with answer type[%d]", ans_type);
 
        /* Fetch the Incoming call data */
        ret = _callmgr_telephony_get_call_by_state(telephony_handle, CM_TEL_CALL_STATE_INCOMING, &incoming_call_data);
@@ -1959,14 +2267,13 @@ int _callmgr_telephony_reject_call(callmgr_telephony_t telephony_handle)
                err("tel_answer_call failed with err: %d", ret);
                return -1;
        }
-
        return 0;
 }
 
 static void __callmgr_telephony_active_call_resp_cb(TapiHandle *handle, int result, void *tapi_data, void *user_data)
 {
        callmgr_telephony_t telephony_handle = (callmgr_telephony_t)user_data;
-       dbg("__callmgr_telephony_active_call_resp_cb() Result : %d", result);
+       info("__callmgr_telephony_active_call_resp_cb() Result : %d", result);
 
        if (TAPI_CAUSE_SUCCESS != result) {
                err("tel_activate_call() failed");
@@ -2008,7 +2315,7 @@ int _callmgr_telephony_active_call(callmgr_telephony_t telephony_handle)
 static void __callmgr_telephony_swap_call_resp_cb(TapiHandle *handle, int result, void *tapi_data, void *user_data)
 {
        callmgr_telephony_t telephony_handle = (callmgr_telephony_t)user_data;
-       dbg("__callmgr_telephony_swap_call_resp_cb() Result : %d", result);
+       info("__callmgr_telephony_swap_call_resp_cb() Result : %d", result);
 
        if (TAPI_CAUSE_SUCCESS != result) {
                err("tel_swap_call() failed");
@@ -2054,7 +2361,7 @@ int _callmgr_telephony_swap_call(callmgr_telephony_t telephony_handle)
 
 static void __callmgr_telephony_transfer_call_resp_cb(TapiHandle *handle, int result, void *tapi_data, void *user_data)
 {
-       dbg("__callmgr_telephony_transfer_call_resp_cb() Result : %d", result);
+       info("__callmgr_telephony_transfer_call_resp_cb() Result : %d", result);
        if (TAPI_CAUSE_SUCCESS != result) {
                err("tel_transfer_call() failed");
                _callmgr_util_launch_popup(CALL_POPUP_CALL_ERR, CALL_ERR_TRANSFER_CALL_FAILED, NULL, 0, NULL, NULL);
@@ -2097,7 +2404,7 @@ static void __callmgr_telephony_end_call_resp_cb(TapiHandle *handle, int result,
        callmgr_telephony_t telephony_handle = user_data;
        CM_RETURN_IF_FAIL(tapi_data);
        CM_RETURN_IF_FAIL(telephony_handle);
-       dbg("Result : %d", result);
+       info("Result : %d", result);
        if (TAPI_CAUSE_SUCCESS != result) {
                err("tel_end_call() failed");
        }
@@ -2117,9 +2424,21 @@ int _callmgr_telephony_end_call(callmgr_telephony_t telephony_handle, unsigned i
        switch (release_type) {
        case CM_TEL_CALL_RELEASE_TYPE_BY_CALL_HANDLE:
                {
-                       /* To do
-                        * Check whether passed handle is of incoming, outgoing or connected call...and accordingly change the state.
-                        */
+                       cm_telephony_call_data_t *call_data = NULL;
+                       if (_callmgr_telephony_get_call_by_call_id(telephony_handle, call_id, &call_data) < 0) {
+                               err("No call_data exists for this event...");
+                       } else {
+                               /*******************************************
+                               * To handle Canceled outgoing call.
+                               * call-ui must call release by call handle,
+                               * in case of ending dilaing call
+                               ********************************************/
+                               if (call_data->call_state == CM_TEL_CALL_STATE_DIALING ||
+                                       call_data->call_state == CM_TEL_CALL_STATE_ALERT) {
+                                       __callmgr_telephony_set_call_canceled_flag(call_data, TRUE);
+                               }
+                       }
+
                        ret_tapi = tel_end_call(telephony_handle->multi_handles[telephony_handle->active_sim_slot], call_id, TAPI_CALL_END, __callmgr_telephony_end_call_resp_cb, telephony_handle);
                        if (ret_tapi != TAPI_API_SUCCESS) {
                                err("tel_end_call() get failed with err: %d", ret);
@@ -2251,7 +2570,7 @@ int _callmgr_telephony_stop_dtmf(callmgr_telephony_t telephony_handle)
 
 static void __callmgr_telephony_burst_dtmf_cb(TapiHandle *handle, int result, void *data, void *user_data)
 {
-       dbg("result : %d", result);
+       info("result : %d", result);
 }
 
 int _callmgr_telephony_burst_dtmf(callmgr_telephony_t telephony_handle, const char *dtmf_digits)
@@ -2309,7 +2628,7 @@ static void __callmgr_telephony_all_call_list_cb(TelCallStatus_t *out, void *use
        __callmgr_telephony_set_call_id(call_data, out->CallHandle);
        __callmgr_telephony_set_conference_call_state(call_data, out->bConferenceState);
 
-       dbg("call state [%d]", out->CallState);
+       info("call state [%d]", out->CallState);
        switch (out->CallState) {
                case TAPI_CALL_STATE_IDLE:
                        call_state = CM_TEL_CALL_STATE_IDLE;
@@ -2358,7 +2677,7 @@ static int __callmgr_telephony_get_all_call_list(callmgr_telephony_t telephony_h
 
 static int __callmgr_telephony_set_call_id(cm_telephony_call_data_t *call, unsigned int call_id)
 {
-       dbg("__callmgr_telephony_set_call_id(), call ID[%d]", call_id);
+       info("__callmgr_telephony_set_call_id(), call ID[%d]", call_id);
        CM_RETURN_VAL_IF_FAIL(call, -1);
        call->call_id = call_id;
        return 0;
@@ -2373,7 +2692,7 @@ static int __callmgr_telephony_set_call_state(cm_telephony_call_data_t *call, cm
 
 static int __callmgr_telephony_set_conference_call_state(cm_telephony_call_data_t *call, gboolean bConferenceState)
 {
-       dbg("__callmgr_telephony_set_conference_call(), bConferenceState[%d]", bConferenceState);
+       info("__callmgr_telephony_set_conference_call(), bConferenceState[%d]", bConferenceState);
        CM_RETURN_VAL_IF_FAIL(call, -1);
        call->is_conference = bConferenceState;
        return 0;
@@ -2429,11 +2748,19 @@ static int __callmgr_telephony_set_start_time(cm_telephony_call_data_t *call)
        return -1;
 }
 
-static int __callmgr_telephony_set_retreive_flag(cm_telephony_call_data_t *call, gboolean is_set)
+static int __callmgr_telephony_set_retrieve_flag(cm_telephony_call_data_t *call, gboolean is_set)
+{
+       CM_RETURN_VAL_IF_FAIL(call, -1);
+       call->retrieve_flag = is_set;
+       warn("call(%d) retrieve flag [%d]", call->call_id, call->retrieve_flag);
+       return 0;
+}
+
+static int __callmgr_telephony_set_call_canceled_flag(cm_telephony_call_data_t *call, gboolean is_set)
 {
        CM_RETURN_VAL_IF_FAIL(call, -1);
-       call->retreive_flag = is_set;
-       warn("retreive flag [%d]", call->retreive_flag);
+       call->is_canceled = is_set;
+       warn("call(%d) is_canceled [%d]", call->call_id, call->is_canceled);
        return 0;
 }
 
@@ -2479,7 +2806,13 @@ int _callmgr_telephony_get_call_number(cm_telephony_call_data_t *call, char **ca
        CM_RETURN_VAL_IF_FAIL(call, -1);
        CM_RETURN_VAL_IF_FAIL(call_number, -1);
        if (call->call_number) {
-               *call_number = g_strdup(call->call_number);
+               if (g_str_has_prefix(call->call_number, CALLMGR_CLI_SHOW_ID)
+                       || g_str_has_prefix(call->call_number, CALLMGR_CLI_HIDE_ID)) {
+                       /* Hide CLI code */
+                       *call_number = g_strdup(call->call_number + 4);
+               } else {
+                       *call_number = g_strdup(call->call_number);
+               }
        } else {
                *call_number = NULL;
        }
@@ -2615,7 +2948,6 @@ int _callmgr_telephony_get_call_by_state(callmgr_telephony_t telephony_handle, c
        cm_telephony_call_data_t *call = NULL;
        int list_len = -1;
        int idx = -1;
-       dbg("_callmgr_telephony_get_call_by_state :%d", state);
        CM_RETURN_VAL_IF_FAIL(telephony_handle, -1);
        CM_RETURN_VAL_IF_FAIL(call_data_out, -1);
 
@@ -2637,7 +2969,6 @@ static int __callmgr_telephony_end_all_call_by_state(callmgr_telephony_t telepho
        cm_telephony_call_data_t *call = NULL;
        int list_len = -1;
        int idx = -1;
-       dbg("__callmgr_telephony_end_all_call_by_state :%d", state);
        CM_RETURN_VAL_IF_FAIL(telephony_handle, -1);
 
        modem_info = &telephony_handle->modem_info[telephony_handle->active_sim_slot];
@@ -2651,13 +2982,13 @@ static int __callmgr_telephony_end_all_call_by_state(callmgr_telephony_t telepho
        return -1;
 }
 
-static int __callmgr_telephony_get_call_to_be_retreived(callmgr_telephony_t telephony_handle, cm_telephony_call_data_t **call_data_out)
+static int __callmgr_telephony_get_call_to_be_retrieved(callmgr_telephony_t telephony_handle, cm_telephony_call_data_t **call_data_out)
 {
        struct __modem_info *modem_info = NULL;
        cm_telephony_call_data_t *call = NULL;
        int list_len = -1;
        int idx = -1;
-       dbg("__callmgr_telephony_get_call_to_be_retreived()");
+       dbg("__callmgr_telephony_get_call_to_be_retrieved()");
        CM_RETURN_VAL_IF_FAIL(telephony_handle, -1);
        CM_RETURN_VAL_IF_FAIL(call_data_out, -1);
 
@@ -2665,7 +2996,7 @@ static int __callmgr_telephony_get_call_to_be_retreived(callmgr_telephony_t tele
        list_len = g_slist_length(modem_info->call_list);
        for (idx = 0; idx < list_len; idx++) {
                call = g_slist_nth_data(modem_info->call_list, idx);
-               if (call->retreive_flag == TRUE) {
+               if (call->retrieve_flag == TRUE) {
                        *call_data_out = call;
                        return 0;
                }
@@ -2717,13 +3048,40 @@ int _callmgr_telephony_get_voice_call(callmgr_telephony_t telephony_handle, cm_t
        return -1;
 }
 
+int _callmgr_telephony_get_sat_event_status(callmgr_telephony_t telephony_handle, cm_telephony_sat_event_type_e event_type, gboolean *b_is_ongoing)
+{
+       CM_RETURN_VAL_IF_FAIL(telephony_handle, -1);
+       CM_RETURN_VAL_IF_FAIL(b_is_ongoing, -1);
+
+       switch(event_type) {
+       case CM_TELEPHONY_SAT_EVENT_SETUP_CALL:
+               if (telephony_handle->modem_info[telephony_handle->active_sim_slot].sat_data.setup_call)
+                       *b_is_ongoing = TRUE;
+               break;
+       case CM_TELEPHONY_SAT_EVENT_SEND_DTMF:
+               if (telephony_handle->modem_info[telephony_handle->active_sim_slot].sat_data.send_dtmf)
+                       *b_is_ongoing = TRUE;
+               break;
+       case CM_TELEPHONY_SAT_EVENT_CALL_CONTROL_RESULT:
+               if (telephony_handle->modem_info[telephony_handle->active_sim_slot].sat_data.call_control_result)
+                       *b_is_ongoing = TRUE;
+               break;
+       default:
+               warn("invalid event_type[%d]", event_type);
+               return -1;
+               break;
+       }
+
+       return 0;
+}
+
 int _callmgr_telephony_get_sat_setup_call_number(callmgr_telephony_t telephony_handle, char **call_number)
 {
        CM_RETURN_VAL_IF_FAIL(telephony_handle, -1);
        CM_RETURN_VAL_IF_FAIL(call_number, -1);
 
        if (telephony_handle->modem_info[telephony_handle->active_sim_slot].sat_data.setup_call) {
-               *call_number = g_strdup(telephony_handle->modem_info[telephony_handle->active_sim_slot].sat_data.setup_call->callNumber.string);
+               *call_number = g_strdup((const gchar *)telephony_handle->modem_info[telephony_handle->active_sim_slot].sat_data.setup_call->callNumber.string);
        } else {
                *call_number = NULL;
        }
@@ -2735,17 +3093,18 @@ int _callmgr_telephony_get_sat_setup_call_name(callmgr_telephony_t telephony_han
        CM_RETURN_VAL_IF_FAIL(telephony_handle, -1);
        CM_RETURN_VAL_IF_FAIL(call_name, -1);
        if (telephony_handle->modem_info[telephony_handle->active_sim_slot].sat_data.setup_call) {
-               *call_name = g_strdup(telephony_handle->modem_info[telephony_handle->active_sim_slot].sat_data.setup_call->dispText.string);
+               *call_name = g_strdup((const gchar *)telephony_handle->modem_info[telephony_handle->active_sim_slot].sat_data.setup_call->dispText.string);
        } else {
                *call_name = NULL;
        }
        return 0;
 }
 
-int _callmgr_telephony_get_sat_event_type(callmgr_telephony_t telephony_handle, cm_telephony_sat_event_type_e *sat_event_type)
+int _callmgr_telephony_get_sat_setup_call_type(callmgr_telephony_t telephony_handle, cm_telephony_sat_setup_call_type_e *sat_setup_call_type)
 {
        CM_RETURN_VAL_IF_FAIL(telephony_handle, -1);
-       *sat_event_type = telephony_handle->modem_info[telephony_handle->active_sim_slot].sat_data.event_type;
+       CM_RETURN_VAL_IF_FAIL(telephony_handle->modem_info[telephony_handle->active_sim_slot].sat_data.setup_call, -1);
+       *sat_setup_call_type = telephony_handle->modem_info[telephony_handle->active_sim_slot].sat_data.setup_call->calltype;
        return 0;
 }
 
@@ -2771,15 +3130,26 @@ int _callmgr_telephony_get_sat_originated_call(callmgr_telephony_t telephony_han
        return -1;
 }
 
-int _callmgr_telephony_is_sat_originated_call(cm_telephony_call_data_t *call, gboolean *is_sat_originated_call)
+int _callmgr_telephony_get_sat_call_control_call(callmgr_telephony_t telephony_handle, cm_telephony_call_data_t **call_data_out)
 {
-       CM_RETURN_VAL_IF_FAIL(call, -1);
-       CM_RETURN_VAL_IF_FAIL(is_sat_originated_call, -1);
-       if (call->is_sat_originated_call)
-               *is_sat_originated_call = TRUE;
-       else
-               *is_sat_originated_call = FALSE;
-       return 0;
+       cm_telephony_call_data_t *call = NULL;
+       GSList *call_list = NULL;
+       int list_len = -1;
+       int idx = -1;
+       CM_RETURN_VAL_IF_FAIL(telephony_handle, -1);
+       CM_RETURN_VAL_IF_FAIL(call_data_out, -1);
+
+       call_list = telephony_handle->modem_info[telephony_handle->active_sim_slot].call_list;
+       list_len = g_slist_length(call_list);
+       for (idx = 0; idx < list_len; idx++) {
+               call = g_slist_nth_data(call_list, idx);
+               if (call->is_in_sat_call_control) {
+                       info("Call found. id[%d], name[%s], number[%s]", call->call_id, call->calling_name, call->call_number);
+                       *call_data_out = call;
+                       return 0;
+               }
+       }
+       return -1;
 }
 
 int _callmgr_telephony_set_sat_originated_call_flag(cm_telephony_call_data_t *call, gboolean is_sat_originated_call)
@@ -2820,7 +3190,7 @@ int _callmgr_telephony_get_call_count(callmgr_telephony_t telephony_handle, int
 
        call_list = telephony_handle->modem_info[telephony_handle->active_sim_slot].call_list;
        *call_count_out = g_slist_length(call_list);
-       dbg("call_cnt :%d", *call_count_out);
+       info("call_cnt :%d", *call_count_out);
        return 0;
 }
 
@@ -3053,36 +3423,59 @@ int _callmgr_telephony_get_mcc_mnc(callmgr_telephony_t telephony_handle, unsigne
        return 0;
 }
 
-static int __callmgr_telephony_set_sim_slot_for_ecc(callmgr_telephony_t telephony_handle)
+static int __callmgr_telephony_set_sim_slot_for_ecc(callmgr_telephony_t telephony_handle, const char *pNumber)
 {
        int sim_init_cnt = 0;
        cm_telepony_preferred_sim_type_e pref_sim_type = CM_TEL_PREFERRED_UNKNOWN_E;
        cm_telepony_sim_slot_type_e preferred_sim = CM_TELEPHONY_SIM_UNKNOWN;
        int idx = -1;
+       gboolean sim_power_off = FALSE;
+
        CM_RETURN_VAL_IF_FAIL(telephony_handle, -1);
 
+
+/* step1. SIM power check for MultiSIM only. if one SIM is powered-off,  use available SIM slot by default regardless SIM state */
+       if(telephony_handle->modem_cnt > 1){
+               for(idx =0;idx<telephony_handle->modem_cnt;idx++){
+                       sim_power_off = telephony_handle->modem_info[idx].is_sim_poweroff;
+                       if(sim_power_off == TRUE){
+                               info("SIM %d powered off. choose alternative slot for emergency call",idx);
+                               if(idx == CM_TELEPHONY_SIM_1){
+                                       return _callmgr_telephony_set_active_sim_slot(telephony_handle, CM_TELEPHONY_SIM_2);
+                               }
+                               else if(idx == CM_TELEPHONY_SIM_2){
+                                       return _callmgr_telephony_set_active_sim_slot(telephony_handle, CM_TELEPHONY_SIM_1);
+                               }
+                       }
+               }
+       }
+
+/*step 2. Pirority check for active SIM(s) */
        for (idx = 0; idx < telephony_handle->modem_cnt; idx++) {
                if (telephony_handle->modem_info[idx].is_sim_initialized == TRUE) {
                        sim_init_cnt++;
                }
        }
 
+       info("sim_init_cnt : %d", sim_init_cnt);
+
        _callmgr_telephony_set_active_sim_slot(telephony_handle, CM_TELEPHONY_SIM_UNKNOWN);
        if (sim_init_cnt > 1) {
                _callmgr_telephony_get_preferred_sim_type(telephony_handle, &pref_sim_type);
-               if (pref_sim_type == CM_TELEPHONY_SIM_2) {
+               if (pref_sim_type == CM_TEL_PREFERRED_SIM_2_E) {
                        preferred_sim = CM_TELEPHONY_SIM_2;
                } else {
                        preferred_sim = CM_TELEPHONY_SIM_1;
                }
        } else if (sim_init_cnt == 1) {
+               info("one SIM disabled/not present/Locked or SingleSIM only model. select initialized SIM");
                if (telephony_handle->modem_info[CM_TELEPHONY_SIM_1].is_sim_initialized) {
                        preferred_sim = CM_TELEPHONY_SIM_1;
                } else {
                        preferred_sim = CM_TELEPHONY_SIM_2;
                }
        } else {
-               err("SIM not initialized!!");
+               err("SingleSIM model or both SIM slot not initialized!!");
                preferred_sim = CM_TELEPHONY_SIM_1;
        }
 
@@ -3098,14 +3491,24 @@ static int __callmgr_telephony_set_sim_slot_for_ecc(callmgr_telephony_t telephon
                } else {
                        alternative_slot = CM_TELEPHONY_SIM_1;
                }
+
                if (telephony_handle->modem_info[alternative_slot].network_status != CM_NETWORK_STATUS_OUT_OF_SERVICE) {
+                       info("SIM%d is on service. use this SIM instead of preferred SIM", alternative_slot);
                        _callmgr_telephony_set_active_sim_slot(telephony_handle, alternative_slot);
                        return 0;
                }
        }
 
-       err("All modem is no service status! Use SIM 1 slot!!");
-       _callmgr_telephony_set_active_sim_slot(telephony_handle, CM_TELEPHONY_SIM_1);
+       warn("(both)SIM slots are in No service, Check SIM ECC");
+       if (__callmgr_telephony_check_ecc_slot(telephony_handle,pNumber, (cm_telepony_sim_slot_type_e *)&idx) == 0)
+       {
+               warn("SIM has same ecc num");
+               _callmgr_telephony_set_active_sim_slot(telephony_handle, idx);
+               return 0;
+       }
+
+       err("ECC list not matched! select pre-selected SIM slot!! : %d", preferred_sim);
+       _callmgr_telephony_set_active_sim_slot(telephony_handle, preferred_sim);
        return -1;
 }
 
@@ -3133,7 +3536,7 @@ int _callmgr_telephony_check_ecc_number(callmgr_telephony_t telephony_handle, co
 
        _callmgr_telephony_get_call_count(telephony_handle, &call_count);
        if (call_count == 0) {
-               __callmgr_telephony_set_sim_slot_for_ecc(telephony_handle);
+               __callmgr_telephony_set_sim_slot_for_ecc(telephony_handle, pNumber);
        }
        _callmgr_vconf_get_salescode(&salescode);
        if ((salescode == CALL_CSC_KT) || (salescode == CALL_CSC_SKT)) {
@@ -3184,6 +3587,72 @@ FINISH:
        return ret_val;
 }
 
+int __callmgr_telephony_check_ecc_slot(callmgr_telephony_t telephony_handle, const char *pNumber, cm_telepony_sim_slot_type_e *sim_slot)
+{
+       cm_telephony_card_type_e simcard_type = CM_CARD_TYPE_UNKNOWN;
+       struct __modem_info *modem_info = NULL;
+       int i = 0;
+       int sim_cnt = 0;
+
+       CM_RETURN_VAL_IF_FAIL(telephony_handle, -1);
+       CM_RETURN_VAL_IF_FAIL(pNumber, -1);
+       CM_RETURN_VAL_IF_FAIL(sim_slot, -1);
+
+       *sim_slot = CM_TELEPHONY_SIM_UNKNOWN;   /*Init*/
+
+       for (sim_cnt = 0 ; sim_cnt < CALLMGR_TAPI_HANDLE_MAX ; sim_cnt++) {
+               modem_info = &telephony_handle->modem_info[sim_cnt];
+               simcard_type = modem_info->card_type;
+               info("simcard_type : %d", simcard_type);
+
+               switch (simcard_type) {
+                       case CM_CARD_TYPE_GSM:
+                               {
+                                       dbg("[SimCardType=SIM_CARD_TYPE_GSM]");
+
+                                       /*TAPI api Compliance */
+                                       /*To get Emergency data of 2G */
+                                       if (modem_info->sim_ecc_list.ecc_count > 0) {
+                                               dbg("GSM pNumber ecc1(%s) ecc2(%s) ecc3(%s) ecc4(%s) ecc5(%s)",
+                                                                  modem_info->sim_ecc_list.list[0].number, modem_info->sim_ecc_list.list[1].number, modem_info->sim_ecc_list.list[2].number, modem_info->sim_ecc_list.list[3].number, modem_info->sim_ecc_list.list[4].number);
+
+                                               if ((g_strcmp0(pNumber, modem_info->sim_ecc_list.list[0].number) == 0)
+                                                       || (g_strcmp0(pNumber, modem_info->sim_ecc_list.list[1].number) == 0)
+                                                       || (g_strcmp0(pNumber, modem_info->sim_ecc_list.list[2].number) == 0)
+                                                       || (g_strcmp0(pNumber, modem_info->sim_ecc_list.list[3].number) == 0)
+                                                       || (g_strcmp0(pNumber, modem_info->sim_ecc_list.list[4].number) == 0)) {
+                                                       dbg("_callmgr_telephony_check_ecc_number: return TRUE");
+                                                       *sim_slot = sim_cnt;
+                                                       return 0;
+                                               }
+                                       }
+                               }
+                               break;
+                       case CM_CARD_TYPE_USIM:
+                               {
+                                       dbg("SimCardType=SIM_CARD_TYPE_USIM");
+
+                                       if (modem_info->sim_ecc_list.ecc_count > 0) {
+                                               for (i = 0; i < modem_info->sim_ecc_list.ecc_count; i++) {
+                                                       dbg("[ecc=%s, category:[%d]]", modem_info->sim_ecc_list.list[i].number, modem_info->sim_ecc_list.list[i].category);
+                                                       if (!g_strcmp0(pNumber, modem_info->sim_ecc_list.list[i].number)) {
+                                                               dbg("uecc matched!!");
+                                                               *sim_slot = sim_cnt;
+                                                               return 0;
+                                                       }
+                                               }
+                                       }
+                               }
+                               break;
+                       default:
+                               dbg("type : %d", simcard_type);
+                               break;
+               }
+       }
+
+       return -1;
+}
+
 
 int _callmgr_telephony_check_sim_ecc(callmgr_telephony_t telephony_handle, const char *pNumber, gboolean *is_sim_ecc, int *ecc_category)
 {
@@ -3200,7 +3669,7 @@ int _callmgr_telephony_check_sim_ecc(callmgr_telephony_t telephony_handle, const
        *is_sim_ecc = FALSE;    /*Init*/
        modem_info = &telephony_handle->modem_info[telephony_handle->active_sim_slot];
        simcard_type = modem_info->card_type;
-       dbg("simcard_type : %d", simcard_type);
+       info("simcard_type : %d", simcard_type);
 
        /*_callmgr_telephony_get_imsi_mcc_mnc(telephony_handle, &imsi_mcc, &imsi_mnc);*/
 
@@ -3212,8 +3681,8 @@ int _callmgr_telephony_check_sim_ecc(callmgr_telephony_t telephony_handle, const
                                /*TAPI api Compliance */
                                /*To get Emergency data of 2G */
                                if (modem_info->sim_ecc_list.ecc_count > 0) {
-                                       /*SEC_DBG("GSM pNumber ecc1(%s) ecc2(%s) ecc3(%s) ecc4(%s) ecc5(%s)",
-                                                          sim_ecc_list.list[0].number, sim_ecc_list.list[1].number, sim_ecc_list.list[2].number, sim_ecc_list.list[3].number, sim_ecc_list.list[4].number);*/
+                                       sec_dbg("GSM pNumber ecc1(%s) ecc2(%s) ecc3(%s) ecc4(%s) ecc5(%s)",
+                                                          modem_info->sim_ecc_list.list[0].number, modem_info->sim_ecc_list.list[1].number, modem_info->sim_ecc_list.list[2].number, modem_info->sim_ecc_list.list[3].number, modem_info->sim_ecc_list.list[4].number);
 
                                        if ((g_strcmp0(pNumber, modem_info->sim_ecc_list.list[0].number) == 0)
                                                || (g_strcmp0(pNumber, modem_info->sim_ecc_list.list[1].number) == 0)
@@ -3233,7 +3702,7 @@ int _callmgr_telephony_check_sim_ecc(callmgr_telephony_t telephony_handle, const
 
                                if (modem_info->sim_ecc_list.ecc_count > 0) {
                                        for (i = 0; i < modem_info->sim_ecc_list.ecc_count; i++) {
-                                               /*SEC_DBG("[ecc=%s, category:[%d]]", usim_ecc_list.list[i].number, usim_ecc_list.list[i].category);*/
+                                               sec_dbg("[ecc=%s, category:[%d]]", modem_info->sim_ecc_list.list[i].number, modem_info->sim_ecc_list.list[i].category);
                                                if (!g_strcmp0(pNumber, modem_info->sim_ecc_list.list[i].number)) {
                                                        *ecc_category = modem_info->sim_ecc_list.list[i].category;
                                                        dbg("uecc matched!!");
@@ -3362,12 +3831,12 @@ int _callmgr_telephony_process_incall_ss(callmgr_telephony_t telephony_handle, c
                                        _callmgr_telephony_end_call(telephony_handle, selected_call_id, CM_TEL_CALL_RELEASE_TYPE_BY_CALL_HANDLE);
 
                                        if (held_call) {
-                                               __callmgr_telephony_set_retreive_flag(held_call, TRUE);
+                                               __callmgr_telephony_set_retrieve_flag(held_call, TRUE);
                                        }
                                } else if (active_call) {
                                        _callmgr_telephony_end_call(telephony_handle, active_call->call_id, CM_TEL_CALL_RELEASE_TYPE_ALL_ACTIVE_CALLS);
                                        if (held_call) {
-                                               __callmgr_telephony_set_retreive_flag(held_call, TRUE);
+                                               __callmgr_telephony_set_retrieve_flag(held_call, TRUE);
                                        }
                                } else if (held_call) {
                                        if (_callmgr_telephony_active_call(telephony_handle) < 0) {
@@ -3514,7 +3983,7 @@ static gboolean __callmgr_telephony_disable_fm_timer_cb(gpointer data)
 
        _callmgr_telephony_get_network_status(telephony_handle, &nw_status);
 
-       dbg("nw_status(%d)", nw_status);
+       info("nw_status(%d)", nw_status);
 
        if (nw_status == CM_NETWORK_STATUS_OUT_OF_SERVICE) {
                g_disable_fm_cnt++;
@@ -3685,6 +4154,8 @@ int _callmgr_telephony_is_number_valid(const char *number, gboolean *b_number_va
 int _callmgr_telephony_is_ss_string(callmgr_telephony_t telephony_handle, int slot_id, const char *number, gboolean *o_is_ss)
 {
        int len;
+       int call_count = -1;
+       gboolean ret = FALSE;
        CM_RETURN_VAL_IF_FAIL(number, -1);
        CM_RETURN_VAL_IF_FAIL(telephony_handle, -1);
        CM_RETURN_VAL_IF_FAIL(slot_id < telephony_handle->modem_cnt, -1);
@@ -3707,7 +4178,7 @@ int _callmgr_telephony_is_ss_string(callmgr_telephony_t telephony_handle, int sl
                                        *o_is_ss = FALSE;
                                        return 0;
                                }
-                               dbg("USSD");
+                               info("USSD");
                                *o_is_ss = TRUE;
                                return 0;
                        }
@@ -3715,28 +4186,49 @@ int _callmgr_telephony_is_ss_string(callmgr_telephony_t telephony_handle, int sl
        }
 
        if ((len == 2)) {
-               if ((number[0] == '0') && (IS1CHARUSSDDIGIT(number[1]))) {
+               ret = _callmgr_telephony_get_call_count(telephony_handle, &call_count);
+               if (ret) {
+                       err("_callmgr_telephony_is_ss_string() call count error");
+                       return -1;
+               }
+               if ((number[0] == '0') && (IS_DIGIT(number[1]))) {
                        if (number[1] == '8') {
                                /* 08 is emergency number */
                                *o_is_ss = FALSE;
                                return 0;
+                       } else if(number[1] == '0' && call_count == 0) {
+                               warn("If NO CALL then dial call for 00");
+                               *o_is_ss = FALSE;
+                               return 0;
                        } else {
-                               dbg("USSD string");
+                               info("USSD string");
                                *o_is_ss = TRUE;
                                return 0;
                        }
-               } else if ((ISUSSDDIGIT(number[0]) && IS_DIGIT(number[1]))) {
+               } 
+               if ((number[0] == '1') && (IS_DIGIT(number[1]))) {
+                       if ((number[1] == '0')&&(call_count >0)) {
+                               /* 10 is ussd  */
+                               info("10 is USSD string when active call exist");
+                               *o_is_ss = TRUE;
+                               return 0;
+                       }else {
+                               *o_is_ss = FALSE;
+                               return 0;
+                       }
+               }
+               else if ((ISUSSDDIGIT(number[0]) && IS_DIGIT(number[1]))) {
                        unsigned long mcc = 0;
                        unsigned long mnc = 0;
                        __callmgr_telephony_get_network_mcc_mnc(telephony_handle, slot_id, &mcc, &mnc);
 
                        if ((mcc == CALL_NETWORK_MCC_CROATIA || mcc == CALL_NETWORK_MCC_SERBIA)
                                        && (number[0] == '9' && ISECCDIGIT(number[1]))) {
-                               dbg("Emergency or Service number");
+                               info("Emergency or Service number");
                                *o_is_ss = FALSE;
                                return 0;
                        } else {
-                               dbg("USSD string");
+                               info("USSD string");
                                *o_is_ss = TRUE;
                                return 0;
                        }
@@ -3750,7 +4242,7 @@ int _callmgr_telephony_is_ss_string(callmgr_telephony_t telephony_handle, int sl
        }
 
        if (number[len - 1] == '#') {
-               dbg("USSD string");
+               info("USSD string");
                *o_is_ss = TRUE;
                return 0;
        }
@@ -3783,7 +4275,7 @@ int _callmgr_telephony_get_answer_request_type(callmgr_telephony_t telephony_han
 
 int __callmgr_telephony_get_end_cause_type(TelCallCause_t call_cause, TelTapiEndCause_t cause, cm_telephony_end_cause_type_e *end_cause_type)
 {
-       dbg("call_cause [%d] end case [%d]", call_cause, cause);
+       info("call_cause [%d] end case [%d]", call_cause, cause);
        *end_cause_type = CM_TELEPHONY_ENDCAUSE_CALL_ENDED;
        if (TAPI_CAUSE_FIXED_DIALING_NUMBER_ONLY == call_cause) {
                /* This case is dial failed because of FDN */
@@ -3884,7 +4376,7 @@ int __callmgr_telephony_get_end_cause_type(TelCallCause_t call_cause, TelTapiEnd
                        default:
                                *end_cause_type = CM_TELEPHONY_ENDCAUSE_CALL_ENDED;
 
-                               dbg("Call Ended or Default Cause Value: %d", *end_cause_type);
+                               info("Call Ended or Default Cause Value: %d", *end_cause_type);
                                break;
                        }
        }
index d4961e6..d4b65a2 100755 (executable)
@@ -129,7 +129,7 @@ static int __callmgr_vr_stop_record_internal(callmgr_vr_handle_h vr_handle);
 static gboolean __callmgr_vr_state_changed_cb_real(void *user_data)
 {
        callmgr_vr_cb_info_t *info = (callmgr_vr_cb_info_t *)user_data;
-       callmgr_vr_handle_h vr_handle = (callmgr_vr_handle_h *)info->user_data;
+       callmgr_vr_handle_h vr_handle = (callmgr_vr_handle_h )info->user_data;
        callmgr_vr_status_extra_type_e extra_data;
 
        /*recorder_state_e previous, recorder_state_e current, bool by_policy,*/
@@ -176,7 +176,7 @@ static gboolean __callmgr_vr_state_changed_cb_real(void *user_data)
 static gboolean __callmgr_vr_limit_reached_cb_real(void *user_data)
 {
        callmgr_vr_cb_info_t *info = (callmgr_vr_cb_info_t *)user_data;
-       callmgr_vr_handle_h vr_handle = (callmgr_vr_handle_h *)info->user_data;
+       callmgr_vr_handle_h vr_handle = (callmgr_vr_handle_h )info->user_data;
        callmgr_vr_status_extra_type_e extra_data = CALLMGR_VR_STATUS_EXTRA_STOP_TYPE_BY_NORMAL;
        int result = 0;
 
@@ -220,7 +220,6 @@ static gboolean __callmgr_vr_limit_reached_cb_real(void *user_data)
 static gboolean __callmgr_vr_error_cb_real(void *user_data)
 {
        callmgr_vr_cb_info_t *info = (callmgr_vr_cb_info_t *)user_data;
-       callmgr_vr_handle_h *vr_handle = (callmgr_vr_handle_h *)info->user_data;
 
        err("!!! ERROR[%d], current state[%d]", info->cb_data.error.error, info->cb_data.error.current_state);
 
@@ -320,58 +319,19 @@ static int __callmgr_vr_ready(callmgr_vr_handle_h vr_handle)
                return -1;
        }
 
-       ret_val = recorder_attr_set_audio_device(vr_handle->recorder_handle, RECORDER_AUDIO_DEVICE_MIC);
-       if (ret_val != RECORDER_ERROR_NONE) {
-               err("recorder_attr_set_audio_device");
-               goto READY_FAIL;
-       }
-
-       ret_val = recorder_set_audio_encoder(vr_handle->recorder_handle, RECORDER_AUDIO_CODEC_AMR);
-       if (ret_val != RECORDER_ERROR_NONE) {
-               err("recorder_set_audio_encoder");
-               goto READY_FAIL;
-       }
-
-       ret_val = recorder_set_file_format(vr_handle->recorder_handle, RECORDER_FILE_FORMAT_AMR);
-       if (ret_val != RECORDER_ERROR_NONE) {
-               err("recorder_set_file_format");
-               goto READY_FAIL;
-       }
-
-       ret_val = recorder_attr_set_audio_samplerate(vr_handle->recorder_handle, CM_VR_SAMPLERATE_LOW);
-       if (ret_val != RECORDER_ERROR_NONE) {
-               err("recorder_attr_set_audio_samplerate");
-               goto READY_FAIL;
-       }
-
-       ret_val = recorder_attr_set_audio_encoder_bitrate(vr_handle->recorder_handle, CM_VR_ENCODER_BITRATE_AMR);
-       if (ret_val != RECORDER_ERROR_NONE) {
-               err("recorder_attr_set_audio_encoder_bitrate");
-               goto READY_FAIL;
-       }
-
-       ret_val = recorder_set_filename(vr_handle->recorder_handle, CM_VR_TEMP_FILENAME);
-       if (ret_val != RECORDER_ERROR_NONE) {
-               err("recorder_set_filename");
-               goto READY_FAIL;
-       }
-
-       ret_val = recorder_attr_set_audio_channel(vr_handle->recorder_handle, CM_VR_SOURCE_CHANNEL);
+       ret_val = recorder_attr_set_time_limit(vr_handle->recorder_handle, vr_handle->max_time);
        if (ret_val != RECORDER_ERROR_NONE) {
-               err("recorder_attr_set_audio_channel");
+               err("recorder_attr_set_time_limit");
                goto READY_FAIL;
        }
 
-       if (vr_handle->is_answering == EINA_TRUE) {
-               vr_handle->max_time = CM_VR_ANSWERING_MSG_MAX_TIME_LIMIT;
-       } else {
-               vr_handle->max_time = CM_VR_RECORD_MAX_TIME_LIMIT;
-       }
+       recorder_state_e rec_status = RECORDER_STATE_NONE;
+       recorder_get_state(vr_handle->recorder_handle, &rec_status);
+       dbg("rec_status = %d ", rec_status);
 
-       ret_val = recorder_attr_set_time_limit(vr_handle->recorder_handle, vr_handle->max_time);
-       if (ret_val != RECORDER_ERROR_NONE) {
-               err("recorder_attr_set_time_limit");
-               goto READY_FAIL;
+       if (rec_status == RECORDER_STATE_READY) {
+               dbg("recorder state is already ready.");
+               return 0;
        }
 
        ret_val = recorder_prepare(vr_handle->recorder_handle);
@@ -382,20 +342,17 @@ static int __callmgr_vr_ready(callmgr_vr_handle_h vr_handle)
                goto READY_FAIL;
        }
 
-       vr_handle->record_state = CALLMGR_VR_INITIALIZED;
        return 0;
 
 READY_FAIL:
-       dbg("Ready fail : 0x%x", ret_val);
+       err("Ready fail : 0x%x", ret_val);
        return -1;
 }
 
-static int __callmgr_vr_create(callmgr_vr_handle_h vr_handle, const char* call_num, const char* call_name, gboolean is_answering_machine)
+static int __callmgr_vr_reset(callmgr_vr_handle_h vr_handle, const char* call_num, const char* call_name, gboolean is_answering_machine)
 {
        CM_RETURN_VAL_IF_FAIL(vr_handle, -1);
-       int ret_val = RECORDER_ERROR_NONE;
 
-       vr_handle->recorder_handle = CM_VR_INVALID_HANDLE;
        vr_handle->is_answering = is_answering_machine;
        vr_handle->elapsed_time = 0;
 
@@ -414,30 +371,87 @@ static int __callmgr_vr_create(callmgr_vr_handle_h vr_handle, const char* call_n
        /* Reset the time */
        vr_handle->start_time = time(NULL);
 
+       if (vr_handle->is_answering == EINA_TRUE) {
+               vr_handle->max_time = CM_VR_ANSWERING_MSG_MAX_TIME_LIMIT;
+       } else {
+               vr_handle->max_time = CM_VR_RECORD_MAX_TIME_LIMIT;
+       }
+
+       return 0;
+}
+
+static int __callmgr_vr_create(callmgr_vr_handle_h vr_handle)
+{
+       CM_RETURN_VAL_IF_FAIL(vr_handle, -1);
+       int ret_val = RECORDER_ERROR_NONE;
+
        ret_val = recorder_create_audiorecorder(&(vr_handle->recorder_handle));
 
        if (ret_val == RECORDER_ERROR_NONE) {
-               recorder_set_state_changed_cb(vr_handle->recorder_handle,
+               ret_val = recorder_set_state_changed_cb(vr_handle->recorder_handle,
                                __callmgr_vr_state_changed_cb, vr_handle);
+               if (ret_val != RECORDER_ERROR_NONE) {
+                       err("recorder_set_state_changed_cb");
+               }
 
-               recorder_set_recording_status_cb(vr_handle->recorder_handle,
+               ret_val = recorder_set_recording_status_cb(vr_handle->recorder_handle,
                                __callmgr_vr_recording_status_changed_cb, vr_handle);
+               if (ret_val != RECORDER_ERROR_NONE) {
+                       err("recorder_set_recording_status_cb");
+               }
 
-               recorder_set_recording_limit_reached_cb(vr_handle->recorder_handle,
+               ret_val = recorder_set_recording_limit_reached_cb(vr_handle->recorder_handle,
                                __callmgr_vr_limit_reached_cb, vr_handle);
+               if (ret_val != RECORDER_ERROR_NONE) {
+                       err("recorder_set_recording_limit_reached_cb");
+               }
 
-               recorder_set_error_cb(vr_handle->recorder_handle,
+               ret_val = recorder_set_error_cb(vr_handle->recorder_handle,
                                __callmgr_vr_error_cb, vr_handle);
+               if (ret_val != RECORDER_ERROR_NONE) {
+                       err("recorder_set_error_cb");
+               }
+
+               ret_val = recorder_attr_set_audio_device(vr_handle->recorder_handle, RECORDER_AUDIO_DEVICE_MIC);
+               if (ret_val != RECORDER_ERROR_NONE) {
+                       err("recorder_attr_set_audio_device");
+               }
+
+               ret_val = recorder_set_audio_encoder(vr_handle->recorder_handle, RECORDER_AUDIO_CODEC_AMR);
+               if (ret_val != RECORDER_ERROR_NONE) {
+                       err("recorder_set_audio_encoder");
+               }
+
+               ret_val = recorder_set_file_format(vr_handle->recorder_handle, RECORDER_FILE_FORMAT_AMR);
+               if (ret_val != RECORDER_ERROR_NONE) {
+                       err("recorder_set_file_format");
+               }
+
+               ret_val = recorder_attr_set_audio_samplerate(vr_handle->recorder_handle, CM_VR_SAMPLERATE_LOW);
+               if (ret_val != RECORDER_ERROR_NONE) {
+                       err("recorder_attr_set_audio_samplerate");
+               }
+
+               ret_val = recorder_attr_set_audio_encoder_bitrate(vr_handle->recorder_handle, CM_VR_ENCODER_BITRATE_AMR);
+               if (ret_val != RECORDER_ERROR_NONE) {
+                       err("recorder_attr_set_audio_encoder_bitrate");
+               }
+
+               ret_val = recorder_set_filename(vr_handle->recorder_handle, CM_VR_TEMP_FILENAME);
+               if (ret_val != RECORDER_ERROR_NONE) {
+                       err("recorder_set_filename");
+               }
+
+               ret_val = recorder_attr_set_audio_channel(vr_handle->recorder_handle, CM_VR_SOURCE_CHANNEL);
+               if (ret_val != RECORDER_ERROR_NONE) {
+                       err("recorder_attr_set_audio_channel");
+               }
        } else {
                err("recorder_create_audiorecorder error : %d", ret_val);
                return -1;
        }
 
-       ret_val = __callmgr_vr_ready(vr_handle);
-       if (ret_val == -1) {
-               err("__voicecall_vr_ready error : %d", ret_val);
-               return -1;
-       }
+       vr_handle->record_state = CALLMGR_VR_INITIALIZED;
 
        return 0;
 }
@@ -490,7 +504,7 @@ static int __callmgr_vr_unrealize(callmgr_vr_handle_h vr_handle)
                }
        }
 
-       vr_handle->record_state = CALLMGR_VR_NONE;
+       vr_handle->record_state = CALLMGR_VR_INITIALIZED;
        return 0;
 }
 
@@ -612,9 +626,9 @@ int _callmgr_vr_start_record(callmgr_vr_handle_h vr_handle, const char* call_num
        int ret_val = RECORDER_ERROR_NONE;
        callmgr_vr_state_e cur_vr_state = CALLMGR_VR_NONE;
 
-       if (__callmgr_vr_is_available_memory() < 0) {
+       if (__callmgr_vr_is_available_memory() == FALSE) {
                err("No free space");
-
+               _callmgr_util_launch_popup(CALL_POPUP_REC_STATUS, CM_UTIL_REC_STATUS_STOP_BY_NO_ENOUGH_MEMORY, NULL, 0, NULL, NULL);
                /*
                 * Todo need to launch "Unable to save data" popup.
                 * (refer [Tizen_2.4]Voice_Call_UI_[Z3].pdf, [Tizen_2.4]Pattern_UI_[Z3].pdf)
@@ -624,11 +638,12 @@ int _callmgr_vr_start_record(callmgr_vr_handle_h vr_handle, const char* call_num
        }
 
        _callmgr_vr_get_recording_state(vr_handle, &cur_vr_state);
+       __callmgr_vr_reset(vr_handle, call_num, call_name, is_answering_machine);
 
        switch (cur_vr_state) {
        case CALLMGR_VR_NONE:
                {
-                       ret_val = __callmgr_vr_create(vr_handle, call_num, call_name, is_answering_machine);
+                       ret_val = __callmgr_vr_create(vr_handle);
                        if (ret_val >= 0) {
 /* Todo need to add check for answering machine */
 /*
@@ -638,6 +653,11 @@ int _callmgr_vr_start_record(callmgr_vr_handle_h vr_handle, const char* call_num
                                }
        #endif
 */
+                               ret_val = __callmgr_vr_ready(vr_handle);
+                               if (ret_val < 0) {
+                                       err("__callmgr_vr_ready error : %d", ret_val);
+                                       return -1;
+                               }
                                ret_val = __callmgr_vr_record(vr_handle);
                                if (ret_val < 0) {
                                        err("__callmgr_vr_record failed");
@@ -649,9 +669,14 @@ int _callmgr_vr_start_record(callmgr_vr_handle_h vr_handle, const char* call_num
 
        case CALLMGR_VR_INITIALIZED:
                {
+                       ret_val = __callmgr_vr_ready(vr_handle);
+                       if (ret_val < 0) {
+                               err("__callmgr_vr_ready error : %d", ret_val);
+                               return -1;
+                       }
                        ret_val = __callmgr_vr_record(vr_handle);
                        if (ret_val < 0) {
-                               err("__callmgr_vr_record failed");
+                               err("__callmgr_vr_record failed : %d", ret_val);
                                return -1;
                        }
                }
@@ -664,7 +689,7 @@ int _callmgr_vr_start_record(callmgr_vr_handle_h vr_handle, const char* call_num
                break;
 
        default:
-               dbg("Invalid State[%d].", cur_vr_state);
+               err("Invalid State[%d].", cur_vr_state);
                break;
        }
 
@@ -773,15 +798,15 @@ static int __callmgr_vr_create_filename(callmgr_vr_handle_h vr_handle)
        rec_size = __callmgr_vr_get_file_size_by_filename(CM_VR_TEMP_FILENAME);
        fex_remain_size = __callmgr_vr_fex_get_available_memory_space(g_storage_type);
        if (rec_size == 0) {
-               dbg("Can't save: empty file!!");
+               err("Can't save: empty file!!");
                return -1;
        } else if ((int)(rec_size / 1024) > fex_remain_size
                        && (g_storage_type != CALLMGR_VR_STORAGE_PHONE)) {
-               dbg("Can't save: short of memory!!");
+               err("Can't save: short of memory!!");
                return -1;
        } else {
                char *str_time = NULL;
-               dbg("Can save: recorded[%d Byte, (=%d KB)], available[%d KB].", (int)rec_size, (int)(rec_size / 1024), (int)(fex_remain_size));
+               info("Can save: recorded[%d Byte, (=%d KB)], available[%d KB].", (int)rec_size, (int)(rec_size / 1024), (int)(fex_remain_size));
 
                /*Get the Traget Path */
                memset(vr_handle->file_path, 0, sizeof(vr_handle->file_path));
@@ -798,7 +823,7 @@ static int __callmgr_vr_create_filename(callmgr_vr_handle_h vr_handle)
 //             }
 
                if (FALSE == __callmgr_vr_is_dir_exist(vr_handle->file_path)) {
-                       dbg("Directory is not exist. Create it");
+                       info("Directory is not exist. Create it");
                        __callmgr_vr_make_dir(vr_handle->file_path, 0755);
                }
                str_time = __callmgr_vr_get_start_time(vr_handle->start_time);
@@ -823,7 +848,7 @@ static int __callmgr_vr_create_filename(callmgr_vr_handle_h vr_handle)
                        sync();
                        dbg("rename success");
                } else {
-                       dbg("rename failed");
+                       err("rename failed");
                        return -1;
                }
 
@@ -848,7 +873,7 @@ static int __callmgr_vr_update_media_info(callmgr_vr_handle_h vr_handle)
                if (ret == MEDIA_CONTENT_ERROR_NONE) {
                        result = 0;
                } else {
-                       dbg("media_info_insert_to_db().. [%d]", ret);
+                       err("media_info_insert_to_db().. [%d]", ret);
                        result = -1;
                }
 
@@ -859,7 +884,7 @@ static int __callmgr_vr_update_media_info(callmgr_vr_handle_h vr_handle)
 
                media_content_disconnect();
        } else {
-               dbg("media_content_connect()..failed [%d]", ret);
+               err("media_content_connect()..failed [%d]", ret);
        }
        return result;
 }
@@ -882,26 +907,26 @@ static int __callmgr_vr_create_filter(callmgr_vr_filter_type_t cond_type, filter
                        condition = "MEDIA_STORAGE_TYPE=122 AND MEDIA_PLAYED_COUNT=0";
                        break;
                default:
-                       dbg("Filter type is error");
+                       err("Filter type is error");
                        goto error;
                        break;
        }
 
        ret = media_filter_create(&filter);
        if (ret != MEDIA_CONTENT_ERROR_NONE) {
-               dbg("media_filter_create() failed : [%d]", ret);
+               err("media_filter_create() failed : [%d]", ret);
                goto error;
        }
 
        ret = media_filter_set_condition(filter, condition, MEDIA_CONTENT_COLLATE_NOCASE);
        if (ret != MEDIA_CONTENT_ERROR_NONE) {
-               dbg("media_filter_set_condition() failed : [%d]", ret);
+               err("media_filter_set_condition() failed : [%d]", ret);
                goto error;
        }
 
        ret = media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_ADDED_TIME, MEDIA_CONTENT_COLLATE_NOCASE);
        if (ret != MEDIA_CONTENT_ERROR_NONE) {
-               dbg("media_filter_set_order() failed : [%d]", ret);
+               err("media_filter_set_order() failed : [%d]", ret);
                goto error;
        }
        *o_filter_h =  filter;
@@ -927,7 +952,7 @@ static int __callmgr_vr_get_file_number_from_db(callmgr_vr_filter_type_t cond_ty
                if (filter) {
                        ret = media_info_get_media_count_from_db(filter, &count);
                        if (ret != MEDIA_CONTENT_ERROR_NONE) {
-                               dbg("media_info_get_media_count_from_db_with_media_mode() failed : [%d]", ret);
+                               err("media_info_get_media_count_from_db_with_media_mode() failed : [%d]", ret);
                        }
 
                        media_filter_destroy(filter);
@@ -935,10 +960,10 @@ static int __callmgr_vr_get_file_number_from_db(callmgr_vr_filter_type_t cond_ty
                }
                media_content_disconnect();
        } else {
-               dbg("media_content_connect() failed : [%d]", ret);
+               err("media_content_connect() failed : [%d]", ret);
        }
 
-       dbg("File count from DB : [%d]", count);
+       info("File count from DB : [%d]", count);
        return count;
 }
 static bool __callmgr_vr_media_info_cb(media_info_h media, void *user_data)
@@ -967,7 +992,7 @@ static void __callmgr_vr_get_oldest_file(char **media_id, char **file_path)
                }
                ret = media_info_foreach_media_from_db(filter, __callmgr_vr_media_info_cb, &media);
                if (ret != MEDIA_CONTENT_ERROR_NONE) {
-                       dbg("media_info_get_media_count_from_db_with_media_mode() failed : [%d]", ret);
+                       err("media_info_get_media_count_from_db_with_media_mode() failed : [%d]", ret);
                        media_filter_destroy(filter);
                        return;
                }
@@ -977,14 +1002,14 @@ static void __callmgr_vr_get_oldest_file(char **media_id, char **file_path)
                if (media_id) {
                        ret = media_info_get_media_id(media, media_id);
                        if (ret != MEDIA_CONTENT_ERROR_NONE) {
-                               dbg("media_info_get_media_id() failed : [%d]", ret);
+                               err("media_info_get_media_id() failed : [%d]", ret);
                        }
                }
 
                if (file_path) {
                        ret = media_info_get_file_path(media, file_path);
                        if (ret != MEDIA_CONTENT_ERROR_NONE) {
-                       dbg("media_info_get_file_path() failed : [%d]", ret);
+                       err("media_info_get_file_path() failed : [%d]", ret);
                        }
                }
 
@@ -1030,11 +1055,11 @@ static int __callmgr_vr_del_read_file(void)
                        if (__callmgr_vr_files_remove_file_real(file_path) >= 0) {
                                int err = media_info_delete_from_db(media_id);
                                if (err != MEDIA_CONTENT_ERROR_NONE) {
-                                       dbg("media_info_delete_from_db Failed : [%d]", err);
+                                       err("media_info_delete_from_db Failed : [%d]", err);
                                        result = -1;
                                }
                        } else {
-                               dbg("Can not remove file");
+                               err("Can not remove file");
                                result = -1;
                        }
 
@@ -1049,11 +1074,11 @@ static int __callmgr_vr_del_read_file(void)
 
                        media_content_disconnect();
                } else {
-                       dbg("media_content_connect failed ; [%d]", ret);
+                       err("media_content_connect failed ; [%d]", ret);
                        result = -1;
                }
        } else {
-               dbg("No need to delete oldest file");
+               err("No need to delete oldest file");
                result = 0;
        }
 
@@ -1080,14 +1105,14 @@ static int __callmgr_vr_update_answering_msg_media_info(callmgr_vr_handle_h vr_h
 
                        ret = media_info_set_display_name(info, vr_handle->disp_name);
                        if (ret != MEDIA_CONTENT_ERROR_NONE) {
-                               dbg("media_info_set_display_name().. [%d]", ret);
+                               err("media_info_set_display_name().. [%d]", ret);
                                result = -1;
                        }
 
                        char *display_name = NULL;
                        ret = media_info_get_display_name(info, &display_name);
                        if (ret != MEDIA_CONTENT_ERROR_NONE) {
-                               dbg("media_info_get_display_name().. [%d]", ret);
+                               err("media_info_get_display_name().. [%d]", ret);
                                result = -1;
                        }
                        free(display_name);
@@ -1095,11 +1120,11 @@ static int __callmgr_vr_update_answering_msg_media_info(callmgr_vr_handle_h vr_h
 
                        ret = media_info_update_to_db(info);
                        if (ret != MEDIA_CONTENT_ERROR_NONE) {
-                               dbg("media_info_update_to_db().. [%d]", ret);
+                               err("media_info_update_to_db().. [%d]", ret);
                                result = -1;
                        }
                } else {
-                       dbg("media_cloud_info_insert_to_db_without_info().. [%d]", ret);
+                       err("media_cloud_info_insert_to_db_without_info().. [%d]", ret);
                        result = -1;
                }
                /* info can't be true due to media_cloud_info_insert_to_db_without_info blocked*/
@@ -1110,7 +1135,7 @@ static int __callmgr_vr_update_answering_msg_media_info(callmgr_vr_handle_h vr_h
 
                media_content_disconnect();
        } else {
-               dbg("media_content_connect()..failed [%d]", ret);
+               err("media_content_connect()..failed [%d]", ret);
                result = -1;
        }
        return result;
@@ -1141,7 +1166,7 @@ static int __callmgr_vr_stop_record_internal(callmgr_vr_handle_h vr_handle)
                                if (ret >= 0) {
                                        ret = __callmgr_vr_update_answering_msg_media_info(vr_handle);
                                } else {
-                                       dbg("Can not remove oldest file");
+                                       err("Can not remove oldest file");
                                }
                        }
                }
@@ -1200,7 +1225,7 @@ static int __callmgr_vr_fex_get_available_memory_space(callmgr_vr_store_type_e s
                }
 
                available_kilobytes = (int)(avail / 1024);
-               dbg("Available size : %lf, KB : %d", avail, available_kilobytes);
+               info("Available size : %lf, KB : %d", avail, available_kilobytes);
        } else {
                struct statfs buf = { 0 };
                callmgr_vr_fex_memory_status_t memory_status = { 0, 0 };
@@ -1214,7 +1239,7 @@ static int __callmgr_vr_fex_get_available_memory_space(callmgr_vr_store_type_e s
 
                memory_status.capacity = buf.f_blocks * (buf.f_bsize / 1024);   /* return kilo byte. Calculating division first avoids overflow */
                memory_status.used = memory_status.capacity - (buf.f_bavail * (buf.f_bsize / 1024));
-               dbg(".....capacity = %ld KB, used = %ld KB", memory_status.capacity, memory_status.used);
+               info(".....capacity = %ld KB, used = %ld KB", memory_status.capacity, memory_status.used);
 
                available_kilobytes = memory_status.capacity - memory_status.used;
        }
@@ -1230,11 +1255,11 @@ static gboolean __callmgr_vr_is_available_memory(void)
        int fex_remain_size = 0;
 
        fex_remain_size = __callmgr_vr_fex_get_available_memory_space(g_storage_type);
-       dbg("The remained memory space size is %d!", fex_remain_size);
+       info("The remained memory space size is %d!", fex_remain_size);
        if (fex_remain_size > 0) {
-               return 0;
+               return TRUE;
        } else {
-               dbg("Short of memory!");
-               return -1;
+               err("Short of memory!");
+               return FALSE;
        }
 }
index eff48fa..576bad4 100755 (executable)
@@ -1,6 +1,6 @@
 %define major 0
 %define minor 1
-%define patchlevel 38
+%define patchlevel 43
 %define ext_feature 0
 
 Name:           call-manager
index c10f859..c0ddb28 100644 (file)
@@ -46,12 +46,14 @@ typedef enum _call_event{
        CALL_MANAGER_CALL_EVENT_ACTIVE_E,
        CALL_MANAGER_CALL_EVENT_HELD_E,
        CALL_MANAGER_CALL_EVENT_ALERT_E,
-       CALL_MANAGER_CALL_EVENT_INCOMING_E,
+
+       CALL_MANAGER_CALL_EVENT_INCOMING_E = 5,
        CALL_MANAGER_CALL_EVENT_WAITING_E,
        CALL_MANAGER_CALL_EVENT_JOIN_E,
        CALL_MANAGER_CALL_EVENT_SPLIT_E,
        CALL_MANAGER_CALL_EVENT_SWAP_E,
-       CALL_MANAGER_CALL_EVENT_RETRIEVED_E,
+
+       CALL_MANAGER_CALL_EVENT_RETRIEVED_E = 10,
        CALL_MANAGER_CALL_EVENT_CALL_CONTROL_E,
 } callmgr_call_event_e;
 
@@ -80,6 +82,7 @@ typedef enum {
        CALL_ERR_CAUSE_PHONE_NOT_INITIALIZED_E,
        CALL_ERR_CAUSE_NOT_REGISTERED_ON_NETWORK_E,
        CALL_ERR_CAUSE_VOICE_SERVICE_BLOCKED_E,
+       CALL_ERR_CAUSE_NO_SIM_E,
 } callmgr_call_error_cause_e;
 
 typedef enum {
@@ -182,6 +185,7 @@ typedef struct _callmgr_core_data {
        gboolean is_auto_answered;
 
        gboolean is_mute_on;
+       gboolean is_video_recording;
 } callmgr_core_data_t;
 
 int _callmgr_core_init(callmgr_core_data_t **o_core_data);
index eed4291..5822cc8 100644 (file)
@@ -386,11 +386,9 @@ static int __callmgr_core_process_dtmf_number(callmgr_core_data_t *core_data)
        _callmgr_telephony_get_dtmf_number(call, &dtmf_number);
 
        if (dtmf_number == NULL) {
-               cm_telephony_sat_event_type_e sat_event_type = CM_TELEPHONY_SAT_EVENT_NONE;
-               _callmgr_telephony_get_sat_event_type(core_data->telephony_handle, &sat_event_type);
-
-               dbg("sat_event_type:%d", sat_event_type);
-               if (sat_event_type == CM_TELEPHONY_SAT_EVENT_SEND_DTMF) {
+               gboolean b_is_ongoing = FALSE;
+               _callmgr_telephony_get_sat_event_status(core_data->telephony_handle, CM_TELEPHONY_SAT_EVENT_SEND_DTMF, &b_is_ongoing);
+               if (b_is_ongoing == TRUE) {
                        _callmgr_telephony_send_sat_response(core_data->telephony_handle,
                                        CM_TELEPHONY_SAT_EVENT_SEND_DTMF, CM_TELEPHONY_SAT_RESPONSE_ME_RET_SUCCESS, CM_TELEPHONY_SIM_UNKNOWN);
                }
@@ -511,7 +509,7 @@ static void __callmgr_core_auto_answer(callmgr_core_data_t *core_data)
                        core_data->auto_answer_timer = g_timeout_add_seconds(auto_answer_time_in_sec, __callmgr_core_auto_answer_timer_cb,core_data);
                }
                else{
-                       dbg("Without earjack or bt, skip auto answer ");
+                       warn("Without earjack or bt, skip auto answer ");
                }
 
        }
@@ -541,7 +539,6 @@ static void __callmgr_core_process_incoming_call(callmgr_core_data_t *core_data,
        unsigned int call_id = -1;
        char *number = NULL;
        callmgr_contact_info_t *contact_out_info = NULL;
-       cm_telephony_call_type_e call_type = CM_TEL_CALL_TYPE_CS_VOICE;
        callmgr_audio_session_mode_e sound_mode = CALLMGR_AUDIO_SESSION_NONE_E;
        int ret = -1;
        int person_id = -1;
@@ -550,6 +547,8 @@ static void __callmgr_core_process_incoming_call(callmgr_core_data_t *core_data,
        callmgr_call_type_e cm_call_type = CALL_TYPE_INVALID_E;
        cm_telephony_end_cause_type_e end_cause = CM_TELEPHONY_ENDCAUSE_MAX;
 
+       gboolean is_video_recording = FALSE;
+
        dbg("__callmgr_core_process_incoming_call() called");
        CM_RETURN_IF_FAIL(core_data);
        CM_RETURN_IF_FAIL(incom_call);
@@ -570,6 +569,11 @@ static void __callmgr_core_process_incoming_call(callmgr_core_data_t *core_data,
        }
        g_free(number);
 
+       /* We need to notify recording status before create call session */
+       /* Unset this value when stop ringtone */
+       _callmgr_util_is_video_recording_progress(&is_video_recording);
+       core_data->is_video_recording = is_video_recording;
+
        _callmgr_util_is_callui_running(&is_callui_running);
        if (FALSE == is_callui_running) {
                _callmgr_util_launch_callui(call_id, sim_slot, cm_call_type);
@@ -588,15 +592,14 @@ static void __callmgr_core_process_incoming_call(callmgr_core_data_t *core_data,
                return;
        }
 
-       _callmgr_telephony_get_call_type(incom_call, &call_type);
-       if (call_type == CM_TEL_CALL_TYPE_CS_VOICE) {
+       if (cm_call_type == CALL_TYPE_VOICE_E) {
                sound_mode = CALLMGR_AUDIO_SESSION_VOICE_E;
        }
-       else if (call_type == CM_TEL_CALL_TYPE_CS_VIDEO) {
+       else if (cm_call_type == CALL_TYPE_VIDEO_E) {
                sound_mode = CALLMGR_AUDIO_SESSION_VIDEO_E;
        }
        else {
-               err("Invalid call type[%d].", call_type);
+               err("Invalid call type[%d].", cm_call_type);
                sound_mode = CALLMGR_AUDIO_SESSION_VOICE_E;
        }
 
@@ -633,7 +636,6 @@ static void __callmgr_core_start_incom_noti(callmgr_core_data_t *core_data)
        gboolean has_held_call = FALSE;
        gboolean is_earjack_available = FALSE;
        cm_telephony_call_data_t *incom_call = NULL;
-       cm_telephony_call_type_e tel_call_type = CM_TEL_CALL_TYPE_INVALID;
        int person_id = -1;
        unsigned int call_id = -1;
 
@@ -641,7 +643,12 @@ static void __callmgr_core_start_incom_noti(callmgr_core_data_t *core_data)
        CM_RETURN_IF_FAIL(core_data);
        _callmgr_telephony_get_call_by_state(core_data->telephony_handle, CM_TEL_CALL_STATE_INCOMING, &incom_call);
 
-       if(incom_call) {
+       if (incom_call) {
+               __callmgr_core_send_bt_events(core_data, 0);
+
+               /* Auto Answering */
+               __callmgr_core_auto_answer(core_data);
+
                _callmgr_telephony_has_call_by_state(core_data->telephony_handle, CM_TEL_CALL_STATE_ACTIVE, &has_active_call);
                _callmgr_telephony_has_call_by_state(core_data->telephony_handle, CM_TEL_CALL_STATE_HELD, &has_held_call);
 
@@ -651,7 +658,6 @@ static void __callmgr_core_start_incom_noti(callmgr_core_data_t *core_data)
                        return;
                }
                _callmgr_telephony_get_call_id(incom_call, &call_id);
-               _callmgr_telephony_get_call_type(incom_call, &tel_call_type);
                _callmgr_ct_get_person_id(call_id, &person_id);
 
                _callmgr_ringer_stop_signal(core_data->ringer_handle);
@@ -664,14 +670,13 @@ static void __callmgr_core_start_incom_noti(callmgr_core_data_t *core_data)
                        char *caller_ringtone_path = NULL;
                        _callmgr_ct_get_caller_ringtone_path(call_id, &caller_ringtone_path);
                        _callmgr_ringer_start_alert(core_data->ringer_handle, caller_ringtone_path, is_earjack_available);
-
                }
 
                /* Init motion sensor to use turn over mute */
                _callmgr_sensor_face_down_start(core_data->sensor_handle);
 
        } else {
-               dbg("no incoming call exists...return");
+               err("no incoming call exists...return");
        }
 }
 
@@ -679,6 +684,9 @@ static void __callmgr_core_stop_incom_noti(callmgr_core_data_t *core_data)
 {
        CM_RETURN_IF_FAIL(core_data);
 
+       /* Reset value */
+       core_data->is_video_recording = FALSE;
+
        /* Stop ringtone */
        _callmgr_ringer_stop_alternate_tone(core_data->ringer_handle);
        _callmgr_ringer_stop_alert(core_data->ringer_handle);
@@ -737,7 +745,7 @@ static void __callmgr_core_answer_msg_finished_cb(void *user_data)
 
 int __callmgr_core_get_signal_type(cm_telephony_end_cause_type_e end_cause_type, callmgr_play_signal_type_e *signal_type)
 {
-       dbg("end_cause_type: %d", end_cause_type);
+       info("end_cause_type: %d", end_cause_type);
        *signal_type = CALL_SIGNAL_NONE_E;
 
        switch (end_cause_type) {
@@ -770,7 +778,7 @@ int __callmgr_core_get_signal_type(cm_telephony_end_cause_type_e end_cause_type,
                break;
        }
 
-       dbg("------ Signal Type : %d ---------", *signal_type);
+       info("------ Signal Type : %d ---------", *signal_type);
        return 0;
 }
 
@@ -782,7 +790,7 @@ static void __callmgr_core_process_telephony_events(cm_telephony_event_type_e ev
        gboolean is_bt_connected = FALSE;
        gboolean is_earjack_connected = FALSE;
        cm_telephony_end_cause_type_e end_cause = CM_TELEPHONY_ENDCAUSE_MAX;
-       dbg("__callmgr_core_process_telephony_events() called %d", event_type);
+       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)) {
@@ -808,6 +816,7 @@ static void __callmgr_core_process_telephony_events(cm_telephony_event_type_e ev
                                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);
@@ -834,11 +843,20 @@ static void __callmgr_core_process_telephony_events(cm_telephony_event_type_e ev
                                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 {
+                               } 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) {
@@ -876,10 +894,10 @@ static void __callmgr_core_process_telephony_events(cm_telephony_event_type_e ev
                                                }
                                                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_REJECT_E;
+                                                               log_data->log_type = CM_CT_PLOG_TYPE_VIDEO_BLOCKED_E;
                                                        }
                                                        else {
-                                                               log_data->log_type = CM_CT_PLOG_TYPE_VOICE_REJECT_E;
+                                                               log_data->log_type = CM_CT_PLOG_TYPE_VOICE_BLOCKED_E;
                                                        }
                                                }
                                                else if (reject_type == CM_CT_PLOG_REJECT_TYPE_REC_REJECT_E) {
@@ -951,7 +969,9 @@ static void __callmgr_core_process_telephony_events(cm_telephony_event_type_e ev
                                                        b_play_effect_tone = FALSE;
                                                }
                                        }
-                                       if (b_play_effect_tone) {
+
+                                       _callmgr_audio_get_active_device(core_data->audio_handle, &active_device);
+                                       if ((b_play_effect_tone) && (active_device != CALLMGR_AUDIO_DEVICE_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");
                                                }
@@ -1009,10 +1029,10 @@ static void __callmgr_core_process_telephony_events(cm_telephony_event_type_e ev
                                                        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) {
-                                                               dbg("End active call and accept incoming call...");
+                                                               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) {
-                                                               dbg("Hold active call and accept incoming call...");
+                                                               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);
@@ -1032,6 +1052,9 @@ static void __callmgr_core_process_telephony_events(cm_telephony_event_type_e ev
                                _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);
 
                                _callmgr_dbus_send_call_event(core_data, CALL_MANAGER_CALL_EVENT_ACTIVE_E, call_id, active_sim_slot, end_cause);
                                _callmgr_ringer_stop_alert(core_data->ringer_handle);
@@ -1111,13 +1134,7 @@ static void __callmgr_core_process_telephony_events(cm_telephony_event_type_e ev
                                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 audio_session = CALLMGR_AUDIO_SESSION_NONE_E;
-                               cm_telephony_call_data_t *sat_call = NULL;
-
-                               if (_callmgr_telephony_get_sat_originated_call(core_data->telephony_handle, &sat_call) == 0) {
-                                       _callmgr_telephony_send_sat_response(core_data->telephony_handle,
-                                                       CM_TELEPHONY_SAT_EVENT_SETUP_CALL, CM_TELEPHONY_SAT_RESPONSE_ME_RET_SUCCESS, CM_TELEPHONY_SIM_UNKNOWN);
-                               }
+                               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*/
@@ -1130,7 +1147,7 @@ static void __callmgr_core_process_telephony_events(cm_telephony_event_type_e ev
                                                _callmgr_ct_get_person_id(call_id, &person_id);
                                                dbg("Contact Info added successfully for CallId : %d, ContactIdx : %d", call_id, person_id);
                                        } else {
-                                               dbg("Failed to add contact object");
+                                               err("Failed to add contact object");
                                        }
 
                                        g_free(number);
@@ -1141,15 +1158,15 @@ static void __callmgr_core_process_telephony_events(cm_telephony_event_type_e ev
 
                                __callmgr_core_convert_tel_call_type(tel_call_type, &cm_call_type);
                                if(CALL_TYPE_VOICE_E == cm_call_type) {
-                                       audio_session = CALLMGR_AUDIO_SESSION_VOICE_E;
+                                       sound_mode = CALLMGR_AUDIO_SESSION_VOICE_E;
                                } else {
-                                       audio_session = CALLMGR_AUDIO_SESSION_VIDEO_E;
+                                       sound_mode = CALLMGR_AUDIO_SESSION_VIDEO_E;
                                }
 
                                _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, audio_session);
+                               ret = _callmgr_audio_create_call_sound_session(core_data->audio_handle, sound_mode);
                                if (ret < 0) {
                                        err("_callmgr_audio_create_call_sound_session() failed");
                                }
@@ -1195,6 +1212,7 @@ static void __callmgr_core_process_telephony_events(cm_telephony_event_type_e ev
                                        gboolean is_blocked_num = FALSE;
                                        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;
 
@@ -1212,6 +1230,7 @@ static void __callmgr_core_process_telephony_events(cm_telephony_event_type_e ev
                                        _callmgr_util_check_block_mode_num(number, &is_blocked_num);
                                        _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(&is_do_not_disturb);
                                        _callmgr_telephony_get_call_count(core_data->telephony_handle, &call_cnt);
@@ -1237,6 +1256,19 @@ static void __callmgr_core_process_telephony_events(cm_telephony_event_type_e ev
                                                } 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);
@@ -1303,9 +1335,13 @@ static void __callmgr_core_process_telephony_events(cm_telephony_event_type_e ev
                                                _callmgr_dbus_send_dial_status(core_data, CALL_MANAGER_DIAL_FAIL);
                                        }
 
-                                       if (_callmgr_telephony_get_sat_originated_call(core_data->telephony_handle, &call) == 0) {
-                                               _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);
+                                       if (result == CM_TEL_CALL_ERR_REJ_SAT_CALL_CTRL) {
+                                               dbg("will send TR soon when CALL_CONTROL indication coming.")
+                                       } else {
+                                               if (_callmgr_telephony_get_sat_originated_call(core_data->telephony_handle, &call) == 0) {
+                                                       _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);
+                                               }
                                        }
                                }
                        }
@@ -1326,7 +1362,7 @@ static void __callmgr_core_process_telephony_events(cm_telephony_event_type_e ev
                        {
                                int ringbacktone_info = GPOINTER_TO_INT(event_data);
                                /* play /stop ringback tone */
-                               dbg("ringback info received = %d ", ringbacktone_info);
+                               info("ringback info received = %d ", ringbacktone_info);
 
                                if (ringbacktone_info == 1) {
                                        _callmgr_ringer_play_local_ringback_tone(core_data->ringer_handle);
@@ -1362,7 +1398,7 @@ static void __callmgr_core_process_telephony_events(cm_telephony_event_type_e ev
                case CM_TELEPHONY_EVENT_PREFERRED_SIM_CHANGED:
                        {
                                int preferred_sim = GPOINTER_TO_INT(event_data);
-                               dbg("preferred SIM [%d]", preferred_sim);
+                               info("preferred SIM [%d]", preferred_sim);
                                _callmgr_util_launch_popup(CALL_POPUP_HIDE, CALL_ERR_NONE, NULL, 0, NULL, NULL);
                        }
                        break;
@@ -1370,14 +1406,77 @@ static void __callmgr_core_process_telephony_events(cm_telephony_event_type_e ev
                        {
                                int ret = 0;
                                char *number = NULL, *name = 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_name(core_data->telephony_handle, &name);
+                               _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), name(%s), current call_cnt(%d)", sat_setup_call_type, number, name, 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;
+                                                       }
+                                                       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;
+                                               }
+                                               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);
@@ -1428,13 +1527,33 @@ SAT_SEND_DTMF_FAIL_EXIT:
                        break;
                case CM_TELEPHONY_EVENT_SAT_CALL_CONTROL_RESULT:
                        {
-                               gboolean *b_ui_update = event_data;
+                               cm_telephony_sat_call_ctrl_type_e *call_ctrl_type = event_data;
 
-                               _callmgr_telephony_send_sat_response(core_data->telephony_handle,
-                                               CM_TELEPHONY_SAT_EVENT_CALL_CONTROL_RESULT, CM_TELEPHONY_SAT_RESPONSE_NONE, CM_TELEPHONY_SIM_UNKNOWN);
+                               if (*call_ctrl_type == CM_TELEPHONY_SAT_CALL_CTRL_R_NOT_ALLOWED) {
+                                       _callmgr_util_launch_popup(CALL_POPUP_CALL_ERR, CALL_ERR_NOT_ALLOWED, NULL, 0, NULL, NULL);
 
-                               if (*b_ui_update == TRUE)
+                                       info("send TR with cause which call is not allowed by SAT call control.")
+                                       _callmgr_telephony_send_sat_response(core_data->telephony_handle,
+                                                       CM_TELEPHONY_SAT_EVENT_SETUP_CALL, CM_TELEPHONY_SAT_RESPONSE_ME_CONTROL_PERMANENT_PROBLEM, CM_TELEPHONY_SIM_UNKNOWN);
+                               } else {
+                                       if (*call_ctrl_type == CM_TELEPHONY_SAT_CALL_CTRL_R_ALLOWED_MOD) {
+                                               char popup[128] = {0,};
+                                               char *number = NULL;
+                                               cm_telephony_call_data_t *call = NULL;
+
+                                               _callmgr_telephony_get_sat_call_control_call(core_data->telephony_handle, &call);
+                                               _callmgr_telephony_get_call_number(call, &number);
+                                               if (number) {
+                                                       // display "Number changed by SIM: XXXX" with popup
+                                                       // according to SMC lab. requirement (P150909-00591)
+                                                       g_snprintf(popup, 127, "Number changed by SIM: %s", number);
+                                                       _callmgr_util_launch_popup(CALL_POPUP_TOAST, CALL_POPUP_TOAST_CUSTOM, popup, 0 , NULL, NULL);
+
+                                                       g_free(number);
+                                               }
+                                       }
                                        _callmgr_dbus_send_call_event(core_data, CALL_MANAGER_CALL_EVENT_CALL_CONTROL_E, 0, active_sim_slot, end_cause);
+                               }
                                return;
                        }
                        break;
@@ -1487,13 +1606,15 @@ static void __callmgr_core_process_audio_events(cm_audio_event_type_e event_type
 
                                _callmgr_core_get_audio_state(core_data, &route);
                                _callmgr_dbus_send_audio_status(core_data, route);
-                               __callmgr_core_set_telephony_audio_route(core_data, active_device);
+                               if (route != CALL_AUDIO_PATH_NONE_E) {
+                                       __callmgr_core_set_telephony_audio_route(core_data, active_device);
+                               }
                        }
                        break;
                case CM_AUDIO_EVENT_EARJACK_CHANGED_E:
                        {
                                gboolean is_available = GPOINTER_TO_INT(event_data);
-                               dbg("Earjack state : %d", is_available);
+                               info("Earjack state : %d", is_available);
                                if (core_data->active_dial || core_data->held) {
                                        /*Change path only if outgoing call or connected call exists */
                                        callmgr_audio_device_e active_device = CALLMGR_AUDIO_DEVICE_NONE_E;
@@ -1554,7 +1675,7 @@ static void __callmgr_core_process_audio_events(cm_audio_event_type_e event_type
                                                telephony_type = CM_TAPI_SOUND_PATH_HANDSET;
                                                break;
                                }
-                               dbg("type : %d, vol : %d", telephony_type, volume);
+                               info("type : %d, vol : %d", telephony_type, volume);
 
                                _callmgr_telephony_set_modem_volume(core_data->telephony_handle, telephony_type, volume);
                        }
@@ -1922,7 +2043,7 @@ static void __callmgr_core_process_sensor_events(cm_sensor_event_type_e event_ty
        switch (event_type) {
                case CM_SENSOR_EVENT_TURN_OVER_E:
                        {
-                               dbg("Detect turn over");
+                               info("Detect turn over");
                                __callmgr_core_stop_incom_noti(core_data);
                        }
                        break;
@@ -1988,7 +2109,7 @@ int _callmgr_core_get_audio_state(callmgr_core_data_t *core_data, callmgr_path_t
        dbg("_callmgr_core_get_audio_state is called");
        callmgr_audio_device_e active_device = CALLMGR_AUDIO_DEVICE_NONE_E;
        if (_callmgr_audio_get_active_device(core_data->audio_handle, &active_device) < 0) {
-               dbg("_callmgr_audio_get_active_device() failed");
+               err("_callmgr_audio_get_active_device() failed");
                return -1;
        }
 
@@ -2014,7 +2135,7 @@ int _callmgr_core_get_audio_state(callmgr_core_data_t *core_data, callmgr_path_t
        return 0;
 }
 
-static gboolean __callmgr_core_check_is_mocall_possible(callmgr_core_data_t *core_data, gboolean is_emergency, callmgr_call_type_e call_type, callmgr_call_error_cause_e* reason)
+static gboolean __callmgr_core_check_is_mocall_possible(callmgr_core_data_t *core_data, gboolean is_emergency, callmgr_call_type_e call_type, const char* number, callmgr_call_error_cause_e* reason)
 {
        CM_RETURN_VAL_IF_FAIL(core_data, FALSE);
        cm_telephony_call_data_t *call = NULL;
@@ -2198,6 +2319,9 @@ static int __callmgr_core_launch_error_popup(callmgr_call_error_cause_e error_ca
        case CALL_ERR_CAUSE_NOT_REGISTERED_ON_NETWORK_E:
                _callmgr_util_launch_popup(CALL_POPUP_CALL_ERR, CALL_ERR_NOT_REGISTERED_ON_NETWORK, NULL, 0, NULL, NULL);
                break;
+       case CALL_ERR_CAUSE_NO_SIM_E:
+               _callmgr_util_launch_popup(CALL_POPUP_CALL_ERR, CALL_ERR_NO_SIM, NULL, 0, NULL, NULL);
+               break;
        default:
                _callmgr_util_launch_popup(CALL_POPUP_CALL_ERR, CALL_ERR_FAILED, NULL, 0, NULL, NULL);
                break;
@@ -2383,7 +2507,7 @@ int _callmgr_core_process_dial(callmgr_core_data_t *core_data, const char *numbe
                return 0;
        }
 
-       is_mo_possible = __callmgr_core_check_is_mocall_possible(core_data, is_emergency_call, call_type, &err_cause);
+       is_mo_possible = __callmgr_core_check_is_mocall_possible(core_data, is_emergency_call, call_type, number, &err_cause);
        if (is_mo_possible == FALSE) {
                if (err_cause == CALL_ERR_CAUSE_FLIGHT_MODE_E) {
                        /* Check if already a MO Invalid handle calldata exists */
@@ -2467,7 +2591,7 @@ int _callmgr_core_process_dial(callmgr_core_data_t *core_data, const char *numbe
 int _callmgr_core_process_end_call(callmgr_core_data_t *core_data, unsigned int call_id, int release_type)
 {
        int ret = -1;
-       dbg("callid[%d], release_type[%d]");
+       info("callid[%d], release_type[%d]");
        CM_RETURN_VAL_IF_FAIL(core_data, -1);
 
        switch (release_type) {
@@ -2495,7 +2619,7 @@ int _callmgr_core_process_end_call(callmgr_core_data_t *core_data, unsigned int
                        }
                        break;
                default:
-                       err("wrong release_type");
+                       err("wrong release_type")
                        return -1;
        }
 
@@ -2646,15 +2770,15 @@ int _callmgr_core_process_answer_call(callmgr_core_data_t *core_data, int ans_ty
 
 int _callmgr_core_process_spk_on(callmgr_core_data_t *core_data)
 {
-       callmgr_audio_device_e cur_route = CALLMGR_AUDIO_DEVICE_RECEIVER_E;
+       callmgr_audio_route_e cur_route = CALLMGR_AUDIO_ROUTE_RECEIVER_E;
        dbg(">>");
        CM_RETURN_VAL_IF_FAIL(core_data, -1);
 
-       if (_callmgr_audio_get_active_device(core_data->audio_handle, &cur_route) < 0) {
+       if (_callmgr_audio_get_audio_route(core_data->audio_handle, &cur_route) < 0) {
                err("_callmgr_audio_get_active_device() failed");
                return -1;
        }
-       if (cur_route == CALLMGR_AUDIO_DEVICE_SPEAKER_E) {
+       if (cur_route == CALLMGR_AUDIO_ROUTE_SPEAKER_E) {
                warn("Already SPK");
                return -1;
        }
@@ -2671,15 +2795,15 @@ int _callmgr_core_process_spk_on(callmgr_core_data_t *core_data)
 
 int _callmgr_core_process_spk_off(callmgr_core_data_t *core_data)
 {
-       callmgr_audio_device_e cur_route = CALLMGR_AUDIO_DEVICE_RECEIVER_E;
+       callmgr_audio_route_e cur_route = CALLMGR_AUDIO_ROUTE_RECEIVER_E;
        dbg(">>");
        CM_RETURN_VAL_IF_FAIL(core_data, -1);
 
-       if (_callmgr_audio_get_active_device(core_data->audio_handle, &cur_route) < 0) {
+       if (_callmgr_audio_get_audio_route(core_data->audio_handle, &cur_route) < 0) {
                err("_callmgr_audio_get_active_device() failed");
                return -1;
        }
-       if (cur_route != CALLMGR_AUDIO_DEVICE_SPEAKER_E) {
+       if (cur_route != CALLMGR_AUDIO_ROUTE_SPEAKER_E) {
                warn("Not SPK");
                return -1;
        }
index ba96751..eea942c 100644 (file)
@@ -734,7 +734,6 @@ static gboolean __get_call_status_handler(GDBusInterfaceSkeleton *di,
        return TRUE;
 }
 
-
 static void __on_name_appeared (GDBusConnection *connection,
                   const gchar     *name,
                   const gchar     *name_owner,
@@ -771,7 +770,7 @@ static void __on_name_vanished (GDBusConnection *connection,
                if(0 == g_strcmp0(name, tmp->appid) && TRUE == tmp->is_appeared){
                        g_bus_unwatch_name( tmp->watch_id);
                        core_data->watch_list = g_slist_remove(core_data->watch_list, tmp);
-                       dbg("appid [%s] exits , stop watching it, now client num = %d ", tmp->appid, g_slist_length(core_data->watch_list));
+                       info("appid [%s] exits , stop watching it, now client num = %d ", tmp->appid, g_slist_length(core_data->watch_list));
                        g_free(tmp->appid);
                        g_free(tmp);
                        break;
@@ -779,7 +778,7 @@ static void __on_name_vanished (GDBusConnection *connection,
        }
 
        if (NULL == core_data->watch_list){
-               dbg("end all calls");
+               warn("end all calls");
                _callmgr_core_process_end_call(core_data, 0, CM_TEL_CALL_RELEASE_TYPE_ALL_CALLS);
        }
 }
@@ -887,6 +886,21 @@ static gboolean __get_answering_machine_status_handler(GDBusInterfaceSkeleton *d
        return TRUE;
 }
 
+static gboolean __get_video_recording_status_handler(GDBusInterfaceSkeleton *di,
+               GDBusMethodInvocation *invoc, gpointer user_data)
+{
+       dbg("__get_video_recording_status_handler() is called");
+       callmgr_core_data_t *core_data = (callmgr_core_data_t *)user_data;
+       CM_RETURN_VAL_IF_FAIL(core_data, FALSE);
+       gboolean is_video_recording = FALSE;
+
+       is_video_recording = core_data->is_video_recording;
+       g_dbus_method_invocation_return_value (invoc, g_variant_new ("(b)", is_video_recording));
+
+       return TRUE;
+}
+
+
 /********************************************/
 static gchar *__callmgr_dbus_convert_name_to_path (const gchar *name)
 {
@@ -1002,6 +1016,7 @@ static int __callmgr_dbus_init_handlers (callmgr_core_data_t *core_data)
        g_signal_connect(di, "handle-stop-voice-record", G_CALLBACK(__stop_voice_record_handler), core_data);
        g_signal_connect(di, "handle-get-mute-status", G_CALLBACK(__get_mute_status_handler), core_data);
        g_signal_connect(di, "handle-get-answering-machine-status", G_CALLBACK(__get_answering_machine_status_handler), core_data);
+       g_signal_connect(di, "handle-get-video-recording-status", G_CALLBACK(__get_video_recording_status_handler), core_data);
 
        __callmgr_dbus_object_export(core_data, di, CALLMGR_DBUS_PATH);
        core_data->dbus_skeleton_interface = di;