aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dan@ioncontrol.co>2025-04-24 20:17:47 -0500
committerDan Williams <dan@ioncontrol.co>2025-05-30 07:59:59 -0500
commit957a141e57e622a9d7eeac160d67be5b0b4cdf7c (patch)
tree142356c083c5304b31d3d2f1c45b12459eee2121
parent2726f8e8a28a802a880bdbf974f522ef02c27bea (diff)
base-call: interpret DTMF character ',' as two-second pause
Do what other dialers do and interpret ',' as a short pause, which helps handle automated menus. Signed-off-by: Dan Williams <dan@ioncontrol.co>
-rw-r--r--introspection/org.freedesktop.ModemManager1.Call.xml3
-rw-r--r--src/mm-base-call.c27
-rw-r--r--src/mm-base-call.h2
3 files changed, 22 insertions, 10 deletions
diff --git a/introspection/org.freedesktop.ModemManager1.Call.xml b/introspection/org.freedesktop.ModemManager1.Call.xml
index 85db4ad2..41dc40f3 100644
--- a/introspection/org.freedesktop.ModemManager1.Call.xml
+++ b/introspection/org.freedesktop.ModemManager1.Call.xml
@@ -103,9 +103,10 @@
<!--
SendDtmf:
- @dtmf: DTMF tone identifier [0-9A-D*#].
+ @dtmf: DTMF tone identifier [0-9A-D*#] or pause character [,].
Send a DTMF tone (Dual Tone Multi-Frequency) (only on supported modems).
+ Since 1.26 the comma [,] is interpreted as a two-second pause.
Applicable only if state is <link linkend="MM-CALL-STATE-ACTIVE:CAPS"><constant>MM_CALL_STATE_ACTIVE</constant></link>.
diff --git a/src/mm-base-call.c b/src/mm-base-call.c
index 3f4e081a..68f77b80 100644
--- a/src/mm-base-call.c
+++ b/src/mm-base-call.c
@@ -870,10 +870,12 @@ send_dtmf_task_step_next (GTask *task)
SendDtmfContext *ctx;
gboolean need_stop;
MMBaseCall *self;
+ gboolean is_pause;
self = g_task_get_source_object (task);
ctx = g_task_get_task_data (task);
+ is_pause = (ctx->dtmf[0] == MM_CALL_DTMF_PAUSE_CHAR);
need_stop = MM_BASE_CALL_GET_CLASS (self)->stop_dtmf &&
MM_BASE_CALL_GET_CLASS (self)->stop_dtmf_finish;
@@ -882,23 +884,30 @@ send_dtmf_task_step_next (GTask *task)
ctx->step++;
/* Fall through */
case DTMF_STEP_START:
- MM_BASE_CALL_GET_CLASS (self)->send_dtmf (self,
- ctx->dtmf,
- (GAsyncReadyCallback)send_dtmf_ready,
- g_object_ref (task));
- break;
+ if (!is_pause) {
+ MM_BASE_CALL_GET_CLASS (self)->send_dtmf (self,
+ ctx->dtmf,
+ (GAsyncReadyCallback)send_dtmf_ready,
+ g_object_ref (task));
+ return;
+ }
+ /* Fall through */
case DTMF_STEP_TIMEOUT:
- if (need_stop) {
+ if (need_stop || is_pause) {
+ guint duration;
+
+ duration = is_pause ? 2000 : mm_base_call_get_dtmf_tone_duration (self);
+
/* Disable DTMF press after DTMF tone duration elapses */
- ctx->timeout_id = g_timeout_add (mm_base_call_get_dtmf_tone_duration (self),
+ ctx->timeout_id = g_timeout_add (duration,
(GSourceFunc) dtmf_timeout,
task);
return;
}
/* Fall through */
case DTMF_STEP_STOP:
- if (need_stop) {
- send_dtmf_context_clear_timeout (ctx);
+ send_dtmf_context_clear_timeout (ctx);
+ if (need_stop && !is_pause) {
MM_BASE_CALL_GET_CLASS (self)->stop_dtmf (self,
(GAsyncReadyCallback)stop_dtmf_ready,
g_object_ref (task));
diff --git a/src/mm-base-call.h b/src/mm-base-call.h
index 2e45ca5f..777b6452 100644
--- a/src/mm-base-call.h
+++ b/src/mm-base-call.h
@@ -41,6 +41,8 @@ typedef struct _MMBaseCallPrivate MMBaseCallPrivate;
#define MM_CALL_NUMBER "number"
#define MM_CALL_DTMF_TONE_DURATION "dtmf-tone-duration"
+#define MM_CALL_DTMF_PAUSE_CHAR ','
+
#define MM_BASE_CALL_PATH "call-path"
#define MM_BASE_CALL_CONNECTION "call-connection"
#define MM_BASE_CALL_IFACE_MODEM_VOICE "call-iface-modem-voice"