Module: kamailio
Branch: master
Commit: d8f6b975f831b4bd49c71f5efb990563b8dda08c
URL:
https://github.com/kamailio/kamailio/commit/d8f6b975f831b4bd49c71f5efb99056…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2016-04-24T20:47:35+02:00
registrar: exported save(...)/lookup(...) variants to kemi
---
Modified: modules/registrar/api.h
Modified: modules/registrar/registrar.c
---
Diff:
https://github.com/kamailio/kamailio/commit/d8f6b975f831b4bd49c71f5efb99056…
Patch:
https://github.com/kamailio/kamailio/commit/d8f6b975f831b4bd49c71f5efb99056…
---
diff --git a/modules/registrar/api.h b/modules/registrar/api.h
index 2e7130f..9f45eb9 100644
--- a/modules/registrar/api.h
+++ b/modules/registrar/api.h
@@ -37,6 +37,7 @@ int regapi_save_uri(sip_msg_t *msg, str *table, int flags, str *uri);
typedef int (*regapi_lookup_f)(sip_msg_t *msg, str *table);
int regapi_lookup(sip_msg_t *msg, str *table);
+int regapi_registered(sip_msg_t *msg, str *table);
typedef int (*regapi_lookup_uri_f)(sip_msg_t *msg, str *table, str *uri);
int regapi_lookup_uri(sip_msg_t *msg, str *table, str *uri);
diff --git a/modules/registrar/registrar.c b/modules/registrar/registrar.c
index 2dcc76c..0752d2e 100644
--- a/modules/registrar/registrar.c
+++ b/modules/registrar/registrar.c
@@ -47,6 +47,7 @@
#include "../../lib/srutils/sruid.h"
#include "../../modules/sl/sl.h"
#include "../../mod_fix.h"
+#include "../../kemi.h"
#include "save.h"
#include "api.h"
@@ -747,3 +748,50 @@ void default_expires_range_update(str* gname, str* name){
void expires_range_update(str* gname, str* name){
update_stat(expire_range_stat, cfg_get(registrar, registrar_cfg, expires_range));
}
+
+/**
+ *
+ */
+static sr_kemi_t sr_kemi_registrar_exports[] = {
+ { str_init("registrar"), str_init("save"),
+ SR_KEMIP_INT, regapi_save,
+ { SR_KEMIP_STR, SR_KEMIP_INT, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init("registrar"), str_init("save_uri"),
+ SR_KEMIP_INT, regapi_save_uri,
+ { SR_KEMIP_STR, SR_KEMIP_INT, SR_KEMIP_STR,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init("registrar"), str_init("lookup"),
+ SR_KEMIP_INT, regapi_lookup,
+ { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init("registrar"), str_init("lookup_uri"),
+ SR_KEMIP_INT, regapi_lookup_uri,
+ { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init("registrar"), str_init("lookup_to_dset"),
+ SR_KEMIP_INT, regapi_lookup_to_dset,
+ { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init("registrar"), str_init("registered"),
+ SR_KEMIP_INT, regapi_registered,
+ { SR_KEMIP_STR, 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 } }
+};
+
+/**
+ *
+ */
+int mod_register(char *path, int *dlflags, void *p1, void *p2)
+{
+ sr_kemi_modules_add(sr_kemi_registrar_exports);
+ return 0;
+}