Module: kamailio
Branch: master
Commit: 3bc5a5775c490d0bfd43030f7eb437ead0d86d89
URL:
https://github.com/kamailio/kamailio/commit/3bc5a5775c490d0bfd43030f7eb437e…
Author: Kamailio Dev <kamailio.dev(a)kamailio.org>
Committer: Kamailio Dev <kamailio.dev(a)kamailio.org>
Date: 2023-06-27T13:32:05+02:00
modules: readme files regenerated - microhttpd ... [skip ci]
---
Modified: src/modules/microhttpd/README
---
Diff:
https://github.com/kamailio/kamailio/commit/3bc5a5775c490d0bfd43030f7eb437e…
Patch:
https://github.com/kamailio/kamailio/commit/3bc5a5775c490d0bfd43030f7eb437e…
---
diff --git a/src/modules/microhttpd/README b/src/modules/microhttpd/README
index f568f0aa8a..d4ed745ec2 100644
--- a/src/modules/microhttpd/README
+++ b/src/modules/microhttpd/README
@@ -26,10 +26,21 @@ Daniel-Constantin Mierla
3. Parameters
3.1. listen_port (int)
+ 3.2. event_callback (str)
+
+ 4. Functions
+
+ 4.1. mhttpd_reply(code, reason, ctype, body)
+
+ 5. Event Routes
+
+ 5.1. microhttpd:request
List of Examples
1.1. Set listen_port parameter
+ 1.2. Set event_callback parameter
+ 1.3. mhttpd_reply usage
Chapter 1. Admin Guide
@@ -44,6 +55,15 @@ Chapter 1. Admin Guide
3. Parameters
3.1. listen_port (int)
+ 3.2. event_callback (str)
+
+ 4. Functions
+
+ 4.1. mhttpd_reply(code, reason, ctype, body)
+
+ 5. Event Routes
+
+ 5.1. microhttpd:request
1. Overview
@@ -68,6 +88,7 @@ Chapter 1. Admin Guide
3. Parameters
3.1. listen_port (int)
+ 3.2. event_callback (str)
3.1. listen_port (int)
@@ -79,3 +100,60 @@ Chapter 1. Admin Guide
...
modparam("microhttpd", "listen_port", 8284)
...
+
+3.2. event_callback (str)
+
+ The name of the function in the kemi configuration file (embedded
+ scripting language such as Lua, Python, ...) to be executed instead of
+ event_route[microhttpd:request] block.
+
+ The function has one string parameter with the value
+ "microhttpd:request".
+
+ Default value is 'empty' (no function is executed for events).
+
+ Example 1.2. Set event_callback parameter
+...
+modparam("microhttpd", "event_callback",
"ksr_microhttpd_event")
+...
+-- event callback function implemented in Lua
+function ksr_microhttpd_event(evname)
+ KSR.info("===== microhttpd module triggered event: " .. evname ..
"\n");
+ return 1;
+end
+...
+
+4. Functions
+
+ 4.1. mhttpd_reply(code, reason, ctype, body)
+
+4.1. mhttpd_reply(code, reason, ctype, body)
+
+ Send back a reply with content-type and body.
+
+ Example 1.3. mhttpd_reply usage
+...
+event_route[microhttpd:request] {
+ mhttpd_reply("200", "OK", "text/html",
+ "<html><body>OK</body></html>");
+}
+...
+
+5. Event Routes
+
+ 5.1. microhttpd:request
+
+5.1. microhttpd:request
+
+ The event route is executed when a new HTTP request is received.
+...
+...
+loadmodule "microhttpd.so
+...
+event_route[microhttpd:request] {
+ xinfo("request: $mhttpd(method) - url: $mhttpd(url) - data: [$mhttpd(data)]\
+n");
+ mhttpd_reply("200", "OK", "text/html",
+ "<html><body>OK</body></html>");
+}
+...