[sr-dev] git:master:7b8d3389: timer: doc - example using the module via kemi

Daniel-Constantin Mierla miconda at gmail.com
Sat Oct 28 15:14:17 CEST 2017


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-10-28T08:58:26+02:00

timer: doc - example using the module via kemi

---

Modified: src/modules/timer/doc/timer.xml

---

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

---

diff --git a/src/modules/timer/doc/timer.xml b/src/modules/timer/doc/timer.xml
index 86ac522061..be86858455 100644
--- a/src/modules/timer/doc/timer.xml
+++ b/src/modules/timer/doc/timer.xml
@@ -100,11 +100,14 @@
 			<para>
 				<itemizedlist>
 				<listitem>
-				<emphasis>timer_id</emphasis> is timer identifier,
+				<emphasis>timer_id</emphasis> is timer identifier.
 				</listitem>
 				<listitem>
 				<emphasis>route</emphasis> is handler to be called when
-				timer is triggered,
+				timer is triggered. It has to be a route block name when native
+				scripting is used, or Kemi function name. The Kemi function
+				name receives one string parameter (for now it has a static
+				value, respectively the module name).
 				</listitem>
 				<listitem>
 				<emphasis>interval</emphasis> is timer interval in milliseconds,
@@ -218,7 +221,7 @@ if (@timer.executed != "") {
     <section id="timer.examples">
 		<title>Examples</title>
 		<example>
-			<title>timer common example</title>
+			<title>Common example using timer module</title>
 			<programlisting>
 ...
 loadmodule "modules/xprint/xprint.so"
@@ -243,7 +246,25 @@ route["ONTIMER2"] {
 }
 ...
 			</programlisting>
+		</example>
+
+		<example>
+			<title>Using timer module with kemi</title>
+			<programlisting>
+...
+loadmodule "timer.so"
 
+modparam("timer", "declare_timer", "tmr1=ksr_timer,1000");
+...
+
+...
+-- timer event callback function implemented in Lua
+function ksr_timer(evname)
+	KSR.info("===== timer module triggered event\n");
+	return 1;
+end
+...
+			</programlisting>
 		</example>
 		<example>
 			<title>Using timer module for testing a functionality</title>




More information about the sr-dev mailing list