Module: kamailio
Branch: master
Commit: ad919796b24d0c38af136cbad2563e6f98df4b74
URL: 
https://github.com/kamailio/kamailio/commit/ad919796b24d0c38af136cbad2563e6f98df4b74

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2024-10-29T06:52:22+01:00

timer: export timer_enable(...) to kemi

- GH #4008

---

Modified: src/modules/timer/timer.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/ad919796b24d0c38af136cbad2563e6f98df4b74.diff
Patch: 
https://github.com/kamailio/kamailio/commit/ad919796b24d0c38af136cbad2563e6f98df4b74.patch

---

diff --git a/src/modules/timer/timer.c b/src/modules/timer/timer.c
index 5cb92a8847c..e31ede94903 100644
--- a/src/modules/timer/timer.c
+++ b/src/modules/timer/timer.c
@@ -306,6 +306,19 @@ static int timer_enable_func(sip_msg_t *m, char 
*timer_act, char *enable)
        return timer_enable_helper(m, a, en);
 }
 
+static int ki_timer_enable(sip_msg_t *m, str *timerid, int enable)
+{
+       timer_action_t *a;
+
+       a = find_action_by_name(timer_actions, timerid->s, -1);
+       if(!a) {
+               LM_ERR("timer '%s' not declared\n", timerid->s);
+               return -1;
+       }
+
+       return timer_enable_helper(m, a, enable);
+}
+
 static int get_next_part(char **s, str *part, char delim)
 {
        char *c, *c2;
@@ -522,3 +535,27 @@ struct module_exports exports = {
        destroy_mod              /* destroy function */
 };
 /* clang-format on */
+
+
+/**
+ *
+ */
+/* clang-format off */
+static sr_kemi_t sr_kemi_timer_exports[] = {
+       { str_init("timer"), str_init("timer_enable"),
+               SR_KEMIP_INT, ki_timer_enable,
+               { SR_KEMIP_STR, SR_KEMIP_INT, SR_KEMIP_NONE,
+                       SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+       },
+       { {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } }
+};
+/* clang-format on */
+
+/**
+ *
+ */
+int mod_register(char *path, int *dlflags, void *p1, void *p2)
+{
+       sr_kemi_modules_add(sr_kemi_timer_exports);
+       return 0;
+}

_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org

Reply via email to