aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dan@ioncontrol.co>2025-05-16 11:16:57 -0500
committerDan Williams <dan@ioncontrol.co>2025-05-22 08:05:58 -0500
commit7f014add61da3e0411d742756ce372fc0e2aee30 (patch)
tree265ba3df911f615653eaac051e406e50279b8721
parent41ceaf6d5ecd85a7f88fc4ed9bdc80a6d2313d23 (diff)
broadband-modem,modem-helpers: generalize call end regex creation
Signed-off-by: Dan Williams <dan@ioncontrol.co>
-rw-r--r--src/mm-broadband-modem.c3
-rw-r--r--src/mm-modem-helpers.c14
-rw-r--r--src/mm-modem-helpers.h6
3 files changed, 21 insertions, 2 deletions
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
index 41159a6c..e0f277fe 100644
--- a/src/mm-broadband-modem.c
+++ b/src/mm-broadband-modem.c
@@ -8473,8 +8473,7 @@ set_voice_in_call_unsolicited_events_handlers (MMBroadbandModem *self,
g_autoptr(GRegex) in_call_event_regex = NULL;
guint i;
- in_call_event_regex = g_regex_new ("\\r\\n(NO CARRIER|BUSY|NO ANSWER|NO DIALTONE)(\\r)?\\r\\n$",
- G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL);
+ in_call_event_regex = mm_call_end_regex_get ();
ports[0] = MM_PORT_SERIAL_AT (ports_ctx->primary);
ports[1] = MM_PORT_SERIAL_AT (ports_ctx->secondary);
diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c
index 926b1997..c6fa13fc 100644
--- a/src/mm-modem-helpers.c
+++ b/src/mm-modem-helpers.c
@@ -483,6 +483,20 @@ mm_at_quote_string (const gchar *input)
/*****************************************************************************/
GRegex *
+mm_call_end_regex_get (void)
+{
+ /* Example:
+ * <CR><LF>NO ANSWER<CR><LF>
+ */
+ return g_regex_new ("\\r\\n(NO CARRIER)|(BUSY)|(NO ANSWER)|(NO DIALTONE)\\r\\n",
+ G_REGEX_DOLLAR_ENDONLY | G_REGEX_RAW | G_REGEX_OPTIMIZE,
+ 0,
+ NULL);
+}
+
+/*****************************************************************************/
+
+GRegex *
mm_voice_ring_regex_get (void)
{
/* Example:
diff --git a/src/mm-modem-helpers.h b/src/mm-modem-helpers.h
index 469492b2..73203c8b 100644
--- a/src/mm-modem-helpers.h
+++ b/src/mm-modem-helpers.h
@@ -86,6 +86,12 @@ gchar *mm_bcd_to_string (const guint8 *bcd,
gchar *mm_at_quote_string (const gchar *input);
/*****************************************************************************/
+/* CALL specific helpers and utilities */
+/*****************************************************************************/
+
+GRegex *mm_call_end_regex_get (void);
+
+/*****************************************************************************/
/* VOICE specific helpers and utilities */
/*****************************************************************************/