diff --git a/cli/mmcli-modem-voice.c b/cli/mmcli-modem-voice.c index e1f1426a..dac650dd 100644 --- a/cli/mmcli-modem-voice.c +++ b/cli/mmcli-modem-voice.c @@ -52,6 +52,7 @@ static gchar *create_str; static gchar *delete_str; static gboolean hold_and_accept_flag; static gboolean hangup_and_accept_flag; +static gboolean hangup_all_flag; static GOptionEntry entries[] = { { "voice-list-calls", 0, 0, G_OPTION_ARG_NONE, &list_flag, @@ -74,6 +75,10 @@ static GOptionEntry entries[] = { "Hangs up all active calls and accepts the next waiting or held call", NULL }, + { "voice-hangup-all", 0, 0, G_OPTION_ARG_NONE, &hangup_all_flag, + "Hangs up all ongoing (active, waiting, held) calls", + NULL + }, { NULL } }; @@ -105,7 +110,8 @@ mmcli_modem_voice_options_enabled (void) !!create_str + !!delete_str + hold_and_accept_flag + - hangup_and_accept_flag); + hangup_and_accept_flag + + hangup_all_flag); if (n_actions > 1) { g_printerr ("error: too many Voice actions requested\n"); @@ -187,6 +193,31 @@ output_call_info (MMCall *call) g_free (extra); } +static void +hangup_all_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 +hangup_all_ready (MMModemVoice *modem, + GAsyncResult *result, + gpointer nothing) +{ + GError *error = NULL; + + mm_modem_voice_hangup_all_finish (modem, result, &error); + hangup_all_process_reply (error); + + mmcli_async_operation_done (); +} + static void hangup_and_accept_process_reply (const GError *error) { @@ -416,6 +447,16 @@ get_modem_ready (GObject *source, return; } + /* Request to hangup all? */ + if (hangup_all_flag) { + g_debug ("Asynchronously hanging up all calls..."); + mm_modem_voice_hangup_all (ctx->modem_voice, + ctx->cancellable, + (GAsyncReadyCallback)hangup_all_ready, + NULL); + return; + } + g_warn_if_reached (); } @@ -528,5 +569,13 @@ mmcli_modem_voice_run_synchronous (GDBusConnection *connection) return; } + /* Request to hangup all? */ + if (hangup_all_flag) { + g_debug ("Synchronously hanging up all calls..."); + mm_modem_voice_hangup_all_sync (ctx->modem_voice, NULL, &error); + hangup_all_process_reply (error); + return; + } + g_warn_if_reached (); } diff --git a/docs/reference/libmm-glib/libmm-glib-sections.txt b/docs/reference/libmm-glib/libmm-glib-sections.txt index a2087f38..be0bdcfe 100644 --- a/docs/reference/libmm-glib/libmm-glib-sections.txt +++ b/docs/reference/libmm-glib/libmm-glib-sections.txt @@ -1018,6 +1018,9 @@ mm_modem_voice_hangup_and_accept_sync mm_modem_voice_hold_and_accept mm_modem_voice_hold_and_accept_finish mm_modem_voice_hold_and_accept_sync +mm_modem_voice_hangup_all +mm_modem_voice_hangup_all_finish +mm_modem_voice_hangup_all_sync MMModemVoiceClass MMModemVoicePrivate @@ -2847,6 +2850,9 @@ mm_gdbus_modem_voice_call_hangup_and_accept_sync mm_gdbus_modem_voice_call_hold_and_accept mm_gdbus_modem_voice_call_hold_and_accept_finish mm_gdbus_modem_voice_call_hold_and_accept_sync +mm_gdbus_modem_voice_call_hangup_all +mm_gdbus_modem_voice_call_hangup_all_finish +mm_gdbus_modem_voice_call_hangup_all_sync mm_gdbus_modem_voice_set_calls mm_gdbus_modem_voice_emit_call_added @@ -2856,6 +2862,7 @@ mm_gdbus_modem_voice_complete_delete_call mm_gdbus_modem_voice_complete_list_calls mm_gdbus_modem_voice_complete_hangup_and_accept mm_gdbus_modem_voice_complete_hold_and_accept +mm_gdbus_modem_voice_complete_hangup_all mm_gdbus_modem_voice_interface_info mm_gdbus_modem_voice_override_properties diff --git a/introspection/org.freedesktop.ModemManager1.Modem.Voice.xml b/introspection/org.freedesktop.ModemManager1.Modem.Voice.xml index b6c16f13..72674e61 100644 --- a/introspection/org.freedesktop.ModemManager1.Modem.Voice.xml +++ b/introspection/org.freedesktop.ModemManager1.Modem.Voice.xml @@ -99,6 +99,18 @@ --> + + +