+static void __on_response_imc_call_handle_error_report(TcorePending *p,
+ guint data_len, const void *data, void *user_data)
+{
+ const TcoreAtResponse *at_resp = data;
+ CoreObject *co = tcore_pending_ref_core_object(p);
+ ImcRespCbData *resp_cb_data = user_data;
+ TelCallResult result = TEL_CALL_RESULT_FAILURE;
+ GSList *tokens = NULL;
+ dbg("entry");
+
+ tcore_check_return_assert(co != NULL);
+ tcore_check_return_assert(resp_cb_data != NULL);
+
+ if (at_resp && at_resp->success) {
+ GSList *resp_data = NULL;
+ gchar *resp_str;
+ gint error;
+
+ resp_data = at_resp->lines;
+ if (!resp_data) {
+ err("invalid response data received");
+ goto OUT;
+ }
+
+ tokens = tcore_at_tok_new(resp_data->data);
+ resp_str = g_slist_nth_data(tokens, 0);
+ if (!resp_str) {
+ err("In extended error report - <category> missing");
+ goto OUT;
+ }
+ dbg("category[%s]", resp_str);
+
+ resp_str = g_slist_nth_data(tokens, 1);
+ if (!resp_str) {
+ err("In extended error report - <cause> missing");
+ goto OUT;
+ }
+ error = atoi(resp_str);
+ dbg("Cause: [%d] description: [%s]", error, g_slist_nth_data(tokens, 2));
+
+ result = __convert_imc_extended_err_tel_call_result(error);
+ dbg("result: [%d]", result);
+ } else {
+ err("Response - [NOK]");
+ }
+OUT:
+
+ dbg("%s: [%s]", IMC_GET_DATA_FROM_RESP_CB_DATA(resp_cb_data),
+ (result == TEL_CALL_RESULT_SUCCESS ? "SUCCESS" : "FAIL"));
+
+ /* Invoke callback */
+ if (resp_cb_data->cb)
+ resp_cb_data->cb(co, (gint)result, NULL, resp_cb_data->cb_data);
+
+ /* Free callback data */
+ imc_destroy_resp_cb_data(resp_cb_data);
+
+ /* Free tokens*/
+ tcore_at_tok_free(tokens);
+}
+
+static void __on_response_imc_call_end_cause(TcorePending *p,
+ guint data_len, const void *data, void *user_data)
+{
+ const TcoreAtResponse *at_resp = data;
+ CoreObject *co = tcore_pending_ref_core_object(p);
+ ImcRespCbData *resp_cb_data = user_data;
+ TelCallStatusIdleNoti idle;
+ TcoreNotification command;
+ TelCallEndCause cause = TEL_CALL_END_CAUSE_NONE;
+ guint *call_id;
+ GSList *tokens = NULL;
+
+ dbg("entry");
+
+ tcore_check_return_assert(co != NULL);
+ tcore_check_return_assert(resp_cb_data != NULL);
+ call_id = IMC_GET_DATA_FROM_RESP_CB_DATA(resp_cb_data);
+
+ if (at_resp && at_resp->success) {
+ GSList *resp_data = NULL;
+ gchar *resp_str;
+ gint error;
+
+ resp_data = at_resp->lines;
+ if (!resp_data) {
+ err("invalid response data received");
+ goto OUT;
+ }
+ tokens = tcore_at_tok_new(resp_data->data);
+ resp_str = g_slist_nth_data(tokens, 0);
+ if (!resp_str) {
+ err("In extended error report - <category> missing");
+ goto OUT;
+ }
+ dbg("category[%s]", resp_str);
+ resp_str = g_slist_nth_data(tokens, 1);
+ if (!resp_str) {
+ err("In extended error report - <cause> missing");
+ goto OUT;
+ }
+ error = atoi(resp_str);
+ dbg("cause: [%d] description: [%s]", error, g_slist_nth_data(tokens, 2));
+
+ cause = __convert_imc_extended_err_call_end_cause(error);
+ dbg("cause: [%d]", cause);
+
+ } else {
+ err("RESPONSE - [NOK]");
+ }
+OUT:
+ command = TCORE_NOTIFICATION_CALL_STATUS_IDLE;
+ idle.call_id = *call_id;
+
+ idle.cause = cause;
+
+ /* Send notification */
+ tcore_object_send_notification(co, command,
+ sizeof(TelCallStatusIdleNoti), &idle);
+
+ /* Free callback data */
+ imc_destroy_resp_cb_data(resp_cb_data);
+
+ /* Free tokens*/
+ tcore_at_tok_free(tokens);
+}