aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2019-07-02 12:20:51 +0200
committerAleksander Morgado <aleksander@aleksander.es>2019-07-11 23:21:00 +0200
commitee2f3fb904688f07593122ad1e798166735f253f (patch)
treea053583b8969d6c032d9ad560a2fb80ec392de5d /src
parentfca8955721e6c8c535c120c7483e86d332093b4f (diff)
iface-modem-voice: allow reporting received DTMF by call index
If the URC reporting the DTMF does not specify the call index, mark it as received in all active ones.
Diffstat (limited to 'src')
-rw-r--r--src/mm-iface-modem-voice.c41
-rw-r--r--src/mm-iface-modem-voice.h5
2 files changed, 46 insertions, 0 deletions
diff --git a/src/mm-iface-modem-voice.c b/src/mm-iface-modem-voice.c
index a051aad7..4effd062 100644
--- a/src/mm-iface-modem-voice.c
+++ b/src/mm-iface-modem-voice.c
@@ -394,6 +394,47 @@ mm_iface_modem_voice_report_all_calls (MMIfaceModemVoice *self,
}
/*****************************************************************************/
+/* Incoming DTMF reception, not associated to a specific call */
+
+typedef struct {
+ guint index;
+ const gchar *dtmf;
+} ReceivedDtmfContext;
+
+static void
+received_dtmf_foreach (MMBaseCall *call,
+ ReceivedDtmfContext *ctx)
+{
+ if ((!ctx->index || (ctx->index == mm_base_call_get_index (call))) &&
+ (mm_base_call_get_state (call) == MM_CALL_STATE_ACTIVE))
+ mm_base_call_received_dtmf (call, ctx->dtmf);
+}
+
+void
+mm_iface_modem_voice_received_dtmf (MMIfaceModemVoice *self,
+ guint index,
+ const gchar *dtmf)
+{
+ MMCallList *list = NULL;
+ ReceivedDtmfContext ctx = {
+ .index = index,
+ .dtmf = dtmf
+ };
+
+ /* Retrieve list of known calls */
+ g_object_get (MM_BASE_MODEM (self),
+ MM_IFACE_MODEM_VOICE_CALL_LIST, &list,
+ NULL);
+ if (!list) {
+ mm_warn ("Cannot report received DTMF: missing call list");
+ return;
+ }
+
+ mm_call_list_foreach (list, (MMCallListForeachFunc)received_dtmf_foreach, &ctx);
+ g_object_unref (list);
+}
+
+/*****************************************************************************/
typedef struct {
MmGdbusModemVoice *skeleton;
diff --git a/src/mm-iface-modem-voice.h b/src/mm-iface-modem-voice.h
index 0e91d7c7..1f28ea36 100644
--- a/src/mm-iface-modem-voice.h
+++ b/src/mm-iface-modem-voice.h
@@ -202,4 +202,9 @@ void mm_iface_modem_voice_report_call (MMIfaceModemVoice *self,
void mm_iface_modem_voice_report_all_calls (MMIfaceModemVoice *self,
GList *call_info_list);
+/* Report an incoming DTMF received */
+void mm_iface_modem_voice_received_dtmf (MMIfaceModemVoice *self,
+ guint index,
+ const gchar *dtmf);
+
#endif /* MM_IFACE_MODEM_VOICE_H */