diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2019-06-07 18:06:42 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2019-07-11 23:00:50 +0200 |
commit | d9a7b403eeb12b22f9d63aae9c6956d735cdd97a (patch) | |
tree | f0fe1060c182fe3712f9dd5c6cdd98cd650719b8 | |
parent | d3ef177f532101dfd8db8415ce57091154d5e97d (diff) |
iface-modem-voice: allow creating incoming calls in waiting state
-rw-r--r-- | src/mm-call-list.c | 7 | ||||
-rw-r--r-- | src/mm-call-list.h | 3 | ||||
-rw-r--r-- | src/mm-iface-modem-voice.c | 11 | ||||
-rw-r--r-- | src/mm-iface-modem-voice.h | 3 |
4 files changed, 16 insertions, 8 deletions
diff --git a/src/mm-call-list.c b/src/mm-call-list.c index 81100640..a3b914bb 100644 --- a/src/mm-call-list.c +++ b/src/mm-call-list.c @@ -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; } } diff --git a/src/mm-call-list.h b/src/mm-call-list.h index 0cf75238..4167cd08 100644 --- a/src/mm-call-list.h +++ b/src/mm-call-list.h @@ -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 */ diff --git a/src/mm-iface-modem-voice.c b/src/mm-iface-modem-voice.c index e2788994..8ddc5d2b 100644 --- a/src/mm-iface-modem-voice.c +++ b/src/mm-iface-modem-voice.c @@ -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); diff --git a/src/mm-iface-modem-voice.h b/src/mm-iface-modem-voice.h index e82c546a..66204eef 100644 --- a/src/mm-iface-modem-voice.h +++ b/src/mm-iface-modem-voice.h @@ -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 */ |