Module: kamailio
Branch: master
Commit: 19f7d568a7bb17a88dd06f0b78775a559a1ca683
URL:
https://github.com/kamailio/kamailio/commit/19f7d568a7bb17a88dd06f0b78775a5…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-11-22T10:25:14+01:00
tsilo: exported functions to kemi framework
---
Modified: src/modules/tsilo/tsilo.c
---
Diff:
https://github.com/kamailio/kamailio/commit/19f7d568a7bb17a88dd06f0b78775a5…
Patch:
https://github.com/kamailio/kamailio/commit/19f7d568a7bb17a88dd06f0b78775a5…
---
diff --git a/src/modules/tsilo/tsilo.c b/src/modules/tsilo/tsilo.c
index f5b1732e89..1bc50c2930 100644
--- a/src/modules/tsilo/tsilo.c
+++ b/src/modules/tsilo/tsilo.c
@@ -32,6 +32,7 @@
#include "../../modules/registrar/api.h"
#include "../../core/dset.h"
#include "../../core/rpc_lookup.h"
+#include "../../core/kemi.h"
#include "ts_hash.h"
#include "ts_handlers.h"
@@ -245,6 +246,7 @@ static int fixup_ts_append(void** param, int param_no)
return 0;
}
+
/**
*
*/
@@ -270,6 +272,28 @@ static int w_ts_append(struct sip_msg* _msg, char *_table, char
*_ruri)
return rc;
}
+
+/**
+ *
+ */
+static int ki_ts_append(sip_msg_t* _msg, str *_table, str *_ruri)
+{
+ str ruri = STR_NULL;
+ int rc;
+
+ if(ts_check_uri(_ruri)<0)
+ return -1;
+
+ if (pkg_str_dup(&ruri, _ruri) < 0)
+ return -1;
+
+ rc = ts_append(_msg, &ruri, _table->s);
+
+ pkg_free(ruri.s);
+
+ return rc;
+}
+
/**
*
*/
@@ -291,6 +315,15 @@ static int w_ts_append_to(struct sip_msg* msg, char *idx, char *lbl,
char *table
return ts_append_to(msg, tindex, tlabel, table, 0);
}
+/**
+ *
+ */
+static int ki_ts_append_to(sip_msg_t* _msg, int tindex, int tlabel, str *_table)
+{
+ return ts_append_to(_msg, (unsigned int)tindex, (unsigned int)tlabel,
+ _table->s, 0);
+}
+
/**
*
*/
@@ -320,6 +353,16 @@ static int w_ts_append_to2(struct sip_msg* msg, char *idx, char *lbl,
char *tabl
return ts_append_to(msg, tindex, tlabel, table, &suri);
}
+/**
+ *
+ */
+static int ki_ts_append_to_uri(sip_msg_t* _msg, int tindex, int tlabel,
+ str *_table, str *_uri)
+{
+ return ts_append_to(_msg, (unsigned int)tindex, (unsigned int)tlabel,
+ _table->s, _uri);
+}
+
/**
*
*/
@@ -328,6 +371,13 @@ static int w_ts_store(struct sip_msg* msg, char *p1, char *p2)
return ts_store(msg, 0);
}
+/**
+ *
+ */
+static int ki_ts_store(sip_msg_t* msg)
+{
+ return ts_store(msg, 0);
+}
/**
*
@@ -342,3 +392,44 @@ static int w_ts_store1(struct sip_msg* msg, char *_ruri, char *p2)
}
return ts_store(msg, &suri);
}
+
+/**
+ *
+ */
+/* clang-format off */
+static sr_kemi_t sr_kemi_tsilo_exports[] = {
+ { str_init("tsilo"), str_init("ts_store"),
+ SR_KEMIP_INT, ki_ts_store,
+ { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init("tsilo"), str_init("ts_store_uri"),
+ SR_KEMIP_INT, ts_store,
+ { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init("tsilo"), str_init("ts_append"),
+ SR_KEMIP_INT, ki_ts_append,
+ { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init("tsilo"), str_init("ts_append_to"),
+ SR_KEMIP_INT, ki_ts_append_to,
+ { SR_KEMIP_INT, SR_KEMIP_INT, SR_KEMIP_STR,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init("tsilo"), str_init("ts_append_to_uri"),
+ SR_KEMIP_INT, ki_ts_append_to_uri,
+ { SR_KEMIP_INT, SR_KEMIP_INT, SR_KEMIP_STR,
+ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+
+ { {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } }
+};
+/* clang-format on */
+
+int mod_register(char *path, int *dlflags, void *p1, void *p2)
+{
+ sr_kemi_modules_add(sr_kemi_tsilo_exports);
+ return 0;
+}
\ No newline at end of file