Module: kamailio
Branch: master
Commit: 92648988694970bc7b29a56814c935421d362cfa
URL:
https://github.com/kamailio/kamailio/commit/92648988694970bc7b29a56814c9354…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-05-28T11:36:24+02:00
kazoo: avoid unnecessary casts for kemi exports
---
Modified: src/modules/kazoo/kz_amqp.c
Modified: src/modules/kazoo/kz_amqp.h
---
Diff:
https://github.com/kamailio/kamailio/commit/92648988694970bc7b29a56814c9354…
Patch:
https://github.com/kamailio/kamailio/commit/92648988694970bc7b29a56814c9354…
---
diff --git a/src/modules/kazoo/kz_amqp.c b/src/modules/kazoo/kz_amqp.c
index 7c9482e270..8076315dfd 100644
--- a/src/modules/kazoo/kz_amqp.c
+++ b/src/modules/kazoo/kz_amqp.c
@@ -1242,21 +1242,21 @@ int kz_amqp_publish_ex(struct sip_msg* msg, char* exchange, char*
routing_key, c
return -1;
}
- return ki_kz_amqp_publish(msg, (char*)&exchange_s, (char*)&routing_key_s,
(char*)&pl_s);
+ return ki_kz_amqp_publish(msg, &exchange_s, &routing_key_s, &pl_s);
};
-int ki_kz_amqp_publish(struct sip_msg* msg, char* exchange, char* routing_key, char*
payload)
+int ki_kz_amqp_publish(sip_msg_t* msg, str* exchange, str* routing_key, str* payload)
{
char *pl = ((str*)payload)->s;
struct json_object *j = json_tokener_parse(pl);
if (j==NULL) {
- LM_ERR("empty or invalid JSON payload : %.*s\n", ((str*)payload)->len,
((str*)payload)->s);
+ LM_ERR("empty or invalid JSON payload : %.*s\n", payload->len,
payload->s);
return -1;
}
-
+
json_object_put(j);
- return kz_amqp_pipe_send((str*)exchange, (str*)routing_key, (str*)payload);
+ return kz_amqp_pipe_send(exchange, routing_key, payload);
}
int kz_amqp_publish(struct sip_msg* msg, char* exchange, char* routing_key, char*
payload)
@@ -1801,16 +1801,16 @@ kz_amqp_exchange_binding_ptr
kz_amqp_exchange_binding_from_json(json_object* JOb
int kz_amqp_subscribe(struct sip_msg* msg, char* payload)
{
str payload_s = STR_NULL;
-
+
if (fixup_get_svalue(msg, (gparam_p)payload, &payload_s) != 0) {
LM_ERR("cannot get payload value\n");
return -1;
}
- return ki_kz_amqp_subscribe(msg, (char*)(&payload_s));
+ return ki_kz_amqp_subscribe(msg, &payload_s);
}
-int ki_kz_amqp_subscribe(struct sip_msg* msg, char* payload)
+int ki_kz_amqp_subscribe(struct sip_msg* msg, str* payload)
{
str exchange_s = STR_NULL;
str queue_s = STR_NULL;
@@ -1833,12 +1833,11 @@ int ki_kz_amqp_subscribe(struct sip_msg* msg, char* payload)
kz_amqp_bind_ptr bind = NULL;
kz_amqp_binding_ptr binding = NULL;
- char* pl = ((str*)payload)->s;
+ char* pl = payload->s;
json_obj = kz_json_parse(pl);
if (json_obj == NULL)
return -1;
-
json_extract_field("exchange", exchange_s);
json_extract_field("queue", queue_s);
diff --git a/src/modules/kazoo/kz_amqp.h b/src/modules/kazoo/kz_amqp.h
index 1ca3e5447f..cf8333acad 100644
--- a/src/modules/kazoo/kz_amqp.h
+++ b/src/modules/kazoo/kz_amqp.h
@@ -274,11 +274,11 @@ int kz_amqp_add_connection(modparam_t type, void* val);
int kz_amqp_publish(struct sip_msg* msg, char* exchange, char* routing_key, char*
payload);
int kz_amqp_publish_ex(struct sip_msg* msg, char* exchange, char* routing_key, char*
payload, char* _pub_flags);
-int ki_kz_amqp_publish(struct sip_msg* msg, char* exchange, char* routing_key, char*
payload);
+int ki_kz_amqp_publish(sip_msg_t* msg, str* exchange, str* routing_key, str* payload);
int kz_amqp_query(struct sip_msg* msg, char* exchange, char* routing_key, char* payload,
char* dst);
int kz_amqp_query_ex(struct sip_msg* msg, char* exchange, char* routing_key, char*
payload);
int kz_amqp_subscribe(struct sip_msg* msg, char* payload);
-int ki_kz_amqp_subscribe(struct sip_msg* msg, char* payload);
+int ki_kz_amqp_subscribe(sip_msg_t* msg, str* payload);
int kz_amqp_subscribe_simple(struct sip_msg* msg, char* exchange, char* exchange_type,
char* queue_name, char* routing_key);
int kz_amqp_encode(struct sip_msg* msg, char* unencoded, char* encoded);
int kz_amqp_encode_ex(str* unencoded, pv_value_p dst_val);