2018-08-03 14:22:12 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2018 Purism SPC
|
|
|
|
*
|
|
|
|
* This file is part of Calls.
|
|
|
|
*
|
|
|
|
* Calls is free software: you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Calls is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Calls. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* Author: Bob Ham <bob.ham@puri.sm>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2021-06-18 09:10:36 +00:00
|
|
|
#define G_LOG_DOMAIN "CallsMMCall"
|
|
|
|
|
2018-08-03 14:22:12 +00:00
|
|
|
#include "calls-mm-call.h"
|
|
|
|
#include "calls-call.h"
|
|
|
|
#include "calls-message-source.h"
|
2023-01-21 15:42:39 +00:00
|
|
|
#include "calls-util.h"
|
2018-08-03 14:22:12 +00:00
|
|
|
|
|
|
|
#include <libmm-glib/libmm-glib.h>
|
|
|
|
#include <glib/gi18n.h>
|
|
|
|
|
|
|
|
|
2022-04-24 10:24:55 +00:00
|
|
|
struct _CallsMMCall {
|
2018-08-03 14:22:12 +00:00
|
|
|
GObject parent_instance;
|
|
|
|
MMCall *mm_call;
|
2023-01-18 20:24:29 +00:00
|
|
|
char *disconnect_reason;
|
2018-08-03 14:22:12 +00:00
|
|
|
};
|
|
|
|
|
2021-04-05 04:00:10 +00:00
|
|
|
static void calls_mm_call_message_source_interface_init (CallsMessageSourceInterface *iface);
|
2018-08-03 14:22:12 +00:00
|
|
|
|
2021-04-05 04:00:10 +00:00
|
|
|
G_DEFINE_TYPE_WITH_CODE (CallsMMCall, calls_mm_call, CALLS_TYPE_CALL,
|
2018-08-03 14:22:12 +00:00
|
|
|
G_IMPLEMENT_INTERFACE (CALLS_TYPE_MESSAGE_SOURCE,
|
2021-04-05 04:00:10 +00:00
|
|
|
calls_mm_call_message_source_interface_init))
|
2018-08-03 14:22:12 +00:00
|
|
|
|
|
|
|
enum {
|
|
|
|
PROP_0,
|
|
|
|
PROP_MM_CALL,
|
2020-02-22 23:55:45 +00:00
|
|
|
PROP_LAST_PROP,
|
|
|
|
};
|
2020-03-17 21:54:25 +00:00
|
|
|
static GParamSpec *props[PROP_LAST_PROP];
|
2018-08-03 14:22:12 +00:00
|
|
|
|
|
|
|
static void
|
2021-10-22 05:21:11 +00:00
|
|
|
notify_id_cb (CallsMMCall *self,
|
2023-01-18 20:24:29 +00:00
|
|
|
const char *id)
|
2018-08-03 14:22:12 +00:00
|
|
|
{
|
2021-12-10 08:46:32 +00:00
|
|
|
calls_call_set_id (CALLS_CALL (self), id);
|
2018-08-03 14:22:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-04-24 10:24:55 +00:00
|
|
|
struct CallsMMCallStateReasonMap {
|
|
|
|
MMCallStateReason value;
|
2023-01-18 20:24:29 +00:00
|
|
|
const char *desc;
|
2018-08-03 14:22:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const struct CallsMMCallStateReasonMap STATE_REASON_MAP[] = {
|
|
|
|
|
|
|
|
#define row(ENUMVALUE,DESCRIPTION) \
|
2020-02-22 23:55:45 +00:00
|
|
|
{ MM_CALL_STATE_REASON_##ENUMVALUE, DESCRIPTION }
|
2018-08-03 14:22:12 +00:00
|
|
|
|
2022-06-17 00:02:52 +00:00
|
|
|
row (UNKNOWN, N_("Unknown reason")),
|
2020-01-21 13:25:47 +00:00
|
|
|
row (OUTGOING_STARTED, N_("Outgoing call started")),
|
|
|
|
row (INCOMING_NEW, N_("New incoming call")),
|
|
|
|
row (ACCEPTED, N_("Call accepted")),
|
|
|
|
row (TERMINATED, N_("Call ended")),
|
|
|
|
row (REFUSED_OR_BUSY, N_("Call disconnected (busy or call refused)")),
|
2021-10-22 05:21:11 +00:00
|
|
|
row (ERROR, N_("Call disconnected (wrong id or network problem)")),
|
2020-01-21 13:25:47 +00:00
|
|
|
row (AUDIO_SETUP_FAILED, N_("Call disconnected (error setting up audio channel)")),
|
2022-09-17 07:11:12 +00:00
|
|
|
/* Translators: Transfer is for active or held calls */
|
2020-01-21 13:25:47 +00:00
|
|
|
row (TRANSFERRED, N_("Call transferred")),
|
2022-09-17 07:11:12 +00:00
|
|
|
/* Translators: Deflecting is for incoming or waiting calls */
|
2020-01-21 13:25:47 +00:00
|
|
|
row (DEFLECTED, N_("Call deflected")),
|
2018-08-03 14:22:12 +00:00
|
|
|
|
|
|
|
#undef row
|
|
|
|
|
|
|
|
{ -1, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
2022-04-24 10:24:55 +00:00
|
|
|
set_disconnect_reason (CallsMMCall *self,
|
|
|
|
MMCallStateReason reason)
|
2018-08-03 14:22:12 +00:00
|
|
|
{
|
|
|
|
const struct CallsMMCallStateReasonMap *map_row;
|
2020-01-21 13:25:47 +00:00
|
|
|
|
|
|
|
if (self->disconnect_reason)
|
2022-04-24 10:24:55 +00:00
|
|
|
g_free (self->disconnect_reason);
|
2018-08-03 14:22:12 +00:00
|
|
|
|
2022-04-24 10:24:55 +00:00
|
|
|
for (map_row = STATE_REASON_MAP; map_row->desc; ++map_row) {
|
|
|
|
if (map_row->value == reason) {
|
|
|
|
self->disconnect_reason =
|
|
|
|
g_strdup (gettext (map_row->desc));
|
|
|
|
return;
|
2018-08-03 14:22:12 +00:00
|
|
|
}
|
2022-04-24 10:24:55 +00:00
|
|
|
}
|
2018-08-03 14:22:12 +00:00
|
|
|
|
2020-01-21 13:25:47 +00:00
|
|
|
self->disconnect_reason =
|
|
|
|
g_strdup_printf (_("Call disconnected (unknown reason code %i)"),
|
2022-04-24 10:24:55 +00:00
|
|
|
(int) reason);
|
2018-08-03 14:22:12 +00:00
|
|
|
|
2020-01-21 13:25:47 +00:00
|
|
|
g_warning ("%s", self->disconnect_reason);
|
2018-08-03 14:22:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-04-24 10:24:55 +00:00
|
|
|
struct CallsMMCallStateMap {
|
|
|
|
MMCallState mm;
|
|
|
|
CallsCallState calls;
|
2023-01-18 20:24:29 +00:00
|
|
|
const char *desc;
|
2018-08-03 14:22:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const struct CallsMMCallStateMap STATE_MAP[] = {
|
|
|
|
|
2018-09-27 08:37:14 +00:00
|
|
|
#define row(MMENUM,CALLSENUM) \
|
|
|
|
{ MM_CALL_STATE_##MMENUM, CALLS_CALL_STATE_##CALLSENUM, #MMENUM } \
|
2018-08-03 14:22:12 +00:00
|
|
|
|
2019-07-22 10:52:31 +00:00
|
|
|
row (UNKNOWN, DIALING),
|
2018-09-27 08:37:14 +00:00
|
|
|
row (DIALING, DIALING),
|
2018-09-27 08:42:13 +00:00
|
|
|
row (RINGING_OUT, ALERTING),
|
2018-09-27 08:37:14 +00:00
|
|
|
row (RINGING_IN, INCOMING),
|
|
|
|
row (ACTIVE, ACTIVE),
|
|
|
|
row (HELD, HELD),
|
|
|
|
row (TERMINATED, DISCONNECTED),
|
2018-08-03 14:22:12 +00:00
|
|
|
|
|
|
|
#undef row
|
|
|
|
|
|
|
|
{ -1, -1 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
2022-04-24 10:24:55 +00:00
|
|
|
state_changed_cb (CallsMMCall *self,
|
2022-06-17 00:02:52 +00:00
|
|
|
MMCallState old_state,
|
|
|
|
MMCallState new_state,
|
2022-04-24 10:24:55 +00:00
|
|
|
MMCallStateReason reason)
|
2018-08-03 14:22:12 +00:00
|
|
|
{
|
2022-06-17 00:02:52 +00:00
|
|
|
const struct CallsMMCallStateMap *state_map_row;
|
|
|
|
const struct CallsMMCallStateReasonMap *reason_map_row;
|
|
|
|
const char *state_str = "state unmatched";
|
|
|
|
const char *reason_str = "reason unmatched";
|
2022-08-05 09:11:52 +00:00
|
|
|
CallsCallState call_state = CALLS_CALL_STATE_UNKNOWN;
|
2018-08-03 14:22:12 +00:00
|
|
|
|
2022-06-17 00:02:52 +00:00
|
|
|
if (new_state == MM_CALL_STATE_TERMINATED)
|
2022-04-24 10:24:55 +00:00
|
|
|
set_disconnect_reason (self, reason);
|
|
|
|
|
2022-06-17 00:02:52 +00:00
|
|
|
|
|
|
|
for (state_map_row = STATE_MAP; state_map_row->mm != -1; state_map_row++) {
|
|
|
|
if (state_map_row->mm == new_state) {
|
|
|
|
state_str = state_map_row->desc;
|
2022-08-05 09:11:52 +00:00
|
|
|
call_state = state_map_row->calls;
|
2022-06-17 00:02:52 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2022-08-05 09:11:52 +00:00
|
|
|
|
|
|
|
if (state_map_row->mm == -1 &&
|
|
|
|
new_state == MM_CALL_STATE_WAITING) {
|
2023-01-18 20:24:29 +00:00
|
|
|
MMCallDirection direction = mm_call_get_direction (self->mm_call);
|
|
|
|
gboolean outgoing = direction == MM_CALL_DIRECTION_OUTGOING;
|
2022-08-05 09:11:52 +00:00
|
|
|
|
2023-01-18 20:24:29 +00:00
|
|
|
call_state = outgoing ? CALLS_CALL_STATE_ALERTING : CALLS_CALL_STATE_INCOMING;
|
2022-08-05 09:11:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_assert_cmpint (call_state, !=, CALLS_CALL_STATE_UNKNOWN);
|
2022-06-17 00:02:52 +00:00
|
|
|
|
|
|
|
for (reason_map_row = STATE_REASON_MAP; reason_map_row->value != -1; reason_map_row++) {
|
|
|
|
if (reason_map_row->value == reason) {
|
|
|
|
reason_str = gettext (reason_map_row->desc);
|
|
|
|
break;
|
2018-08-03 14:22:12 +00:00
|
|
|
}
|
2022-04-24 10:24:55 +00:00
|
|
|
}
|
2022-06-17 00:02:52 +00:00
|
|
|
g_assert_cmpint (reason_map_row->value, !=, -1);
|
|
|
|
|
|
|
|
g_debug ("MM call '%s' changed state to `%s': %s",
|
|
|
|
mm_call_get_path (self->mm_call),
|
|
|
|
state_str,
|
|
|
|
reason_str);
|
2022-08-05 09:11:52 +00:00
|
|
|
calls_call_set_state (CALLS_CALL (self), call_state);
|
2018-08-03 14:22:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-04-26 10:00:02 +00:00
|
|
|
static const char *
|
|
|
|
calls_mm_call_get_protocol (CallsCall *self)
|
|
|
|
{
|
|
|
|
return "tel";
|
|
|
|
}
|
|
|
|
|
2022-04-24 10:24:55 +00:00
|
|
|
struct CallsMMOperationData {
|
2023-01-18 20:24:29 +00:00
|
|
|
const char *desc;
|
2018-08-03 14:22:12 +00:00
|
|
|
CallsMMCall *self;
|
2022-04-24 10:24:55 +00:00
|
|
|
gboolean (*finish_func) (MMCall *, GAsyncResult *, GError **);
|
2018-08-03 14:22:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
operation_cb (MMCall *mm_call,
|
|
|
|
GAsyncResult *res,
|
|
|
|
struct CallsMMOperationData *data)
|
|
|
|
{
|
|
|
|
gboolean ok;
|
2022-04-24 10:24:55 +00:00
|
|
|
|
2021-02-24 08:26:47 +00:00
|
|
|
g_autoptr (GError) error = NULL;
|
2018-08-03 14:22:12 +00:00
|
|
|
|
|
|
|
ok = data->finish_func (mm_call, res, &error);
|
2022-04-24 10:24:55 +00:00
|
|
|
if (!ok) {
|
2022-06-17 00:02:52 +00:00
|
|
|
g_warning ("Error %s MM call '%s': %s (domain: %s [%d])",
|
2022-04-24 10:24:55 +00:00
|
|
|
data->desc,
|
2022-06-17 00:02:52 +00:00
|
|
|
mm_call_get_path (mm_call),
|
|
|
|
error->message,
|
|
|
|
g_quark_to_string (error->domain),
|
|
|
|
error->code);
|
2022-04-24 10:24:55 +00:00
|
|
|
CALLS_ERROR (data->self, error);
|
|
|
|
}
|
2018-08-03 14:22:12 +00:00
|
|
|
|
|
|
|
g_free (data);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define DEFINE_OPERATION(op,name,desc_str) \
|
|
|
|
static void \
|
|
|
|
name (CallsCall *call) \
|
|
|
|
{ \
|
|
|
|
CallsMMCall *self = CALLS_MM_CALL (call); \
|
|
|
|
struct CallsMMOperationData *data; \
|
|
|
|
\
|
|
|
|
data = g_new0 (struct CallsMMOperationData, 1); \
|
|
|
|
data->desc = desc_str; \
|
|
|
|
data->self = self; \
|
|
|
|
data->finish_func = mm_call_##op##_finish; \
|
|
|
|
\
|
|
|
|
mm_call_##op \
|
|
|
|
(self->mm_call, \
|
|
|
|
NULL, \
|
|
|
|
(GAsyncReadyCallback) operation_cb, \
|
|
|
|
data); \
|
|
|
|
}
|
|
|
|
|
2022-04-24 10:24:55 +00:00
|
|
|
DEFINE_OPERATION (accept, calls_mm_call_answer, "accepting");
|
|
|
|
DEFINE_OPERATION (hangup, calls_mm_call_hang_up, "hanging up");
|
|
|
|
DEFINE_OPERATION (start, calls_mm_call_start_call, "starting outgoing call");
|
2018-08-03 14:22:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
static void
|
2023-01-18 20:24:29 +00:00
|
|
|
calls_mm_call_send_dtmf_tone (CallsCall *call, char key)
|
2018-08-03 14:22:12 +00:00
|
|
|
{
|
|
|
|
CallsMMCall *self = CALLS_MM_CALL (call);
|
|
|
|
struct CallsMMOperationData *data;
|
|
|
|
char key_str[2] = { key, '\0' };
|
|
|
|
|
|
|
|
data = g_new0 (struct CallsMMOperationData, 1);
|
|
|
|
data->desc = "sending DTMF";
|
|
|
|
data->self = self;
|
|
|
|
data->finish_func = mm_call_send_dtmf_finish;
|
|
|
|
|
|
|
|
mm_call_send_dtmf
|
|
|
|
(self->mm_call,
|
2022-04-24 10:24:55 +00:00
|
|
|
key_str,
|
|
|
|
NULL,
|
|
|
|
(GAsyncReadyCallback) operation_cb,
|
|
|
|
data);
|
2018-08-03 14:22:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
CallsMMCall *self = CALLS_MM_CALL (object);
|
|
|
|
|
|
|
|
switch (property_id) {
|
|
|
|
case PROP_MM_CALL:
|
|
|
|
g_set_object (&self->mm_call,
|
|
|
|
MM_CALL (g_value_get_object (value)));
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
constructed (GObject *object)
|
|
|
|
{
|
|
|
|
CallsMMCall *self = CALLS_MM_CALL (object);
|
|
|
|
MmGdbusCall *gdbus_call = MM_GDBUS_CALL (self->mm_call);
|
2018-09-27 08:46:47 +00:00
|
|
|
MMCallState state;
|
2022-06-17 00:02:52 +00:00
|
|
|
MMCallDirection direction;
|
|
|
|
const char *number;
|
|
|
|
const char *path;
|
|
|
|
gboolean outgoing;
|
2018-08-03 14:22:12 +00:00
|
|
|
|
|
|
|
g_signal_connect_swapped (gdbus_call, "notify::number",
|
2021-10-22 05:21:11 +00:00
|
|
|
G_CALLBACK (notify_id_cb), self);
|
2018-08-03 14:22:12 +00:00
|
|
|
g_signal_connect_swapped (gdbus_call, "state-changed",
|
|
|
|
G_CALLBACK (state_changed_cb), self);
|
|
|
|
|
2022-06-17 00:02:52 +00:00
|
|
|
number = mm_call_get_number (self->mm_call);
|
|
|
|
notify_id_cb (self, number);
|
2018-08-03 14:22:12 +00:00
|
|
|
|
2018-09-27 08:46:47 +00:00
|
|
|
state = mm_call_get_state (self->mm_call);
|
|
|
|
state_changed_cb (self,
|
2022-06-19 15:22:27 +00:00
|
|
|
MM_CALL_STATE_UNKNOWN,
|
2018-09-27 08:46:47 +00:00
|
|
|
state,
|
|
|
|
mm_call_get_state_reason (self->mm_call));
|
|
|
|
|
2022-06-17 00:02:52 +00:00
|
|
|
direction = mm_call_get_direction (self->mm_call);
|
|
|
|
outgoing = direction == MM_CALL_DIRECTION_OUTGOING;
|
|
|
|
|
2018-08-03 14:22:12 +00:00
|
|
|
/* Start outgoing call */
|
2022-06-17 00:02:52 +00:00
|
|
|
if (state == MM_CALL_STATE_UNKNOWN &&
|
|
|
|
outgoing)
|
2021-12-10 07:51:25 +00:00
|
|
|
calls_mm_call_start_call (CALLS_CALL (self));
|
2018-08-03 14:22:12 +00:00
|
|
|
|
2022-06-17 00:02:52 +00:00
|
|
|
path = mm_call_get_path (self->mm_call);
|
|
|
|
|
|
|
|
if (direction == MM_CALL_DIRECTION_UNKNOWN)
|
|
|
|
g_debug ("New call (%s) with '%s'",
|
|
|
|
path, number);
|
|
|
|
else
|
|
|
|
g_debug ("New %s call (%s) %s %s",
|
|
|
|
outgoing ? "outgoing" : "incoming",
|
|
|
|
path,
|
|
|
|
outgoing ? "to" : "from",
|
|
|
|
number);
|
|
|
|
|
2020-02-18 15:01:22 +00:00
|
|
|
G_OBJECT_CLASS (calls_mm_call_parent_class)->constructed (object);
|
2018-08-03 14:22:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
dispose (GObject *object)
|
|
|
|
{
|
|
|
|
CallsMMCall *self = CALLS_MM_CALL (object);
|
|
|
|
|
|
|
|
g_clear_object (&self->mm_call);
|
|
|
|
|
2020-02-18 15:01:22 +00:00
|
|
|
G_OBJECT_CLASS (calls_mm_call_parent_class)->dispose (object);
|
2018-08-03 14:22:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
finalize (GObject *object)
|
|
|
|
{
|
|
|
|
CallsMMCall *self = CALLS_MM_CALL (object);
|
|
|
|
|
|
|
|
g_free (self->disconnect_reason);
|
|
|
|
|
2020-02-18 15:01:22 +00:00
|
|
|
G_OBJECT_CLASS (calls_mm_call_parent_class)->finalize (object);
|
2018-08-03 14:22:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
calls_mm_call_class_init (CallsMMCallClass *klass)
|
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
2021-04-05 04:00:10 +00:00
|
|
|
CallsCallClass *call_class = CALLS_CALL_CLASS (klass);
|
2018-08-03 14:22:12 +00:00
|
|
|
|
|
|
|
object_class->set_property = set_property;
|
|
|
|
object_class->constructed = constructed;
|
|
|
|
object_class->dispose = dispose;
|
|
|
|
object_class->finalize = finalize;
|
|
|
|
|
2021-04-26 10:00:02 +00:00
|
|
|
call_class->get_protocol = calls_mm_call_get_protocol;
|
2021-04-05 04:00:10 +00:00
|
|
|
call_class->answer = calls_mm_call_answer;
|
|
|
|
call_class->hang_up = calls_mm_call_hang_up;
|
2021-11-16 12:59:06 +00:00
|
|
|
call_class->send_dtmf_tone = calls_mm_call_send_dtmf_tone;
|
2021-04-05 04:00:10 +00:00
|
|
|
|
2020-03-17 21:54:25 +00:00
|
|
|
props[PROP_MM_CALL] = g_param_spec_object ("mm-call",
|
2020-05-29 18:50:19 +00:00
|
|
|
"MM call",
|
|
|
|
"A libmm-glib proxy object for the underlying call object",
|
2020-03-17 21:54:25 +00:00
|
|
|
MM_TYPE_CALL,
|
|
|
|
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
|
|
|
|
g_object_class_install_property (object_class, PROP_MM_CALL, props[PROP_MM_CALL]);
|
2018-08-03 14:22:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2021-04-05 04:00:10 +00:00
|
|
|
calls_mm_call_message_source_interface_init (CallsMessageSourceInterface *iface)
|
2018-08-03 14:22:12 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
calls_mm_call_init (CallsMMCall *self)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CallsMMCall *
|
|
|
|
calls_mm_call_new (MMCall *mm_call)
|
|
|
|
{
|
2021-12-10 07:00:11 +00:00
|
|
|
gboolean inbound;
|
|
|
|
|
2018-08-03 14:22:12 +00:00
|
|
|
g_return_val_if_fail (MM_IS_CALL (mm_call), NULL);
|
|
|
|
|
2021-12-10 07:00:11 +00:00
|
|
|
inbound = mm_call_get_direction (mm_call) == MM_CALL_DIRECTION_INCOMING;
|
2018-08-03 14:22:12 +00:00
|
|
|
return g_object_new (CALLS_TYPE_MM_CALL,
|
|
|
|
"mm-call", mm_call,
|
2021-12-10 07:00:11 +00:00
|
|
|
"inbound", inbound,
|
2022-02-12 13:37:28 +00:00
|
|
|
"call-type", CALLS_CALL_TYPE_CELLULAR,
|
2018-08-03 14:22:12 +00:00
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-01-18 20:24:29 +00:00
|
|
|
const char *
|
2018-08-03 14:22:12 +00:00
|
|
|
calls_mm_call_get_object_path (CallsMMCall *call)
|
|
|
|
{
|
2023-01-18 20:25:39 +00:00
|
|
|
g_return_val_if_fail (CALLS_IS_MM_CALL (call), NULL);
|
|
|
|
|
2018-08-03 14:22:12 +00:00
|
|
|
return mm_call_get_path (call->mm_call);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-01-18 20:24:29 +00:00
|
|
|
const char *
|
2018-08-03 14:22:12 +00:00
|
|
|
calls_mm_call_get_disconnect_reason (CallsMMCall *call)
|
|
|
|
{
|
2023-01-18 20:25:39 +00:00
|
|
|
g_return_val_if_fail (CALLS_IS_MM_CALL (call), NULL);
|
|
|
|
|
2018-08-03 14:22:12 +00:00
|
|
|
return call->disconnect_reason;
|
|
|
|
}
|