tizen 2.4 release accepted/tizen_2.4_mobile tizen_2.4 accepted/tizen/2.4/mobile/20151029.031623 submit/tizen_2.4/20151028.064725 tizen_2.4_mobile_release
authorjk7744.park <jk7744.park@samsung.com>
Sat, 24 Oct 2015 08:06:48 +0000 (17:06 +0900)
committerjk7744.park <jk7744.park@samsung.com>
Sat, 24 Oct 2015 08:06:48 +0000 (17:06 +0900)
12 files changed:
CMakeLists.txt [new file with mode: 0755]
LICENSE [new file with mode: 0644]
callmgr_client.pc.in [new file with mode: 0644]
doc/call_manager_doc.h [new file with mode: 0644]
include/call-manager-common.h [new file with mode: 0755]
include/call-manager-extension.h [new file with mode: 0755]
include/call-manager.h [new file with mode: 0755]
libcall-manager.manifest [new file with mode: 0644]
packaging/libcall-manager.spec [new file with mode: 0755]
src/call-manager.c [new file with mode: 0755]
test/CMakeLists.txt [new file with mode: 0644]
test/test.c [new file with mode: 0644]

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..666edfb
--- /dev/null
@@ -0,0 +1,47 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(call-manager C)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(EXEC_PREFIX "\${prefix}")
+SET(LIBDIR "\${prefix}/lib")
+SET(INCLUDEDIR "\${prefix}/include")
+SET(CLIENT "call-manager")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(client_pkgs REQUIRED
+       glib-2.0
+       gio-2.0
+       dlog
+       vconf
+       capi-system-device
+       capi-base-common
+       capi-system-info
+)
+
+FOREACH(flag ${client_pkgs_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wextra -fvisibility=hidden -fPIC -fdata-sections -ffunction-sections -Wl,--gc-sections")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter -Wno-missing-field-initializers -Wmissing-declarations -Wcast-align")
+
+SET(CLIENT_SRCS
+       src/call-manager.c
+)
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include/)
+
+ADD_LIBRARY(${CLIENT} SHARED ${CLIENT_SRCS})
+TARGET_LINK_LIBRARIES(${CLIENT} ${client_pkgs_LDFLAGS})
+SET_TARGET_PROPERTIES(${CLIENT} PROPERTIES VERSION 0.0.0 SOVERSION 0 OUTPUT_NAME ${CLIENT})
+
+# pkgconfig file
+CONFIGURE_FILE(callmgr_client.pc.in callmgr_client.pc @ONLY)
+
+# install
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION include/${CLIENT})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/callmgr_client.pc DESTINATION ${LIBDIR}/pkgconfig)
+INSTALL(TARGETS ${CLIENT} DESTINATION ${LIBDIR})
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME libcall-manager)
+ADD_SUBDIRECTORY(test)
diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
index 0000000..a06208b
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,204 @@
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
diff --git a/callmgr_client.pc.in b/callmgr_client.pc.in
new file mode 100644 (file)
index 0000000..334efae
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@/call-manager
+
+Name: callmgr_client
+Description: Call Manager Client Library
+Requires: dlog glib-2.0 gobject-2.0
+Version: @VERSION@
+Libs: -L${libdir} -lcall-manager
+Cflags: -I${includedir}
diff --git a/doc/call_manager_doc.h b/doc/call_manager_doc.h
new file mode 100644 (file)
index 0000000..315d194
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact: Sung Joon Won <sungjoon.won@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TIZEN_CALL_MANAGER_DOC_H__
+#define __TIZEN_CALL_MANAGER_DOC_H__
+
+
+/**
+ * @file call_manager_doc.h
+ * @brief This file contains high level documentation of the Call Manager API.
+ */
+
+/**
+ * @ingroup CAPI_CALL_FRAMEWORK
+ * @defgroup CAPI_CALL_MANAGER_MODULE Call Manager
+ * @brief  The Call Manager API provides functions to get the voice and video call status.
+ *
+ * @section CAPI_CALL_MANAGER_MODULE_HEADER Required Header
+ *   \#include <call_manager.h>
+ *
+ * @section CAPI_CALL_MANAGER_OVERVIEW Overview
+ * The Call Manager service allows APIs to manage call operations.
+ *
+ * The Call Manager API allows you to:
+ * - get the call status
+ *
+ *
+ * It is recommended to design feature related codes in your application for reliability.\n
+ *
+ * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
+ *
+ * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
+ *
+ * More details on featuring your application can be found from <a href="../org.tizen.gettingstarted/html/native/details/app_filtering_n.htm"><b>Feature List</b>.</a>
+ */
+
+#endif /* __TIZEN_CALL_MANAGER_DOC_H__ */
diff --git a/include/call-manager-common.h b/include/call-manager-common.h
new file mode 100755 (executable)
index 0000000..0a33a70
--- /dev/null
@@ -0,0 +1,190 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact: Sung Joon Won <sungjoon.won@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __CALL_MANAGER_COMMON_H__
+#define __CALL_MANAGER_COMMON_H__
+
+#include <glib.h>
+#include <gio/gio.h>
+#include <dlog.h>
+#include <system_info.h>
+
+#ifndef CM_CLIENT_LOG_TAG
+#define CM_CLIENT_LOG_TAG "CALL_MGR_CLIENT"
+#endif
+
+#define TELEPHONY_FEATURE      "http://tizen.org/feature/network.telephony"
+
+#define info(fmt,args...)   { __dlog_print(LOG_ID_MAIN, DLOG_INFO,  CM_CLIENT_LOG_TAG, "<LIB> "fmt "\n", ##args); }
+#define dbg(fmt,args...)    { __dlog_print(LOG_ID_MAIN, DLOG_DEBUG, CM_CLIENT_LOG_TAG, "<LIB:%s:%d> " fmt "\n", __func__, __LINE__, ##args); }
+#define warn(fmt,args...)   { __dlog_print(LOG_ID_MAIN, DLOG_WARN,  CM_CLIENT_LOG_TAG, "<LIB:%s:%d> " fmt "\n", __func__, __LINE__, ##args); }
+#define err(fmt,args...)    { __dlog_print(LOG_ID_MAIN, DLOG_ERROR, CM_CLIENT_LOG_TAG, "<LIB:%s:%d> " fmt "\n", __func__, __LINE__, ##args); }
+#define fatal(fmt,args...)  { __dlog_print(LOG_ID_MAIN, DLOG_FATAL, CM_CLIENT_LOG_TAG, "<LIB:%s:%d> " fmt "\n", __func__, __LINE__, ##args); }
+
+#define sec_err(fmt, arg...) {SECURE_LOGE(CM_CLIENT_LOG_TAG, fmt"\n", ##arg); }
+#define sec_warn(fmt, arg...) {SECURE_LOGW(CM_CLIENT_LOG_TAG, fmt"\n", ##arg); }
+#define sec_dbg(fmt, arg...) {SECURE_LOGD(CM_CLIENT_LOG_TAG, fmt"\n", ##arg); }
+
+#define CHECK_SUPPORTED_FEATURE(feature_name) { \
+       bool telephony_supported = FALSE; \
+       if (!system_info_get_platform_bool(feature_name, &telephony_supported)) { \
+               if (telephony_supported == FALSE) { \
+                       LOGE("telephony feature is disabled"); \
+                       return CM_ERROR_NOT_SUPPORTED; \
+               } \
+       } else { \
+               LOGE("Error - Feature getting from System Info"); \
+               return CM_ERROR_OPERATION_FAILED; \
+       } \
+}
+
+#define CM_RETURN_IF_FAIL(scalar_exp) {\
+       if (!scalar_exp) \
+       { \
+               err("CM_RETURN_IF_FAIL: Failed: Returning from here."); \
+               return; \
+       } \
+}
+
+#define CM_RETURN_VAL_IF_FAIL(scalar_exp, ret) { \
+       if (!scalar_exp) \
+       { \
+               err("CM_RETURN_VAL_IF_FAIL: Failed: Returning [%d]", ret); \
+               return ret; \
+       } \
+}
+
+/* Call-mgr DBus interface*/
+#define DBUS_CALL_MANAGER      "org.tizen.callmgr"
+#define DBUS_CALL_MANAGER_PATH "/org/tizen/callmgr"
+#define DBUS_CALL_MANAGER_DEFAULT_INTERFACE DBUS_CALL_MANAGER
+
+/* DeviceD DBus interface*/
+#define DBUS_DEVICED                   "org.tizen.system.deviced"
+#define DBUS_DEVICED_OBJECT_PATH       "/Org/Tizen/System/DeviceD"
+#define DBUS_DEVICED_INTERFACE         DBUS_DEVICED
+#define DBUS_DEVICED_PATH_DISPLAY      DBUS_DEVICED_OBJECT_PATH"/Display"
+#define DBUS_DEVICED_INTERFACE_DISPLAY DBUS_DEVICED_INTERFACE".display"
+
+/*Method*/
+#define DBUS_CALL_MANAGER_METHOD_TEST  "Test"
+#define DBUS_CALL_MANAGER_METHOD_DIAL_CALL     "DialCall"
+#define DBUS_CALL_MANAGER_METHOD_SWAP_CALL     "SwapCall"
+#define DBUS_CALL_MANAGER_METHOD_HOLD_CALL     "HoldCall"
+#define DBUS_CALL_MANAGER_METHOD_UNHOLD_CALL   "UnholdCall"
+#define DBUS_CALL_MANAGER_METHOD_END_CALL      "EndCall"
+#define DBUS_CALL_MANAGER_METHOD_REJECT_CALL   "RejectCall"
+#define DBUS_CALL_MANAGER_METHOD_JOIN_CALL     "JoinCall"
+#define DBUS_CALL_MANAGER_METHOD_SPLIT_CALL    "SplitCall"
+#define DBUS_CALL_MANAGER_METHOD_TRANSFER_CALL "TransferCall"
+#define DBUS_CALL_MANAGER_METHOD_ANSWER_CALL   "AnswerCall"
+#define DBUS_CALL_MANAGER_METHOD_GET_CALL_LIST "GetCallList"
+#define DBUS_CALL_MANAGER_METHOD_GET_CONF_CALL_LIST    "GetConfCallList"
+#define DBUS_CALL_MANAGER_METHOD_GET_ALL_CALL_DATA     "GetAllCallData"
+#define DBUS_CALL_MANAGER_METHOD_SEND_DTMF_RESP        "SendDtmfResp"
+#define DBUS_CALL_MANAGER_METHOD_START_DTMF            "StartDtmf"
+#define DBUS_CALL_MANAGER_METHOD_STOP_DTMF             "StopDtmf"
+#define DBUS_CALL_MANAGER_METHOD_BURST_DTMF            "BurstDtmf"
+#define DBUS_CALL_MANAGER_METHOD_SPK_ON        "SpkOn"
+#define DBUS_CALL_MANAGER_METHOD_SPK_OFF       "SpkOff"
+#define DBUS_CALL_MANAGER_METHOD_BLUETOOTH_ON  "BluetoothOn"
+#define DBUS_CALL_MANAGER_METHOD_BLUETOOTH_OFF "BluetoothOff"
+#define DBUS_CALL_MANAGER_METHOD_SET_EXTRA_VOL "SetExtraVol"
+#define DBUS_CALL_MANAGER_METHOD_SET_NOISE_REDUCTION   "SetNoiseReduction"
+#define DBUS_CALL_MANAGER_METHOD_SET_MUTE_STATE        "SetMuteState"
+#define DBUS_CALL_MANAGER_METHOD_GET_AUDIO_STATE       "GetAudioState"
+#define DBUS_CALL_MANAGER_METHOD_STOP_ALERT            "StopAlert"
+#define DBUS_CALL_MANAGER_METHOD_START_ALERT           "StartAlert"
+#define DBUS_CALL_MANAGER_METHOD_ACTIVATE_UI           "ActivateUi"
+#define DBUS_CALL_MANAGER_METHOD_GET_CALL_STATUS               "GetCallStatus"
+#define DBUS_CALL_MANAGER_METHOD_SET_WATCH_NAME                "SetWatchName"
+#define DBUS_DEVICED_METHOD_SET_LCDTIMEOUT     "setlcdtimeout"
+#define DBUS_DEVICED_METHOD_UPDATE_LCDTIMEOUT_BY_TOUCH         "UpdateLCDTimeoutByTouch"
+#define DBUS_CALL_MANAGER_METHOD_START_VOICE_RECORD            "StartVoiceRecord"
+#define DBUS_CALL_MANAGER_METHOD_STOP_VOICE_RECORD             "StopVoiceRecord"
+#define DBUS_CALL_MANAGER_METHOD_GET_MUTE_STATUS               "GetMuteStatus"
+#define DBUS_CALL_MANAGER_METHOD_GET_ANSWERING_MACHINE_STATUS  "GetAnsweringMachineStatus"
+
+/*Signal*/
+#define DBUS_CALL_MANAGER_SIGNAL_CALL_STATUS   "CallStatus"
+#define DBUS_CALL_MANAGER_SIGNAL_CALL_EVENT            "CallEvent"
+#define DBUS_CALL_MANAGER_SIGNAL_DIAL_STATUS   "DialStatus"
+#define DBUS_CALL_MANAGER_SIGNAL_DTMF_INDI             "DtmfIndi"
+#define DBUS_CALL_MANAGER_SIGNAL_AUDIO_STATE   "AudioState"
+#define DBUS_CALL_MANAGER_SIGNAL_GO_FOREGROUND "GoForeground"
+#define DBUS_CALL_MANAGER_SIGNAL_VOICE_RECORD_STATUS   "VoiceRecordStatus"
+#define DBUS_CALL_MANAGER_SIGNAL_MUTE_STATUS   "MuteStatus"
+
+
+#define CM_DEFAULT_TIMEOUT    (5 * 1000)
+
+struct __cm_client {
+       GDBusConnection *dbus_conn;
+       GCancellable *ca;
+//     gchar *name;
+       GHashTable *evt_list;
+};
+
+struct __cm_call_data {
+       unsigned int call_id;                                                   /**< Unique call id*/
+       cm_call_direction_e call_direction;                                             /**< 0 : MO, 1 : MT*/
+       char *call_number;                                                      /**< call number */
+       char *calling_name;                                                     /**< calling name */
+       cm_call_type_e call_type;                       /**< Specifies type of call (voice, data, emergency) */
+       cm_call_state_e call_state;             /**< Current Call state */
+       int member_count;                                               /**< 1: Single call, more than 1: Conference call. It reflects call member count */
+       gboolean is_ecc;                                                /**< is emergency*/
+       gboolean is_voicemail_number;                           /**<is voicemail number*/
+       cm_call_domain_e call_domain;   /**< Current Call domain */
+       int person_id;          /**< Contact Index */
+       long start_time;                /**<Call start time */
+       cm_name_mode_e name_mode;       /**<Name Mode */
+};
+
+struct __cm_call_event_data {
+       unsigned int call_id;
+       cm_multi_sim_slot_type_e sim_slot;
+       cm_call_end_cause_type_e end_cause;
+
+       cm_call_data_t *incom;  /* Incoming CallData, Important : Application should free this after use */
+       cm_call_data_t *active_dial;    /* Active or Dial CallData, Important : Application should free this after use */
+       cm_call_data_t *held;   /* Held CallData, Important : Application should free this after use */
+};
+
+struct __cm_conf_call_data {
+       unsigned int call_id;                                                   /**< Unique call id*/
+       char *call_number;                                                      /**< call number */
+       int person_id;                                                          /**< Contact Index */
+       cm_name_mode_e name_mode;                                       /**<Name Mode */
+};
+
+#define MAKE_CALL_STATE_ASYNC_DATA(data,cb,ud)  \
+       data = g_try_new0 (struct __cm_async_data, 1); \
+       if (!data) { return -1; } \
+       data->cb_fn = cb; \
+       data->user_data = ud \
+
+struct __cm_async_data {
+       void *cb_fn;
+       void* user_data;
+       cm_client_h handle;
+       guint id;
+};
+
+#endif //__CALL_MANAGER_COMMON_H__
+
diff --git a/include/call-manager-extension.h b/include/call-manager-extension.h
new file mode 100755 (executable)
index 0000000..0500f89
--- /dev/null
@@ -0,0 +1,1843 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact: Sung Joon Won <sungjoon.won@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __CALL_MANAGER_EXTENSION_H__
+#define __CALL_MANAGER_EXTENSION_H__
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#include <glib.h>
+#include <tizen.h>
+
+// TODO:
+// Please add doxygen comment for all header files.
+
+typedef struct __cm_call_data cm_call_data_t;
+typedef struct __cm_call_event_data cm_call_event_data_t;
+typedef struct __cm_conf_call_data cm_conf_call_data_t;
+
+/*
+ * This enum is inline with cm_telephony_call_state_e, so update both enum's together.
+ * Also the state of the call can be retrieved from the call_data by the UI which has the call-state enum which can be compared with 'cm_call_state_e' to
+ * fetch the call state by the UI.
+ */
+typedef enum _call_state {
+       CM_CALL_STATE_IDLE,             /**< Call is in idle state */
+       CM_CALL_STATE_ACTIVE,           /**< Call is in connected and conversation state */
+       CM_CALL_STATE_HELD,                     /**< Call is in held state */
+       CM_CALL_STATE_DIALING,          /**< Call is in dialing state */
+       CM_CALL_STATE_ALERT,            /**< Call is in alerting state */
+       CM_CALL_STATE_INCOMING,         /**< Call is in incoming state */
+       CM_CALL_STATE_WAITING,          /**< Call is in answered state, and waiting for connected indication event */
+       CM_CALL_STATE_MAX                       /**< Call state unknown */
+} cm_call_state_e;
+
+/*This enum is inline with cm_telephony_call_type_e and callmgr_call_type_e, so update all enum's together*/
+typedef enum _call_type {
+       CM_CALL_TYPE_VOICE,             /**< Voice call type. */
+       CM_CALL_TYPE_VIDEO,             /**< Video call type. */
+       CM_CALL_TYPE_INVALID,   /**< Invalid call type */
+} cm_call_type_e;
+
+/*This enum is inline with cm_telephony_call_domain_e and callmgr_call_domain_e, so update all enum's together*/
+typedef enum _call_domain {
+       CM_CALL_DOMAIN_CS,              /**< CS call domain. */
+       CM_CALL_DOMAIN_PS,              /**< PS call domain. */
+       CM_CALL_DOMAIN_HFP,             /**< Wearable call domain. */
+} cm_call_domain_e;
+
+/*This enum is inline with cm_telephony_call_direction_e, so update both enum's together*/
+typedef enum {
+       CM_CALL_DIRECTION_MO,
+       CM_CALL_DIRECTION_MT,
+} cm_call_direction_e;
+
+/*This enum is inline with callmgr_call_event_e, so update both enum's together*/
+typedef enum _call_event {
+       CM_CALL_EVENT_IDLE = 0,
+       CM_CALL_EVENT_DIALING,
+       CM_CALL_EVENT_ACTIVE,
+       CM_CALL_EVENT_HELD,
+       CM_CALL_EVENT_ALERT,
+       CM_CALL_EVENT_INCOMING,
+       CM_CALL_EVENT_WAITING,
+       CM_CALL_EVENT_JOIN,
+       CM_CALL_EVENT_SPLIT,
+       CM_CALL_EVENT_SWAPPED,
+       CM_CALL_EVENT_RETRIEVED,
+       CM_CALL_EVENT_SAT_CALL_CONTROL,
+} cm_call_event_e;
+
+typedef enum _dial_status {
+       CM_DIAL_SUCCESS = 0,
+       CM_DIAL_CANCEL,
+       CM_DIAL_FAIL,
+       CM_DIAL_FAIL_SS,
+       CM_DIAL_FAIL_FDN,
+       CM_DIAL_FAIL_FLIGHT_MODE,
+} cm_dial_status_e;
+
+typedef enum {
+       CM_VR_STATUS_STARTED = 0,
+       CM_VR_STATUS_STOPPED,
+} cm_vr_status_e;
+
+typedef enum {
+       CM_VR_STATUS_EXTRA_START_TYPE = 0x00,
+       CM_VR_STATUS_EXTRA_START_TYPE_NORMAL,           /**< Normal recording*/
+       CM_VR_STATUS_EXTRA_START_TYPE_ANSWER_MSG,               /**< Answering message*/
+       CM_VR_STATUS_EXTRA_START_TYPE_MAX = 0x0f,
+
+       CM_VR_STATUS_EXTRA_STOP_TYPE = 0x10,
+       CM_VR_STATUS_EXTRA_STOP_TYPE_BY_NORMAL,                                         /**< BY_NORMAL*/
+       CM_VR_STATUS_EXTRA_STOP_TYPE_BY_MAX_SIZE,                                       /**< by MAX_SIZE*/
+       CM_VR_STATUS_EXTRA_STOP_TYPE_BY_NO_FREE_SPACE,          /**< BY_NO_FREE_SPACE*/
+       CM_VR_STATUS_EXTRA_STOP_TYPE_BY_TIME_LIMIT,                             /**< BY_TIME_LIMIT*/
+       CM_VR_STATUS_EXTRA_STOP_TYPE_ERROR,                                                             /**< ERROR*/
+       CM_VR_STATUS_EXTRA_STOP_TYPE_MAX = 0x1f,
+} cm_vr_status_extra_type_e;
+
+/**
+ * This enum defines call answer types for accepting the Incoming Call
+ */
+typedef enum _call_answer_type_t {
+       CALL_ANSWER_TYPE_NORMAL = 0,                            /**< Only single call exist, Accept the Incoming call*/
+       CALL_ANSWER_TYPE_HOLD_ACTIVE_AND_ACCEPT,        /**< Put the active call on hold and accepts the call*/
+       CALL_ANSWER_TYPE_RELEASE_ACTIVE_AND_ACCEPT,     /**< Releases the active call and accept the call*/
+       CALL_ANSWER_TYPE_RELEASE_HOLD_AND_ACCEPT,       /**< Releases the held call and accept the call*/
+       CALL_ANSWER_TYPE_RELEASE_ALL_AND_ACCEPT         /**< Releases all calls and accept the call*/
+} cm_call_answer_type_e;
+
+/**
+ * This enum defines call release type for releasing the call.
+ */
+typedef enum {
+       CALL_RELEASE_TYPE_BY_CALL_HANDLE = 0, /**< Release call using given call_handle*/
+       CALL_RELEASE_TYPE_ALL_CALLS,                    /**< Release all Calls*/
+       CALL_RELEASE_TYPE_ALL_HOLD_CALLS,       /**< Releases all hold calls*/
+       CALL_RELEASE_TYPE_ALL_ACTIVE_CALLS,     /**< Releases all active calls*/
+} cm_call_release_type_e;
+
+typedef enum {
+       CM_DTMF_INDI_IDLE_E = 0,
+       CM_DTMF_INDI_PROGRESSING_E,
+       CM_DTMF_INDI_WAIT_E,
+} cm_dtmf_indi_type_e;
+
+/**
+ * This enum defines audio state type.
+ */
+typedef enum {
+       CM_AUDIO_STATE_NONE_E,          /**< none */
+       CM_AUDIO_STATE_SPEAKER_E,       /**< System LoudSpeaker path */
+       CM_AUDIO_STATE_RECEIVER_E,      /**< System Receiver*/
+       CM_AUDIO_STATE_EARJACK_E,       /**< Earjack path*/
+       CM_AUDIO_STATE_BT_E                     /**< System BT Headset path */
+} cm_audio_state_type_e;
+
+typedef enum {
+       CM_DTMF_RESP_CANCEL_E = 0,
+       CM_DTMF_RESP_CONTINUE_E,
+} cm_dtmf_resp_type_e;
+
+typedef enum {
+       CM_SIM_SLOT_1_E = 0,
+       CM_SIM_SLOT_2_E,
+       CM_SIM_SLOT_DEFAULT_E,          /**< Follow system configuration*/
+} cm_multi_sim_slot_type_e;
+
+typedef enum {
+       CM_LCD_TIMEOUT_SET = 1,
+       CM_LCD_TIMEOUT_UNSET,
+       CM_LCD_TIMEOUT_LOCKSCREEN_SET, /*After lock-screen comes in Connected state LCD goes to OFF in 5 secs*/
+       CM_LCD_TIMEOUT_KEYPAD_SET, /*When Keypad is ON, LCD goes to DIM in 3 secs then goes to OFF in 5 secs*/
+       CM_LCD_TIMEOUT_DEFAULT,
+} cm_lcd_timeout_e;
+
+typedef enum {
+       CM_LCD_OFF = 1,
+       CM_LCD_ON,
+       CM_LCD_ON_LOCK,
+       CM_LCD_ON_UNLOCK,
+       CM_LCD_OFF_SLEEP_LOCK,
+       CM_LCD_OFF_SLEEP_UNLOCK,
+} cm_lcd_control_state_e;
+
+typedef enum {
+       CM_CALL_ENDCAUSE_CALL_ENDED,                                            /**< Call ended */
+
+       CM_CALL_ENDCAUSE_CALL_DISCONNECTED,                             /**< Call disconnected */
+       CM_CALL_ENDCAUSE_CALL_SERVICE_NOT_ALLOWED,              /**< Service not allowed */
+       CM_CALL_ENDCAUSE_CALL_BARRED,                                           /**< Call barred */
+       CM_CALL_ENDCAUSE_NO_SERVICE,                                            /**< No Service */
+       CM_CALL_ENDCAUSE_NW_BUSY,                                                       /**< Network busy */
+
+       CM_CALL_ENDCAUSE_NW_FAILED,                                             /**< Network failed */
+       CM_CALL_ENDCAUSE_NO_ANSWER,                                             /**< No anwer from other party */
+       CM_CALL_ENDCAUSE_NO_CREDIT,                                             /**< No credit available */
+       CM_CALL_ENDCAUSE_REJECTED,                                                      /**< Call rejected */
+       CM_CALL_ENDCAUSE_USER_BUSY,                                             /**< user busy */
+
+       CM_CALL_ENDCAUSE_WRONG_GROUP,                                   /**< Wrong group */
+       CM_CALL_ENDCAUSE_CALL_NOT_ALLOWED,                              /**< Call not allowed */
+       CM_CALL_ENDCAUSE_TAPI_ERROR,                                            /**< Tapi error */
+       CM_CALL_ENDCAUSE_CALL_FAILED,                                           /**< Call Failed */
+       CM_CALL_ENDCAUSE_NO_USER_RESPONDING,                            /**< User not responding */
+
+       CM_CALL_ENDCAUSE_USER_ALERTING_NO_ANSWER,               /**< User Alerting No Answer */
+       CM_CALL_ENDCAUSE_SERVICE_TEMP_UNAVAILABLE,              /**< Circuit Channel Unavailable,Network is out of Order,Switching equipment congestion,Temporary Failure */
+       CM_CALL_ENDCAUSE_USER_UNAVAILABLE,                              /**< Called Party Rejects the Call */
+       CM_CALL_ENDCAUSE_INVALID_NUMBER_FORMAT,                 /**< Entered number is invalid or incomplete */
+       CM_CALL_ENDCAUSE_NUMBER_CHANGED,                                /**< Entered number has been changed */
+
+       CM_CALL_ENDCAUSE_UNASSIGNED_NUMBER,                             /**< Unassigned/Unallocated number*/
+       CM_CALL_ENDCAUSE_USER_DOESNOT_RESPOND,                  /**< Called Party does not respond*/
+       CM_CALL_ENDCAUSE_IMEI_REJECTED,                 /**< Called Party does not respond*/
+       CM_CALL_ENDCAUSE_FIXED_DIALING_NUMBER_ONLY,                     /**< FDN Number only */
+       CM_CALL_ENDCAUSE_REJ_SAT_CALL_CTRL,                             /**< SAT call control reject */
+       CM_CALL_ENDCAUSE_MAX,
+}cm_call_end_cause_type_e;
+
+typedef enum {
+       CM_CALL_NAME_MODE_NONE,                 /**<  None */
+       CM_CALL_NAME_MODE_UNKNOWN,                      /**<  Unknown*/
+       CM_CALL_NAME_MODE_PRIVATE,              /**<  Private*/
+       CM_CALL_NAME_MODE_PAYPHONE,                     /**<  Payphone*/
+       CM_CALL_NAME_MODE_MAX,
+} cm_name_mode_e;
+
+typedef void (*cm_dial_status_cb) (cm_dial_status_e dial_status, void *user_data);
+typedef void (*cm_call_event_cb) (cm_call_event_e call_event, cm_call_event_data_t* event_data, void *user_data);
+typedef void (*cm_dtmf_indi_cb) (cm_dtmf_indi_type_e indi_type, char* dtmf_number, void *user_data);
+typedef void (*cm_audio_state_changed_cb) (cm_audio_state_type_e audio_state, void *user_data);
+typedef void (*cm_go_foreground_cb) (void *user_data);
+typedef void (*cm_voice_record_status_cb) (cm_vr_status_e vr_status, cm_vr_status_extra_type_e extra_type, void *user_data);
+
+/**
+ * @brief Sets the appid to watch appid is appeared or vanished.
+ *
+ * @details This API is used for ending all calls when call-ui got crashed.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from cm_init()
+ * @param[in] appid  The appid to be watched
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The handle should be obtained from #cm_init()
+ * @post The should be released by using #cm_deinit()
+ */
+int cm_enable_recovery (cm_client_h handle, char* appid);
+
+/**
+ * @brief Originates MO call setup.
+ *
+ * @details TBD.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from cm_init()
+ * @param[in] number  The destination phone number
+ * @param[in] call_type  The type of the call (#cm_call_type_e)
+ * @param[in] sim_slot  The sim card slot to be used for MO call setup (#cm_multi_sim_slot_type_e)
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The handle should be obtained from #cm_init()
+ * @post The should be released by using #cm_deinit()
+ *
+ * @see #cm_answer_call #cm_end_call
+ */
+int cm_dial_call(cm_client_h handle, char*number, cm_call_type_e call_type, cm_multi_sim_slot_type_e sim_slot);
+
+/**
+ * @brief Releases the call identified by the call id irrespective of whether the call is in the hold or active state.
+ *
+ * @details TBD.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from cm_init()
+ * @param[in] call_id  A unique id that refers to the call
+ * @param[in] release_type  The end call type (#cm_call_release_type_e)
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The handle should be obtained from #cm_init()
+ * @post The should be released by using #cm_deinit()
+ *
+ * @see cm_dial_call()
+ * @see cm_answer_call()
+ */
+int cm_end_call(cm_client_h handle, unsigned int call_id, cm_call_release_type_e release_type);
+
+/**
+ * @brief Swaps calls. A user can place all active calls and accept other held calls with this function.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from cm_init()
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The handle should be obtained from #cm_init()
+ * @post The should be released by using #cm_deinit()
+ */
+int cm_swap_call(cm_client_h handle);
+
+/**
+ * @brief Puts the given call which is in active state on hold.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from cm_init()
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The handle should be obtained from #cm_init()
+ * @post The should be released by using #cm_deinit()
+ *
+ * @see cm_unhold_call()
+ */
+int cm_hold_call(cm_client_h handle);
+
+/**
+ * @brief Retrieves the call being held.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from cm_init()
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The handle should be obtained from #cm_init()
+ * @post The should be released by using #cm_deinit()
+ */
+int cm_unhold_call(cm_client_h handle);
+
+/**
+ * @brief Joins the given two calls (one call in the active conversation state and the other call in the held state) into conference.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from cm_init()
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The handle should be obtained from #cm_init()
+ * @post The should be released by using #cm_deinit()
+ *
+ * @see cm_split_call()
+ */
+int cm_join_call(cm_client_h handle);
+
+/**
+ * @brief Triggers splitting a private call from a multiparty call.
+ *
+ * @details This API allows creating a private communication with one of the remote parties in a
+ *          multiparty session.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from cm_init()
+ * @param[in] call_id  The id of the call to be made private \n
+ *                       The call handle referring to the call that is to be split from the conference
+ *                       (call to be made private)
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The handle should be obtained from #cm_init()
+ * @post The should be released by using #cm_deinit()
+ *
+ * @see cm_join_call()
+ */
+int cm_split_call(cm_client_h handle, unsigned int call_id);
+
+/**
+ * @brief Triggers making an explicit call transfer by connecting the two parties where one party is being
+ *        active (active state) and another party is being held (held state).
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from cm_init()
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The handle should be obtained from #cm_init()
+ * @post The should be released by using #cm_deinit()
+ */
+int cm_transfer_call(cm_client_h handle);
+
+/**
+ * @brief Supports answering the incoming call by accepting or rejecting the call.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from cm_init()
+ * @param[in] ans_type  The answer type (#cm_call_answer_type_e)
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The handle should be obtained from #cm_init()
+ * @post The should be released by using #cm_deinit()
+ *
+ * @see cm_dial_call()
+ * @see cm_end_call()
+ */
+int cm_answer_call(cm_client_h handle, cm_call_answer_type_e ans_type);
+
+
+/**
+ * @brief Sets the audio session route to speaker.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from cm_init()
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The handle should be obtained from #cm_init()
+ * @post The should be released by using #cm_deinit()
+ *
+ */
+int cm_speaker_on (cm_client_h handle);
+
+/**
+ * @brief Sets the audio session route to earjack or built in receiver.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from cm_init()
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The handle should be obtained from #cm_init()
+ * @post The should be released by using #cm_deinit()
+ *
+ */
+int cm_speaker_off (cm_client_h handle);
+
+/**
+ * @brief Opens the bluetooth SCO.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from cm_init()
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The handle should be obtained from #cm_init()
+ * @post The should be released by using #cm_deinit()
+ *
+ */
+int cm_bluetooth_on (cm_client_h handle);
+
+/**
+ * @brief Closes the bluetooth SCO.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from cm_init()
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The handle should be obtained from #cm_init()
+ * @post The should be released by using #cm_deinit()
+ *
+ */
+int cm_bluetooth_off (cm_client_h handle);
+
+/**
+ * @brief Sets the extra volume.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from cm_init()
+ * @param[in] is_extra_vol  The extra volume status
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The handle should be obtained from #cm_init()
+ * @post The should be released by using #cm_deinit()
+ *
+ */
+int cm_set_extra_vol (cm_client_h handle, gboolean is_extra_vol);
+
+/**
+ * @brief Sets the audio TX mute status.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from cm_init()
+ * @param[in] is_mute_state  The tx mute status
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The handle should be obtained from #cm_init()
+ * @post The should be released by using #cm_deinit()
+ *
+ */
+int cm_set_mute_state(cm_client_h handle, gboolean is_mute_state);
+
+/**
+ * @brief Starts continuous DTMF by sending a single digit during the call.
+ *
+ * @details DTMF is an abbreviation for Dual-tone-multi-frequency. It is used for telecommunication signaling\n
+ *          over telephone lines in the voice-frequency band between UE and other communication devices.\n
+ *          For example UE sends a DTMF tone to the server to choose from options which the server provides.\n
+ *          If the UE is not within a call, this function will fail with an error code.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from cm_init()
+ * @param[in] dtmf_digit The DTMF digit to be sent
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The handle should be obtained from #cm_init()
+ *      An active call should be present.
+ * @post The should be released by using #cm_deinit()
+ *
+ */
+int cm_start_dtmf(cm_client_h handle, unsigned char dtmf_digit);
+
+/**
+ * @brief Stops continuous DTMF during the call.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from cm_init()
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The handle should be obtained from #cm_init()
+ * @post The should be released by using #cm_deinit()
+ */
+int cm_stop_dtmf(cm_client_h handle);
+
+/**
+ * @brief Sends one or more DTMF digits during the call. (3GPP2 specific)
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from cm_init()
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The handle should be obtained from #cm_init()
+ * @post The should be released by using #cm_deinit()
+ */
+int cm_burst_dtmf(cm_client_h handle, char *dtmf_digits);
+
+/**
+ * @brief Sends one or more DTMF digits during the call. (3GPP2 specific)
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from cm_init()
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The handle should be obtained from #cm_init()
+ * @post The should be released by using #cm_deinit()
+ */
+int cm_send_dtmf_resp(cm_client_h handle, cm_dtmf_resp_type_e resp_type);
+
+/**
+ * @brief Gets the current audio path.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from cm_init()
+ * @param[out] audio_state The current path of the call audio
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The handle should be obtained from #cm_init()
+ * @post The should be released by using #cm_deinit()
+ */
+int cm_get_audio_state(cm_client_h handle, cm_audio_state_type_e *audio_state);
+
+/**
+ * @brief Shows the view of call-ui.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from cm_init()
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The handle should be obtained from #cm_init()
+ * @post The should be released by using #cm_deinit()
+ */
+int cm_activate_ui(cm_client_h handle);
+
+/**
+ * @brief Sets LCD timeout values.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from cm_init()
+ * @param[in] timeout  The type of the LCD timeout (#cm_lcd_timeout_e)
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The handle should be obtained from #cm_init()
+ * @post The should be released by using #cm_deinit()
+ */
+int cm_set_lcd_timeout(cm_client_h handle, cm_lcd_timeout_e timeout);
+
+/**
+ * @brief Gets the list of the current call.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from cm_init()
+ * @param[out] call_list  List of call information for existing calls
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The handle should be obtained from #cm_init()
+ * @post The should be released by using #cm_deinit()
+ */
+int cm_get_all_call_list(cm_client_h handle, GSList **call_list);
+
+/**
+ * @brief Gets the list of the current conference call.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from cm_init()
+ * @param[out] call_list  List of call information for existing conference calls
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The handle should be obtained from #cm_init()
+ * @post The should be released by using #cm_deinit()
+ */
+int cm_get_conference_call_list(cm_client_h handle, GSList **call_list);
+
+/**
+ * @brief Gets the informations of the current incoming/active/held call.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from cm_init()
+ * @param[out] incom  List of call informations for existing incoming call
+ * @param[out] active  List of call informations for existing active call
+ * @param[out] held  List of call informations for existing held call
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The handle should be obtained from #cm_init()
+ * @post The should be released by using #cm_deinit()
+ */
+int cm_get_all_calldata(cm_client_h handle, cm_call_data_t **incom, cm_call_data_t **active, cm_call_data_t **held);
+
+/**
+ * @brief Triggers the voice recoding.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from cm_init()
+ * @param[in] call_num  The number of voice call to be recorded
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The handle should be obtained from #cm_init()
+ * @post The should be released by using #cm_deinit()
+ */
+int cm_start_voice_record(cm_client_h handle, char *call_num);
+
+/**
+ * @brief Stops the voice recoding.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from cm_init()
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The handle should be obtained from #cm_init()
+ * @post The should be released by using #cm_deinit()
+ */
+int cm_stop_voice_record(cm_client_h handle);
+
+/**
+ * @brief Sets a callback function to be invoked when the call state changes.
+ *
+ * @since_tizen 2.4
+ *
+ * @param[in] handle The handle from cm_init()
+ * @param[in] cb The callback to be invoked when the call state changes
+ * @param[in] user_data The user data passed to the callback function
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @post cm_call_event_cb() will be invoked.
+ *
+ * @see cm_unset_call_event_cb()
+ */
+int cm_set_call_event_cb(cm_client_h handle, cm_call_event_cb cb, void *user_data);
+
+/**
+ * @brief Unsets the call state callback function.
+ *
+ * @since_tizen 2.4
+ *
+ * @param[in] handle The handle from cm_init()
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @see cm_set_call_event_cb()
+ */
+int cm_unset_call_event_cb(cm_client_h handle);
+
+/**
+ * @brief Sets a callback function to be invoked when the dial status changes.
+ *
+ * @since_tizen 2.4
+ *
+ * @param[in] handle The handle from cm_init()
+ * @param[in] cb The callback to be invoked when the dial status changes
+ * @param[in] user_data The user data passed to the callback function
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @post cm_dial_status_cb() will be invoked.
+ *
+ * @see cm_unset_dial_status_cb()
+ */
+int cm_set_dial_status_cb(cm_client_h handle, cm_dial_status_cb cb, void *user_data);
+
+/**
+ * @brief Unsets the dial status changes callback function.
+ *
+ * @since_tizen 2.4
+ *
+ * @param[in] handle The handle from cm_init()
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @see cm_set_dial_status_cb()
+ */
+int cm_unset_dial_status_cb(cm_client_h handle);
+
+/**
+ * @brief Sets a callback function to be invoked when the audio path changes.
+ *
+ * @since_tizen 2.4
+ *
+ * @param[in] handle The handle from cm_init()
+ * @param[in] cb The callback to be invoked when the audio path changes
+ * @param[in] user_data The user data passed to the callback function
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @post cm_audio_state_changed_cb() will be invoked.
+ *
+ * @see cm_unset_audio_state_changed_cb()
+ */
+int cm_set_audio_state_changed_cb(cm_client_h handle, cm_audio_state_changed_cb cb, void *user_data);
+
+/**
+ * @brief Unsets the audio path changes callback function.
+ *
+ * @since_tizen 2.4
+ *
+ * @param[in] handle The handle from cm_init()
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @see cm_set_audio_state_changed_cb()
+ */
+int cm_unset_audio_state_changed_cb (cm_client_h handle);
+
+/**
+ * @brief Sets a callback function to be invoked when the dtmf indication status changes.
+ *
+ * @since_tizen 2.4
+ *
+ * @param[in] handle The handle from cm_init()
+ * @param[in] cb The callback to be invoked when the dtmf indication status changes
+ * @param[in] user_data The user data passed to the callback function
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @post cm_dtmf_indi_cb() will be invoked.
+ *
+ * @see cm_unset_dtmf_indication_cb()
+ */
+int cm_set_dtmf_indication_cb(cm_client_h handle, cm_dtmf_indi_cb cb, void *user_data);
+
+/**
+ * @brief Unsets the dtmf indication status changes callback function.
+ *
+ * @since_tizen 2.4
+ *
+ * @param[in] handle The handle from cm_init()
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @see cm_set_dtmf_indication_cb()
+ */
+int cm_unset_dtmf_indication_cb (cm_client_h handle);
+
+/**
+ * @brief Sets a callback function to be invoked when the call ui needs to be in foreground.
+ * @details The application could call cm_activate_ui when call ui need to be in foreground.
+ *
+ * @since_tizen 2.4
+ *
+ * @param[in] handle The handle from cm_init()
+ * @param[in] cb The callback to be invoked when the application calls cm_activate_ui
+ * @param[in] user_data The user data passed to the callback function
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @post cm_go_foreground_cb() will be invoked.
+ *
+ * @see cm_unset_foreground_cb()
+ */
+int cm_set_foreground_cb(cm_client_h handle, cm_go_foreground_cb cb, void *user_data);
+
+/**
+ * @brief Unsets the foreground callback function.
+ *
+ * @since_tizen 2.4
+ *
+ * @param[in] handle The handle from cm_init()
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @see cm_set_foreground_cb()
+ */
+int cm_unset_foreground_cb (cm_client_h handle);
+
+/**
+ * @brief Sets a callback function to be invoked when the voice recording status changes.
+ *
+ * @since_tizen 2.4
+ *
+ * @param[in] handle The handle from cm_init()
+ * @param[in] cb The callback to be invoked when the voice recording status changes
+ * @param[in] user_data The user data passed to the callback function
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @post cm_voice_record_status_cb() will be invoked.
+ *
+ * @see cm_unset_voice_record_status_cb()
+ */
+int cm_set_voice_record_status_cb(cm_client_h handle, cm_voice_record_status_cb cb, void *user_data);
+
+/**
+ * @brief Unsets the voice recording status changes callback function.
+ *
+ * @since_tizen 2.4
+ *
+ * @param[in] handle The handle from cm_init()
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @see cm_set_voice_record_status_cb()
+ */
+int cm_unset_voice_record_status_cb (cm_client_h handle);
+
+/* GSList of cm_call_data_t structures */
+/**
+ * @brief Releases the call data from #cm_get_all_calldata().
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] call_data The handle from #cm_get_all_calldata()
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ */
+int cm_call_data_free(cm_call_data_t *call_data);
+
+/**
+ * @brief Gets the call ID.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] call_data The handle from #cm_get_all_calldata()
+ * @param[out] call_id The id of the call handle
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The call handle should be obtained from #cm_get_all_calldata()
+ * @post The call list should be released by using #cm_call_data_free()
+ */
+int cm_call_data_get_call_id(cm_call_data_t *call_data, unsigned int *call_id);
+
+/**
+ * @brief Gets whether the call is MO(Mobile Originated) call or MT(Mobile Terminated).
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] call_data The handle from #cm_get_all_calldata()
+ * @param[out] call_direction The direction of the call (#cm_call_direction_e)
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The call handle should be obtained from #cm_get_all_calldata()
+ * @post The call list should be released by using #cm_call_data_free()
+ */
+int cm_call_data_get_call_direction(cm_call_data_t *call_data, cm_call_direction_e *call_direction);
+
+/**
+ * @brief Gets the call number.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @remarks You must release @c call_number using free().
+ *
+ * @param[in] call_data The handle from #cm_get_all_calldata()
+ * @param[out] call_number The number of the call
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The call handle should be obtained from #cm_get_all_calldata()
+ * @post The call list should be released by using #cm_call_data_free()
+ */
+int cm_call_data_get_call_number(cm_call_data_t *call_data, char **call_number);
+
+/**
+ * @brief Gets the caller name if exist.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @remarks You must release @c calling_name using free().
+ *
+ * @param[in] call_data The handle from #cm_get_all_calldata()
+ * @param[out] calling_name The name of the caller
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The call handle should be obtained from #cm_get_all_calldata()
+ * @post The call list should be released by using #cm_call_data_free()
+ */
+int cm_call_data_get_calling_name(cm_call_data_t *call_data, char **calling_name);
+
+/**
+ * @brief Gets the call type.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] call_data The handle from #cm_get_all_calldata()
+ * @param[out] call_type The type of the call (#cm_call_type_e)
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The call handle should be obtained from #cm_get_all_calldata()
+ * @post The call list should be released by using #cm_call_data_free()
+ */
+int cm_call_data_get_call_type(cm_call_data_t *call_data, cm_call_type_e *call_type);
+
+/**
+ * @brief Gets the call status.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] call_data The handle from #cm_get_all_calldata()
+ * @param[out] call_state The status of the call (#cm_call_state_e)
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The call handle should be obtained from #cm_get_all_calldata()
+ * @post The call list should be released by using #cm_call_data_free()
+ */
+int cm_call_data_get_call_state(cm_call_data_t *call_data, cm_call_state_e *call_state);
+
+/**
+ * @brief Gets the domain of the call.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] call_data The handle from #cm_get_all_calldata()
+ * @param[out] call_domain The domain of the call (#cm_call_domain_e)
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The call handle should be obtained from #cm_get_all_calldata()
+ * @post The call list should be released by using #cm_call_data_free()
+ */
+int cm_call_data_get_call_domain(cm_call_data_t *call_data, cm_call_domain_e *call_domain);
+
+/**
+ * @brief Gets the contact index of the Caller.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] call_data The handle from #cm_get_all_calldata()
+ * @param[out] person_id The contact index of the Caller
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The call handle should be obtained from #cm_get_all_calldata()
+ * @post The call list should be released by using #cm_call_data_free()
+ */
+int cm_call_data_get_person_id(cm_call_data_t *call_data, int *person_id);
+
+/**
+ * @brief Gets the call member count.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] call_data The handle from #cm_get_all_calldata()
+ * @param[out] member_count The call member count
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The call handle should be obtained from #cm_get_all_calldata()
+ * @post The call list should be released by using #cm_call_data_free()
+ */
+int cm_call_data_get_call_member_count(cm_call_data_t *call_data, int *member_count);
+
+/**
+ * @brief Indicates whether the call is emergency call or not.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] call_data The handle from #cm_get_all_calldata()
+ * @param[out] is_emergency The emergency call status
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The call handle should be obtained from #cm_get_all_calldata()
+ * @post The call list should be released by using #cm_call_data_free()
+ */
+int cm_call_data_is_emergency_call(cm_call_data_t *call_data, gboolean *is_emergency);
+
+/**
+ * @brief Indicates whether the call is voicemail number or not.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] call_data The handle from #cm_get_all_calldata()
+ * @param[out] is_voicemail_number The voicemail number status
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The call handle should be obtained from #cm_get_all_calldata()
+ * @post The call list should be released by using #cm_call_data_free()
+ */
+int cm_call_data_is_voicemail_number(cm_call_data_t *call_data, gboolean *is_voicemail_number);
+
+/**
+ * @brief Gets the start time of a call.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] call_data The handle from #cm_get_all_calldata()
+ * @param[out] start_time The start time
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The call handle should be obtained from #cm_get_all_calldata()
+ * @post The call list should be released by using #cm_call_data_free()
+ */
+int cm_call_data_get_start_time(cm_call_data_t *call_data, long *start_time);
+
+/**
+ * @brief Gets the display mode of a call.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] call_data The handle from #cm_get_all_calldata()
+ * @param[out] name_mode The name mode of a call (#cm_name_mode_e)
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The call handle should be obtained from #cm_get_all_calldata()
+ * @post The call list should be released by using #cm_call_data_free()
+ */
+int cm_call_data_get_name_mode(cm_call_data_t *call_data, cm_name_mode_e *name_mode);
+
+/**
+ * @brief Gets the call id when call event callback received.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] call_event_data The event data from #cm_call_event_cb()
+ * @param[out] call_id The id of the call
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The call_event_data should be obtained from #cm_call_event_cb()
+ */
+int cm_call_event_data_get_call_id(cm_call_event_data_t *call_event_data, unsigned int *call_id);
+
+/**
+ * @brief Gets the activated sim slot when call event callback received.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] call_event_data The event data from #cm_call_event_cb()
+ * @param[out] sim_slot The activated sim slot of the call (#cm_multi_sim_slot_type_e)
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The call_event_data should be obtained from #cm_call_event_cb()
+ */
+int cm_call_event_data_get_sim_slot(cm_call_event_data_t *call_event_data, cm_multi_sim_slot_type_e *sim_slot);
+
+/**
+ * @brief Gets the information of incoming call when call event callback received.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] call_event_data The event data from #cm_call_event_cb()
+ * @param[out] incom_call The structure which includes information of the incoming call (#cm_call_data_t)
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The call_event_data should be obtained from #cm_call_event_cb()
+ */
+int cm_call_event_data_get_incom_call(cm_call_event_data_t *call_event_data, cm_call_data_t **incom_call);
+
+/**
+ * @brief Gets the information of active call when call event callback received.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] call_event_data The event data from #cm_call_event_cb()
+ * @param[out] active_call The structure which includes information of the active call (#cm_call_data_t)
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The call_event_data should be obtained from #cm_call_event_cb()
+ */
+int cm_call_event_data_get_active_call(cm_call_event_data_t *call_event_data, cm_call_data_t **active_call);
+
+/**
+ * @brief Gets the information of held call when call event callback received.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] call_event_data The event data from #cm_call_event_cb()
+ * @param[out] held_call The structure which includes information of the held call (#cm_call_data_t)
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The call_event_data should be obtained from #cm_call_event_cb()
+ */
+int cm_call_event_data_get_held_call(cm_call_event_data_t *call_event_data, cm_call_data_t **held_call);
+
+/**
+ * @brief Gets the call end cause when call event callback received.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] call_event_data The event data from #cm_call_event_cb()
+ * @param[out] end_cause The end cause of the call (#cm_call_end_cause_type_e)
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The call_event_data should be obtained from #cm_call_event_cb()
+ */
+int cm_call_event_data_get_end_cause(cm_call_event_data_t *call_event_data, cm_call_end_cause_type_e *end_cause);
+
+/**
+ * @brief Gets the call ID of the conference call.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] conf_call The handle from #cm_get_conference_call_list()
+ * @param[out] call_id The id of the call handle
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The call handle should be obtained from #cm_get_conference_call_list()
+ * @post The call list should be released by using #cm_conf_call_data_free()
+ */
+int cm_conf_call_data_get_call_id(cm_conf_call_data_t *conf_call, unsigned int *call_id);
+
+/**
+ * @brief Gets the call number of the conference call.
+ *
+ * @remarks You must release @c call_number using free().
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] conf_call The handle from #cm_get_conference_call_list()
+ * @param[out] call_number The number of the call
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The call handle should be obtained from #cm_get_conference_call_list()
+ * @post The call list should be released by using #cm_conf_call_data_free()
+ */
+int cm_conf_call_data_get_call_number(cm_conf_call_data_t *conf_call, char **call_number);
+
+/**
+ * @brief Gets the contact index of the Caller in conference call.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] conf_call The handle from #cm_get_conference_call_list()
+ * @param[out] person_id The contact index of the Caller
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The call handle should be obtained from #cm_get_conference_call_list()
+ * @post The call list should be released by using #cm_conf_call_data_free()
+ */
+int cm_conf_call_data_get_person_id(cm_conf_call_data_t *conf_call, int *person_id);
+
+/**
+ * @brief Gets the display mode of the conference call.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] conf_call The handle from #cm_get_conference_call_list()
+ * @param[out] name_mode The name mode of a call (#cm_name_mode_e)
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The call handle should be obtained from #cm_get_conference_call_list()
+ * @post The call list should be released by using #cm_conf_call_data_free()
+ */
+int cm_conf_call_data_get_name_mode(cm_conf_call_data_t *conf_call, cm_name_mode_e *name_mode);
+
+/**
+ * @brief Releases the call data from #cm_get_conference_call_list().
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] conf_call The handle from #cm_get_conference_call_list()
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ */
+int cm_conf_call_data_free(cm_conf_call_data_t *conf_call);
+
+/**
+ * @brief Sets the LCD display states.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] state The states of the LCD to be set (#cm_lcd_control_state_e)
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ */
+int cm_set_lcd_state(cm_lcd_control_state_e state);
+
+/**
+ * @brief Starts the incoming call alert ringtone.
+ *
+ * @since_tizen 2.4
+ * @privlevel TBD
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from cm_init()
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Out of memory
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED Invalid parameter
+ *
+ */
+int cm_start_alert(cm_client_h handle);
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* __CALL_MANAGER_EXTENSION_H__ */
+
diff --git a/include/call-manager.h b/include/call-manager.h
new file mode 100755 (executable)
index 0000000..5c605c4
--- /dev/null
@@ -0,0 +1,351 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact: Sung Joon Won <sungjoon.won@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TIZEN_CALL_MANAGER_H__
+#define __TIZEN_CALL_MANAGER_H__
+
+/**
+ * @file call_manager.h
+ * @brief This file contains Call Manager APIs and related enumerations.
+ */
+
+#include <tizen.h>
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/**
+ * @file call_manager.h
+ * @brief This file contains the Call Manager API.
+ */
+
+/**
+ * @addtogroup CAPI_CALL_MANAGER_MODULE
+ * @{
+ */
+
+/**
+ * @brief The Call Manager API handle.
+ * @since_tizen 2.4
+ */
+typedef struct __cm_client *cm_client_h;
+
+// TODO:
+// Below define will be removed when Call Manager error included in tizen_error.h during ACR
+#ifndef TIZEN_ERROR_CALL_MANAGER
+#define TIZEN_ERROR_CALL_MANAGER       -0x00000000
+#endif
+
+/**
+ * @brief Enumeration for Call Manager error.
+ * @since_tizen 2.4
+ */
+typedef enum {
+ CM_ERROR_NONE = TIZEN_ERROR_NONE,                            /**< Successful */
+ CM_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY,          /**< Out of memory */
+ CM_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,  /**< Invalid parameter */
+ CM_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED,  /**< Permission denied */
+ CM_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED,          /**< Not supported */
+ CM_ERROR_NOT_REGISTERED = TIZEN_ERROR_CALL_MANAGER | 0x01,  /**< Callback not registered */
+ CM_ERROR_ALREADY_REGISTERED = TIZEN_ERROR_CALL_MANAGER | 0x02,  /**< Callback already registered */
+ CM_ERROR_OPERATION_FAILED = TIZEN_ERROR_CALL_MANAGER | 0x03,  /**< Operation failed */
+} cm_error_e;
+
+/**
+ * @brief Enumeration for Call status.
+ * @since_tizen 2.4
+ */
+typedef enum {
+       CM_CALL_STATUS_IDLE,        /**< Call is in idle state */
+       CM_CALL_STATUS_RINGING,         /**< A new call arrived and is ringing or waiting */
+       CM_CALL_STATUS_OFFHOOK,         /**< At least one call exist that is in dialing, alerting, active, on hold state */
+       CM_CALL_STATUS_MAX
+} cm_call_status_e;
+
+/**
+ * @brief Enumeration for Mute status.
+ * @since_tizen 2.4
+ */
+typedef enum {
+       CM_MUTE_STATUS_OFF,              /**< Mute state is off */
+       CM_MUTE_STATUS_ON,              /**<Mute state is on */
+       CM_MUTE_STATUS_MAX
+} cm_mute_status_e;
+
+
+/**
+ * @brief Called when the call status changes.
+ * @since_tizen 2.4
+ * @param[in]   call_status    The changed call status
+ * @param[in]   call_num       The call number with changed call status
+ * @param[in]   user_data      The user data passed from the callback registration function
+ * @pre You should register this callback using cm_set_call_status_cb().
+ * @see cm_set_call_status_cb()
+ * @see cm_unset_call_status_cb()
+ */
+typedef void (*cm_call_status_cb) (cm_call_status_e call_status, const char *call_num, void *user_data);
+
+
+/**
+ * @brief Called when the mute status changes.
+ * @since_tizen 2.4
+ * @param[in]   mute_status    The changed mute status
+ * @param[in]   user_data      The user data passed from the callback registration function
+ * @pre You should register this callback using cm_set_mute_status_cb().
+ * @see cm_set_mute_status_cb()
+ * @see cm_unset_mute_status_cb()
+ */
+typedef void (*cm_mute_status_cb) (cm_mute_status_e mute_status, void *user_data);
+
+
+/**
+ * @brief Acquires the handle to use the Call Manager API.
+ *
+ * @since_tizen 2.4
+ *
+ * @param[out] handle The handle to use the Call Manager API
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @see cm_deinit()
+ */
+int cm_init (cm_client_h *handle);
+
+/**
+ * @brief Deinitializes the Call Manager handle.
+ *
+ * @since_tizen 2.4
+ *
+ * @param[in] handle The handle to be deinitialized
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @see cm_init()
+ */
+int cm_deinit (cm_client_h handle);
+
+/**
+ * @brief Rejects the incoming call.
+ *
+ * @since_tizen 2.4
+ * @privlevel platform
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from cm_init()
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Out of memory
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED Invalid parameter
+ *
+ */
+int cm_reject_call(cm_client_h handle);
+
+/**
+ * @brief Stops incoming call alert ringtone.
+ *
+ * @since_tizen 2.4
+ * @privlevel platform
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from cm_init()
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Out of memory
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED Invalid parameter
+ *
+ */
+int cm_stop_alert(cm_client_h handle);
+
+/**
+ * @brief Gets the call status.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege TBD
+ *
+ * @param[in] handle The handle from #cm_init()
+ * @param[out] call_status The status of the call (#cm_call_status_e)
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The handle should be obtained from #cm_init()
+ * @post The should be released by using #cm_deinit()
+ */
+int cm_get_call_status (cm_client_h handle, cm_call_status_e *call_status);
+
+/**
+ * @brief Sets a callback function to be invoked when the call status changes.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege TBD
+ *
+ * @param[in] handle  The handle to use the Call Manager API
+ * @param[in] cb The callback to be invoked when the call status changes
+ * @param[in] user_data The user data passed to the callback function
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_ALREADY_REGISTERED Callback already registered
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @post cm_call_status_cb() will be invoked.
+ *
+ * @see cm_unset_call_status_cb()
+ */
+int cm_set_call_status_cb (cm_client_h handle, cm_call_status_cb cb, void *user_data);
+
+/**
+ * @brief Unsets a callback function.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege TBD
+ *
+ * @param[in] handle  The handle to use the Call Manager API
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_SUPPORTED     Not supported
+ * @retval #CM_ERROR_NOT_REGISTERED Callback not registered
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @see cm_set_call_status_cb()
+ */
+int cm_unset_call_status_cb (cm_client_h handle);
+
+/**
+ * @brief Gets the mute status.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/telephony
+ *
+ * @param[in] handle The handle from #cm_init()
+ * @param[out] mutel_status The status of the call (#cm_mute_status_e)
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @pre The handle should be obtained from #cm_init()
+ * @post The should be released by using #cm_deinit()
+ */
+int cm_get_mute_status (cm_client_h handle, cm_mute_status_e *mutel_status);
+
+/**
+ * @brief Sets a callback function to be invoked when the mute status changes.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/telephony
+ *
+ * @param[in] handle  The handle to use the Call Manager API
+ * @param[in] cb The callback to be invoked when the mute status changes
+ * @param[in] user_data The user data passed to the callback function
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_ALREADY_REGISTERED Callback already registered
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @post cm_mute_status_cb() will be invoked.
+ *
+ * @see cm_unset_mute_status_cb()
+ */
+int cm_set_mute_status_cb (cm_client_h handle, cm_mute_status_cb cb, void *user_data);
+
+/**
+ * @brief Unsets a callback function.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/telephony
+ *
+ * @param[in] handle  The handle to use the Call Manager API
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CM_ERROR_NONE              Successful
+ * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CM_ERROR_NOT_REGISTERED Callback not registered
+ * @retval #CM_ERROR_OPERATION_FAILED  Operation failed
+ *
+ * @see cm_set_mute_status_cb()
+ */
+int cm_unset_mute_status_cb (cm_client_h handle);
+
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* __TIZEN_CALL_MANAGER_H__ */
diff --git a/libcall-manager.manifest b/libcall-manager.manifest
new file mode 100644 (file)
index 0000000..8f89963
--- /dev/null
@@ -0,0 +1,8 @@
+<manifest>
+       <assign>
+               <filesystem path="/usr/bin/cm-test" exec_label="callmgr"/>
+       </assign>
+       <request>
+               <domain name="_"/>
+       </request>
+</manifest>
diff --git a/packaging/libcall-manager.spec b/packaging/libcall-manager.spec
new file mode 100755 (executable)
index 0000000..63a49f4
--- /dev/null
@@ -0,0 +1,79 @@
+%define major 0
+%define minor 0
+%define patchlevel 5
+%define ext_feature 0
+
+Name:           libcall-manager
+Version:        %{major}.%{minor}.%{patchlevel}
+Release:        1
+License:        Apache-2.0
+Summary:        Call Manager library
+Group:          System/Libraries
+Source0:        %{name}-%{version}.tar.gz
+
+BuildRequires: cmake
+BuildRequires: pkgconfig(gio-2.0)
+BuildRequires: pkgconfig(gio-unix-2.0)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(vconf)
+BuildRequires: pkgconfig(capi-system-device)
+BuildRequires: pkgconfig(capi-base-common)
+BuildRequires: pkgconfig(capi-system-info)
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+
+%if "%{?tizen_profile_name}" != "mobile"
+ExcludeArch: %{arm} %ix86 x86_64
+%endif
+
+%description
+Call Manager Library
+
+%package devel
+Summary: Call Manager API library (devel)
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+Call Manager API library (devel)
+
+%prep
+%setup -q
+
+%build
+export LDFLAGS+=" -Wl,-z,nodelete "
+
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DVERSION=%{version} \
+%if 0%{?ext_feature}
+-D_ENABLE_EXT_FEATURE:BOOL=ON \
+%else
+-D_ENABLE_EXT_FEATURE:BOOL=OFF \
+%endif
+
+make %{?_smp_mflags}
+
+%install
+%make_install
+
+mkdir -p %{buildroot}/usr/share/license
+cp LICENSE %{buildroot}/usr/share/license/libcall-manager
+
+%post
+
+%postun -p /sbin/ldconfig
+
+%files
+%manifest libcall-manager.manifest
+%defattr(644,system,system,-)
+%{_datadir}/license/libcall-manager
+%attr(755,system,system) %{_bindir}/cm-test
+%{_libdir}/*.so.*
+
+%files devel
+# callmgr client
+%defattr(644,system,system,-)
+%{_libdir}/libcall-manager.so
+%{_includedir}/call-manager/*
+%{_libdir}/pkgconfig/callmgr_client.pc
+
diff --git a/src/call-manager.c b/src/call-manager.c
new file mode 100755 (executable)
index 0000000..9aca021
--- /dev/null
@@ -0,0 +1,1943 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact: Sung Joon Won <sungjoon.won@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gio/gio.h>
+#include <vconf.h>
+
+#include <device/display.h>
+#include <device/power.h>
+
+#include "call-manager.h"
+#include "call-manager-extension.h"
+#include "call-manager-common.h"
+
+static int __cm_fetch_call_data(GVariantIter *iter, cm_call_data_t **call_data);
+static void __cm_on_signal_recv(GDBusConnection *conn, const gchar *name,
+               const gchar *path, const gchar *interface, const gchar *sig,
+               GVariant *param, gpointer user_data);
+static int __cm_set_cb(cm_client_h handle, char *signal, void *cb, void *user_data);
+static int __cm_unset_cb(cm_client_h handle, char *signal);
+static void __cm_set_LCDtimeout_cb(GObject *source_object, GAsyncResult *res, gpointer user_data);
+
+
+static void __cm_set_LCDtimeout_cb(GObject *source_object, GAsyncResult *res, gpointer user_data)
+{
+       GError *error = NULL;
+       GDBusConnection *conn = NULL;
+       int result = -1;
+       GVariant *dbus_result = NULL;
+
+       conn = G_DBUS_CONNECTION(source_object);
+       dbus_result = g_dbus_connection_call_finish(conn, res, &error);
+       if (error) {
+               err("Failed: %s", error->message);
+               g_error_free(error);
+       }
+
+       g_variant_get(dbus_result, "(i)", &result);
+
+       dbg("result : %d", result);
+}
+
+
+static int __cm_fetch_call_data(GVariantIter *iter, cm_call_data_t **call_data)
+{
+       cm_call_data_t *tmp_call_data = NULL;
+       gchar *key = 0;
+       GVariant *value = 0;
+       CM_RETURN_VAL_IF_FAIL(iter, -1);
+       CM_RETURN_VAL_IF_FAIL(call_data, -1);
+
+       tmp_call_data = (cm_call_data_t*)calloc(1, sizeof(cm_call_data_t));
+       CM_RETURN_VAL_IF_FAIL(tmp_call_data, -1);
+
+       while (g_variant_iter_loop(iter, "{sv}", &key, &value)) {
+               if (!g_strcmp0(key, "call_id")) {
+                       tmp_call_data->call_id = g_variant_get_uint32(value);
+               } else if (!g_strcmp0(key, "call_direction")) {
+                       tmp_call_data->call_direction = (int)g_variant_get_int32(value);
+               } else if (!g_strcmp0(key, "call_number")) {
+                       tmp_call_data->call_number = g_strdup(g_variant_get_string(value, 0));
+               } else if (!g_strcmp0(key, "calling_name")) {
+                       tmp_call_data->calling_name = g_strdup(g_variant_get_string(value, 0));
+               } else if (!g_strcmp0(key, "call_type")) {
+                       tmp_call_data->call_type = (int)g_variant_get_int32(value);
+               } else if (!g_strcmp0(key, "call_state")) {
+                       tmp_call_data->call_state = (int)g_variant_get_int32(value);
+               } else if (!g_strcmp0(key, "member_count")) {
+                       tmp_call_data->member_count = (int)g_variant_get_int32(value);
+               } else if (!g_strcmp0(key, "is_ecc")) {
+                       tmp_call_data->is_ecc = (int)g_variant_get_boolean(value);
+               } else if (!g_strcmp0(key, "is_voicemail_number")) {
+                       tmp_call_data->is_voicemail_number = (int)g_variant_get_boolean(value);
+               } else if (!g_strcmp0(key, "person_id")) {
+                       tmp_call_data->person_id = g_variant_get_uint32(value);
+               } else if (!g_strcmp0(key, "start_time")) {
+                       tmp_call_data->start_time = g_variant_get_int64(value);
+               } else if (!g_strcmp0(key, "name_mode")) {
+                       tmp_call_data->name_mode = g_variant_get_int32(value);
+               }
+       }
+
+       dbg("\n\n <<<<<<<<< CallData Info in Library START >>>>>>>>>> \n");
+       dbg("call_id                            : %d, ", tmp_call_data->call_id);
+       dbg("call_direction             : %d, ", tmp_call_data->call_direction);
+       if (tmp_call_data->call_number) {
+               dbg("call_number                        : %s, ", tmp_call_data->call_number);
+       }
+       if (tmp_call_data->calling_name) {
+               dbg("calling_name                       : %s, ", tmp_call_data->calling_name);
+       }
+       dbg("call_type                          : %d, ", tmp_call_data->call_type);
+       dbg("call_state                         : %d, ", tmp_call_data->call_state);
+       dbg("member count                       : %d, ", tmp_call_data->member_count);
+       dbg("is_ecc                             : %d, ", tmp_call_data->is_ecc);
+       dbg("is_voicemail_number                : %d, ", tmp_call_data->is_voicemail_number);
+       dbg("person_id                          : %d", tmp_call_data->person_id);
+       dbg("start time                         : %ld", tmp_call_data->start_time);
+       dbg("name mode                          : %d", tmp_call_data->name_mode);
+       dbg("\n\n <<<<<<<<< CallData Info in Library END >>>>>>>>>> \n");
+
+       *call_data = tmp_call_data;
+
+       return 0;
+}
+
+static void __cm_on_signal_recv(GDBusConnection *conn, const gchar *name,
+               const gchar *path, const gchar *interface, const gchar *sig,
+               GVariant *param, gpointer user_data)
+{
+       info("[%s] received", sig);
+       cm_client_h handle = user_data;
+       struct __cm_async_data *ad = NULL;
+       char *noti_id = NULL;
+       int ret = -1;
+       CM_RETURN_IF_FAIL(handle);
+
+       noti_id = g_strdup_printf("%s:%s:%s", path, interface, sig);
+       ad = g_hash_table_lookup(handle->evt_list, noti_id);
+       if (!ad) {
+               err("can't find noti_id(%s) callback info", noti_id);
+               g_free(noti_id);
+               return;
+       }
+
+       if (!g_strcmp0(sig, DBUS_CALL_MANAGER_SIGNAL_CALL_STATUS)) {
+               cm_call_status_e call_status = CM_CALL_STATUS_IDLE;
+               cm_call_type_e call_type = CM_CALL_TYPE_INVALID;
+               char *call_number = NULL;
+
+               g_variant_get(param, "(iis)", &call_status, &call_type, &call_number);
+               dbg("call status: %d, call_type: %d", call_status, call_type);
+               if (call_number) {
+                       dbg("call number: %s", call_number);
+               }
+
+               ((cm_call_status_cb)ad->cb_fn)(call_status, call_number, ad->user_data);
+               g_free(call_number);
+       } else if (!g_strcmp0(sig, DBUS_CALL_MANAGER_SIGNAL_CALL_EVENT)) {
+               const gchar *param_type;
+               gint event = -1;
+               cm_call_event_data_t *evt_data = NULL;
+               cm_multi_sim_slot_type_e sim_slot = CM_SIM_SLOT_DEFAULT_E;
+               cm_call_end_cause_type_e end_cause = CM_CALL_ENDCAUSE_MAX;
+               unsigned int call_id = 0;
+               cm_call_data_t *callData = NULL;
+               GVariantIter *iter_incom = 0, *iter_active_dial = 0, *iter_held = 0;
+
+               param_type = g_variant_get_type_string(param);
+               dbg("param_type: '%s'", param_type);
+               g_variant_get(param, "(iuiia{sv}a{sv}a{sv})", &event, &call_id, &sim_slot, &end_cause, &iter_incom, &iter_active_dial, &iter_held);
+               dbg("received event: '%d'", event);
+
+               evt_data = calloc(1, sizeof(cm_call_event_data_t));
+               if (NULL == evt_data) {
+                       err("memory allocation failed...");
+                       g_variant_iter_free(iter_incom);
+                       g_variant_iter_free(iter_active_dial);
+                       g_variant_iter_free(iter_held);
+                       g_free(noti_id);
+                       return;
+               }
+               evt_data->call_id = call_id;
+               evt_data->sim_slot = sim_slot;
+               evt_data->end_cause = end_cause;
+
+               dbg("call_event: %d, sim_slot: %d", event, sim_slot);
+
+               /*Fetch IncomingData*/
+               if (iter_incom && (g_variant_iter_n_children(iter_incom) > 0)) {
+                       ret = __cm_fetch_call_data(iter_incom, &callData);
+                       if (ret == 0) {
+                               evt_data->incom = callData;
+                       }
+                       g_variant_iter_free(iter_incom);
+               }
+
+               /*Fetch ActiveData*/
+               if (iter_active_dial && (g_variant_iter_n_children(iter_active_dial) > 0)) {
+                       ret = __cm_fetch_call_data(iter_active_dial, &callData);
+                       if (ret == 0) {
+                               evt_data->active_dial = callData;
+                       }
+                       g_variant_iter_free(iter_active_dial);
+               }
+
+               /*Fetch HeldData*/
+               if (iter_held && (g_variant_iter_n_children(iter_held) > 0)) {
+                       ret = __cm_fetch_call_data(iter_held, &callData);
+                       if (ret == 0) {
+                               evt_data->held = callData;
+                       }
+                       g_variant_iter_free(iter_held);
+               }
+
+               ((cm_call_event_cb)ad->cb_fn)(event, evt_data, ad->user_data);
+               if (evt_data->incom) {
+                       cm_call_data_free(evt_data->incom);
+               }
+               if (evt_data->active_dial) {
+                       cm_call_data_free(evt_data->active_dial);
+               }
+               if (evt_data->held) {
+                       cm_call_data_free(evt_data->held);
+               }
+               g_free(evt_data);
+       } else if (!g_strcmp0(sig, DBUS_CALL_MANAGER_SIGNAL_AUDIO_STATE)) {
+               gint audio_status = -1;
+
+               g_variant_get(param, "(i)", &audio_status);
+               dbg("received audio_status: %d", audio_status);
+
+               ((cm_audio_state_changed_cb)ad->cb_fn)(audio_status, ad->user_data);
+       } else if (!g_strcmp0(sig, DBUS_CALL_MANAGER_SIGNAL_DTMF_INDI)) {
+               cm_dtmf_indi_type_e indi_type = CM_DTMF_INDI_IDLE_E;
+               char *dtmf_number = NULL;
+
+               g_variant_get(param, "(is)", &indi_type, &dtmf_number);
+               dbg("received indication: %d", indi_type);
+               if (dtmf_number) {
+                       dbg("received dtmf numbe: %s", dtmf_number);
+               }
+
+               ((cm_dtmf_indi_cb)ad->cb_fn)(indi_type, dtmf_number, ad->user_data);
+               g_free(dtmf_number);
+       } else if (!g_strcmp0(sig, DBUS_CALL_MANAGER_SIGNAL_GO_FOREGROUND)) {
+               ((cm_go_foreground_cb)ad->cb_fn)(ad->user_data);
+       } else if (!g_strcmp0(sig, DBUS_CALL_MANAGER_SIGNAL_DIAL_STATUS)) {
+               cm_dial_status_e dial_status = CM_DIAL_SUCCESS;
+               g_variant_get(param, "(i)", &dial_status);
+               dbg("received dial status: %d", dial_status);
+
+               ((cm_dial_status_cb)ad->cb_fn)(dial_status, ad->user_data);
+       } else if (!g_strcmp0(sig, DBUS_CALL_MANAGER_SIGNAL_VOICE_RECORD_STATUS)) {
+               cm_vr_status_e vr_status = -1;
+               cm_vr_status_extra_type_e extra_type;
+
+               g_variant_get (param, "(ii)", &vr_status, &extra_type);
+               dbg("received vr_status: '%d', extra_type: 0x%02x", vr_status, extra_type);
+
+               ((cm_voice_record_status_cb)ad->cb_fn)(vr_status, extra_type, ad->user_data);
+       } else if (!g_strcmp0(sig, DBUS_CALL_MANAGER_SIGNAL_MUTE_STATUS)) {
+               cm_mute_status_e mute_status = CM_MUTE_STATUS_MAX;
+               g_variant_get(param, "(i)", &mute_status);
+               dbg("received mute status: %d", mute_status);
+
+               ((cm_mute_status_cb)ad->cb_fn)(mute_status, ad->user_data);
+       }
+       g_free(noti_id);
+}
+
+static int __cm_set_cb(cm_client_h handle, char *signal, void *cb, void *user_data)
+{
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(signal, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(cb, CM_ERROR_INVALID_PARAMETER);
+       struct __cm_async_data *ad = NULL;
+       guint id = 0;
+       gchar *noti_id = NULL;
+
+       noti_id = g_strdup_printf("%s:%s:%s", DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, signal);
+       dbg("noti_id: '%s'", noti_id);
+
+       ad = g_hash_table_lookup(handle->evt_list, noti_id);
+       if (ad != NULL) {
+               dbg("noti_id(%s) is already registered", noti_id);
+               g_free(noti_id);
+               return CM_ERROR_ALREADY_REGISTERED;
+       }
+
+       MAKE_CALL_STATE_ASYNC_DATA(ad, cb, user_data);
+       CM_RETURN_VAL_IF_FAIL(ad, CM_ERROR_OPERATION_FAILED);
+
+       id = g_dbus_connection_signal_subscribe(handle->dbus_conn,
+                       DBUS_CALL_MANAGER, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, signal, DBUS_CALL_MANAGER_PATH, NULL,
+                       G_DBUS_SIGNAL_FLAGS_NONE, __cm_on_signal_recv, handle, NULL);
+       dbg("id = %d", id);
+
+       ad->id = id;
+       ad->handle = handle;
+       g_hash_table_insert(handle->evt_list, noti_id, ad);
+
+       return CM_ERROR_NONE;
+}
+
+static int __cm_unset_cb(cm_client_h handle, char *signal)
+{
+       struct __cm_async_data *ad = NULL;
+       gchar *noti_id = NULL;
+       gboolean rv = FALSE;
+       CM_RETURN_VAL_IF_FAIL(signal, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+
+       noti_id = g_strdup_printf("%s:%s:%s", DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, signal);
+       dbg("noti_id: '%s'", noti_id);
+
+       ad = g_hash_table_lookup(handle->evt_list, noti_id);
+       if (ad == NULL) {
+               warn("noti_id(%s) is not registered", noti_id);
+               g_free(noti_id);
+               return CM_ERROR_NOT_REGISTERED;
+       }
+
+       if (ad->id == 0) {
+               warn("id(%d) is wrong", ad->id);
+               g_free(noti_id);
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       rv = g_hash_table_remove(handle->evt_list, noti_id);
+       if (!rv) {
+               warn("fail to deregister noti event(%s)", noti_id);
+               g_free(noti_id);
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       g_free(noti_id);
+       return CM_ERROR_NONE;
+}
+
+static void __cm_evt_list_key_destroyed_cb(gpointer data)
+{
+       dbg("__cm_evt_list_key_destroyed_cb()");
+       gchar *noti_id = (gchar *)data;
+       CM_RETURN_IF_FAIL(noti_id);
+
+       warn("Key[%s] is removed from hash table.", noti_id);
+       g_free(noti_id);
+       return;
+}
+
+static void __cm_evt_list_value_destroyed_cb(gpointer data)
+{
+       dbg("__cm_evt_list_value_destroyed_cb()");
+       struct __cm_async_data *ad = (struct __cm_async_data *)data;
+       CM_RETURN_IF_FAIL(ad);
+       cm_client_h handle = ad->handle;
+       CM_RETURN_IF_FAIL(handle);
+
+       g_dbus_connection_signal_unsubscribe(handle->dbus_conn, ad->id);
+       g_free(ad);
+       return;
+}
+
+EXPORT_API int cm_init(cm_client_h *handle)
+{
+       struct __cm_client *client_handle;
+       GError *error = NULL;
+
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+
+       dbg("cm_init");
+
+#if !GLIB_CHECK_VERSION(2, 35, 0)
+       g_type_init();
+#endif
+
+       client_handle = g_try_new0(struct __cm_client, 1);
+       if (!client_handle)
+               return CM_ERROR_OPERATION_FAILED;
+
+       client_handle->dbus_conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+       if (!client_handle->dbus_conn) {
+               err("dbus connection get failed: %s", error->message);
+               g_error_free(error);
+               g_free(client_handle);
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       client_handle->ca = g_cancellable_new();
+       client_handle->evt_list = g_hash_table_new_full(g_str_hash, g_str_equal, __cm_evt_list_key_destroyed_cb,
+                       __cm_evt_list_value_destroyed_cb);
+
+       *handle = client_handle;
+
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_enable_recovery(cm_client_h handle, char* appid)
+{
+       GError *error = NULL;
+       GVariant *dbus_result = NULL;
+       gint value = 0;
+       guint own_id = 0;
+
+       CM_RETURN_VAL_IF_FAIL(appid, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+
+       dbg(" appid [%s] cm_enable_recovery", appid);
+
+       own_id = g_bus_own_name(G_BUS_TYPE_SYSTEM, appid,
+                               G_BUS_NAME_OWNER_FLAGS_NONE, NULL, NULL, NULL,
+                               handle, NULL);
+       if (0 == own_id) {
+               err("g_bus_own_name failed");
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_SET_WATCH_NAME,
+                       g_variant_new("(s)", appid), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (error) {
+               err("Failed: %s", error->message);
+               g_error_free(error);
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       if (!dbus_result) {
+               err("no result");
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_get(dbus_result, "(i)", &value);
+       g_variant_unref(dbus_result);
+
+       return CM_ERROR_NONE;
+}
+
+
+EXPORT_API int cm_deinit(cm_client_h handle)
+{
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+
+       dbg("cm_deinit");
+
+       g_hash_table_remove_all(handle->evt_list);
+       g_hash_table_unref(handle->evt_list);
+
+       g_cancellable_cancel(handle->ca);
+
+       g_object_unref(handle->ca);
+
+       g_object_unref(handle->dbus_conn);
+
+       memset(handle, 0, sizeof(struct __cm_client));
+       g_free(handle);
+
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_dial_call(cm_client_h handle, char*number, cm_call_type_e call_type, cm_multi_sim_slot_type_e sim_slot)
+{
+       GVariant *dbus_result;
+       GError *error = NULL;
+       gint value = CM_ERROR_NONE;
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(number, CM_ERROR_INVALID_PARAMETER);
+
+       dbg("cm_dial_call()");
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_DIAL_CALL,
+                       g_variant_new("(siiib)", number, call_type, sim_slot, 0, FALSE/*is_emergency_contact*/), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (dbus_result) {
+               g_variant_get(dbus_result, "(i)", &value);
+               /* TODO: get proper error cause then return proper error */
+               if (value != 0) {
+                       value = CM_ERROR_OPERATION_FAILED;
+               }
+       } else {
+               err("g_dbus_conn failed. error (%s)", error->message);
+               if (strstr(error->message, "No access rights")) {
+                       err("PERMISSION_DENIED");
+                       value = CM_ERROR_PERMISSION_DENIED;
+               } else {
+                       value = CM_ERROR_OPERATION_FAILED;
+               }
+               g_error_free(error);
+       }
+
+        g_variant_unref(dbus_result);
+
+        return value;
+}
+
+EXPORT_API int cm_end_call(cm_client_h handle, unsigned int call_id, cm_call_release_type_e release_type)
+{
+       GVariant *dbus_result;
+       GError *error = NULL;
+       gint value = 0;
+       dbg("cm_end_call()");
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_END_CALL,
+                       g_variant_new("(ui)", call_id, release_type), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (error) {
+               err("Failed: %s", error->message);
+               g_error_free(error);
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       if (!dbus_result) {
+               err("no result");
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+        g_variant_get(dbus_result, "(i)", &value);
+        g_variant_unref(dbus_result);
+
+        return value;
+}
+
+EXPORT_API int cm_reject_call(cm_client_h handle)
+{
+       GVariant *dbus_result;
+       GError *error = NULL;
+       gint value = CM_ERROR_NONE;
+
+       dbg("cm_reject_call()");
+
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_REJECT_CALL,
+                       g_variant_new("()"), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (dbus_result) {
+               g_variant_get(dbus_result, "(i)", &value);
+               if (value != 0) {
+                       value = CM_ERROR_OPERATION_FAILED;
+               }
+       } else {
+               err("g_dbus_conn failed. error (%s)", error->message);
+               if (strstr(error->message, "No access rights")) {
+                       err("PERMISSION_DENIED");
+                       value = CM_ERROR_PERMISSION_DENIED;
+               } else {
+                       value = CM_ERROR_OPERATION_FAILED;
+               }
+               g_error_free(error);
+       }
+
+       g_variant_unref(dbus_result);
+
+        return value;
+}
+
+
+EXPORT_API int cm_swap_call(cm_client_h handle)
+{
+       GVariant *dbus_result;
+       GError *error = NULL;
+       gint value = 0;
+       dbg("cm_swap_call()");
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_SWAP_CALL,
+                       g_variant_new("()"), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (error) {
+               err("Failed: %s", error->message);
+               g_error_free(error);
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       if (!dbus_result) {
+               err("no result");
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+        g_variant_get(dbus_result, "(i)", &value);
+        g_variant_unref(dbus_result);
+
+        return value;
+}
+
+EXPORT_API int cm_hold_call(cm_client_h handle)
+{
+       GVariant *dbus_result;
+       GError *error = NULL;
+       gint value = 0;
+       dbg("cm_hold_call()");
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_HOLD_CALL,
+                       g_variant_new("()"), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (error) {
+               err("Failed: %s", error->message);
+               g_error_free(error);
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       if (!dbus_result) {
+               err("no result");
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+        g_variant_get(dbus_result, "(i)", &value);
+        g_variant_unref(dbus_result);
+
+        return value;
+}
+
+EXPORT_API int cm_unhold_call(cm_client_h handle)
+{
+       GVariant *dbus_result;
+       GError *error = NULL;
+       gint value = 0;
+       dbg("cm_unhold_call()");
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_UNHOLD_CALL,
+                       g_variant_new("()"), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (error) {
+               err("Failed: %s", error->message);
+               g_error_free(error);
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       if (!dbus_result) {
+               err("no result");
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+        g_variant_get(dbus_result, "(i)", &value);
+        g_variant_unref(dbus_result);
+
+        return value;
+}
+
+EXPORT_API int cm_join_call(cm_client_h handle)
+{
+       GVariant *dbus_result;
+       GError *error = NULL;
+       gint value = 0;
+       dbg("cm_join_call()");
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_JOIN_CALL,
+                       g_variant_new("()"), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (error) {
+               err("Failed: %s", error->message);
+               g_error_free(error);
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       if (!dbus_result) {
+               err("no result");
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+        g_variant_get(dbus_result, "(i)", &value);
+        g_variant_unref(dbus_result);
+
+        return value;
+}
+
+EXPORT_API int cm_split_call(cm_client_h handle, unsigned int call_id)
+{
+       GVariant *dbus_result;
+       GError *error = NULL;
+       gint value = 0;
+       dbg("cm_split_call()");
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_SPLIT_CALL,
+                       g_variant_new("(u)", call_id), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (error) {
+               err("Failed: %s", error->message);
+               g_error_free(error);
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       if (!dbus_result) {
+               err("no result");
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+        g_variant_get(dbus_result, "(i)", &value);
+        g_variant_unref(dbus_result);
+
+        return value;
+}
+
+EXPORT_API int cm_transfer_call(cm_client_h handle)
+{
+       GVariant *dbus_result;
+       GError *error = NULL;
+       gint value = 0;
+       dbg("cm_transfer_call()");
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_TRANSFER_CALL,
+                       g_variant_new("()"), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (error) {
+               err("Failed: %s", error->message);
+               g_error_free(error);
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       if (!dbus_result) {
+               err("no result");
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+        g_variant_get(dbus_result, "(i)", &value);
+        g_variant_unref(dbus_result);
+
+        return value;
+}
+
+EXPORT_API int cm_answer_call(cm_client_h handle, cm_call_answer_type_e ans_type)
+{
+       GVariant *dbus_result;
+       GError *error = NULL;
+       gint value = 0;
+       dbg("cm_answer_call()");
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_ANSWER_CALL,
+                       g_variant_new("(i)", ans_type), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (error) {
+               err("Failed: %s", error->message);
+               g_error_free(error);
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       if (!dbus_result) {
+               err("no result");
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+        g_variant_get(dbus_result, "(i)", &value);
+        g_variant_unref(dbus_result);
+
+        return value;
+}
+
+EXPORT_API int cm_speaker_on(cm_client_h handle)
+{
+       GVariant *dbus_result;
+       GError *error = NULL;
+       gint value = 0;
+       dbg(">>");
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_SPK_ON,
+                       g_variant_new("()"), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (error) {
+               err("Failed: %s", error->message);
+               g_error_free(error);
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       if (!dbus_result) {
+               err("no result");
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+        g_variant_get(dbus_result, "(i)", &value);
+        g_variant_unref(dbus_result);
+
+        return value;
+}
+
+EXPORT_API int cm_speaker_off(cm_client_h handle)
+{
+       GVariant *dbus_result;
+       GError *error = NULL;
+       gint value = 0;
+       dbg(">>");
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_SPK_OFF,
+                       g_variant_new("()"), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (error) {
+               err("Failed: %s", error->message);
+               g_error_free(error);
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       if (!dbus_result) {
+               err("no result");
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+        g_variant_get(dbus_result, "(i)", &value);
+        g_variant_unref(dbus_result);
+
+        return value;
+}
+
+EXPORT_API int cm_bluetooth_on(cm_client_h handle)
+{
+       GVariant *dbus_result;
+       GError *error = NULL;
+       gint value = 0;
+       dbg(">>");
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_BLUETOOTH_ON,
+                       g_variant_new("()"), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (error) {
+               err("Failed: %s", error->message);
+               g_error_free(error);
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       if (!dbus_result) {
+               err("no result");
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+        g_variant_get(dbus_result, "(i)", &value);
+        g_variant_unref(dbus_result);
+
+        return value;
+}
+
+EXPORT_API int cm_bluetooth_off(cm_client_h handle)
+{
+       GVariant *dbus_result;
+       GError *error = NULL;
+       gint value = 0;
+       dbg(">>");
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_BLUETOOTH_OFF,
+                       g_variant_new("()"), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (error) {
+               err("Failed: %s", error->message);
+               g_error_free(error);
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       if (!dbus_result) {
+               err("no result");
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+        g_variant_get(dbus_result, "(i)", &value);
+        g_variant_unref(dbus_result);
+
+        return value;
+}
+
+EXPORT_API int cm_set_extra_vol(cm_client_h handle, gboolean is_extra_vol)
+{
+       GVariant *dbus_result;
+       GError *error = NULL;
+       gint value = 0;
+       dbg(">>");
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_SET_EXTRA_VOL,
+                       g_variant_new("(b)", is_extra_vol), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (error) {
+               err("Failed: %s", error->message);
+               g_error_free(error);
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       if (!dbus_result) {
+               err("no result");
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+        g_variant_get(dbus_result, "(i)", &value);
+        g_variant_unref(dbus_result);
+
+        return value;
+}
+
+EXPORT_API int cm_set_mute_state(cm_client_h handle, gboolean is_mute_state)
+{
+       GVariant *dbus_result;
+       GError *error = NULL;
+       gint value = 0;
+       dbg(">>");
+       dbg("is_mute_state: %d", is_mute_state);
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_SET_MUTE_STATE,
+                       g_variant_new("(b)", is_mute_state), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (error) {
+               err("Failed: %s", error->message);
+               g_error_free(error);
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       if (!dbus_result) {
+               err("no result");
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+        g_variant_get(dbus_result, "(i)", &value);
+        g_variant_unref(dbus_result);
+
+        return value;
+}
+
+EXPORT_API int cm_start_dtmf(cm_client_h handle, unsigned char dtmf_digit)
+{
+       GVariant *dbus_result;
+       GError *error = NULL;
+       gint value = 0;
+       dbg("cm_start_dtmf()");
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(dtmf_digit, CM_ERROR_INVALID_PARAMETER);
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_START_DTMF,
+                       g_variant_new("(y)", dtmf_digit), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (error) {
+               err("Failed: %s", error->message);
+               g_error_free(error);
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       if (!dbus_result) {
+               err("no result");
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+        g_variant_get(dbus_result, "(i)", &value);
+        g_variant_unref(dbus_result);
+
+        return value;
+}
+
+EXPORT_API int cm_stop_dtmf(cm_client_h handle)
+{
+       GVariant *dbus_result;
+       GError *error = NULL;
+       gint value = 0;
+       dbg("cm_stop_dtmf()");
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_STOP_DTMF,
+                       g_variant_new("()"), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (error) {
+               err("Failed: %s", error->message);
+               g_error_free(error);
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       if (!dbus_result) {
+               err("no result");
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+        g_variant_get(dbus_result, "(i)", &value);
+        g_variant_unref(dbus_result);
+
+        return value;
+}
+
+EXPORT_API int cm_burst_dtmf(cm_client_h handle, char *dtmf_digits)
+{
+       GVariant *dbus_result;
+       GError *error = NULL;
+       gint value = 0;
+       dbg("cm_burst_dtmf()");
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(dtmf_digits, CM_ERROR_INVALID_PARAMETER);
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_BURST_DTMF,
+                       g_variant_new("(s)", dtmf_digits), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (error) {
+               err("Failed: %s", error->message);
+               g_error_free(error);
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       if (!dbus_result) {
+               err("no result");
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+        g_variant_get(dbus_result, "(i)", &value);
+        g_variant_unref(dbus_result);
+
+        return value;
+}
+
+EXPORT_API int cm_send_dtmf_resp(cm_client_h handle, cm_dtmf_resp_type_e resp_type)
+{
+       GVariant *dbus_result;
+       GError *error = NULL;
+       gint value = 0;
+       dbg(">>");
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_SEND_DTMF_RESP,
+                       g_variant_new("(i)", resp_type), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (error) {
+               err("Failed: %s", error->message);
+               g_error_free(error);
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       if (!dbus_result) {
+               err("no result");
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+        g_variant_get(dbus_result, "(i)", &value);
+        g_variant_unref(dbus_result);
+
+        return value;
+}
+
+EXPORT_API int cm_get_audio_state(cm_client_h handle, cm_audio_state_type_e *audio_state)
+{
+       GVariant *dbus_result;
+       GError *error = NULL;
+       gint value = 0;
+       dbg("cm_get_audio_state()");
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_GET_AUDIO_STATE,
+                       g_variant_new("()"), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (error) {
+               err("Failed: %s", error->message);
+               g_error_free(error);
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       if (!dbus_result) {
+               err("no result");
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_get(dbus_result, "(i)", &value);
+       *audio_state = value;
+       g_variant_unref(dbus_result);
+
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_stop_alert(cm_client_h handle)
+{
+       gint value = 0;
+       GVariant *dbus_result;
+       GError *error = NULL;
+
+       dbg("cm_stop_alert()");
+
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_STOP_ALERT,
+                       g_variant_new("()"), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (dbus_result) {
+               g_variant_get(dbus_result, "(i)", &value);
+               if (value != 0) {
+                       value = CM_ERROR_OPERATION_FAILED;
+               }
+       } else {
+               err("g_dbus_conn failed. error (%s)", error->message);
+               if (strstr(error->message, "No access rights")) {
+                       err("PERMISSION_DENIED");
+                       value = CM_ERROR_PERMISSION_DENIED;
+               } else {
+                       value = CM_ERROR_OPERATION_FAILED;
+               }
+               g_error_free(error);
+       }
+
+       g_variant_unref(dbus_result);
+
+       return value;
+}
+
+EXPORT_API int cm_start_alert(cm_client_h handle)
+{
+       gint value = 0;
+       GVariant *dbus_result;
+       GError *error = NULL;
+
+       dbg("cm_start_alert()");
+
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_START_ALERT,
+                       g_variant_new("()"), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (dbus_result) {
+               g_variant_get(dbus_result, "(i)", &value);
+               if (value != 0) {
+                       value = CM_ERROR_OPERATION_FAILED;
+               }
+       } else {
+               err("g_dbus_conn failed. error (%s)", error->message);
+               if (strstr(error->message, "No access rights")) {
+                       err("PERMISSION_DENIED");
+                       value = CM_ERROR_PERMISSION_DENIED;
+               } else {
+                       value = CM_ERROR_OPERATION_FAILED;
+               }
+               g_error_free(error);
+       }
+
+       g_variant_unref(dbus_result);
+
+       return value;
+}
+
+EXPORT_API int cm_activate_ui(cm_client_h handle)
+{
+       dbg("cm_activate_ui()");
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+       GError *error = NULL;
+       gint value = 0;
+       GVariant *dbus_result;
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_ACTIVATE_UI,
+                       g_variant_new("()"), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (error) {
+               err("Failed: %s", error->message);
+               g_error_free(error);
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       if (!dbus_result) {
+               err("no result");
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_get(dbus_result, "(i)", &value);
+       g_variant_unref(dbus_result);
+       return value;
+}
+
+EXPORT_API int cm_set_lcd_timeout(cm_client_h handle, cm_lcd_timeout_e timeout)
+{
+       dbg("cm_set_lcd_timeout()");
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+
+       int bPowerkeyMode = 0;
+       int on = 0;
+       int dim = 0;
+       int holdkey = 0;
+       int ret = -1;
+       int update_timer = 0;
+
+       if (timeout == CM_LCD_TIMEOUT_LOCKSCREEN_SET) {
+               update_timer = 0;
+       } else {
+               update_timer = 1;
+       }
+
+       ret = vconf_get_bool(VCONFKEY_CISSAPPL_POWER_KEY_ENDS_CALL_BOOL, &bPowerkeyMode);
+       if (ret < 0) {
+               err("vconf_get_bool [VCONFKEY_CISSAPPL_POWER_KEY_ENDS_CALL_BOOL] failed.\n");
+       }
+
+       dbg("set timeout : %d, powerkeymode : %d", timeout, bPowerkeyMode);
+       if (timeout == CM_LCD_TIMEOUT_SET) {
+               on = 10;
+               dim = 20;
+               holdkey = bPowerkeyMode;
+       } else if (timeout == CM_LCD_TIMEOUT_UNSET) {
+               on = 0;
+               dim = 0;
+               holdkey = bPowerkeyMode;
+       } else if (timeout == CM_LCD_TIMEOUT_LOCKSCREEN_SET) { /*After lock-screen comes in Connected state LCD goes to OFF in 5 secs*/
+               on = 5;
+               dim = 0;
+               holdkey = bPowerkeyMode;
+       } else if (timeout == CM_LCD_TIMEOUT_KEYPAD_SET) {
+               on = 3;
+               dim = 5;
+               holdkey = bPowerkeyMode;
+       } else {
+               on = 0;
+               dim = 0;
+               holdkey = 0;
+       }
+
+       dbg("on(%d), dim(%d), hold(%d)", on, dim, holdkey);
+
+       g_dbus_connection_call(handle->dbus_conn, DBUS_DEVICED,
+                       DBUS_DEVICED_PATH_DISPLAY, DBUS_DEVICED_INTERFACE_DISPLAY, DBUS_DEVICED_METHOD_SET_LCDTIMEOUT,
+                       g_variant_new("(iii)", on, dim, holdkey), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, __cm_set_LCDtimeout_cb, NULL);
+
+       g_dbus_connection_call(handle->dbus_conn, DBUS_DEVICED,
+                       DBUS_DEVICED_PATH_DISPLAY, DBUS_DEVICED_INTERFACE_DISPLAY, DBUS_DEVICED_METHOD_UPDATE_LCDTIMEOUT_BY_TOUCH,
+                       g_variant_new("(i)", update_timer), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, __cm_set_LCDtimeout_cb, NULL);
+
+       return 0;
+}
+
+
+EXPORT_API int cm_get_all_call_list(cm_client_h handle, GSList **call_list)
+{
+       GVariant *dbus_result;
+       GError *error = NULL;
+       const gchar *param_type;
+       cm_call_data_t *callData = NULL;
+       GVariantIter *iter = 0, *iter_row = 0;
+       int ret = -1;
+       dbg("cm_get_all_calllist()");
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_GET_CALL_LIST,
+                       g_variant_new("()"), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (error) {
+               err("Failed: %s", error->message);
+               g_error_free(error);
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       if (!dbus_result) {
+               err("no result");
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       param_type = g_variant_get_type_string(dbus_result);
+       dbg("param_type: '%s'", param_type);
+       g_variant_get(dbus_result, "(aa{sv})", &iter);
+       while (g_variant_iter_next(iter, "a{sv}", &iter_row)) {
+               if (iter_row && (g_variant_iter_n_children(iter_row) > 0)) {
+                       ret = __cm_fetch_call_data(iter_row, &callData);
+                       if (ret == 0) {
+                               *call_list = g_slist_append(*call_list, callData);
+                       }
+                       g_variant_iter_free(iter_row);
+               }
+       }
+       g_variant_iter_free(iter);
+       g_variant_unref(dbus_result);
+
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_get_conference_call_list(cm_client_h handle, GSList **call_list)
+{
+       GVariant *dbus_result;
+       GError *error = NULL;
+       const gchar *param_type;
+       cm_conf_call_data_t *callData = NULL;
+       GVariantIter *iter = 0, *iter_row = 0;
+       dbg("cm_get_all_calllist()");
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_GET_CONF_CALL_LIST,
+                       g_variant_new("()"), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (error) {
+               err("Failed: %s", error->message);
+               g_error_free(error);
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       if (!dbus_result) {
+               err("no result");
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       param_type = g_variant_get_type_string(dbus_result);
+       dbg("param_type: '%s'", param_type);
+       g_variant_get(dbus_result, "(aa{sv})", &iter);
+       while (g_variant_iter_next(iter, "a{sv}", &iter_row)) {
+               if (iter_row && (g_variant_iter_n_children(iter_row) > 0)) {
+                       gchar *key = 0;
+                       GVariant *value = 0;
+
+                       callData = (cm_conf_call_data_t*)calloc(1, sizeof(cm_conf_call_data_t));
+                       CM_RETURN_VAL_IF_FAIL(callData, CM_ERROR_OPERATION_FAILED);
+
+                       while (g_variant_iter_loop(iter_row, "{sv}", &key, &value)) {
+                               if (!g_strcmp0(key, "call_id")) {
+                                       callData->call_id = g_variant_get_uint32(value);
+                               } else if (!g_strcmp0(key, "call_number")) {
+                                       callData->call_number = g_strdup(g_variant_get_string(value, 0));
+                               } else if (!g_strcmp0(key, "person_id")) {
+                                       callData->person_id = g_variant_get_uint32(value);
+                               } else if (!g_strcmp0(key, "name_mode")) {
+                                       callData->name_mode = g_variant_get_uint32(value);
+                               }
+                       }
+                       dbg("\n\n <<<<<<<<< CallData Info in Library START >>>>>>>>>> \n");
+                       dbg("call_id                            : %d, ", callData->call_id);
+                       if (callData->call_number) {
+                               dbg("call_number                        : %s, ", callData->call_number);
+                       }
+                       dbg("person_id                          : %d", callData->person_id);
+                       dbg("name_mode                          : %d", callData->name_mode);
+                       dbg("\n\n <<<<<<<<< CallData Info in Library END >>>>>>>>>> \n");
+
+                       *call_list = g_slist_append(*call_list, callData);
+                       g_variant_iter_free(iter_row);
+               }
+       }
+       g_variant_iter_free(iter);
+       g_variant_unref(dbus_result);
+
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_get_all_calldata(cm_client_h handle, cm_call_data_t **incom, cm_call_data_t **active, cm_call_data_t **held)
+{
+       GVariant *dbus_result;
+       GError *error = NULL;
+       const gchar *param_type;
+       GVariantIter *iter_incom = 0, *iter_active_dial = 0, *iter_held = 0;
+       dbg("cm_get_all_calldata()");
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_GET_ALL_CALL_DATA,
+                       g_variant_new("()"), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (error) {
+               err("Failed: %s", error->message);
+               g_error_free(error);
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       if (!dbus_result) {
+               err("no result");
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       param_type = g_variant_get_type_string(dbus_result);
+       dbg("param_type: '%s'", param_type);
+       g_variant_get(dbus_result, "(a{sv}a{sv}a{sv})", &iter_incom, &iter_active_dial, &iter_held);
+
+       /*Fetch IncomingData*/
+       if (iter_incom && (g_variant_iter_n_children(iter_incom) > 0)) {
+               __cm_fetch_call_data(iter_incom, incom);
+               g_variant_iter_free(iter_incom);
+       }
+
+       /*Fetch ActiveData*/
+       if (iter_active_dial && (g_variant_iter_n_children(iter_active_dial) > 0)) {
+               __cm_fetch_call_data(iter_active_dial, active);
+               g_variant_iter_free(iter_active_dial);
+       }
+
+       /*Fetch HeldData*/
+       if (iter_held && (g_variant_iter_n_children(iter_held) > 0)) {
+               __cm_fetch_call_data(iter_held, held);
+               g_variant_iter_free(iter_held);
+       }
+
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_get_call_status(cm_client_h handle, cm_call_status_e *call_status)
+{
+       GError *error = NULL;
+       guint status = 0;
+       guint type = 0;
+       GVariant *dbus_result;
+       int error_code = CM_ERROR_NONE;
+
+       dbg("cm_get_call_status()");
+
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(call_status, CM_ERROR_INVALID_PARAMETER);
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_GET_CALL_STATUS,
+                       g_variant_new("()"), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (dbus_result) {
+               g_variant_get(dbus_result, "(ii)", &status, &type);
+               if (status < CM_CALL_STATUS_MAX) {
+                       *call_status = (cm_call_status_e)status;
+               } else {
+                       error_code = CM_ERROR_OPERATION_FAILED;
+               }
+       } else {
+               err("g_dbus_conn failed. error (%s)", error->message);
+               if (strstr(error->message, "No access rights")) {
+                       err("PERMISSION_DENIED");
+                       error_code = CM_ERROR_PERMISSION_DENIED;
+               } else {
+                       error_code = CM_ERROR_OPERATION_FAILED;
+               }
+               g_error_free(error);
+       }
+
+       g_variant_unref(dbus_result);
+
+       return error_code;
+}
+
+EXPORT_API int cm_get_mute_status(cm_client_h handle, cm_mute_status_e *mute_status)
+{
+       GError *error = NULL;
+       gint status = 0;
+       GVariant *dbus_result;
+       int error_code = CM_ERROR_NONE;
+
+       dbg("cm_get_mute_status()");
+
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(mute_status, CM_ERROR_INVALID_PARAMETER);
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_GET_MUTE_STATUS,
+                       g_variant_new("()"), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (dbus_result) {
+               g_variant_get(dbus_result, "(i)", &status);
+               if (status < CM_MUTE_STATUS_MAX && status >= CM_MUTE_STATUS_OFF) {
+                       *mute_status = (cm_mute_status_e)status;
+               } else {
+                       error_code = CM_ERROR_OPERATION_FAILED;
+               }
+       } else {
+               err("g_dbus_conn failed. error (%s)", error->message);
+               if (strstr(error->message, "No access rights")) {
+                       err("PERMISSION_DENIED");
+                       error_code = CM_ERROR_PERMISSION_DENIED;
+               } else {
+                       error_code = CM_ERROR_OPERATION_FAILED;
+               }
+               g_error_free(error);
+       }
+
+       g_variant_unref(dbus_result);
+
+       return error_code;
+}
+
+
+EXPORT_API int cm_set_mute_status_cb(cm_client_h handle, cm_mute_status_cb cb, void *user_data)
+{
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(cb, CM_ERROR_INVALID_PARAMETER);
+       return __cm_set_cb(handle, DBUS_CALL_MANAGER_SIGNAL_MUTE_STATUS, cb, user_data);
+}
+
+EXPORT_API int cm_unset_mute_status_cb(cm_client_h handle)
+{
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+       return __cm_unset_cb(handle, DBUS_CALL_MANAGER_SIGNAL_MUTE_STATUS);
+}
+
+EXPORT_API int cm_set_call_status_cb(cm_client_h handle, cm_call_status_cb cb, void *user_data)
+{
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(cb, CM_ERROR_INVALID_PARAMETER);
+       return __cm_set_cb(handle, DBUS_CALL_MANAGER_SIGNAL_CALL_STATUS, cb, user_data);
+}
+
+EXPORT_API int cm_unset_call_status_cb(cm_client_h handle)
+{
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+       return __cm_unset_cb(handle, DBUS_CALL_MANAGER_SIGNAL_CALL_STATUS);
+}
+
+EXPORT_API int cm_set_call_event_cb(cm_client_h handle, cm_call_event_cb cb, void *user_data)
+{
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(cb, CM_ERROR_INVALID_PARAMETER);
+       return __cm_set_cb(handle, DBUS_CALL_MANAGER_SIGNAL_CALL_EVENT, cb, user_data);
+}
+
+EXPORT_API int cm_unset_call_event_cb(cm_client_h handle)
+{
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+       return __cm_unset_cb(handle, DBUS_CALL_MANAGER_SIGNAL_CALL_EVENT);
+}
+
+EXPORT_API int cm_set_dial_status_cb(cm_client_h handle, cm_dial_status_cb cb, void *user_data)
+{
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(cb, CM_ERROR_INVALID_PARAMETER);
+       return __cm_set_cb(handle, DBUS_CALL_MANAGER_SIGNAL_DIAL_STATUS, cb, user_data);
+}
+
+EXPORT_API int cm_unset_dial_status_cb(cm_client_h handle)
+{
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+       return __cm_unset_cb(handle, DBUS_CALL_MANAGER_SIGNAL_DIAL_STATUS);
+}
+
+EXPORT_API int cm_set_audio_state_changed_cb(cm_client_h handle, cm_audio_state_changed_cb cb, void *user_data)
+{
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(cb, CM_ERROR_INVALID_PARAMETER);
+       return __cm_set_cb(handle, DBUS_CALL_MANAGER_SIGNAL_AUDIO_STATE, cb, user_data);
+}
+
+EXPORT_API int cm_unset_audio_state_changed_cb(cm_client_h handle)
+{
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+       return __cm_unset_cb(handle, DBUS_CALL_MANAGER_SIGNAL_AUDIO_STATE);
+}
+
+EXPORT_API int cm_set_dtmf_indication_cb(cm_client_h handle, cm_dtmf_indi_cb cb, void *user_data)
+{
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(cb, CM_ERROR_INVALID_PARAMETER);
+       return __cm_set_cb(handle, DBUS_CALL_MANAGER_SIGNAL_DTMF_INDI, cb, user_data);
+}
+
+EXPORT_API int cm_unset_dtmf_indication_cb(cm_client_h handle)
+{
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+       return __cm_unset_cb(handle, DBUS_CALL_MANAGER_SIGNAL_DTMF_INDI);
+}
+
+EXPORT_API int cm_set_foreground_cb(cm_client_h handle, cm_go_foreground_cb cb, void *user_data)
+{
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(cb, CM_ERROR_INVALID_PARAMETER);
+       return __cm_set_cb(handle, DBUS_CALL_MANAGER_SIGNAL_GO_FOREGROUND, cb, user_data);
+}
+
+EXPORT_API int cm_unset_foreground_cb(cm_client_h handle)
+{
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+       return __cm_unset_cb(handle, DBUS_CALL_MANAGER_SIGNAL_GO_FOREGROUND);
+}
+
+EXPORT_API int cm_call_data_free(cm_call_data_t *call_data)
+{
+       CM_RETURN_VAL_IF_FAIL(call_data, CM_ERROR_INVALID_PARAMETER);
+       g_free(call_data->call_number);
+       g_free(call_data->calling_name);
+       g_free(call_data);
+
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_call_data_get_call_id(cm_call_data_t *call_data, unsigned int *call_id)
+{
+       CM_RETURN_VAL_IF_FAIL(call_data, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(call_id, CM_ERROR_INVALID_PARAMETER);
+
+       *call_id = call_data->call_id;
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_call_data_get_call_direction(cm_call_data_t *call_data, cm_call_direction_e *call_direction)
+{
+       CM_RETURN_VAL_IF_FAIL(call_data, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(call_direction, CM_ERROR_INVALID_PARAMETER);
+
+       *call_direction = call_data->call_direction;
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_call_data_get_call_number(cm_call_data_t *call_data, char **call_number)
+{
+       CM_RETURN_VAL_IF_FAIL(call_data, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(call_number, CM_ERROR_INVALID_PARAMETER);
+
+       *call_number = call_data->call_number;
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_call_data_get_calling_name(cm_call_data_t *call_data, char **calling_name)
+{
+       CM_RETURN_VAL_IF_FAIL(call_data, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(calling_name, CM_ERROR_INVALID_PARAMETER);
+
+       *calling_name = call_data->calling_name;
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_call_data_get_call_type(cm_call_data_t *call_data, cm_call_type_e *call_type)
+{
+       CM_RETURN_VAL_IF_FAIL(call_data, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(call_type, CM_ERROR_INVALID_PARAMETER);
+
+       *call_type = call_data->call_type;
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_call_data_get_call_state(cm_call_data_t *call_data, cm_call_state_e *call_state)
+{
+       CM_RETURN_VAL_IF_FAIL(call_data, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(call_state, CM_ERROR_INVALID_PARAMETER);
+
+       *call_state = call_data->call_state;
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_call_data_get_call_domain(cm_call_data_t *call_data, cm_call_domain_e *call_domain)
+{
+       CM_RETURN_VAL_IF_FAIL(call_data, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(call_domain, CM_ERROR_INVALID_PARAMETER);
+
+       *call_domain = call_data->call_domain;
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_call_data_get_person_id(cm_call_data_t *call_data, int *person_id)
+{
+       CM_RETURN_VAL_IF_FAIL(call_data, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(person_id, CM_ERROR_INVALID_PARAMETER);
+
+       *person_id = call_data->person_id;
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_call_data_get_call_member_count(cm_call_data_t *call_data, int *member_count)
+{
+       CM_RETURN_VAL_IF_FAIL(call_data, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(member_count, CM_ERROR_INVALID_PARAMETER);
+
+       *member_count = call_data->member_count;
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_call_data_is_emergency_call(cm_call_data_t *call_data, gboolean *is_emergency)
+{
+       CM_RETURN_VAL_IF_FAIL(call_data, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(is_emergency, CM_ERROR_INVALID_PARAMETER);
+
+       *is_emergency = call_data->is_ecc;
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_call_data_is_voicemail_number(cm_call_data_t *call_data, gboolean *is_voicemail_number)
+{
+       CM_RETURN_VAL_IF_FAIL(call_data, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(is_voicemail_number, CM_ERROR_INVALID_PARAMETER);
+
+       *is_voicemail_number = call_data->is_voicemail_number;
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_call_data_get_start_time(cm_call_data_t *call_data, long *start_time)
+{
+       CM_RETURN_VAL_IF_FAIL(call_data, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(start_time, CM_ERROR_INVALID_PARAMETER);
+
+       *start_time = call_data->start_time;
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_call_data_get_name_mode(cm_call_data_t *call_data, cm_name_mode_e *name_mode)
+{
+       CM_RETURN_VAL_IF_FAIL(call_data, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(name_mode, CM_ERROR_INVALID_PARAMETER);
+
+       *name_mode = call_data->name_mode;
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_call_event_data_get_call_id(cm_call_event_data_t *call_event_data, unsigned int *call_id)
+{
+       CM_RETURN_VAL_IF_FAIL(call_event_data, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(call_id, CM_ERROR_INVALID_PARAMETER);
+       *call_id = call_event_data->call_id;
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_call_event_data_get_sim_slot(cm_call_event_data_t *call_event_data, cm_multi_sim_slot_type_e *sim_slot)
+{
+       CM_RETURN_VAL_IF_FAIL(call_event_data, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(sim_slot, CM_ERROR_INVALID_PARAMETER);
+       *sim_slot = call_event_data->sim_slot;
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_call_event_data_get_end_cause(cm_call_event_data_t *call_event_data, cm_call_end_cause_type_e *end_cause)
+{
+       CM_RETURN_VAL_IF_FAIL(call_event_data, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(end_cause, CM_ERROR_INVALID_PARAMETER);
+       *end_cause = call_event_data->end_cause;
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_call_event_data_get_incom_call(cm_call_event_data_t *call_event_data, cm_call_data_t **incom_call)
+{
+       CM_RETURN_VAL_IF_FAIL(call_event_data, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(incom_call, CM_ERROR_INVALID_PARAMETER);
+       *incom_call = call_event_data->incom;
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_call_event_data_get_active_call(cm_call_event_data_t *call_event_data, cm_call_data_t **active_call)
+{
+       CM_RETURN_VAL_IF_FAIL(call_event_data, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(active_call, CM_ERROR_INVALID_PARAMETER);
+       *active_call = call_event_data->active_dial;
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_call_event_data_get_held_call(cm_call_event_data_t *call_event_data, cm_call_data_t **held_call)
+{
+       CM_RETURN_VAL_IF_FAIL(call_event_data, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(held_call, CM_ERROR_INVALID_PARAMETER);
+       *held_call = call_event_data->held;
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_conf_call_data_get_call_id(cm_conf_call_data_t *conf_call, unsigned int *call_id)
+{
+       CM_RETURN_VAL_IF_FAIL(conf_call, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(call_id, CM_ERROR_INVALID_PARAMETER);
+
+       *call_id = conf_call->call_id;
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_conf_call_data_get_call_number(cm_conf_call_data_t *conf_call, char **call_number)
+{
+       CM_RETURN_VAL_IF_FAIL(conf_call, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(call_number, CM_ERROR_INVALID_PARAMETER);
+
+       *call_number = conf_call->call_number;
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_conf_call_data_get_person_id(cm_conf_call_data_t *conf_call, int *person_id)
+{
+       CM_RETURN_VAL_IF_FAIL(conf_call, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(person_id, CM_ERROR_INVALID_PARAMETER);
+
+       *person_id = conf_call->person_id;
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_conf_call_data_get_name_mode(cm_conf_call_data_t *conf_call, cm_name_mode_e *name_mode)
+{
+       CM_RETURN_VAL_IF_FAIL(conf_call, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(name_mode, CM_ERROR_INVALID_PARAMETER);
+
+       *name_mode = conf_call->name_mode;
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_conf_call_data_free(cm_conf_call_data_t *conf_call)
+{
+       CM_RETURN_VAL_IF_FAIL(conf_call, CM_ERROR_INVALID_PARAMETER);
+       g_free(conf_call->call_number);
+       g_free(conf_call);
+
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_set_lcd_state(cm_lcd_control_state_e state)
+{
+       dbg("[%d]", state);
+       int result = -1;
+       switch (state) {
+       case CM_LCD_OFF:
+               result = device_display_change_state(DISPLAY_STATE_SCREEN_OFF);
+               break;
+
+       case CM_LCD_ON:
+               result = device_display_change_state(DISPLAY_STATE_NORMAL);
+               break;
+
+       case CM_LCD_ON_LOCK:
+               result = device_display_change_state(DISPLAY_STATE_NORMAL);
+               result = device_power_request_lock(POWER_LOCK_DISPLAY, 0);
+               break;
+
+       case CM_LCD_ON_UNLOCK:
+               result = device_display_change_state(DISPLAY_STATE_NORMAL);
+               result = device_power_release_lock(POWER_LOCK_DISPLAY);
+               result = device_power_release_lock(POWER_LOCK_CPU);
+               break;
+
+       case CM_LCD_OFF_SLEEP_LOCK:
+               result = device_power_request_lock(POWER_LOCK_CPU, 0);
+               break;
+
+       case CM_LCD_OFF_SLEEP_UNLOCK:
+               result = device_power_release_lock(POWER_LOCK_DISPLAY);
+               result = device_power_release_lock(POWER_LOCK_CPU);
+               break;
+
+       default:
+               break;
+       }
+       if (result != DEVICE_ERROR_NONE) {
+               warn("error during change lcd state");
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       return CM_ERROR_NONE;
+}
+
+EXPORT_API int cm_start_voice_record(cm_client_h handle, char *call_num)
+{
+       GVariant *dbus_result;
+       GError *error = NULL;
+       gint value = 0;
+       dbg("cm_start_voice_record()");
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(call_num, CM_ERROR_INVALID_PARAMETER);
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_START_VOICE_RECORD,
+                       g_variant_new("(s)", call_num), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (error) {
+               err("Failed: %s", error->message);
+               g_error_free(error);
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       if (!dbus_result) {
+               err("no result");
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+        g_variant_get(dbus_result, "(i)", &value);
+        g_variant_unref(dbus_result);
+
+        return value;
+}
+
+EXPORT_API int cm_stop_voice_record(cm_client_h handle)
+{
+       GVariant *dbus_result;
+       GError *error = NULL;
+       gint value = 0;
+       dbg("cm_stop_voice_record()");
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+
+       dbus_result = g_dbus_connection_call_sync(handle->dbus_conn, DBUS_CALL_MANAGER,
+                       DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_STOP_VOICE_RECORD,
+                       g_variant_new("()"), NULL, G_DBUS_CALL_FLAGS_NONE,
+                       CM_DEFAULT_TIMEOUT, handle->ca, &error);
+
+       if (error) {
+               err("Failed: %s", error->message);
+               g_error_free(error);
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+       if (!dbus_result) {
+               err("no result");
+               return CM_ERROR_OPERATION_FAILED;
+       }
+
+        g_variant_get(dbus_result, "(i)", &value);
+        g_variant_unref(dbus_result);
+
+        return value;
+}
+
+EXPORT_API int cm_set_voice_record_status_cb(cm_client_h handle, cm_voice_record_status_cb cb, void *user_data)
+{
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+       CM_RETURN_VAL_IF_FAIL(cb, CM_ERROR_INVALID_PARAMETER);
+       return __cm_set_cb(handle, DBUS_CALL_MANAGER_SIGNAL_VOICE_RECORD_STATUS, cb, user_data);
+}
+
+EXPORT_API int cm_unset_voice_record_status_cb (cm_client_h handle)
+{
+       CM_RETURN_VAL_IF_FAIL(handle, CM_ERROR_INVALID_PARAMETER);
+       return __cm_unset_cb(handle, DBUS_CALL_MANAGER_SIGNAL_VOICE_RECORD_STATUS);
+}
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644 (file)
index 0000000..8409ad1
--- /dev/null
@@ -0,0 +1,44 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(cm-test C)
+
+################################################################################
+# Set external libraries                                                       #
+################################################################################
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs REQUIRED
+        glib-2.0
+        gobject-2.0
+)
+
+FOREACH(flag ${pkgs_CFLAGS})
+        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/client/include/)
+################################################################################
+# Custom configure                                                             #
+################################################################################
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIE")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+SET(CMAKE_LDFLAGS "-Wl,-zdefs" )
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
+
+################################################################################
+# Set source files                                                             #
+################################################################################
+SET(SRCS
+    ${CMAKE_CURRENT_SOURCE_DIR}/test.c
+)
+
+################################################################################
+# Set build target                                                             #
+################################################################################
+ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} call-manager)
+
+################################################################################
+# Install Target                                                               #
+################################################################################
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
+
diff --git a/test/test.c b/test/test.c
new file mode 100644 (file)
index 0000000..0439e60
--- /dev/null
@@ -0,0 +1,713 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <glib.h>
+#include <glib-object.h>
+
+#include <call-manager.h>
+#include <call-manager-extension.h>
+
+static GMainLoop *gloop = NULL;
+static gchar *keybuf = NULL;
+GIOChannel *ioChannel = NULL;
+cm_client_h cm_handle = NULL;
+
+static void __call_status_changed_cb(cm_call_status_e call_status, const char* call_num, void *user_data)
+{
+       g_print("====> Call Status changed!!!!<====\n");
+       g_print("====> Call status: %d\n", call_status);
+
+       switch (call_status) {
+       case CM_CALL_STATUS_IDLE:
+               g_print("Call status is idle!\n");
+               break;
+       case CM_CALL_STATUS_RINGING:
+               {
+                       g_print("Call status is ringing!\n");
+                       if (call_num) {
+                               g_print("call num is %s\n", call_num);
+                       }
+               }
+               break;
+       case CM_CALL_STATUS_OFFHOOK:
+               g_print("Call status is offhook!\n");
+               break;
+       default:
+               break;
+       }
+
+       g_print("Call status changed cb done\n");
+       return;
+}
+
+static void __mute_status_changed_cb(cm_mute_status_e mute_status, void *user_data)
+{
+       g_print("====> Mute Status changed!!!!<====\n");
+       g_print("====> Mute status: %d\n", mute_status);
+
+       switch (mute_status) {
+       case CM_MUTE_STATUS_OFF:
+               g_print("Mute OFF !\n");
+               break;
+       case CM_MUTE_STATUS_ON:
+               g_print("Mute ON !\n");
+               break;
+       default:
+               break;
+       }
+
+       g_print("Mute status changed cb done\n");
+       return;
+}
+
+static void __call_event_changed_cb(cm_call_event_e call_event, cm_call_event_data_t* event_data, void *user_data)
+{
+       g_print("====> Call event changed!!!!<====\n");
+       g_print("====>Event_id: %d\n", call_event);
+
+       switch (call_event) {
+               case CM_CALL_EVENT_ACTIVE:
+               {
+                       cm_multi_sim_slot_type_e sim_slot = 0;
+                       unsigned int call_id = 0;
+                       cm_call_data_t *incom_call = NULL;
+                       cm_call_data_t *active_call = NULL;
+                       cm_call_data_t *held_call = NULL;
+
+                       cm_call_event_data_get_sim_slot(event_data, &sim_slot);
+                       g_print("sim_slot: %d\n", sim_slot);
+                       cm_call_event_data_get_call_id(event_data, &call_id);
+                       g_print("call_id: %d\n", call_id);
+                       cm_call_event_data_get_active_call(event_data, &active_call);
+                       cm_call_event_data_get_incom_call(event_data, &incom_call);
+                       cm_call_event_data_get_held_call(event_data, &held_call);
+                       break;
+               }
+               case CM_CALL_EVENT_IDLE:
+               {
+                       cm_call_end_cause_type_e end_cause = CM_CALL_ENDCAUSE_MAX;
+                       cm_call_event_data_get_end_cause(event_data, &end_cause);
+                       g_print("end_cause: %d\n", end_cause);
+               }
+               case CM_CALL_EVENT_INCOMING:
+               case CM_CALL_EVENT_ALERT:
+               case CM_CALL_EVENT_DIALING:
+               case CM_CALL_EVENT_HELD:
+               case CM_CALL_EVENT_RETRIEVED:
+               case CM_CALL_EVENT_SWAPPED:
+               case CM_CALL_EVENT_WAITING:
+               case CM_CALL_EVENT_JOIN:
+               case CM_CALL_EVENT_SPLIT:
+                       break;
+               default:
+                       break;
+       }
+       return;
+}
+
+static void __dtmf_indication_cb(cm_dtmf_indi_type_e indi_type, char* dtmf_number, void *user_data)
+{
+       g_print("====> __dtmf_indication_cb!!!!<====\n");
+       g_print("====>indi type: %d\n", indi_type);
+       if (dtmf_number)
+               g_print("====>dtmf number: %s\n", dtmf_number);
+
+       return;
+}
+
+static void __audio_state_changed_cb(cm_audio_state_type_e audio_status, void *user_data)
+{
+       g_print("====> __audio_state_changed_cb!!!!<====\n");
+       g_print("====>audio status: %d\n", audio_status);
+
+       return;
+}
+
+static void __go_foreground_cb(void *user_data)
+{
+       g_print("====> __go_foreground_cb!!!!<====\n");
+
+       return;
+}
+
+static void __print_conf_call_data(cm_conf_call_data_t* call_data)
+{
+       if (call_data == NULL) {
+               g_print("conf call data is NULL\n");
+               return;
+       }
+
+       unsigned int call_id;
+       char *call_number = NULL;
+       int person_id;
+       cm_name_mode_e name_mode;
+       cm_conf_call_data_get_call_id(call_data, &call_id);
+       cm_conf_call_data_get_call_number(call_data, &call_number);
+       cm_conf_call_data_get_person_id(call_data, &person_id);
+       cm_conf_call_data_get_name_mode(call_data, &name_mode);
+       g_print("conf call call_id : %d\n", call_id);
+       g_print("conf call person_id : %d\n", person_id);
+       g_print("conf call call_number : %s\n", call_number ? call_number : "");
+       g_print("conf call name_mode : %d\n", name_mode);
+
+       return;
+}
+
+static void __print_call_data(cm_call_data_t* call_data)
+{
+       if (call_data == NULL) {
+               g_print("call data is NULL\n");
+               return;
+       }
+
+       unsigned int call_id;
+       cm_call_direction_e call_direction;
+       char *call_number = NULL;
+       char *calling_name = NULL;
+       cm_call_type_e call_type;
+       cm_call_state_e call_state;
+       cm_call_domain_e call_domain;
+       int person_id;
+       int member_count;
+       gboolean is_emergency;
+       long start_time;
+
+       cm_call_data_get_call_id(call_data, &call_id);
+       cm_call_data_get_call_number(call_data, &call_number);
+       cm_call_data_get_calling_name(call_data, &calling_name);
+       cm_call_data_get_call_member_count(call_data, &member_count);
+       cm_call_data_get_call_direction(call_data, &call_direction);
+       cm_call_data_get_call_domain(call_data, &call_domain);
+       cm_call_data_get_call_state(call_data, &call_state);
+       cm_call_data_get_call_type(call_data, &call_type);
+       cm_call_data_is_emergency_call(call_data, &is_emergency);
+       cm_call_data_get_start_time(call_data, &start_time);
+       cm_call_data_get_person_id(call_data, &person_id);
+
+       g_print("call_id : %d\n", call_id);
+       g_print("call_direction : %d\n", call_direction);
+       g_print("call_number : %s\n", call_number ? call_number : "");
+       g_print("calling_name : %s\n", calling_name ? calling_name : "");
+       g_print("call_type : %d\n", call_type);
+       g_print("call_state : %d\n", call_state);
+       g_print("member_count : %d\n", member_count);
+       g_print("is_ecc : %d\n", is_emergency);
+       g_print("call_domain : %d\n", call_domain);
+       g_print("person_id : %d\n", person_id);
+       g_print("start_time : %ld\n", start_time);
+
+       return;
+}
+
+
+static void __print_menu(void)
+{
+       g_print("+++++++++++++++++++++++++++++++++++++\n");
+       g_print("Operations\n");
+       g_print("%-40s: exit this program\n", "0. exit");
+       g_print("%-40s: print this message\n", "1. help");
+       g_print("=====================================\n");
+       g_print("%-40s: CM Initialize\n", "2. init");
+       g_print("%-40s: CM Deinitialize\n", "3. deinit");
+       g_print("\n");
+       g_print("%-40s: Set Call Event Changed Cb\n", "4. setcb");
+       g_print("%-40s: Unset Call Event Changed Cb\n", "5. unsetcb");
+       g_print("\n");
+       g_print("%-40s: Dial Voice Call\n", "6. dial_voicecall");
+       g_print("%-40s: Dial Video Call\n", "7. dial_videocall");
+       g_print("%-40s: End Call\n", "8. end");
+       g_print("%-40s: Swap Call\n", "9. swap");
+       g_print("%-40s: Hold Call\n", "10. hold");
+       g_print("%-40s: Unhold Call\n", "11.unhold");
+       g_print("%-40s: Join Call\n", "12.join");
+       g_print("%-40s: Split Call\n", "13.split");
+       g_print("%-40s: Answer Call\n", "14.answer");
+       g_print("\n");
+       g_print("%-40s: Set Extra volume on/off\n", "15.extra_vol");
+       g_print("%-40s: Set Mute state on/off\n", "16.mute_state");
+       g_print("%-40s: SPK on/off\n", "17.spk");
+       g_print("%-40s: bluetooth on/off\n", "18.bluetooth");
+       g_print("%-40s: Set DTMF indi handler\n", "19.setdtmfcb");
+       g_print("%-40s: Unset DTMF indi handler\n", "20.unsetdtmfcb");
+       g_print("%-40s: Send DTMF response\n", "21.senddtmfrsp");
+       g_print("%-40s: Set Audio State Changed Cb\n", "22.setaudiocb");
+       g_print("%-40s: Unset Audio State Changed Cb\n", "23.unsetaudiocb");
+       g_print("%-40s: Get Audio State\n", "24.getaudiostate");
+       g_print("\n");
+       g_print("%-40s: Set Foreground Cb\n", "25.setfg");
+       g_print("%-40s: Unset Foreground Cb\n", "26.unsetfg");
+       g_print("%-40s: Activate UI\n", "27.activate");
+       g_print("%-40s: Set Call Status Changed Cb\n", "28.setstatuscb");
+       g_print("%-40s: Unset Call Status Changed Cb\n", "29.unsetstatuscb");
+       g_print("%-40s: Transfer call\n", "30.transfercall");
+       g_print("%-40s: Start dtmf\n", "31.startdtmf");
+       g_print("%-40s: Stop dtmf\n", "32.stopdtmf");
+       g_print("%-40s: Burst dtmf\n", "33.burstdtmf");
+       g_print("%-40s: Stop alert\n", "34.stopalert");
+       g_print("%-40s: Start alert\n", "35.startalert");
+       g_print("\n");
+       g_print("%-40s: Get all call list \n", "36.getallcalllist");
+       g_print("%-40s: Get conference call list\n", "37.getconfcalllist");
+       g_print("%-40s: Get all call data\n", "38.getallcalldata");
+       g_print("%-40s: Reject call\n", "39.reject");
+       g_print("%-40s: Get call status\n", "40.get_callstatus");
+       g_print("%-40s: Set Mute Status Changed Cb\n", "41.setmutestatuscb");
+       g_print("%-40s: Unset Mute Status Changed Cb\n", "41.unsetmutestatuscb");
+       g_print("%-40s: Get Mute State\n", "43.getmutestatus");
+       g_print("+++++++++++++++++++++++++++++++++++++\n");
+}
+
+static gboolean __process_input(gchar * buffer)
+{
+       gchar **strsplits = NULL;
+
+       g_strchomp(buffer);
+       strsplits = g_strsplit_set(buffer, " ,\t\n", 2);
+
+       if (strsplits[0] == NULL) {
+               g_print("Input > ");
+               g_strfreev(strsplits);
+               return TRUE;
+       } else if ((g_strcmp0(strsplits[0], "1") == 0) || (g_strcmp0(strsplits[0], "help") == 0)) {
+               __print_menu();
+       } else if ((g_strcmp0(strsplits[0], "0") == 0) || (g_strcmp0(strsplits[0], "exit") == 0)) {
+               g_main_loop_quit(gloop);
+       } else if ((g_strcmp0(strsplits[0], "2") == 0) || (g_strcmp0(strsplits[0], "init") == 0)) {
+               if (cm_handle) {
+                       g_print("!!!!!!!!!!!!!!!!Already initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               } else {
+                       cm_init(&cm_handle);
+                       cm_enable_recovery(cm_handle, "org.tizen.cmtest");
+               }
+       } else if ((g_strcmp0(strsplits[0], "3") == 0) || (g_strcmp0(strsplits[0], "deinit") == 0)) {
+               if (cm_handle) {
+                       cm_deinit(cm_handle);
+                       cm_handle = NULL;
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "4") == 0) || (g_strcmp0(strsplits[0], "setcb") == 0)) {
+               if (cm_handle) {
+                       g_print(">>>>>>Monitor Call Event Change\n");
+                       cm_set_call_event_cb(cm_handle, __call_event_changed_cb, NULL);
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "5") == 0) || (g_strcmp0(strsplits[0], "unsetcb") == 0)) {
+               if (cm_handle) {
+                       g_print(">>>>>>Monitor Call Event Change\n");
+                       cm_unset_call_event_cb(cm_handle);
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "6") == 0) || (g_strcmp0(strsplits[0], "dial_voicecall") == 0)) {
+               if (cm_handle) {
+                       if (strsplits[1] == NULL) {
+                               g_print("!!!!!!!!!!!!!!!!Enter dial number!!!!!!!!!!!!!!!!!!!!!\n");
+                       } else {
+                               g_print(">>>>>>Dial to %s\n", strsplits[1]);
+                               cm_dial_call(cm_handle, strsplits[1], CM_CALL_TYPE_VOICE, CM_SIM_SLOT_DEFAULT_E);
+                       }
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "7") == 0) || (g_strcmp0(strsplits[0], "dial_videocall") == 0)) {
+               if (cm_handle) {
+                       if (strsplits[1] == NULL) {
+                               g_print("!!!!!!!!!!!!!!!!Enter dial number!!!!!!!!!!!!!!!!!!!!!\n");
+                       } else {
+                               g_print(">>>>>>Dial to %s\n", strsplits[1]);
+                               cm_dial_call(cm_handle, strsplits[1], CM_CALL_TYPE_VIDEO, CM_SIM_SLOT_DEFAULT_E);
+                       }
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "8") == 0) || (g_strcmp0(strsplits[0], "end") == 0)) {
+               if (cm_handle) {
+                       if (strsplits[1] == NULL) {
+                               g_print("!!!!!!!!!!!!!!!!Enter Call ID!!!!!!!!!!!!!!!!!!!!!\n");
+                       } else {
+                               unsigned int call_id = strtoul(strsplits[1], NULL, 10);
+                               g_print(">>>>>>End call %d\n", call_id);
+                               cm_end_call(cm_handle, call_id, CALL_RELEASE_TYPE_BY_CALL_HANDLE);
+                       }
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "9") == 0) || (g_strcmp0(strsplits[0], "swap") == 0)) {
+               if (cm_handle) {
+                       cm_swap_call(cm_handle);
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "10") == 0) || (g_strcmp0(strsplits[0], "hold") == 0)) {
+               if (cm_handle) {
+                       cm_hold_call(cm_handle);
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "11") == 0) || (g_strcmp0(strsplits[0], "unhold") == 0)) {
+               if (cm_handle) {
+                       cm_unhold_call(cm_handle);
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "12") == 0) || (g_strcmp0(strsplits[0], "join") == 0)) {
+               if (cm_handle) {
+                       cm_join_call(cm_handle);
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "13") == 0) || (g_strcmp0(strsplits[0], "split") == 0)) {
+               if (cm_handle) {
+                       if (strsplits[1] == NULL) {
+                               g_print("!!!!!!!!!!!!!!!!Enter Call ID!!!!!!!!!!!!!!!!!!!!!\n");
+                       } else {
+                               unsigned int call_id = strtoul(strsplits[1], NULL, 10);
+                               g_print(">>>>>>Split call %d\n", call_id);
+                               cm_split_call(cm_handle, call_id);
+                       }
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "14") == 0) || (g_strcmp0(strsplits[0], "answer") == 0)) {
+               if (cm_handle) {
+                       if (strsplits[1] == NULL) {
+                               g_print("!!!!!!!!!!!!!!!!Enter Answer Type!!!!!!!!!!!!!!!!!!!!!\n");
+                       } else {
+                               int ans_type = strtoul(strsplits[1], NULL, 10);
+                               g_print(">>>>>>Answer call %d\n", ans_type);
+                               cm_answer_call(cm_handle, ans_type);
+                       }
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "15") == 0) || (g_strcmp0(strsplits[0], "extra_vol") == 0)) {
+               if (cm_handle) {
+                       if (strsplits[1] == NULL) {
+                               g_print("!!!!!!!!!!!!!!!!Enter \"on\" or \"off\"!!!!!!!!!!!!!!!!!!!!!\n");
+                       } else {
+                               g_print(">>>>>>Extra volume %s\n", strsplits[1]);
+                               if (g_strcmp0(strsplits[1], "on") == 0) {
+                                       cm_set_extra_vol(cm_handle, 1);
+                               } else {
+                                       cm_set_extra_vol(cm_handle, 0);
+                               }
+                       }
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "16") == 0) || (g_strcmp0(strsplits[0], "mute_state") == 0)) {
+               if (cm_handle) {
+                       if (strsplits[1] == NULL) {
+                               g_print("!!!!!!!!!!!!!!!!Enter \"on\" or \"off\"!!!!!!!!!!!!!!!!!!!!!\n");
+                       } else {
+                               g_print(">>>>>>Set Mute state %s\n", strsplits[1]);
+                               if (g_strcmp0(strsplits[1], "on") == 0) {
+                                       cm_set_mute_state(cm_handle, 1);
+                               } else {
+                                       cm_set_mute_state(cm_handle, 0);
+                               }
+                       }
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "17") == 0) || (g_strcmp0(strsplits[0], "spk") == 0)) {
+               if (cm_handle) {
+                       if (strsplits[1] == NULL) {
+                               g_print("!!!!!!!!!!!!!!!!Enter \"on\" or \"off\"!!!!!!!!!!!!!!!!!!!!!\n");
+                       } else {
+                               g_print(">>>>>>Speaker %s\n", strsplits[1]);
+                               if (g_strcmp0(strsplits[1], "on") == 0) {
+                                       cm_speaker_on(cm_handle);
+                               } else {
+                                       cm_speaker_off(cm_handle);
+                               }
+                       }
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "18") == 0) || (g_strcmp0(strsplits[0], "bluetooth") == 0)) {
+               if (cm_handle) {
+                       if (strsplits[1] == NULL) {
+                               g_print("!!!!!!!!!!!!!!!!Enter \"on\" or \"off\"!!!!!!!!!!!!!!!!!!!!!\n");
+                       } else {
+                               g_print(">>>>>>Bluetooth %s\n", strsplits[1]);
+                               if (g_strcmp0(strsplits[1], "on") == 0) {
+                                       cm_bluetooth_on(cm_handle);
+                               } else {
+                                       cm_bluetooth_off(cm_handle);
+                               }
+                       }
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "19") == 0) || (g_strcmp0(strsplits[0], "setdtmfcb") == 0)) {
+               if (cm_handle) {
+                       cm_set_dtmf_indication_cb(cm_handle, __dtmf_indication_cb, NULL);
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "20") == 0) || (g_strcmp0(strsplits[0], "unsetdtmfcb") == 0)) {
+               if (cm_handle) {
+                       cm_unset_dtmf_indication_cb(cm_handle);
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "21") == 0) || (g_strcmp0(strsplits[0], "senddtmfrsp") == 0)) {
+               if (cm_handle) {
+                       if (strsplits[1] == NULL) {
+                               g_print("!!!!!!!!!!!!!!!!Enter response type!!!!!!!!!!!!!!!!!!!!!\n");
+                       } else {
+                               int resp_type = strtoul(strsplits[1], NULL, 10);
+                               g_print(">>>>>>resp type %d\n", resp_type);
+                               cm_send_dtmf_resp(cm_handle, resp_type);
+                       }
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "22") == 0) || (g_strcmp0(strsplits[0], "setaudiocb") == 0)) {
+               if (cm_handle) {
+                       cm_set_audio_state_changed_cb(cm_handle, __audio_state_changed_cb, NULL);
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "23") == 0) || (g_strcmp0(strsplits[0], "unsetaudiocb") == 0)) {
+               if (cm_handle) {
+                       cm_unset_audio_state_changed_cb(cm_handle);
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "24") == 0) || (g_strcmp0(strsplits[0], "getaudiostate") == 0)) {
+               if (cm_handle) {
+                       cm_audio_state_type_e audio_state;
+                       cm_get_audio_state(cm_handle, &audio_state);
+                       g_print("current audio state: %d\n", audio_state);
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "25") == 0) || (g_strcmp0(strsplits[0], "setfg") == 0)) {
+               if (cm_handle) {
+                       cm_set_foreground_cb(cm_handle, __go_foreground_cb, NULL);
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "26") == 0) || (g_strcmp0(strsplits[0], "unsetfg") == 0)) {
+               if (cm_handle) {
+                       cm_unset_foreground_cb(cm_handle);
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "27") == 0) || (g_strcmp0(strsplits[0], "activate") == 0)) {
+               if (cm_handle) {
+                       cm_activate_ui(cm_handle);
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "28") == 0) || (g_strcmp0(strsplits[0], "setstatuscb") == 0)) {
+               if (cm_handle) {
+                       g_print(">>>>>>Monitor Call Status Change\n");
+                       cm_set_call_status_cb(cm_handle, __call_status_changed_cb, NULL);
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "29") == 0) || (g_strcmp0(strsplits[0], "unsetstatuscb") == 0)) {
+               if (cm_handle) {
+                       g_print(">>>>>>Monitor Call Status Change\n");
+                       cm_unset_call_status_cb(cm_handle);
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "30") == 0) || (g_strcmp0(strsplits[0], "transfercall") == 0)) {
+               if (cm_handle) {
+                       cm_transfer_call(cm_handle);
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "31") == 0) || (g_strcmp0(strsplits[0], "startdtmf") == 0)) {
+               if (cm_handle) {
+                       if (strsplits[1] == NULL) {
+                               g_print("!!!!!!!!!!!!!!!!Enter dtmf_digit !!!!!!!!!!!!!!!!!!!!!\n");
+                       } else {
+                               cm_start_dtmf(cm_handle, strsplits[1][0]);
+                       }
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "32") == 0) || (g_strcmp0(strsplits[0], "stopdtmf") == 0)) {
+               if (cm_handle) {
+                       cm_stop_dtmf(cm_handle);
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "33") == 0) || (g_strcmp0(strsplits[0], "burstdtmf") == 0)) {
+               if (cm_handle) {
+                       if (strsplits[1] == NULL) {
+                               g_print("!!!!!!!!!!!!!!!!Enter dtmf_digit !!!!!!!!!!!!!!!!!!!!!\n");
+                       } else {
+                               cm_burst_dtmf(cm_handle, strsplits[1]);
+                       }
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "34") == 0) || (g_strcmp0(strsplits[0], "stopalert") == 0)) {
+               if (cm_handle) {
+                       cm_stop_alert(cm_handle);
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "35") == 0) || (g_strcmp0(strsplits[0], "startalert") == 0)) {
+               if (cm_handle) {
+                       cm_start_alert(cm_handle);
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "36") == 0) || (g_strcmp0(strsplits[0], "getallcalllist") == 0)) {
+               if (cm_handle) {
+                       GSList *list = NULL;
+                       cm_get_all_call_list(cm_handle, &list);
+                       int list_len = g_slist_length(list);
+                       if (list == NULL)
+                               g_print("all call list is NULL!\n");
+                       else {
+                               int idx;
+                               cm_call_data_t *callData = NULL;
+                               for (idx = 0; idx < list_len; idx++) {
+                                       callData = (cm_call_data_t *)g_slist_nth_data(list, idx);
+                                       __print_call_data(callData);
+                                       cm_call_data_free(callData);
+                               }
+                       }
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "37") == 0) || (g_strcmp0(strsplits[0], "getconfcalllist") == 0)) {
+               if (cm_handle) {
+                       GSList *list = NULL;
+                       cm_conf_call_data_t *call_data = NULL;
+                       cm_get_conference_call_list(cm_handle, &list);
+                       if (list == NULL)
+                               g_print("conference_call_list is NULL!\n");
+                       else{
+                               int list_len = g_slist_length(list);
+                               int idx;
+                               for (idx = 0; idx < list_len; idx++) {
+                                       call_data = (cm_conf_call_data_t *)g_slist_nth_data(list, idx);
+                                       __print_conf_call_data(call_data);
+                                       cm_conf_call_data_free(call_data);
+                               }
+                       }
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "38") == 0) || (g_strcmp0(strsplits[0], "getallcalldata") == 0)) {
+               if (cm_handle) {
+                       cm_call_data_t *incom = NULL;
+                       cm_call_data_t *active = NULL;
+                       cm_call_data_t *held = NULL;
+                       cm_get_all_calldata(cm_handle, &incom, &active, &held);
+                       g_print("incom call data:\n");
+                       __print_call_data(incom);
+                       g_print("active call data:\n");
+                       __print_call_data(active);
+                       g_print("held call data:\n");
+                       __print_call_data(held);
+                       cm_call_data_free(incom);
+                       cm_call_data_free(active);
+                       cm_call_data_free(held);
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "39") == 0) || (g_strcmp0(strsplits[0], "reject") == 0)) {
+               if (cm_handle) {
+                       cm_reject_call(cm_handle);
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "40") == 0) || (g_strcmp0(strsplits[0], "get_callstatus") == 0)) {
+               if (cm_handle) {
+                       cm_call_status_e call_status = CM_CALL_STATUS_IDLE;
+                       cm_get_call_status(cm_handle, &call_status);
+                       g_print("Call Status: %d\n", call_status);
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "41") == 0) || (g_strcmp0(strsplits[0], "setmutestatuscb") == 0)) {
+               if (cm_handle) {
+                       g_print(">>>>>>Monitor Mute Status Change\n");
+                       cm_set_mute_status_cb(cm_handle, __mute_status_changed_cb, NULL);
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "42") == 0) || (g_strcmp0(strsplits[0], "unsetmutestatuscb") == 0)) {
+               if (cm_handle) {
+                       g_print(">>>>>>Stop monitor Mute Status Change\n");
+                       cm_unset_mute_status_cb(cm_handle);
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       } else if ((g_strcmp0(strsplits[0], "43") == 0) || (g_strcmp0(strsplits[0], "getmutestatus") == 0)) {
+               if (cm_handle) {
+                       cm_mute_status_e mute_status;
+                       cm_get_mute_status(cm_handle, &mute_status);
+                       g_print("current mute status: %d\n", mute_status);
+               } else {
+                       g_print("!!!!!!!!!!!!!!!!Not initialized!!!!!!!!!!!!!!!!!!!!!\n");
+               }
+       }
+
+       g_print("Input > ");
+       g_strfreev(strsplits);
+       return TRUE;
+}
+
+static gboolean __keyboard_event(GIOChannel * source, GIOCondition condition, gpointer data)
+{
+       GError *error = NULL;
+       g_io_channel_read_line(source, &keybuf, NULL, NULL, &error);
+       return __process_input(keybuf);
+}
+
+static void __init_keyboard(gpointer user_data)
+{
+       GIOChannel *ioChannel = NULL;
+       ioChannel = g_io_channel_unix_new(fileno(stdin));
+       if (ioChannel == NULL) {
+               g_error("Fail to Create keyboard");
+       }
+       g_io_add_watch(ioChannel, G_IO_IN, __keyboard_event, user_data);
+}
+
+static void __interrupt_cb(int signal)
+{
+       g_print("Interrupt\n");
+       g_main_loop_quit(gloop);
+}
+
+int main(int argc, char **argv)
+{
+       struct sigaction sa = {.sa_handler = 0 };
+
+#if !GLIB_CHECK_VERSION(2, 35, 0)
+       g_type_init();
+#endif
+
+       /* set up a signal handler */
+       sa.sa_handler = __interrupt_cb;
+       sigaction(SIGINT, &sa, NULL);
+
+       gloop = g_main_loop_new(NULL, TRUE);
+       __init_keyboard(NULL);
+       __print_menu();
+       g_print("Input > ");
+       g_main_loop_run(gloop);
+
+       if (gloop)
+               g_main_loop_unref(gloop);
+       if (ioChannel)
+               g_io_channel_unref(ioChannel);
+       if (keybuf)
+               g_free(keybuf);
+       return 0;
+}
+