From 6d85146bba3edceeaf9f23e0e7a5281fda527d59 Mon Sep 17 00:00:00 2001 From: Marco Bascetta Date: Tue, 5 May 2015 18:00:09 +0200 Subject: core: handle incoming calls (RING/CRING, CLIP, NO CARRIER). --- src/mm-call-list.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) (limited to 'src/mm-call-list.c') diff --git a/src/mm-call-list.c b/src/mm-call-list.c index 76af785b..aa650058 100644 --- a/src/mm-call-list.c +++ b/src/mm-call-list.c @@ -84,6 +84,65 @@ mm_call_list_get_paths (MMCallList *self) /*****************************************************************************/ +MMBaseCall* mm_call_list_get_new_incoming(MMCallList *self) +{ + MMBaseCall *call = NULL; + GList *l; + guint i; + + for (i = 0, l = self->priv->list; l && !call; l = g_list_next (l)) { + + MMCallState state; + MMCallStateReason reason; + MMCallDirection direct; + + g_object_get (MM_BASE_CALL (l->data), + "state" , &state, + "state-reason", &reason, + "direction" , &direct, + NULL); + + if( direct == MM_CALL_DIRECTION_INCOMING && + state == MM_CALL_STATE_RINGING_IN && + reason == MM_CALL_STATE_REASON_INCOMING_NEW ) { + + call = MM_BASE_CALL (l->data); + break; + } + } + + return call; +} + +MMBaseCall* mm_call_list_get_first_non_terminated_call(MMCallList *self) +{ + MMBaseCall *call = NULL; + GList *l; + guint i; + + for (i = 0, l = self->priv->list; l && !call; l = g_list_next (l)) { + + MMCallState state; + MMCallStateReason reason; + MMCallDirection direct; + + g_object_get (MM_BASE_CALL (l->data), + "state" , &state, + "state-reason", &reason, + "direction" , &direct, + NULL); + + if( state != MM_CALL_STATE_TERMINATED ) { + call = MM_BASE_CALL (l->data); + break; + } + } + + return call; +} + +/*****************************************************************************/ + typedef struct { MMCallList *self; GSimpleAsyncResult *result; -- cgit v1.2.3-70-g09d2