}
static void voicecalls_release_queue(struct ofono_voicecall *vc, GSList *calls,
- ofono_voicecall_cb_t cb)
+ ofono_voicecall_cb_t cb,
+ ofono_bool_t skip_held)
{
GSList *l;
struct voicecall *call;
if (call->call->status == CALL_STATUS_WAITING)
continue;
+ if (skip_held && call->call->status == CALL_STATUS_HELD)
+ continue;
+
vc->release_list = g_slist_prepend(vc->release_list, l->data);
}
/* Fall back to the old-fashioned way */
voicecalls_release_queue(vc, vc->multiparty_list,
- voicecalls_release_done);
+ voicecalls_release_done, FALSE);
voicecalls_release_next(vc);
out:
voicecalls_have_waiting(vc)) {
GSList *held = voicecalls_held_list(vc);
- voicecalls_release_queue(vc, held, voicecalls_release_done);
+ voicecalls_release_queue(vc, held,
+ voicecalls_release_done, FALSE);
voicecalls_release_next(vc);
g_slist_free(held);
{
struct ofono_voicecall *vc = userdata;
struct ofono_error result;
- GSList *l;
- struct voicecall *call;
result.error = 0;
goto done;
}
- for (l = vc->call_list; l; l = l->next) {
- call = l->data;
-
- if (call->call->status == CALL_STATUS_WAITING ||
- call->call->status == CALL_STATUS_HELD)
- continue;
-
- vc->release_list = g_slist_prepend(vc->release_list,
- l->data);
- }
-
- if (vc->release_list == NULL)
+ if (voicecalls_have_active(vc) == FALSE)
goto fail;
vc->pending_em = em;
- vc->release_queue_done_cb = emulator_generic_cb;
+ voicecalls_release_queue(vc, vc->call_list,
+ emulator_generic_cb, TRUE);
voicecalls_release_next(vc);
done: