Module: kamailio
Branch: master
Commit: 185e7f64668cf4e8de3fa83d482e02e90b4fd3e5
URL:
https://github.com/kamailio/kamailio/commit/185e7f64668cf4e8de3fa83d482e02e…
Author: Sergey Safarov <s.safarov(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-12-12T12:50:18+01:00
kazoo: fixed rabbitmq-c deprecation warning
---
Modified: src/modules/kazoo/Makefile
Modified: src/modules/kazoo/kz_amqp.c
Modified: src/modules/kazoo/kz_amqp.h
---
Diff:
https://github.com/kamailio/kamailio/commit/185e7f64668cf4e8de3fa83d482e02e…
Patch:
https://github.com/kamailio/kamailio/commit/185e7f64668cf4e8de3fa83d482e02e…
---
diff --git a/src/modules/kazoo/Makefile b/src/modules/kazoo/Makefile
index b7b1e1615cd..c0c7e9d3d22 100644
--- a/src/modules/kazoo/Makefile
+++ b/src/modules/kazoo/Makefile
@@ -11,6 +11,10 @@ ifeq ($(BUILDER),)
JSONC=$(shell ls $(SYSBASE)/include/lib/libjson*.so $(LOCALBASE)/lib/libjson*.so
2>/dev/null | grep json-c)
else
JSONC=$(shell pkg-config --libs json-c 2>/dev/null | grep json-c)
+
+ ifeq ($(shell pkg-config --atleast-version=0.13.0 librabbitmq; echo $$?),0)
+ DEFS += -DRABBITMQ_DEPRECATION
+ endif
endif
ifneq ($(JSONC),)
diff --git a/src/modules/kazoo/kz_amqp.c b/src/modules/kazoo/kz_amqp.c
index a5cb429270a..ed696116514 100644
--- a/src/modules/kazoo/kz_amqp.c
+++ b/src/modules/kazoo/kz_amqp.c
@@ -29,10 +29,19 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
+
+#if RABBITMQ_DEPRECATION
+#include <rabbitmq-c/amqp.h>
+#include <rabbitmq-c/framing.h>
+#include <rabbitmq-c/tcp_socket.h>
+#include <rabbitmq-c/ssl_socket.h>
+#else
#include <amqp.h>
#include <amqp_framing.h>
#include <amqp_tcp_socket.h>
#include <amqp_ssl_socket.h>
+#endif
+
#include <json.h>
#include <uuid/uuid.h>
#include "../../core/mem/mem.h"
diff --git a/src/modules/kazoo/kz_amqp.h b/src/modules/kazoo/kz_amqp.h
index 6cfddbed8ac..faca990f166 100644
--- a/src/modules/kazoo/kz_amqp.h
+++ b/src/modules/kazoo/kz_amqp.h
@@ -32,7 +32,12 @@
#include <fcntl.h>
#include <event.h>
#include <sys/timerfd.h>
+
+#if RABBITMQ_DEPRECATION
+#include <rabbitmq-c/amqp.h>
+#else
#include <amqp.h>
+#endif
#include "../../core/sr_module.h"
#include "../../core/str.h"