iface-modem-voice: allow creating incoming calls in waiting state

This commit is contained in:
Aleksander Morgado
2019-06-07 18:06:42 +02:00
parent d3ef177f53
commit d9a7b403ee
4 changed files with 16 additions and 8 deletions

View File

@@ -84,10 +84,13 @@ mm_call_list_get_paths (MMCallList *self)
/*****************************************************************************/
MMBaseCall *
mm_call_list_get_first_ringing_in_call (MMCallList *self)
mm_call_list_get_first_incoming_call (MMCallList *self,
MMCallState incoming_state)
{
GList *l;
g_assert (incoming_state == MM_CALL_STATE_RINGING_IN || incoming_state == MM_CALL_STATE_WAITING);
for (l = self->priv->list; l; l = g_list_next (l)) {
MMBaseCall *call;
MMCallState state;
@@ -101,7 +104,7 @@ mm_call_list_get_first_ringing_in_call (MMCallList *self)
NULL);
if (direction == MM_CALL_DIRECTION_INCOMING &&
state == MM_CALL_STATE_RINGING_IN) {
state == incoming_state) {
return call;
}
}

View File

@@ -68,6 +68,7 @@ gboolean mm_call_list_delete_call (MMCallList *self,
const gchar *call_path,
GError **error);
MMBaseCall *mm_call_list_get_first_ringing_in_call (MMCallList *self);
MMBaseCall *mm_call_list_get_first_incoming_call (MMCallList *self,
MMCallState incoming_state);
#endif /* MM_CALL_LIST_H */

View File

@@ -73,11 +73,14 @@ create_outgoing_call_from_properties (MMIfaceModemVoice *self,
void
mm_iface_modem_voice_report_incoming_call (MMIfaceModemVoice *self,
const gchar *number)
const gchar *number,
MMCallState state)
{
MMBaseCall *call = NULL;
MMCallList *list = NULL;
g_assert (state == MM_CALL_STATE_RINGING_IN || state == MM_CALL_STATE_WAITING);
g_object_get (MM_BASE_MODEM (self),
MM_IFACE_MODEM_VOICE_CALL_LIST, &list,
NULL);
@@ -87,7 +90,7 @@ mm_iface_modem_voice_report_incoming_call (MMIfaceModemVoice *self,
return;
}
call = mm_call_list_get_first_ringing_in_call (list);
call = mm_call_list_get_first_incoming_call (list, state);
/* If call exists already, refresh its validity and set number if it wasn't set */
if (call) {
@@ -101,8 +104,8 @@ mm_iface_modem_voice_report_incoming_call (MMIfaceModemVoice *self,
mm_dbg ("Creating new incoming call...");
call = create_incoming_call (self, number);
/* Set the state as ringing in */
mm_base_call_change_state (call, MM_CALL_STATE_RINGING_IN, MM_CALL_STATE_REASON_INCOMING_NEW);
/* Set the state */
mm_base_call_change_state (call, state, MM_CALL_STATE_REASON_INCOMING_NEW);
/* Start its validity timeout */
mm_base_call_incoming_refresh (call);

View File

@@ -120,6 +120,7 @@ void mm_iface_modem_voice_bind_simple_status (MMIfaceModemVoice *self,
/* Incoming call management */
void mm_iface_modem_voice_report_incoming_call (MMIfaceModemVoice *self,
const gchar *number);
const gchar *number,
MMCallState state);
#endif /* MM_IFACE_MODEM_VOICE_H */