diff -urN asterisk-trunk/apps/app_queue.c asterisk-new/apps/app_queue.c --- asterisk-trunk/apps/app_queue.c 2006-06-14 08:38:01.000000000 +0200 +++ asterisk-new/apps/app_queue.c 2006-06-14 08:45:57.000000000 +0200 @@ -99,7 +99,8 @@ QUEUE_STRATEGY_LEASTRECENT, QUEUE_STRATEGY_FEWESTCALLS, QUEUE_STRATEGY_RANDOM, - QUEUE_STRATEGY_RRMEMORY + QUEUE_STRATEGY_RRMEMORY, + QUEUE_STRATEGY_LINEAR }; static struct strategy { @@ -112,6 +113,7 @@ { QUEUE_STRATEGY_FEWESTCALLS, "fewestcalls" }, { QUEUE_STRATEGY_RANDOM, "random" }, { QUEUE_STRATEGY_RRMEMORY, "rrmemory" }, + { QUEUE_STRATEGY_LINEAR, "linear" }, }; #define DEFAULT_RETRY 5 @@ -2181,6 +2183,8 @@ /* Everyone equal, except for penalty */ tmp->metric = mem->penalty * 1000000; break; + case QUEUE_STRATEGY_LINEAR: + /* Fall through */ case QUEUE_STRATEGY_ROUNDROBIN: if (!pos) { if (!q->wrapped) { @@ -2375,6 +2379,12 @@ if (!strcmp(peer->tech->type, "Zap")) ast_channel_setoption(peer, AST_OPTION_TONE_VERIFY, &nondataquality, sizeof(nondataquality), 0); /* Update parameters for the queue */ + + if (qe->parent->strategy == QUEUE_STRATEGY_LINEAR) { + /* answer - we can reset position now! */ + qe->parent->rrpos = 0; + } + recalc_holdtime(qe); member = lpeer->member; hangupcalls(outgoing, peer); @@ -3638,6 +3648,13 @@ /* Re-initialize the queue, and clear statistics */ init_queue(q); clear_queue(q); + + if (q->strategy == QUEUE_STRATEGY_LINEAR) { + /* free static members in linear mode, to get a sorted + list like defined in config */ + free_members ( q, (int) !queue_persistent_members ); + } + for (cur = q->members; cur; cur = cur->next) { if (!cur->dynamic) { cur->delme = 1;