Module: kamailio
Branch: master
Commit: 9670bd80550b9e0c2af1d5d61df618292346ba28
URL:
https://github.com/kamailio/kamailio/commit/9670bd80550b9e0c2af1d5d61df6182…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2018-04-27T08:56:32+02:00
cfgutils: update route_if_exists() to have same behaviour as route()
- do not run the route block as a top route
- related to GH #1503
---
Modified: src/modules/cfgutils/cfgutils.c
---
Diff:
https://github.com/kamailio/kamailio/commit/9670bd80550b9e0c2af1d5d61df6182…
Patch:
https://github.com/kamailio/kamailio/commit/9670bd80550b9e0c2af1d5d61df6182…
---
diff --git a/src/modules/cfgutils/cfgutils.c b/src/modules/cfgutils/cfgutils.c
index eedef71691..c0872ec33c 100644
--- a/src/modules/cfgutils/cfgutils.c
+++ b/src/modules/cfgutils/cfgutils.c
@@ -801,11 +801,10 @@ static int w_check_route_exists(struct sip_msg *msg, char *route)
static int w_route_exists(struct sip_msg *msg, char *route)
{
struct run_act_ctx ctx;
- int newroute, backup_rt, ret;
+ int newroute, ret;
str s;
- if (fixup_get_svalue(msg, (gparam_p) route, &s) != 0)
- {
+ if (fixup_get_svalue(msg, (gparam_p) route, &s) != 0) {
LM_ERR("invalid route parameter\n");
return -1;
}
@@ -814,12 +813,8 @@ static int w_route_exists(struct sip_msg *msg, char *route)
if (newroute<0) {
return -1;
}
- backup_rt = get_route_type();
- set_route_type(REQUEST_ROUTE);
-
init_run_actions_ctx(&ctx);
- ret = run_top_route(main_rt.rlist[newroute], msg, &ctx);
- set_route_type(backup_rt);
+ ret=run_actions(&ctx, main_rt.rlist[newroute], msg);
if (ctx.run_flags & EXIT_R_F) {
return 0;
}