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.
This commit is contained in:
@@ -393,6 +393,47 @@ mm_iface_modem_voice_report_all_calls (MMIfaceModemVoice *self,
|
||||
g_object_unref (list);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* 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 {
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user