Browse Source

cfgutils: Properly handle 'exit' when from route_if_exists()

exit is supposed to exit the routing script. route_if_exists() wasn't
handling the exit, so script would continue to run after 'exit'.

(cherry picked from commit d6a374d707f23afddfc007edfeae40b01836b3c0)
Alex Hermann 8 years ago
parent
commit
635ff24db1
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/modules/cfgutils/cfgutils.c

+ 4 - 0
src/modules/cfgutils/cfgutils.c

@@ -765,9 +765,13 @@ static int w_route_exists(struct sip_msg *msg, char *route)
 	}
 	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);
+	if (ctx.run_flags & EXIT_R_F) {
+		return 0;
+	}
 	return ret;
 }