summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg2011-09-02 10:01:07 +0200
committerAndreas Eversberg2011-09-02 10:01:07 +0200
commit08bdc61deb2e8f8a5dc9fc129913cf1e55248d8f (patch)
treeb861758cc8f1d2280e84c69d735ad2eb350c9c3b
parentAdditionally adding output of bchannel "ref" at some debug output. (diff)
downloadlcr-08bdc61deb2e8f8a5dc9fc129913cf1e55248d8f.tar.gz
lcr-08bdc61deb2e8f8a5dc9fc129913cf1e55248d8f.tar.xz
lcr-08bdc61deb2e8f8a5dc9fc129913cf1e55248d8f.zip
Fixed broken timeout condition
A given timeout condition never made the rule match.
-rw-r--r--action.cpp3
-rw-r--r--route.c15
2 files changed, 10 insertions, 8 deletions
diff --git a/action.cpp b/action.cpp
index 478406d..514c016 100644
--- a/action.cpp
+++ b/action.cpp
@@ -2283,11 +2283,12 @@ void EndpointAppPBX::process_dialing(int timeout)
}
gettimeofday(&current_time, NULL);
- if (timeout && TIME_SMALLER(&e_match_timeout.timeout, &current_time)) {
+ if (e_match_to_action && TIME_SMALLER(&e_match_timeout.timeout, &current_time)) {
/* return timeout rule */
PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal '%s' dialing: '%s', timeout in ruleset '%s'\n", ea_endpoint->ep_serial, e_ext.number, e_dialinginfo.id, e_ruleset->name);
unsched_timer(&e_match_timeout);
e_action = e_match_to_action;
+ e_match_to_action = NULL;
e_extdialing = e_match_to_extdialing;
trace_header("ROUTING (timeout)", DIRECTION_NONE);
add_trace("action", NULL, "%s", action_defs[e_action->index].name);
diff --git a/route.c b/route.c
index c1bf079..3caed2b 100644
--- a/route.c
+++ b/route.c
@@ -2313,12 +2313,13 @@ struct route_action *EndpointAppPBX::route(struct route_ruleset *ruleset)
cond = cond->next;
}
- if (timeout>now_ll && match==1) /* the matching rule with timeout in the future */
- if (match_timeout == 0 || timeout < match_timeout) { /* first timeout or lower */
- /* set timeout in the furture */
- match_timeout = timeout;
- e_match_to_action = rule->action_first;
- e_match_to_extdialing = e_dialinginfo.id + dialing_required;
+ if (timeout>now_ll && match==1) { /* the matching rule with timeout in the future */
+ if (match_timeout == 0 || timeout < match_timeout) { /* first timeout or lower */
+ /* set timeout in the furture */
+ match_timeout = timeout;
+ e_match_to_action = rule->action_first;
+ e_match_to_extdialing = e_dialinginfo.id + dialing_required;
+ }
match = 0; /* matches in the future */
}
if (match == 1) {
@@ -2338,7 +2339,7 @@ struct route_action *EndpointAppPBX::route(struct route_ruleset *ruleset)
if (match_timeout == 0)
unsched_timer(&e_match_timeout); /* no timeout */
else {
- schedule_timer(&e_match_timeout, match_timeout / 1000000, match_timeout % 1000000);
+ schedule_timer(&e_match_timeout, (match_timeout-now_ll) / 1000000, (match_timeout-now_ll) % 1000000);
}
return(action);
}