Module: kamailio Branch: master Commit: 43e7f3425ed5d2ad2bcd9b9c52442174ef243729 URL: https://github.com/kamailio/kamailio/commit/43e7f3425ed5d2ad2bcd9b9c52442174ef243729
Author: Luis Azedo <luis.az...@factorlusitano.com> Committer: Luis Azedo <luis.az...@factorlusitano.com> Date: 2015-06-16T20:14:40+01:00 kazoo : do not override common properties in payload if they exist also adds app_name parameter to be sent in "App-Name" field, defaults to NAME at compilation time (kamailio) --- Modified: modules/kazoo/const.h Modified: modules/kazoo/kazoo.c Modified: modules/kazoo/kz_amqp.c --- Diff: https://github.com/kamailio/kamailio/commit/43e7f3425ed5d2ad2bcd9b9c52442174ef243729.diff Patch: https://github.com/kamailio/kamailio/commit/43e7f3425ed5d2ad2bcd9b9c52442174ef243729.patch --- diff --git a/modules/kazoo/const.h b/modules/kazoo/const.h index 0e469bd..0e1ff9a 100644 --- a/modules/kazoo/const.h +++ b/modules/kazoo/const.h @@ -13,6 +13,7 @@ extern str str_event_message_summary; extern str str_event_dialog; extern str str_event_presence; +extern str kz_app_name; extern str str_username_col; extern str str_domain_col; diff --git a/modules/kazoo/kazoo.c b/modules/kazoo/kazoo.c index 05027d9..0b1cfa4 100644 --- a/modules/kazoo/kazoo.c +++ b/modules/kazoo/kazoo.c @@ -103,6 +103,8 @@ str kz_db_url = {0,0}; str kz_query_timeout_avp = {0,0}; pv_spec_t kz_query_timeout_spec; +str kz_app_name = str_init(NAME); + MODULE_VERSION static tr_export_t mod_trans[] = { @@ -176,6 +178,7 @@ static param_export_t params[] = { {"consume_messages_on_reconnect", INT_PARAM, &dbk_consume_messages_on_reconnect}, {"amqp_query_timeout_avp", STR_PARAM, &kz_query_timeout_avp.s}, {"json_escape_char", STR_PARAM, &kz_json_escape_str.s}, + {"app_name", STR_PARAM, &kz_app_name.s}, {0, 0, 0} }; diff --git a/modules/kazoo/kz_amqp.c b/modules/kazoo/kz_amqp.c index 075ad84..af01260 100644 --- a/modules/kazoo/kz_amqp.c +++ b/modules/kazoo/kz_amqp.c @@ -688,15 +688,19 @@ void kz_amqp_add_payload_common_properties(json_obj_ptr json_obj, char* server_i char node_name[512]; - json_object_object_add(json_obj, BLF_JSON_APP_NAME, - json_object_new_string(NAME)); - json_object_object_add(json_obj, BLF_JSON_APP_VERSION, - json_object_new_string(VERSION)); - sprintf(node_name, "kamailio@%.*s", dbk_node_hostname.len, dbk_node_hostname.s); - json_object_object_add(json_obj, BLF_JSON_NODE, - json_object_new_string(node_name)); - json_object_object_add(json_obj, BLF_JSON_MSG_ID, - json_object_new_string_len(unique->s, unique->len)); + if(kz_json_get_object(json_obj, BLF_JSON_APP_NAME) == NULL) + json_object_object_add(json_obj, BLF_JSON_APP_NAME, json_object_new_string(kz_app_name.s)); + + if(kz_json_get_object(json_obj, BLF_JSON_APP_VERSION) == NULL) + json_object_object_add(json_obj, BLF_JSON_APP_VERSION, json_object_new_string(VERSION)); + + if(kz_json_get_object(json_obj, BLF_JSON_NODE) == NULL) { + sprintf(node_name, "kamailio@%.*s", dbk_node_hostname.len, dbk_node_hostname.s); + json_object_object_add(json_obj, BLF_JSON_NODE, json_object_new_string(node_name)); + } + + if(kz_json_get_object(json_obj, BLF_JSON_MSG_ID) == NULL) + json_object_object_add(json_obj, BLF_JSON_MSG_ID, json_object_new_string_len(unique->s, unique->len)); } _______________________________________________ sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev