broadband-modem,modem-helpers: generalize call end regex creation

Signed-off-by: Dan Williams <dan@ioncontrol.co>
This commit is contained in:
Dan Williams
2025-05-22 08:05:58 -05:00
parent 41ceaf6d5e
commit 7f014add61
3 changed files with 21 additions and 2 deletions
+1 -2
View File
@@ -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);
+14
View File
@@ -482,6 +482,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)
{
+6
View File
@@ -85,6 +85,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 */
/*****************************************************************************/