Hello,
based on some of the plans for Kamailio 5.0
(https://www.kamailio.org/wiki/devel/kamailio-5.0-design), I started the
implementation for the support to allow writing the active routing logic
at runtime (respectively what are now the routing blocks) in other
embedded languages than the native kamailio.cfg interpreter. Of course,
besides a lot more extensive set of functions and expressions coming
with the well established scripting languages, this way will allow
reloading the logic without kamailio restart.
I already committed the foundation for it, currently the request_route{}
and reply_route{} can be implemented in Lua, relying on app_lua module.
Lua was selected for first experiments given that I have some past
experience with it, but other languages such as Perl, Python will
hopefully follow soon, once the framework gets to a stable design.
I wrote some initial docuentation on the wiki:
- https://www.kamailio.org/wiki/devel/config-engines
Would be helpful if people with experience on the other supported
embedded languages will join the effort to design the framework to suit
those languages, as well as other developers and community members to
start exporting C functions.
Also, there are some other things to decide on, listed in the to-do
section, where suggestions/assistance are appreciated:
- https://www.kamailio.org/wiki/devel/config-engines#to-do
Many of them probably will be approached during the planned IRC devel
meeting next week:
- https://www.kamailio.org/wiki/devel/irc-meetings/2016a
Any feedback is welcome!
Cheers,
Daniel
--
Daniel-Constantin Mierla
http://www.asipto.comhttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio World Conference, Berlin, May 18-20, 2016 - http://www.kamailioworld.com
Module: kamailio
Branch: master
Commit: 2dbcd56c69db94543c355d936f486d2f525855e5
URL: https://github.com/kamailio/kamailio/commit/2dbcd56c69db94543c355d936f486d2…
Author: Camille Oudot <camille.oudot(a)orange.com>
Committer: Camille Oudot <camille.oudot(a)orange.com>
Date: 2016-04-12T13:47:12+02:00
log_systemd: refresh README
---
Modified: modules/log_systemd/README
---
Diff: https://github.com/kamailio/kamailio/commit/2dbcd56c69db94543c355d936f486d2…
Patch: https://github.com/kamailio/kamailio/commit/2dbcd56c69db94543c355d936f486d2…
---
diff --git a/modules/log_systemd/README b/modules/log_systemd/README
index 36b2b5c..9453ec0 100644
--- a/modules/log_systemd/README
+++ b/modules/log_systemd/README
@@ -27,11 +27,13 @@ Daniel-Constantin Mierla
4. Functions
4.1. sd_journal_print(level, text)
+ 4.2. sd_journal_send_xavp(name)
List of Examples
1.1. Core Logging Replacement with Systemd
1.2. sd_journal_print usage
+ 1.3. sd_journal_send_xavp usage
Chapter 1. Admin Guide
@@ -47,6 +49,7 @@ Chapter 1. Admin Guide
4. Functions
4.1. sd_journal_print(level, text)
+ 4.2. sd_journal_send_xavp(name)
1. Overview
@@ -88,6 +91,7 @@ loadmodule "log_systemd.so"
4. Functions
4.1. sd_journal_print(level, text)
+ 4.2. sd_journal_send_xavp(name)
4.1. sd_journal_print(level, text)
@@ -104,3 +108,38 @@ loadmodule "log_systemd.so"
...
sd_journal_print("LOG_INFO", "R-URI is $ru\n");
...
+
+4.2. sd_journal_send_xavp(name)
+
+ Creates a structured log event in journald.
+
+ The sd_journal_send_xavp(name) function sends a log event in journald,
+ based on the fields provided in the xavp whose root name is specified
+ as parameter. This function is a wrapper for journald's
+ sd_journal_send() function, and allows to specify as many custom fields
+ as desired (see sd_journal_send(3)).
+
+ The xavp given as parameter must contain child AVPs with names
+ conforming to journald's field name policy (only uppercase letters,
+ numbers and underscore), otherwise they will be discarded by journald.
+
+ Some field name have a default meaning for journald:
+ * MESSAGE: the human-readable message string for this entry.
+ * PRIORTTY: integer priority value between 0 ("emerg") and 7
+ ("debug")
+ * (...) (see systemd.journald-fields(7))
+
+ This function can be used from ANY_ROUTE.
+
+ Example 1.3. sd_journal_send_xavp usage
+request_route {
+ $xavp(event=>MESSAGE) = $rm + " request logged with journald";
+ $xavp(event[0]=>SIP_MESSAGE) = $mb;
+# don't forget the '[0]', otherwise kamailio will create and
+# stack new AVPs (see pseudovariable documentation) over the previous one
+ $xavp(event[0]=>SIP_CALL_ID) = $ci;
+ $xavp(event[0]=>SIP_SRC_PORT) = $sp;
+ $xavp(event[0]=>PRIORITY) = 6;
+ sd_journal_send_xavp("event");
+(...)
+}
Journald can store arbitrary **KEY=>values[]** properties for each log event. The `sd_journal_send_xavp()` function is a binding on journald's `sd_journal_sendv()` function, that allows pushing structured events in journald, using the fields from a xavp.
(use `journald --output json-pretty` to see all the fields for the events in the journal)
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/565
-- Commit Summary --
* log_systemd: new function `sd_journal_send_xavp`
* log_systemd: refresh README
-- File Changes --
M modules/log_systemd/README (39)
M modules/log_systemd/doc/log_systemd_admin.xml (56)
A modules/log_systemd/journal_send.c (123)
A modules/log_systemd/journal_send.h (31)
M modules/log_systemd/log_systemd_mod.c (16)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/565.patchhttps://github.com/kamailio/kamailio/pull/565.diff
---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/565