Fix Call ID is not reflecting settings/vconf state.
[platform/core/telephony/tel-plugin-imc.git] / src / s_call.c
old mode 100644 (file)
new mode 100755 (executable)
index e48e900..ea69d0b
@@ -29,6 +29,7 @@
 #include <core_object.h>
 #include <plugin.h>
 #include <queue.h>
+#include <storage.h>
 #include <co_call.h>
 #include <user_request.h>
 #include <server.h>
@@ -268,7 +269,7 @@ const call_end_cause_info call_end_cause_table[] =   // call end cause table to
 
 static enum tcore_call_cli_mode _get_clir_status(char *num)
 {
-       enum tcore_call_cli_mode clir = CALL_CLI_MODE_DEFAULT;
+       enum tcore_call_cli_mode clir = TCORE_CALL_CLI_MODE_DEFAULT;
 
        dbg("Entry");
 
@@ -282,7 +283,10 @@ static enum tcore_call_cli_mode _get_clir_status(char *num)
                return TCORE_CALL_CLI_MODE_PRESENT;
        }
 
-       err("Exit");
+       dbg("CLI mode default");
+
+       dbg("Exit");
+
        return clir;
 }
 
@@ -474,7 +478,7 @@ static void _call_status_idle(TcorePlugin *p, CallObject *co)
        UserRequest *ur;
 
        dbg("Entry");
-       core_obj = tcore_plugin_ref_core_object(p, "call");
+       core_obj = tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_CALL);
        dbg("Call ID [%d], Call Status [%d]", tcore_call_object_get_id(co), tcore_call_object_get_status(co));
 
        if (tcore_call_object_get_status(co) != TCORE_CALL_STATUS_IDLE) {
@@ -533,7 +537,7 @@ static void _call_status_dialing(TcorePlugin *p, CallObject *co)
 
                // Send notification to TAPI
                tcore_server_send_notification(tcore_plugin_ref_server(p),
-                                                                          tcore_plugin_ref_core_object(p, "call"),
+                                                                          tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_CALL),
                                                                           TNOTI_CALL_STATUS_DIALING,
                                                                           sizeof(struct tnoti_call_status_dialing),
                                                                           (void *) &data);
@@ -562,7 +566,7 @@ static void _call_status_alert(TcorePlugin *p, CallObject *co)
 
                // Send notification to TAPI
                tcore_server_send_notification(tcore_plugin_ref_server(p),
-                                                                          tcore_plugin_ref_core_object(p, "call"),
+                                                                          tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_CALL),
                                                                           TNOTI_CALL_STATUS_ALERT,
                                                                           sizeof(struct tnoti_call_status_alert),
                                                                           (void *) &data);
@@ -590,7 +594,7 @@ static void _call_status_active(TcorePlugin *p, CallObject *co)
 
                // Send notification to TAPI
                tcore_server_send_notification(tcore_plugin_ref_server(p),
-                                                                          tcore_plugin_ref_core_object(p, "call"),
+                                                                          tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_CALL),
                                                                           TNOTI_CALL_STATUS_ACTIVE,
                                                                           sizeof(struct tnoti_call_status_active),
                                                                           (void *) &data);
@@ -618,7 +622,7 @@ static void _call_status_held(TcorePlugin *p, CallObject *co)
 
                // Send notification to TAPI
                tcore_server_send_notification(tcore_plugin_ref_server(p),
-                                                                          tcore_plugin_ref_core_object(p, "call"),
+                                                                          tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_CALL),
                                                                           TNOTI_CALL_STATUS_HELD,
                                                                           sizeof(struct tnoti_call_status_held),
                                                                           (void *) &data);
@@ -662,7 +666,7 @@ static void _call_status_incoming(TcorePlugin *p, CallObject *co)
 
                // Send notification to TAPI
                tcore_server_send_notification(tcore_plugin_ref_server(p),
-                                                                          tcore_plugin_ref_core_object(p, "call"),
+                                                                          tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_CALL),
                                                                           TNOTI_CALL_STATUS_INCOMING,
                                                                           sizeof(struct tnoti_call_status_incoming),
                                                                           (void *) &data);
@@ -780,6 +784,29 @@ static void on_confirmation_call_message_send(TcorePending *p, gboolean result,
        return;
 }
 
+static void call_prepare_and_send_pending_request(CoreObject *co, const char *at_cmd, const char *prefix, enum tcore_at_command_type at_cmd_type, TcorePendingResponseCallback callback)
+{
+       TcoreATRequest *req = NULL;
+       TcoreHal *hal = NULL;
+       TcorePending *pending = NULL;
+       TReturn ret;
+
+       hal = tcore_object_get_hal(co);
+       dbg("hal: %p", hal);
+
+       pending = tcore_pending_new(co, 0);
+       if (!pending)
+               dbg("Pending is NULL");
+       req = tcore_at_request_new(at_cmd, prefix, at_cmd_type);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+       tcore_pending_set_response_callback(pending, callback, NULL);
+       tcore_pending_set_send_callback(pending, on_confirmation_call_message_send, NULL);
+       ret = tcore_hal_send_request(hal, pending);
+}
+
 static void on_confirmation_call_outgoing(TcorePending *p, int data_len, const void *data, void *user_data)
 {
        UserRequest *ur = NULL;
@@ -821,7 +848,7 @@ static void on_confirmation_call_outgoing(TcorePending *p, int data_len, const v
                err("User Request is NULL");
        }
 
-       dbg("Exit")
+       dbg("Exit");
        return;
 }
 
@@ -1468,6 +1495,51 @@ static void on_confirmation_call_swap(TcorePending *p, int data_len, const void
        return;
 }
 
+static void on_confirmation_set_sound_path(TcorePending *p, int data_len,
+                                               const void *data,
+                                               void *user_data)
+{
+       const TcoreATResponse *resp = data;
+       struct tnoti_call_sound_path *snd_path = user_data;
+       struct tresp_call_sound_set_path resp_set_sound_path;
+       UserRequest *ur = tcore_pending_ref_user_request(p);
+       TcorePlugin *plugin = tcore_pending_ref_plugin(p);
+       CoreObject *co_call;
+
+       if (ur == NULL) {
+               err("User Request is NULL");
+               g_free(user_data);
+               return;
+       }
+
+       if (resp->success <= 0) {
+
+               dbg("RESPONSE NOT OK");
+               resp_set_sound_path.err = TRUE;
+
+               goto out;
+       }
+
+       dbg("RESPONSE OK");
+       resp_set_sound_path.err = FALSE;
+
+       co_call = tcore_plugin_ref_core_object(plugin, CORE_OBJECT_TYPE_CALL);
+
+       /* Notify control plugin about sound path */
+       tcore_server_send_notification(tcore_plugin_ref_server(plugin),
+                                       co_call, TNOTI_CALL_SOUND_PATH,
+                                       sizeof(struct tnoti_call_sound_path),
+                                       snd_path);
+
+out:
+       /* Answer TAPI request */
+       tcore_user_request_send_response(ur, TRESP_CALL_SET_SOUND_PATH,
+                               sizeof(resp_set_sound_path),
+                               &resp_set_sound_path);
+
+       g_free(user_data);
+}
+
 static void on_confirmation_call_set_source_sound_path(TcorePending *p, int data_len, const void *data, void *user_data)
 {
        UserRequest *ur = NULL;
@@ -2299,10 +2371,7 @@ static int _callFromCLCCLine(char *line, struct clcc_call_t *p_call)
 ERROR:
        err("Invalid CLCC line");
 
-       if (num) {
-               g_free(num);
-               num = NULL;
-       }
+       g_free(num);
 
        // Free tokens
        tcore_at_tok_free(tokens);
@@ -2413,7 +2482,7 @@ static void on_notification_call_incoming(CoreObject *o, const void *data, void
                return;
        }
 
-       dbg("freeing  at token")
+       dbg("freeing  at token");
        tcore_at_tok_free(tokens);
 
        eflag = g_new0(gboolean, 1);
@@ -2546,52 +2615,61 @@ static void on_notification_call_status(CoreObject *o, const void *data, void *u
 static TReturn s_call_outgoing(CoreObject *o, UserRequest *ur)
 {
        struct treq_call_dial *data = 0;
-       char *raw_str = NULL;
-       char *cmd_str = NULL;
-       const char *cclir;
+       char *cmd_str;
+       const char *cclir, *num;
        enum tcore_call_cli_mode clir = CALL_CLI_MODE_DEFAULT;
-       TcorePending *pending = NULL;
+       TcorePending *pending;
        TcoreATRequest *req;
-       gboolean ret = FALSE;
-
-       dbg("function entrance");
+       gboolean ret;
 
-       if (FALSE == tcore_hal_get_power_state(tcore_object_get_hal(o))) {
-               dbg("cp not ready/n");
-               return TCORE_RETURN_ENOSYS;
-       }
+       dbg("Entry");
 
        data = (struct treq_call_dial *) tcore_user_request_ref_data(ur, 0);
        if (data->type == CALL_TYPE_VIDEO) {
-               dbg("invalid call type")
+               dbg("invalid call type");
                return TCORE_RETURN_FAILURE;
        }
 
        clir = _get_clir_status(data->number);
 
-       // Compose ATD Cmd string
+       if (clir == TCORE_CALL_CLI_MODE_DEFAULT) {
+               TcorePlugin *plugin = tcore_object_ref_plugin(o);
+               Server *server = tcore_plugin_ref_server(plugin);
+               Storage *strg;
+
+               dbg("Reading VCONF key");
+
+               strg = tcore_server_find_storage(server, "vconf");
+               clir = tcore_storage_get_int(strg,
+                               STORAGE_KEY_CISSAPPL_SHOW_MY_NUMBER_INT);
+
+               num = data->number;
+       } else
+               /* Need to remove CLIR code from dialing number */
+               num = data->number + 4;
+
+       /* Compose ATD Cmd string */
        switch (clir) {
        case TCORE_CALL_CLI_MODE_PRESENT:
                dbg("CALL_CLI_MODE_PRESENT");
-               cclir = "I";
-               break;  // invocation
+               cclir = "i";
+               break;
 
        case TCORE_CALL_CLI_MODE_RESTRICT:
                dbg("CALL_CLI_MODE_RESTRICT");
-               cclir = "i";
-               break;  // suppression
+               cclir = "I";
+               break;
 
        case TCORE_CALL_CLI_MODE_DEFAULT:
        default:
                cclir = "";
                dbg("CALL_CLI_MODE_DEFAULT");
-               break;   // subscription default
+               break;
        }
 
        dbg("data->number = %s", data->number);
 
-       raw_str = g_strdup_printf("ATD%s%s;", data->number, cclir);
-       cmd_str = g_strdup_printf("%s", raw_str);
+       cmd_str = g_strdup_printf("ATD%s%s;", num, cclir);
 
        dbg("request command : %s", cmd_str);
 
@@ -2602,16 +2680,17 @@ static TReturn s_call_outgoing(CoreObject *o, UserRequest *ur)
        tcore_pending_set_request_data(pending, 0, req);
        ret = _call_request_message(pending, o, ur, on_confirmation_call_outgoing, NULL);
 
-       g_free(raw_str);
        g_free(cmd_str);
 
-       if (!ret) {
+       if (ret == FALSE) {
                dbg("AT request(%s) sent failed", req->cmd);
                return TCORE_RETURN_FAILURE;
        }
 
        dbg("AT request(%s) sent success", req->cmd);
 
+       dbg("Exit");
+
        return TCORE_RETURN_SUCCESS;
 }
 
@@ -2969,7 +3048,7 @@ static TReturn s_call_send_dtmf(CoreObject *o, UserRequest *ur)
        g_free(cmd_str);
 
        if (!ret) {
-               dbg("AT request sent failed")
+               dbg("AT request sent failed");
                return TCORE_RETURN_FAILURE;
        }
 
@@ -2985,6 +3064,8 @@ static TReturn s_call_set_sound_path(CoreObject *o, UserRequest *ur)
        int device_type = -1;
        struct treq_call_sound_set_path *sound_path = 0;
        gboolean ret = FALSE;
+       TcorePlugin *plugin = tcore_object_ref_plugin(o);
+       const char *cp_name = tcore_server_get_cp_name_by_plugin(plugin);
 
        dbg("function entrance");
 
@@ -3036,31 +3117,73 @@ static TReturn s_call_set_sound_path(CoreObject *o, UserRequest *ur)
                return TCORE_RETURN_FAILURE;
        }
 
-       cmd_str = g_strdup_printf("AT+XDRV=40,4,3,0,0,0,0,0,1,0,1,0,%d",device_type); // source type.
-       pending = tcore_pending_new(o, 0);
-       req = tcore_at_request_new(cmd_str, "+XDRV", TCORE_AT_SINGLELINE);
-       dbg("XDRV req-cmd for source type  : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
-       tcore_pending_set_request_data(pending, 0, req);
-       ur_dup = tcore_user_request_ref(ur);
-       ret = _call_request_message(pending, o, ur_dup, on_confirmation_call_set_source_sound_path, NULL);
-       g_free(cmd_str);
+       if (g_str_has_prefix(cp_name, "mfld_blackbay") == TRUE) {
+               struct tnoti_call_sound_path *tnoti_snd_path;
 
-       if (!ret) {
-               dbg("At request(%s) sent failed", req->cmd);
-               return TCORE_RETURN_FAILURE;
-       }
+               tnoti_snd_path = g_try_new0(struct tnoti_call_sound_path, 1);
+               if (!tnoti_snd_path)
+                       return TCORE_RETURN_ENOMEM;
 
-       cmd_str1 = g_strdup_printf("AT+XDRV=40,5,2,0,0,0,0,0,1,0,1,0,%d",device_type); // destination type
-       pending1 = tcore_pending_new(o, 0);
-       req1 = tcore_at_request_new(cmd_str1, "+XDRV", TCORE_AT_SINGLELINE);
-       dbg("XDRV req-cmd for destination type : %s, prefix(if any) :%s, cmd_len : %d", req1->cmd, req1->prefix, strlen(req1->cmd));
-       tcore_pending_set_request_data(pending1, 0, req1);
-       ret = _call_request_message(pending1, o, ur, on_confirmation_call_set_destination_sound_path, NULL);
-       g_free(cmd_str1);
+               tnoti_snd_path->path = sound_path->path;
 
-       if (!ret) {
-               dbg("AT request %s has failed ", req1->cmd);
-               return TCORE_RETURN_FAILURE;
+               /* Configure modem I2S1 to 8khz, mono, PCM if routing to bluetooth */
+               if (sound_path->path == CALL_SOUND_PATH_BLUETOOTH || sound_path->path == CALL_SOUND_PATH_STEREO_BLUETOOTH) {
+                       call_prepare_and_send_pending_request(o, "AT+XDRV=40,4,3,0,1,0,0,0,0,0,0,0,21", NULL, TCORE_AT_NO_RESULT, NULL);
+                       call_prepare_and_send_pending_request(o, "AT+XDRV=40,5,2,0,1,0,0,0,0,0,0,0,22", NULL, TCORE_AT_NO_RESULT, NULL);
+               }
+               else {
+                       call_prepare_and_send_pending_request(o, "AT+XDRV=40,4,3,0,1,0,8,0,1,0,2,0,21", NULL, TCORE_AT_NO_RESULT, NULL);
+                       call_prepare_and_send_pending_request(o, "AT+XDRV=40,5,2,0,1,0,8,0,1,0,2,0,22", NULL, TCORE_AT_NO_RESULT, NULL);
+               }
+
+               /* Configure modem I2S2 and do the modem routing */
+               call_prepare_and_send_pending_request(o, "AT+XDRV=40,4,4,0,0,0,8,0,1,0,2,0,21", NULL, TCORE_AT_NO_RESULT, NULL);
+               call_prepare_and_send_pending_request(o, "AT+XDRV=40,5,3,0,0,0,8,0,1,0,2,0,22", NULL, TCORE_AT_NO_RESULT, NULL);
+               call_prepare_and_send_pending_request(o, "AT+XDRV=40,6,0,4", NULL, TCORE_AT_NO_RESULT, NULL);
+               call_prepare_and_send_pending_request(o, "AT+XDRV=40,6,3,0", NULL, TCORE_AT_NO_RESULT, NULL);
+               call_prepare_and_send_pending_request(o, "AT+XDRV=40,6,4,2", NULL, TCORE_AT_NO_RESULT, NULL);
+               call_prepare_and_send_pending_request(o, "AT+XDRV=40,6,5,2", NULL, TCORE_AT_NO_RESULT, NULL);
+
+               /* amc enable */
+               call_prepare_and_send_pending_request(o, "AT+XDRV=40,2,4", NULL, TCORE_AT_NO_RESULT, NULL); //AMC_I2S2_RX
+               call_prepare_and_send_pending_request(o, "AT+XDRV=40,2,3", NULL, TCORE_AT_NO_RESULT, NULL); //AMC_I2S1_RX
+               /* amc route: AMC_RADIO_RX => AMC_I2S1_TX */
+
+               pending = tcore_pending_new(o, 0);
+               req = tcore_at_request_new("AT+XDRV=40,6,0,2", "+XDRV", TCORE_AT_SINGLELINE);
+               dbg("XDRV req-cmd for source type  : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+               tcore_pending_set_request_data(pending, 0, req);
+               ur_dup = tcore_user_request_ref(ur);
+               ret = _call_request_message(pending, o, ur_dup, on_confirmation_set_sound_path, tnoti_snd_path);
+
+       } else {
+
+               cmd_str = g_strdup_printf("AT+XDRV=40,4,3,0,0,0,0,0,1,0,1,0,%d",device_type); // source type.
+               pending = tcore_pending_new(o, 0);
+               req = tcore_at_request_new(cmd_str, "+XDRV", TCORE_AT_SINGLELINE);
+               dbg("XDRV req-cmd for source type  : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+               tcore_pending_set_request_data(pending, 0, req);
+               ur_dup = tcore_user_request_ref(ur);
+               ret = _call_request_message(pending, o, ur_dup, on_confirmation_call_set_source_sound_path, NULL);
+               g_free(cmd_str);
+
+               if (!ret) {
+                       dbg("At request(%s) sent failed", req->cmd);
+                       return TCORE_RETURN_FAILURE;
+               }
+
+               cmd_str1 = g_strdup_printf("AT+XDRV=40,5,2,0,0,0,0,0,1,0,1,0,%d",device_type); // destination type
+               pending1 = tcore_pending_new(o, 0);
+               req1 = tcore_at_request_new(cmd_str1, "+XDRV", TCORE_AT_SINGLELINE);
+               dbg("XDRV req-cmd for destination type : %s, prefix(if any) :%s, cmd_len : %d", req1->cmd, req1->prefix, strlen(req1->cmd));
+               tcore_pending_set_request_data(pending1, 0, req1);
+               ret = _call_request_message(pending1, o, ur, on_confirmation_call_set_destination_sound_path, NULL);
+               g_free(cmd_str1);
+
+               if (!ret) {
+                       dbg("AT request %s has failed ", req1->cmd);
+                       return TCORE_RETURN_FAILURE;
+               }
        }
 
        return TCORE_RETURN_SUCCESS;
@@ -3397,696 +3520,22 @@ static struct tcore_call_operations call_ops = {
        .set_sound_noise_reduction = NULL,
 };
 
-static void s_call_info_mo_waiting(CoreObject *o)
+gboolean s_call_init(TcorePlugin *cp, CoreObject *co_call)
 {
-       TcorePlugin *plugin = NULL;
-       CallObject *co = NULL;
-       int id = 0;
-
        dbg("Entry");
 
-       // Parent plugin
-       plugin = tcore_object_ref_plugin(o);
-
-       // Call Core object
-       co = tcore_call_object_current_on_mo_processing(o);
-       if (!co) {
-               err("Failed to find Call Core object!");
-               return;
-       }
-
-       // Call ID
-       id = tcore_call_object_get_id(co);
+       tcore_call_override_ops(co_call, &call_ops, NULL);
 
-       // Send notification to TAPI
-       tcore_server_send_notification(tcore_plugin_ref_server(plugin),
-                                                                  tcore_plugin_ref_core_object(plugin, "call"),
-                                                                  TNOTI_CALL_INFO_WAITING,
-                                                                  sizeof(unsigned int),
-                                                                  (void *) &id);
+       /* Add Callbacks */
+       tcore_object_override_callback(co_call, "+XCALLSTAT", on_notification_call_info, NULL);
+       tcore_object_override_callback(co_call, "+CLIP", on_notification_call_clip_info, NULL);
 
        dbg("Exit");
-       return;
-}
-
-static void s_call_info_mo_forwarded(CoreObject *o)
-{
-       TcorePlugin *plugin = NULL;
-       CallObject *co = NULL;
-       int id = 0;
-
-       dbg("Entry");
-
-       // Parent plugin
-       plugin = tcore_object_ref_plugin(o);
-
-       // Call Core object
-       co = tcore_call_object_current_on_mo_processing(o);
-       if (!co) {
-               err("Failed to find Call Core object!");
-               return;
-       }
-
-       // Call ID
-       id = tcore_call_object_get_id(co);
-
-       // Send notification to TAPI
-       tcore_server_send_notification(tcore_plugin_ref_server(plugin),
-                                                                  tcore_plugin_ref_core_object(plugin, "call"),
-                                                                  TNOTI_CALL_INFO_FORWARDED,
-                                                                  sizeof(unsigned int),
-                                                                  (void *) &id);
-
-       dbg("Exit");
-       return;
-}
-
-static void s_call_info_mo_barred_incoming(CoreObject *o)
-{
-       TcorePlugin *plugin = NULL;
-       CallObject *co = NULL;
-       int id = 0;
-
-       dbg("Entry");
-
-       // Parent plugin
-       plugin = tcore_object_ref_plugin(o);
-
-       // Call Core object
-       co = tcore_call_object_current_on_mo_processing(o);
-       if (!co) {
-               err("Failed to find Call Core object!");
-               return;
-       }
-
-       // Call ID
-       id = tcore_call_object_get_id(co);
-
-       // Send notification to TAPI
-       tcore_server_send_notification(tcore_plugin_ref_server(plugin),
-                                                                  tcore_plugin_ref_core_object(plugin, "call"),
-                                                                  TNOTI_CALL_INFO_BARRED_INCOMING,
-                                                                  sizeof(unsigned int),
-                                                                  (void *) &id);
-
-       dbg("Exit");
-       return;
-}
-
-static void s_call_info_mo_barred_outgoing(CoreObject *o)
-{
-       TcorePlugin *plugin = NULL;
-       CallObject *co = NULL;
-       int id = 0;
-
-       dbg("Entry");
-
-       // Parent plugin
-       plugin = tcore_object_ref_plugin(o);
-
-       // Call Core object
-       co = tcore_call_object_current_on_mo_processing(o);
-       if (!co) {
-               err("Failed to find Call Core object!");
-               return;
-       }
-
-       // Call ID
-       id = tcore_call_object_get_id(co);
-
-       // Send notification to TAPI
-       tcore_server_send_notification(tcore_plugin_ref_server(plugin),
-                                                                  tcore_plugin_ref_core_object(plugin, "call"),
-                                                                  TNOTI_CALL_INFO_BARRED_OUTGOING,
-                                                                  sizeof(unsigned int),
-                                                                  (void *) &id);
-
-       dbg("Exit");
-       return;
-}
-
-static void s_call_info_mo_deflected(CoreObject *o)
-{
-       TcorePlugin *plugin = NULL;
-       CallObject *co = NULL;
-       int id = 0;
-
-       dbg("Entry");
-
-       // Parent plugin
-       plugin = tcore_object_ref_plugin(o);
-
-       // Call Core object
-       co = tcore_call_object_current_on_mo_processing(o);
-       if (!co) {
-               err("Failed to find Call Core object!");
-               return;
-       }
-
-       // Call ID
-       id = tcore_call_object_get_id(co);
-
-       // Send notification to TAPI
-       tcore_server_send_notification(tcore_plugin_ref_server(plugin),
-                                                                  tcore_plugin_ref_core_object(plugin, "call"),
-                                                                  TNOTI_CALL_INFO_DEFLECTED,
-                                                                  sizeof(unsigned int),
-                                                                  (void *) &id);
-
-       dbg("Exit");
-       return;
-}
-
-static void s_call_info_mo_clir_suppression_reject(CoreObject *o)
-{
-       TcorePlugin *plugin = NULL;
-       CallObject *co = NULL;
-       int id = 0;
-
-       dbg("Entry");
-
-       // Parent plugin
-       plugin = tcore_object_ref_plugin(o);
-
-       // Call Core object
-       co = tcore_call_object_current_on_mo_processing(o);
-       if (!co) {
-               err("Failed to find Call Core object!");
-               return;
-       }
-
-       // Call ID
-       id = tcore_call_object_get_id(co);
-
-       // Send notification to TAPI
-       tcore_server_send_notification(tcore_plugin_ref_server(plugin),
-                                                                  tcore_plugin_ref_core_object(plugin, "call"),
-                                                                  TNOTI_CALL_INFO_CLIR_SUPPRESSION_REJECT,
-                                                                  sizeof(unsigned int),
-                                                                  (void *) &id);
-
-       dbg("Exit");
-       return;
-}
-
-static void s_call_info_mo_cfu(CoreObject *o)
-{
-       TcorePlugin *plugin = NULL;
-       CallObject *co = NULL;
-       int id = 0;
-
-       dbg("Entry");
-
-       // Parent plugin
-       plugin = tcore_object_ref_plugin(o);
-
-       // Call Core object
-       co = tcore_call_object_current_on_mo_processing(o);
-       if (!co) {
-               err("Failed to find Call Core object!");
-               return;
-       }
-
-       // Call ID
-       id = tcore_call_object_get_id(co);
-
-       // Send notification to TAPI
-       tcore_server_send_notification(tcore_plugin_ref_server(plugin),
-                                                                  tcore_plugin_ref_core_object(plugin, "call"),
-                                                                  TNOTI_CALL_INFO_FORWARD_UNCONDITIONAL,
-                                                                  sizeof(unsigned int),
-                                                                  (void *) &id);
-
-       dbg("Exit");
-       return;
-}
-
-static void s_call_info_mo_cfc(CoreObject *o)
-{
-       TcorePlugin *plugin = NULL;
-       CallObject *co = NULL;
-       int id = 0;
-
-       dbg("Entry");
-
-       // Parent plugin
-       plugin = tcore_object_ref_plugin(o);
-
-       // Call Core object
-       co = tcore_call_object_current_on_mo_processing(o);
-       if (!co) {
-               err("Failed to find Call Core object!");
-               return;
-       }
-
-       // Call ID
-       id = tcore_call_object_get_id(co);
-
-       // Send notification to TAPI
-       tcore_server_send_notification(tcore_plugin_ref_server(plugin),
-                                                                  tcore_plugin_ref_core_object(plugin, "call"),
-                                                                  TNOTI_CALL_INFO_FORWARD_CONDITIONAL,
-                                                                  sizeof(unsigned int),
-                                                                  (void *) &id);
-
-       dbg("Exit");
-       return;
-}
 
-static void s_call_info_mt_cli(CoreObject *o, enum tcore_call_cli_mode mode, char *number)
-{
-       CallObject *co = NULL;
-
-       dbg("Entry");
-
-       // Call Core object
-       co = tcore_call_object_current_on_mt_processing(o);
-       if (!co) {
-               err("Failed to find Call Core object!");
-               return;
-       }
-
-       // Set CLI information
-       tcore_call_object_set_cli_info(co, mode, number);
-
-       dbg("Exit");
-       return;
-}
-
-static void s_call_info_mt_cna(CoreObject *o, enum tcore_call_cna_mode mode, char *name, int dcs)
-{
-       CallObject *co = NULL;
-
-       dbg("Entry");
-
-       // Call Core object
-       co = tcore_call_object_current_on_mt_processing(o);
-       if (!co) {
-               err("Failed to find Call Core object!");
-               return;
-       }
-
-       // Set CNA information
-       tcore_call_object_set_cna_info(co, mode, name, dcs);
-
-       dbg("Exit");
-       return;
-}
-
-static void s_call_info_mt_forwarded_call(CoreObject *o, char *number)
-{
-       TcorePlugin *plugin = NULL;
-       CallObject *co = NULL;
-       int id = 0;
-
-       dbg("Entry");
-
-       // Parent plugin
-       plugin = tcore_object_ref_plugin(o);
-
-       // Call Core object
-       co = tcore_call_object_find_by_number(o, number);
-       if (!co) {
-               err("Failed to find Call Core object!");
-               return;
-       }
-
-       // Call ID
-       id = tcore_call_object_get_id(co);
-
-       // Send notification to TAPI
-       tcore_server_send_notification(tcore_plugin_ref_server(plugin),
-                                                                  tcore_plugin_ref_core_object(plugin, "call"),
-                                                                  TNOTI_CALL_INFO_FORWARDED_CALL,
-                                                                  sizeof(unsigned int),
-                                                                  (void *) &id);
-
-       dbg("Exit");
-       return;
-}
-
-static void s_call_info_mt_deflected_call(CoreObject *o, char *number)
-{
-       TcorePlugin *plugin = NULL;
-       CallObject *co = NULL;
-       int id = 0;
-
-       dbg("Entry");
-
-       // Parent plugin
-       plugin = tcore_object_ref_plugin(o);
-
-       // Call Core object
-       co = tcore_call_object_find_by_number(o, number);
-       if (!co) {
-               err("Failed to find Call Core object!");
-               return;
-       }
-
-       // Call ID
-       id = tcore_call_object_get_id(co);
-
-       // Send notification to TAPI
-       tcore_server_send_notification(tcore_plugin_ref_server(plugin),
-                                                                  tcore_plugin_ref_core_object(plugin, "call"),
-                                                                  TNOTI_CALL_INFO_DEFLECTED_CALL,
-                                                                  sizeof(unsigned int),
-                                                                  (void *) &id);
-
-       dbg("Exit");
-       return;
-}
-
-static void s_call_info_mt_transfered(CoreObject *o, char *number)
-{
-       TcorePlugin *plugin = NULL;
-       CallObject *co = NULL;
-       int id = 0;
-
-       dbg("Entry");
-
-       // Parent plugin
-       plugin = tcore_object_ref_plugin(o);
-
-       // Call Core object
-       co = tcore_call_object_find_by_number(o, number);
-       if (!co) {
-               err("Failed to find Call Core object!");
-               return;
-       }
-
-       // Call ID
-       id = tcore_call_object_get_id(co);
-
-       // Send notification to TAPI
-       tcore_server_send_notification(tcore_plugin_ref_server(plugin),
-                                                                  tcore_plugin_ref_core_object(plugin, "call"),
-                                                                  TNOTI_CALL_INFO_TRANSFERED_CALL,
-                                                                  sizeof(unsigned int),
-                                                                  (void *) &id);
-
-       dbg("Exit");
-       return;
-}
-
-static void s_call_info_held(CoreObject *o, char *number)
-{
-       TcorePlugin *plugin = NULL;
-       CallObject *co = NULL;
-       int id = 0;
-
-       dbg("Entry");
-
-       // Parent plugin
-       plugin = tcore_object_ref_plugin(o);
-
-       // Call Core object
-       co = tcore_call_object_find_by_number(o, number);
-       if (!co) {
-               err("Failed to find Call Core object!");
-               return;
-       }
-
-       // Call ID
-       id = tcore_call_object_get_id(co);
-
-       // Send notification to TAPI
-       tcore_server_send_notification(tcore_plugin_ref_server(plugin),
-                                                                  tcore_plugin_ref_core_object(plugin, "call"),
-                                                                  TNOTI_CALL_INFO_HELD,
-                                                                  sizeof(unsigned int),
-                                                                  (void *) &id);
-
-       dbg("Exit");
-       return;
-}
-
-static void s_call_info_active(CoreObject *o, char *number)
-{
-       TcorePlugin *plugin = NULL;
-       CallObject *co = NULL;
-       int id = 0;
-
-       dbg("Entry");
-
-       // Parent plugin
-       plugin = tcore_object_ref_plugin(o);
-
-       // Call Core object
-       co = tcore_call_object_find_by_number(o, number);
-       if (!co) {
-               err("Failed to find Call Core object!");
-               return;
-       }
-
-       // Call ID
-       id = tcore_call_object_get_id(co);
-
-       // Send notification to TAPI
-       tcore_server_send_notification(tcore_plugin_ref_server(plugin),
-                                                                  tcore_plugin_ref_core_object(plugin, "call"),
-                                                                  TNOTI_CALL_INFO_ACTIVE,
-                                                                  sizeof(unsigned int),
-                                                                  (void *) &id);
-
-       dbg("Exit");
-       return;
-}
-
-static void s_call_info_joined(CoreObject *o, char *number)
-{
-       TcorePlugin *plugin = NULL;
-       CallObject *co = NULL;
-       int id = 0;
-
-       dbg("Entry");
-
-       // Parent plugin
-       plugin = tcore_object_ref_plugin(o);
-
-       // Call Core object
-       co = tcore_call_object_find_by_number(o, number);
-       if (!co) {
-               err("Failed to find Call Core object!");
-               return;
-       }
-
-       // Call ID
-       id = tcore_call_object_get_id(co);
-
-       // Send notification to TAPI
-       tcore_server_send_notification(tcore_plugin_ref_server(plugin),
-                                                                  tcore_plugin_ref_core_object(plugin, "call"),
-                                                                  TNOTI_CALL_INFO_JOINED,
-                                                                  sizeof(unsigned int),
-                                                                  (void *) &id);
-
-       dbg("Exit");
-       return;
-}
-
-static void s_call_info_released_on_hold(CoreObject *o, char *number)
-{
-       TcorePlugin *plugin = NULL;
-       CallObject *co = NULL;
-       int id = 0;
-
-       dbg("Entry");
-
-       // Parent plugin
-       plugin = tcore_object_ref_plugin(o);
-
-       // Call Core object
-       co = tcore_call_object_find_by_number(o, number);
-       if (!co) {
-               err("Failed to find Call Core object!");
-               return;
-       }
-
-       // Call ID
-       id = tcore_call_object_get_id(co);
-
-       // Send notification to TAPI
-       tcore_server_send_notification(tcore_plugin_ref_server(plugin),
-                                                                  tcore_plugin_ref_core_object(plugin, "call"),
-                                                                  TNOTI_CALL_INFO_RELEASED_ON_HOLD,
-                                                                  sizeof(unsigned int),
-                                                                  (void *) &id);
-
-       dbg("Exit");
-       return;
-}
-
-static void s_call_info_transfer_alert(CoreObject *o, char *number)
-{
-       TcorePlugin *plugin = NULL;
-       CallObject *co = NULL;
-       int id = 0;
-
-       dbg("Entry");
-
-       // Parent plugin
-       plugin = tcore_object_ref_plugin(o);
-
-       // Call Core object
-       co = tcore_call_object_find_by_number(o, number);
-       if (!co) {
-               err("Failed to find Call Core object!");
-               return;
-       }
-
-       // Call ID
-       id = tcore_call_object_get_id(co);
-
-       // Send notification to TAPI
-       tcore_server_send_notification(tcore_plugin_ref_server(plugin),
-                                                                  tcore_plugin_ref_core_object(plugin, "call"),
-                                                                  TNOTI_CALL_INFO_TRANSFER_ALERT,
-                                                                  sizeof(unsigned int),
-                                                                  (void *) &id);
-
-       dbg("Exit");
-       return;
-}
-
-static void s_call_info_transfered(CoreObject *o, char *number)
-{
-       TcorePlugin *plugin = NULL;
-       CallObject *co = NULL;
-       int id = 0;
-
-       dbg("Entry");
-
-       // Parent plugin
-       plugin = tcore_object_ref_plugin(o);
-
-       // Call Core object
-       co = tcore_call_object_find_by_number(o, number);
-       if (!co) {
-               err("Failed to find Call Core object!");
-               return;
-       }
-
-       // Call ID
-       id = tcore_call_object_get_id(co);
-
-       // Send notification to TAPI
-       tcore_server_send_notification(tcore_plugin_ref_server(plugin),
-                                                                  tcore_plugin_ref_core_object(plugin, "call"),
-                                                                  TNOTI_CALL_INFO_TRANSFERED,
-                                                                  sizeof(unsigned int),
-                                                                  (void *) &id);
-
-       dbg("Exit");
-       return;
-}
-
-static void s_call_info_cf_check_message(CoreObject *o, char *number)
-{
-       TcorePlugin *plugin = NULL;
-       CallObject *co = NULL;
-       int id = 0;
-
-       dbg("Entry");
-
-       // Parent plugin
-       plugin = tcore_object_ref_plugin(o);
-
-       // Call Core object
-       co = tcore_call_object_find_by_number(o, number);
-       if (!co) {
-               err("Failed to find Call Core object!");
-               return;
-       }
-
-       // Call ID
-       id = tcore_call_object_get_id(co);
-
-       // Send notification to TAPI
-       tcore_server_send_notification(tcore_plugin_ref_server(plugin),
-                                                                  tcore_plugin_ref_core_object(plugin, "call"),
-                                                                  TNOTI_CALL_INFO_CF_CHECK_MESSAGE,
-                                                                  sizeof(unsigned int),
-                                                                  (void *) &id);
-
-       dbg("Exit");
-       return;
-}
-
-// Call Information Operations
-static struct tcore_call_information_operations call_information_ops = {
-       .mo_call_col = 0,
-       .mo_call_waiting = s_call_info_mo_waiting,
-       .mo_call_cug = 0,
-       .mo_call_forwarded = s_call_info_mo_forwarded,
-       .mo_call_barred_incoming = s_call_info_mo_barred_incoming,
-       .mo_call_barred_outgoing = s_call_info_mo_barred_outgoing,
-       .mo_call_deflected = s_call_info_mo_deflected,
-       .mo_call_clir_suppression_reject = s_call_info_mo_clir_suppression_reject,
-       .mo_call_cfu = s_call_info_mo_cfu,
-       .mo_call_cfc = s_call_info_mo_cfc,
-       .mt_call_cli = s_call_info_mt_cli,
-       .mt_call_cna = s_call_info_mt_cna,
-       .mt_call_forwarded_call = s_call_info_mt_forwarded_call,
-       .mt_call_cug_call = 0,
-       .mt_call_deflected_call = s_call_info_mt_deflected_call,
-       .mt_call_transfered = s_call_info_mt_transfered,
-       .call_held = s_call_info_held,
-       .call_active = s_call_info_active,
-       .call_joined = s_call_info_joined,
-       .call_released_on_hold = s_call_info_released_on_hold,
-       .call_transfer_alert = s_call_info_transfer_alert,
-       .call_transfered = s_call_info_transfered,
-       .call_cf_check_message = s_call_info_cf_check_message,
-};
-
-gboolean s_call_init(TcorePlugin *p, TcoreHal *h)
-{
-       CoreObject *o = NULL;
-       struct property_call_info *data = NULL;
-
-       dbg("Entry");
-
-       // Creating Call COre object
-       o = tcore_call_new(p, "call", &call_ops, h);
-       if (!o) {
-               err("Failed to create Call Core Object");
-               return FALSE;
-       }
-
-       // Set Call Operations
-       tcore_call_information_set_operations(o, &call_information_ops);
-
-       // Add Callbacks
-       tcore_object_add_callback(o, "+XCALLSTAT", on_notification_call_info, NULL);
-       tcore_object_add_callback(o, "+CLIP", on_notification_call_clip_info, NULL);
-
-       // User Data
-       data = calloc(sizeof(struct property_call_info *), 1);
-       tcore_plugin_link_property(p, "CALL", data);
-
-       dbg("Exit");
        return TRUE;
 }
 
-void s_call_exit(TcorePlugin *p)
+void s_call_exit(TcorePlugin *cp, CoreObject *co_call)
 {
-       CoreObject *o = NULL;
-       struct property_network_info *data = NULL;
-
-       dbg("Entry");
-
-       o = tcore_plugin_ref_core_object(p, "call");
-
-       // Free Call Core Object */
-       tcore_call_free(o);
-
-       // Free 'CALL' property */
-       data = tcore_plugin_ref_property(p, "CALL");
-       if (data) {
-               g_free(data);
-       }
-
        dbg("Exit");
-       return;
 }