aboutsummaryrefslogtreecommitdiff
path: root/src/mm-modem-helpers.c
diff options
context:
space:
mode:
authorDan Williams <dan@ioncontrol.co>2025-04-11 20:43:17 -0500
committerDan Williams <dan@ioncontrol.co>2025-05-30 07:59:58 -0500
commit5448a85a2bae32b6c9dfb82ac148904bf20fc209 (patch)
treed3dc01eb24ab04b592195ef335d43ca8ef4c08d0 /src/mm-modem-helpers.c
parent28b195465422b63ccc77e1a8d9d21e8bb6f217e9 (diff)
call: allow setting DTMF tone duration at call creation time
Instead of hard-coding a 500ms DTMF tone duration, let applications use a specific duration at call setup time. Signed-off-by: Dan Williams <dan@ioncontrol.co>
Diffstat (limited to 'src/mm-modem-helpers.c')
-rw-r--r--src/mm-modem-helpers.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c
index a79ca956..0e258e61 100644
--- a/src/mm-modem-helpers.c
+++ b/src/mm-modem-helpers.c
@@ -5871,3 +5871,19 @@ mm_parse_cpin_response (const gchar *response,
return MM_MODEM_LOCK_UNKNOWN;
}
+
+/*****************************************************************************/
+
+guint
+mm_dtmf_duration_normalize (guint duration_ms)
+{
+ /* Default to 500ms */
+ if (duration_ms == 0)
+ return 500;
+
+ /* round to next highest 100ms */
+ if (duration_ms % 100)
+ duration_ms = ((duration_ms + 100) / 100) * 100;
+
+ return CLAMP (duration_ms, 100, 1000);
+}