summaryrefslogtreecommitdiff
path: root/pbx/pbx_dundi.c
diff options
context:
space:
mode:
Diffstat (limited to 'pbx/pbx_dundi.c')
-rw-r--r--pbx/pbx_dundi.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c
index 79787cd1a..338be0c5c 100644
--- a/pbx/pbx_dundi.c
+++ b/pbx/pbx_dundi.c
@@ -3534,8 +3534,10 @@ static int optimize_transactions(struct dundi_request *dr, int order)
}
AST_LIST_TRAVERSE(&peers, peer, list) {
- if (has_permission(&peer->include, dr->dcontext) &&
- ast_eid_cmp(&peer->eid, &trans->them_eid) &&
+ if (ast_eid_cmp(&peer->eid, &empty_eid) && /* peer's eid is not empty (in case of dynamic peers) */
+ (peer->lastms > -1) && /* peer is reachable */
+ has_permission(&peer->include, dr->dcontext) && /* peer has destination context */
+ ast_eid_cmp(&peer->eid, &trans->them_eid) && /* peer is not transaction endpoint */
(peer->order <= order)) {
/* For each other transaction, make sure we don't
ask this EID about the others if they're not
@@ -4688,7 +4690,9 @@ static void build_peer(dundi_eid *eid, struct ast_variable *v, int *globalpcmode
if (needregister) {
peer->registerid = ast_sched_add(sched, 2000, do_register, peer);
}
- qualify_peer(peer, 1);
+ if (ast_eid_cmp(&peer->eid, &empty_eid)) {
+ qualify_peer(peer, 1);
+ }
}
AST_LIST_UNLOCK(&peers);
}