[sr-dev] git:master:9f140ce9: sworker: KSR.sworker.active() exported to kemi

Daniel-Constantin Mierla miconda at gmail.com
Fri Jul 30 13:32:44 CEST 2021


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-07-30T13:31:30+02:00

sworker: KSR.sworker.active() exported to kemi

- equivalent to existing sworker_active() config function

---

Modified: src/modules/sworker/sworker_mod.c

---

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

---

diff --git a/src/modules/sworker/sworker_mod.c b/src/modules/sworker/sworker_mod.c
index 33ee3361bd..e6dce05c9b 100644
--- a/src/modules/sworker/sworker_mod.c
+++ b/src/modules/sworker/sworker_mod.c
@@ -196,6 +196,17 @@ static int w_sworker_task(sip_msg_t *msg, char *pgname, char *p2)
 	return ki_sworker_task(msg, &gname);
 }
 
+/**
+ *
+ */
+static int ki_sworker_active(sip_msg_t *msg)
+{
+	if(_sworker_active==0) {
+		return -1;
+	}
+	return 1;
+}
+
 /**
  *
  */
@@ -217,6 +228,11 @@ static sr_kemi_t sr_kemi_sworker_exports[] = {
 		{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
 	},
+	{ str_init("sworker"), str_init("active"),
+		SR_KEMIP_INT, ki_sworker_active,
+		{ SR_KEMIP_NONE, 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 } }
 };




More information about the sr-dev mailing list