Index: apps/app_queue.c =================================================================== --- apps/app_queue.c (revision 333692) +++ apps/app_queue.c (working copy) @@ -4021,6 +4021,7 @@ struct ao2_iterator queue_iter; if (shared_lastcall) { + ao2_lock(queues); queue_iter = ao2_iterator_init(queues, 0); while ((qtmp = ao2_t_iterator_next(&queue_iter, "Iterate through queues"))) { ao2_lock(qtmp); @@ -4034,6 +4035,7 @@ queue_t_unref(qtmp, "Done with iterator"); } ao2_iterator_destroy(&queue_iter); + ao2_unlock(queues); } else { ao2_lock(q); time(&member->lastcall); @@ -4584,9 +4586,10 @@ orig = to; ++qe->pending; ao2_unlock(qe->parent); + if (need_weight) { + ao2_unlock(queues); + } ring_one(qe, outgoing, &numbusies); - if (need_weight) - ao2_unlock(queues); lpeer = wait_for_answer(qe, outgoing, &to, &digit, numbusies, ast_test_flag(&(bridge_config.features_caller), AST_FEATURE_DISCONNECT), forwardsallowed, update_connectedline); /* The ast_channel_datastore_remove() function could fail here if the * datastore was moved to another channel during a masquerade. If this is