Module: kamailio
Branch: master
Commit: e4800a83439cb04eb3a5d4e106ad767a3d6776a5
URL:
https://github.com/kamailio/kamailio/commit/e4800a83439cb04eb3a5d4e106ad767…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-10-27T16:44:56+02:00
timer: use route_lookup() instead of route_get() to find a route block
- avoids creating an empty route block structure
- split code for dedicated cfg function wrapper
---
Modified: src/modules/timer/timer.c
---
Diff:
https://github.com/kamailio/kamailio/commit/e4800a83439cb04eb3a5d4e106ad767…
Patch:
https://github.com/kamailio/kamailio/commit/e4800a83439cb04eb3a5d4e106ad767…
---
diff --git a/src/modules/timer/timer.c b/src/modules/timer/timer.c
index 4a09a94c2b..009bc6a95d 100644
--- a/src/modules/timer/timer.c
+++ b/src/modules/timer/timer.c
@@ -252,12 +252,8 @@ static int timer_enable_fixup(void** param, int param_no)
return 0;
}
-static int timer_enable_func(sip_msg_t* m, char* timer_act, char* enable)
+static int timer_enable_helper(sip_msg_t* m, timer_action_t* a, int en)
{
- timer_action_t* a;
- int en;
- a = (void*) timer_act;
- en = (int)(long) enable;
/* timer is not deleted immediately but is removed from handler
* by itself because timer_del may be slow blocking procedure
* Disable and enable in sequence may be tricky
@@ -282,6 +278,16 @@ static int timer_enable_func(sip_msg_t* m, char* timer_act, char*
enable)
return 1;
}
+static int timer_enable_func(sip_msg_t* m, char* timer_act, char* enable)
+{
+ timer_action_t* a;
+ int en;
+ a = (void*) timer_act;
+ en = (int)(long) enable;
+
+ return timer_enable_helper(m, a, en);
+}
+
static int get_next_part(char** s, str* part, char delim)
{
char *c, *c2;
@@ -331,7 +337,7 @@ static int declare_timer(modparam_t type, char* param)
c = s.s[s.len];
s.s[s.len] = '\0';
- n = route_get(&main_rt, s.s);
+ n = route_lookup(&main_rt, s.s);
s.s[s.len] = c;
if (n == -1) goto err;
route_no = n;