Module: kamailio Branch: master Commit: f87a631146c50a3c6e0ef843c5f85120957cb101 URL: https://github.com/kamailio/kamailio/commit/f87a631146c50a3c6e0ef843c5f85120...
Author: Luis Azedo luis.azedo@factorlusitano.com Committer: Luis Azedo luis.azedo@factorlusitano.com Date: 2015-06-23T09:47:14+01:00
kazoo : federation tweaks
---
Modified: modules/kazoo/kazoo.c Modified: modules/kazoo/kz_amqp.c
---
Diff: https://github.com/kamailio/kamailio/commit/f87a631146c50a3c6e0ef843c5f85120... Patch: https://github.com/kamailio/kamailio/commit/f87a631146c50a3c6e0ef843c5f85120...
---
diff --git a/modules/kazoo/kazoo.c b/modules/kazoo/kazoo.c index 4d3b8e9..6366d3b 100644 --- a/modules/kazoo/kazoo.c +++ b/modules/kazoo/kazoo.c @@ -59,7 +59,7 @@ int dbk_reconn_retries = 8; int dbk_presentity_phtable_size = 4096;
int dbk_use_federated_exchange = 1; -str dbk_federated_exchange = str_init("federate"); +str dbk_federated_exchange = str_init("federation"); str dbk_primary_zone_name = str_init("local");
//int dbk_dialog_expires = 30; diff --git a/modules/kazoo/kz_amqp.c b/modules/kazoo/kz_amqp.c index 3894cc8..4b3d6fb 100644 --- a/modules/kazoo/kz_amqp.c +++ b/modules/kazoo/kz_amqp.c @@ -1480,14 +1480,16 @@ int kz_amqp_bind_consumer(kz_amqp_conn_ptr kz_conn, kz_amqp_bind_ptr bind, int i amqp_bytes_t federated_routing_key = {0, 0}; char _federated[100];
- amqp_exchange_declare(kz_conn->conn, chan[idx].channel, bind->exchange, bind->exchange_type, 0, 0, kz_amqp_empty_table); - if (kz_amqp_error("Declaring exchange", amqp_get_rpc_reply(kz_conn->conn))) - { - ret = -RET_AMQP_ERROR; - goto error; - } + if(bind->federate == 0 || dbk_use_federated_exchange == 0) { + amqp_exchange_declare(kz_conn->conn, chan[idx].channel, bind->exchange, bind->exchange_type, 0, 0, kz_amqp_empty_table); + if (kz_amqp_error("Declaring exchange", amqp_get_rpc_reply(kz_conn->conn))) + { + ret = -RET_AMQP_ERROR; + goto error; + } + }
- if(bind->federate == 1 && dbk_use_federated_exchange == 1) { + if(bind->federate == 1 && dbk_use_federated_exchange == 1) { federated_exchange = kz_local_amqp_bytes_dup_from_string(dbk_federated_exchange.s); amqp_exchange_declare(kz_conn->conn, chan[idx].channel, federated_exchange, bind->exchange_type, 0, 0, kz_amqp_empty_table); if (kz_amqp_error("Declaring federated exchange", amqp_get_rpc_reply(kz_conn->conn))) @@ -1504,13 +1506,15 @@ int kz_amqp_bind_consumer(kz_amqp_conn_ptr kz_conn, kz_amqp_bind_ptr bind, int i goto error; }
- LM_DBG("QUEUE BIND\n"); - if (amqp_queue_bind(kz_conn->conn, chan[idx].channel, bind->queue, bind->exchange, bind->routing_key, kz_amqp_empty_table) < 0 - || kz_amqp_error("Binding queue", amqp_get_rpc_reply(kz_conn->conn))) - { - ret = -RET_AMQP_ERROR; - goto error; - } + if(bind->federate == 0 || dbk_use_federated_exchange == 0) { + LM_DBG("QUEUE BIND\n"); + if (amqp_queue_bind(kz_conn->conn, chan[idx].channel, bind->queue, bind->exchange, bind->routing_key, kz_amqp_empty_table) < 0 + || kz_amqp_error("Binding queue", amqp_get_rpc_reply(kz_conn->conn))) + { + ret = -RET_AMQP_ERROR; + goto error; + } + }
if(bind->federate == 1 && dbk_use_federated_exchange == 1) { sprintf(_federated, "%.*s%s%.*s", (int)bind->exchange.len, (char*)bind->exchange.bytes,