From fb872d7e65ffc0563789f92e9e6f10d855f13207 Mon Sep 17 00:00:00 2001 From: Super User Date: Sun, 29 Jul 2007 11:46:49 +0200 Subject: [PATCH] fixed routing: only parameters that are allowed may be present in the routing file. fixed pick-up of a call that rings on a different extension/phone --- apppbx.cpp | 2 +- default/routing.conf | 6 +++--- route.c | 9 +++++++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/apppbx.cpp b/apppbx.cpp index 1aeba78..05d755e 100644 --- a/apppbx.cpp +++ b/apppbx.cpp @@ -3725,7 +3725,7 @@ reject: PERROR("EPOINT(%d) ringing endpoint's join not found.\n", ea_endpoint->ep_serial); goto reject; } - if (joinpbx->j_type != JOIN_TYPE_PBX) + if (join->j_type != JOIN_TYPE_PBX) { PDEBUG(DEBUG_EPOINT, "EPOINT(%d) ringing endpoint's join is not a PBX join, so we must reject.\n", ea_endpoint->ep_serial); goto reject; diff --git a/default/routing.conf b/default/routing.conf index 38e739a..4fbd4ab 100644 --- a/default/routing.conf +++ b/default/routing.conf @@ -30,11 +30,11 @@ dialing=0 : extern dialing=1 : extern capability=digital-unrestricted dialing=200-299 : intern dialing=3 : pick -dialing=5 : reply +dialing=5 enblock : reply +dialing=5 : reply select dialing=6 enblock : redial dialing=6 : redial select -dialing=7 enblock : abbrev -dialing=7 : abbrev select +dialing=7 : abbrev dialing=80 : vbox-play dialing=81 : partyline room=42 dialing=90 : powerdial diff --git a/route.c b/route.c index a7b1416..8c158bf 100644 --- a/route.c +++ b/route.c @@ -848,6 +848,7 @@ struct route_ruleset *ruleset_parse(void) struct route_param *param; struct route_param **param_pointer = NULL; char failure[256]; + unsigned long long allowed_params; /* check the integrity of IDs for ACTION_* and PARAM_* */ i = 0; @@ -1461,6 +1462,7 @@ struct route_ruleset *ruleset_parse(void) SPRINT(failure, "Unknown action name '%s'.", key); goto parse_error; } + allowed_params = action_defs[index].params; /* alloc memory for action */ action = (struct route_action *)MALLOC(sizeof(struct route_action)); @@ -1510,6 +1512,13 @@ struct route_ruleset *ruleset_parse(void) goto parse_error; } + /* check if item is allowed for the action */ + if (!(param_defs[index].id & allowed_params)) + { + SPRINT(failure, "Param name '%s' exists, but not for this action.", key); + goto parse_error; + } + /* params without values must not have any parameter */ if (param_defs[index].type == PARAM_TYPE_NULL) { -- 2.13.6