int affected_types;
};
+static GSList *find_dialing(GSList *calls)
+{
+ GSList *c;
+
+ c = g_slist_find_custom(calls, GINT_TO_POINTER(CALL_STATUS_DIALING),
+ at_util_call_compare_by_status);
+
+ if (!c)
+ c = g_slist_find_custom(calls,
+ GINT_TO_POINTER(CALL_STATUS_ALERTING),
+ at_util_call_compare_by_status);
+
+ return c;
+}
+
static struct ofono_call *create_call(struct voicecall_data *d, int type,
int direction, int status,
const char *num, int num_type, int clip)
return;
/* Look for dialing or alerting calls on the new list */
- n = g_slist_find_custom(calls, GINT_TO_POINTER(CALL_STATUS_DIALING),
- at_util_call_compare_by_status);
-
- if (!n)
- n = g_slist_find_custom(calls,
- GINT_TO_POINTER(CALL_STATUS_ALERTING),
- at_util_call_compare_by_status);
+ n = find_dialing(calls);
/* Let us find if we have done the dial from HF by looking for
* existing dialing or alerting calls
*/
- o = g_slist_find_custom(vd->calls, GINT_TO_POINTER(CALL_STATUS_DIALING),
- at_util_call_compare_by_status);
-
- if (!o)
- o = g_slist_find_custom(vd->calls,
- GINT_TO_POINTER(CALL_STATUS_ALERTING),
- at_util_call_compare_by_status);
+ o = find_dialing(vd->calls);
if (!n && o) {
oc = o->data;
GSList *dialing;
GSList *waiting;
- dialing = g_slist_find_custom(vd->calls,
- GINT_TO_POINTER(CALL_STATUS_DIALING),
- at_util_call_compare_by_status);
-
- if (!dialing)
- dialing = g_slist_find_custom(vd->calls,
- GINT_TO_POINTER(CALL_STATUS_ALERTING),
- at_util_call_compare_by_status);
+ dialing = find_dialing(vd->calls);
waiting = g_slist_find_custom(vd->calls,
GINT_TO_POINTER(CALL_STATUS_WAITING),
goto out;
}
- /* If call=1 and no call is waiting or dialing, the call
- * is active. */
+ /* If call=1 and no call is waiting or dialing, the call is
+ * active and we moved it to active state when call=1 arrived
+ */
if (waiting == NULL && dialing == NULL)
goto out;