[mod_amqp] Add support for newer librabbitmq

This commit is contained in:
Andrey Volk
2025-07-12 11:55:57 +00:00
parent ff18e4db5f
commit 239c28db8f
6 changed files with 31 additions and 4 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ if HAVE_AMQP
mod_LTLIBRARIES = mod_amqp.la
mod_amqp_la_SOURCES = mod_amqp_utils.c mod_amqp_connection.c mod_amqp_producer.c mod_amqp_command.c mod_amqp_logging.c mod_amqp.c
mod_amqp_la_CFLAGS = $(AM_CFLAGS) $(AMQP_CFLAGS)
mod_amqp_la_CFLAGS = $(AM_CFLAGS) $(AMQP_CFLAGS) -DAMQP_MAJOR_VERSION=$(AMQP_MAJOR_VERSION) -DAMQP_MINOR_VERSION=$(AMQP_MINOR_VERSION)
mod_amqp_la_LIBADD = $(switch_builddir)/libfreeswitch.la
mod_amqp_la_LDFLAGS = -avoid-version -module -no-undefined -shared $(AMQP_LIBS) $(SWITCH_AM_LDFLAGS)
@@ -40,10 +40,18 @@
#define MOD_AMQP_H
#include <switch.h>
#define AMQP_VERSION_INT(a, b) ((a)<<8 | (b))
#if AMQP_VERSION_INT(AMQP_MAJOR_VERSION, AMQP_MINOR_VERSION) >= AMQP_VERSION_INT(0, 12)
#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
#ifndef _MSC_VER
#include <strings.h>
@@ -117,7 +117,9 @@ switch_status_t mod_amqp_connection_open(mod_amqp_connection_t *connections, mod
while (connection_attempt && amqp_status){
if (connection_attempt->ssl_on == 1) {
#if AMQP_VERSION_INT(AMQP_MAJOR_VERSION, AMQP_MINOR_VERSION) < AMQP_VERSION_INT(0, 13)
amqp_set_initialize_ssl_library(connection_attempt->ssl_on);
#endif
if (!(socket = amqp_ssl_socket_new(newConnection))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not create SSL socket\n");
goto err;