aboutsummaryrefslogtreecommitdiff
path: root/cli/mmcli-modem-voice.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2019-06-27 14:50:00 +0200
committerAleksander Morgado <aleksander@aleksander.es>2019-07-11 23:20:59 +0200
commit8b01958cb4f1060c9cda114228168be32090c639 (patch)
treeab38951c4df3304b7b645c3d10368d3ed44e02db /cli/mmcli-modem-voice.c
parent7ceac6f789e4ae65f1c38166f30a906751023aa6 (diff)
api,voice: new Transfer() method
This method will join all active and held calls into a single multiparty call, and then request the network to terminate the call on the subscriber's end and transfer the control of the call to the parties that are still in the call.
Diffstat (limited to 'cli/mmcli-modem-voice.c')
-rw-r--r--cli/mmcli-modem-voice.c51
1 files changed, 50 insertions, 1 deletions
diff --git a/cli/mmcli-modem-voice.c b/cli/mmcli-modem-voice.c
index dac650dd..0eff1f00 100644
--- a/cli/mmcli-modem-voice.c
+++ b/cli/mmcli-modem-voice.c
@@ -53,6 +53,7 @@ static gchar *delete_str;
static gboolean hold_and_accept_flag;
static gboolean hangup_and_accept_flag;
static gboolean hangup_all_flag;
+static gboolean transfer_flag;
static GOptionEntry entries[] = {
{ "voice-list-calls", 0, 0, G_OPTION_ARG_NONE, &list_flag,
@@ -79,6 +80,10 @@ static GOptionEntry entries[] = {
"Hangs up all ongoing (active, waiting, held) calls",
NULL
},
+ { "voice-transfer", 0, 0, G_OPTION_ARG_NONE, &transfer_flag,
+ "Joins active and held calls and disconnects from them",
+ NULL
+ },
{ NULL }
};
@@ -111,7 +116,8 @@ mmcli_modem_voice_options_enabled (void)
!!delete_str +
hold_and_accept_flag +
hangup_and_accept_flag +
- hangup_all_flag);
+ hangup_all_flag +
+ transfer_flag);
if (n_actions > 1) {
g_printerr ("error: too many Voice actions requested\n");
@@ -194,6 +200,31 @@ output_call_info (MMCall *call)
}
static void
+transfer_process_reply (const GError *error)
+{
+ if (error) {
+ g_printerr ("error: couldn't hangup all: '%s'\n",
+ error->message);
+ exit (EXIT_FAILURE);
+ }
+
+ g_print ("operation successful\n");
+}
+
+static void
+transfer_ready (MMModemVoice *modem,
+ GAsyncResult *result,
+ gpointer nothing)
+{
+ GError *error = NULL;
+
+ mm_modem_voice_transfer_finish (modem, result, &error);
+ transfer_process_reply (error);
+
+ mmcli_async_operation_done ();
+}
+
+static void
hangup_all_process_reply (const GError *error)
{
if (error) {
@@ -457,6 +488,16 @@ get_modem_ready (GObject *source,
return;
}
+ /* Request to transfer? */
+ if (transfer_flag) {
+ g_debug ("Asynchronously transferring calls...");
+ mm_modem_voice_transfer (ctx->modem_voice,
+ ctx->cancellable,
+ (GAsyncReadyCallback)transfer_ready,
+ NULL);
+ return;
+ }
+
g_warn_if_reached ();
}
@@ -577,5 +618,13 @@ mmcli_modem_voice_run_synchronous (GDBusConnection *connection)
return;
}
+ /* Request to transfer? */
+ if (transfer_flag) {
+ g_debug ("Synchronously transferring calls...");
+ mm_modem_voice_transfer_sync (ctx->modem_voice, NULL, &error);
+ transfer_process_reply (error);
+ return;
+ }
+
g_warn_if_reached ();
}