mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 18:55:19 +00:00 
			
		
		
		
	Do the right thing with ringall queues with entries that have penalties
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1314 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		| @@ -398,13 +398,23 @@ static int ring_one(struct queue_ent *qe, struct localuser *outgoing) | |||||||
| 			cur = cur->next; | 			cur = cur->next; | ||||||
| 		} | 		} | ||||||
| 		if (best) { | 		if (best) { | ||||||
| 			/* Ring the best channel, and remember the best | 			if (!qe->parent->strategy) { | ||||||
| 			   metric for the next pass */ | 				/* Ring everyone who shares this best metric (for ringall) */ | ||||||
| 			ast_log(LOG_DEBUG, "Trying '%s/%s' with metric %d\n", best->tech, best->numsubst, best->metric); | 				cur = outgoing; | ||||||
| 			ring_entry(qe, best); | 				while(cur) { | ||||||
|  | 					if (cur->stillgoing && !cur->chan && (cur->metric == bestmetric)) { | ||||||
|  | 						ast_log(LOG_DEBUG, "(Parallel) Trying '%s/%s' with metric %d\n", cur->tech, cur->numsubst, cur->metric); | ||||||
|  | 						ring_entry(qe, cur); | ||||||
|  | 					} | ||||||
|  | 					cur = cur->next; | ||||||
|  | 				} | ||||||
|  | 			} else { | ||||||
|  | 				/* Ring just the best channel */ | ||||||
|  | 				ast_log(LOG_DEBUG, "Trying '%s/%s' with metric %d\n", best->tech, best->numsubst, best->metric); | ||||||
|  | 				ring_entry(qe, best); | ||||||
|  | 			} | ||||||
| 		} | 		} | ||||||
| 	} while (best && !best->chan); | 	} while (best && !best->chan); | ||||||
| 	 |  | ||||||
| 	if (!best) { | 	if (!best) { | ||||||
| 		ast_log(LOG_DEBUG, "Nobody left to try ringing in queue\n"); | 		ast_log(LOG_DEBUG, "Nobody left to try ringing in queue\n"); | ||||||
| 		return 0; | 		return 0; | ||||||
| @@ -628,7 +638,8 @@ static int calc_metric(struct ast_call_queue *q, struct member *mem, int pos, st | |||||||
| { | { | ||||||
| 	switch (q->strategy) { | 	switch (q->strategy) { | ||||||
| 	case QUEUE_STRATEGY_RINGALL: | 	case QUEUE_STRATEGY_RINGALL: | ||||||
| 		ast_log(LOG_WARNING, "Can't calculate metric for ringall strategy\n"); | 		/* Everyone equal, except for penalty */ | ||||||
|  | 		tmp->metric = mem->penalty * 1000000; | ||||||
| 		break; | 		break; | ||||||
| 	case QUEUE_STRATEGY_ROUNDROBIN: | 	case QUEUE_STRATEGY_ROUNDROBIN: | ||||||
| 		if (!pos) { | 		if (!pos) { | ||||||
| @@ -738,10 +749,7 @@ static int try_calling(struct queue_ent *qe, char *options, char *announceoverri | |||||||
| 		} | 		} | ||||||
| 		/* Special case: If we ring everyone, go ahead and ring them, otherwise | 		/* Special case: If we ring everyone, go ahead and ring them, otherwise | ||||||
| 		   just calculate their metric for the appropriate strategy */ | 		   just calculate their metric for the appropriate strategy */ | ||||||
| 		if (!qe->parent->strategy) | 		calc_metric(qe->parent, cur, x++, qe, tmp); | ||||||
| 			ring_entry(qe, tmp); |  | ||||||
| 		else |  | ||||||
| 			calc_metric(qe->parent, cur, x++, qe, tmp); |  | ||||||
| 		/* Put them in the list of outgoing thingies...  We're ready now.  | 		/* Put them in the list of outgoing thingies...  We're ready now.  | ||||||
| 		   XXX If we're forcibly removed, these outgoing calls won't get | 		   XXX If we're forcibly removed, these outgoing calls won't get | ||||||
| 		   hung up XXX */ | 		   hung up XXX */ | ||||||
| @@ -757,8 +765,7 @@ static int try_calling(struct queue_ent *qe, char *options, char *announceoverri | |||||||
| 		to = qe->parent->timeout * 1000; | 		to = qe->parent->timeout * 1000; | ||||||
| 	else | 	else | ||||||
| 		to = -1; | 		to = -1; | ||||||
| 	if (qe->parent->strategy) | 	ring_one(qe, outgoing); | ||||||
| 		ring_one(qe, outgoing); |  | ||||||
| 	ast_mutex_unlock(&qe->parent->lock); | 	ast_mutex_unlock(&qe->parent->lock); | ||||||
| 	lpeer = wait_for_answer(qe, outgoing, &to, &allowredir_in, &allowredir_out, &allowdisconnect, &digit); | 	lpeer = wait_for_answer(qe, outgoing, &to, &allowredir_in, &allowredir_out, &allowdisconnect, &digit); | ||||||
| 	if (lpeer) | 	if (lpeer) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user