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

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2019-03-28T18:50:27+01:00

cfgutils: exported sleep() and usleep() to kemi framework

---

Modified: src/modules/cfgutils/cfgutils.c

---

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

---

diff --git a/src/modules/cfgutils/cfgutils.c b/src/modules/cfgutils/cfgutils.c
index e62012cd14..02d7c46c54 100644
--- a/src/modules/cfgutils/cfgutils.c
+++ b/src/modules/cfgutils/cfgutils.c
@@ -623,6 +623,12 @@ static int m_sleep(struct sip_msg *msg, char *time, char 
*str2)
        return 1;
 }
 
+static int ki_sleep(sip_msg_t* msg, int v)
+{
+       sleep((unsigned int)v);
+       return 1;
+}
+
 static int m_usleep(struct sip_msg *msg, char *time, char *str2)
 {
        int s;
@@ -635,6 +641,12 @@ static int m_usleep(struct sip_msg *msg, char *time, char 
*str2)
        return 1;
 }
 
+static int ki_usleep(sip_msg_t* msg, int v)
+{
+       sleep_us((unsigned int)v);
+       return 1;
+}
+
 static int dbg_abort(struct sip_msg* msg, char* foo, char* bar)
 {
        LM_CRIT("abort called\n");
@@ -1055,6 +1067,16 @@ static sr_kemi_t sr_kemi_cfgutils_exports[] = {
                { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_INT,
                        SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
        },
+       { str_init("cfgutils"), str_init("sleep"),
+               SR_KEMIP_INT, ki_sleep,
+               { SR_KEMIP_INT, SR_KEMIP_NONE, SR_KEMIP_NONE,
+                       SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+       },
+       { str_init("cfgutils"), str_init("usleep"),
+               SR_KEMIP_INT, ki_usleep,
+               { SR_KEMIP_INT, SR_KEMIP_NONE, SR_KEMIP_NONE,
+                       SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+       },
 
        { {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } }
 };


_______________________________________________
Kamailio (SER) - Development Mailing List
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to