Module: sip-router
Branch: lazedo/kazoo
Commit: 722ee5ea86d38337d2ea901fbd5c087c9cc43ab3
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=722ee5e…
Author: Luis Azedo <luis(a)2600hz.com>
Committer: Luis Azedo <luis(a)2600hz.com>
Date: Thu Sep 11 17:32:56 2014 +0100
kazoo: remove dependency on tm module
---
modules/kazoo/Makefile | 7 ++-----
modules/kazoo/kazoo.c | 24 ------------------------
modules/kazoo/kz_amqp.c | 19 +++++++++++++++++--
modules/kazoo/kz_amqp.h | 1 -
4 files changed, 19 insertions(+), 32 deletions(-)
diff --git a/modules/kazoo/Makefile b/modules/kazoo/Makefile
index ae8bb2e..087ae6b 100644
--- a/modules/kazoo/Makefile
+++ b/modules/kazoo/Makefile
@@ -6,14 +6,11 @@ include ../../Makefile.defs
auto_gen=
NAME=kazoo.so
-DEFS+=-I/usr/local/include -DKAMAILIO_MOD_INTERFACE
-LIBS=-L/usr/local/lib -lrabbitmq -ljson
+DEFS+=-I$(LOCALBASE)/include -I$(SYSBASE)/include -DKAMAILIO_MOD_INTERFACE
+LIBS=-L$(LOCALBASE)/lib -I$(SYSBASE)/lib -lrabbitmq -ljson -luuid
DEFS += -DSER_MOD_INTERFACE
-ifeq ($(CROSS_COMPILE),)
-XML2CFG=$(shell which xml2-config)
-endif
SERLIBPATH=../../lib
SER_LIBS=$(SERLIBPATH)/srdb2/srdb2 $(SERLIBPATH)/srdb1/srdb1
diff --git a/modules/kazoo/kazoo.c b/modules/kazoo/kazoo.c
index 4428ee9..273f143 100644
--- a/modules/kazoo/kazoo.c
+++ b/modules/kazoo/kazoo.c
@@ -90,11 +90,6 @@ int dbk_pua_mode = 1;
int dbk_single_consumer_on_reconnect = 1;
int dbk_consume_messages_on_reconnect = 1;
-
-struct tm_binds tmb;
-pua_api_t kz_pua_api;
-presence_api_t kz_presence_api;
-
int startup_time = 0;
int *kz_pipe_fds = NULL;
@@ -195,20 +190,6 @@ struct module_exports exports = {
mod_child_init /* per-child init function */
};
-
-
-static int kz_initialize_bindings() {
- LM_DBG("kz_initialize_bindings\n");
-
- /* load all TM stuff */
- if (load_tm_api(&tmb) == -1) {
- LM_ERR("Can't load tm functions. Module TM not loaded?\n");
- return -1;
- }
-
- return 0;
-}
-
static int mod_init(void) {
int i;
startup_time = (int) time(NULL);
@@ -225,11 +206,6 @@ static int mod_init(void) {
kz_amqp_init();
- if(kz_initialize_bindings() == -1) {
- LM_ERR("Error initializing bindings\n");
- return -1;
- }
-
if(dbk_pua_mode == 1) {
kz_db_url.len = kz_db_url.s ? strlen(kz_db_url.s) : 0;
LM_DBG("db_url=%s/%d/%p\n", ZSW(kz_db_url.s), kz_db_url.len,kz_db_url.s);
diff --git a/modules/kazoo/kz_amqp.c b/modules/kazoo/kz_amqp.c
index 3931d27..abfe370 100644
--- a/modules/kazoo/kz_amqp.c
+++ b/modules/kazoo/kz_amqp.c
@@ -5,6 +5,7 @@
#include <amqp_framing.h>
#include <amqp_tcp_socket.h>
#include <json/json.h>
+#include <uuid/uuid.h>
#include "../../mem/mem.h"
#include "../../timer_proc.h"
#include "../../sr_module.h"
@@ -575,7 +576,14 @@ int kz_amqp_pipe_send(str *str_exchange, str *str_routing_key, str
*str_payload)
str unique_string = { 0, 0 };
char serverid[512];
- tmb.generate_callid(&unique_string);
+ uuid_t id;
+ char uuid_buffer[40];
+
+ uuid_generate_random(id);
+ uuid_unparse_lower(id, uuid_buffer);
+ unique_string.s = uuid_buffer;
+ unique_string.len = strlen(unique_string.s);
+
sprintf(serverid, "kamailio(a)%.*s-<%d>-script-%lu"script-%lu",
dbk_node_hostname.len, dbk_node_hostname.s, my_pid(), rpl_query_routing_key_count++);
@@ -642,7 +650,14 @@ int kz_amqp_pipe_send_receive(str *str_exchange, str
*str_routing_key, str *str_
str unique_string = { 0, 0 };
char serverid[512];
- tmb.generate_callid(&unique_string);
+ uuid_t id;
+ char uuid_buffer[40];
+
+ uuid_generate_random(id);
+ uuid_unparse_lower(id, uuid_buffer);
+ unique_string.s = uuid_buffer;
+ unique_string.len = strlen(unique_string.s);
+
sprintf(serverid, "kamailio(a)%.*s-<%d>-script-%lu"script-%lu",
dbk_node_hostname.len, dbk_node_hostname.s, my_pid(), rpl_query_routing_key_count++);
diff --git a/modules/kazoo/kz_amqp.h b/modules/kazoo/kz_amqp.h
index 10b9095..27769d6 100644
--- a/modules/kazoo/kz_amqp.h
+++ b/modules/kazoo/kz_amqp.h
@@ -22,7 +22,6 @@ typedef kz_amqp_connection_info *kz_amqp_connection_info_ptr;
extern int dbk_channels;
extern str dbk_node_hostname;
-extern struct tm_binds tmb;
extern str dbk_consumer_event_key;
extern str dbk_consumer_event_subkey;
extern int dbk_consumer_processes;