From a4f96220ec608b8a2984863c5efe3ab4e03bd17e Mon Sep 17 00:00:00 2001 From: Alessio Garzi Date: Tue, 23 Mar 2021 17:00:56 +0100 Subject: [PATCH] TT#116555 new last_hih redis key managed Implemented to store new redis key "last_hih" to mysql cdrs. Change-Id: I796943bf6cc07c592a5ff26f05db1dad0ab08c44 --- cdr.c | 8 ++++++++ cdr.h | 1 + medmysql.c | 3 +++ 3 files changed, 12 insertions(+) diff --git a/cdr.c b/cdr.c index 530fec6..d481282 100644 --- a/cdr.c +++ b/cdr.c @@ -532,6 +532,14 @@ static int cdr_parse_srcleg_json(json_object *json, cdr_entry_t *cdr) goto ret; } + // source_last_hih + if (!cdr_parse_json_get_strbuf(json, "last_hih", cdr->source_last_hih)) { + L_DEBUG("Call-Id '%s' does not contain 'last_hih' key (source last hih), '%s'", cdr->call_id, json_object_get_string(json)); + /// Added in mr9.4, it should be changed to -1 in mr10.+ + /// goto err; + goto ret; + } + ret: json_object_put(json); return 0; diff --git a/cdr.h b/cdr.h index 3a904a7..f2ea1aa 100644 --- a/cdr.h +++ b/cdr.h @@ -95,6 +95,7 @@ typedef struct { char destination_concurrent_calls_quota[32]; char destination_concurrent_calls_count[32]; char destination_concurrent_calls_count_customer[32]; + char source_last_hih[32]; char acc_ref[256]; unsigned int intermediate:1; diff --git a/medmysql.c b/medmysql.c index a55a78e..9164c75 100644 --- a/medmysql.c +++ b/medmysql.c @@ -1137,6 +1137,9 @@ int medmysql_insert_cdrs(cdr_entry_t *entries, uint64_t count, struct medmysql_b if (medmysql_tag_cdr(batch, medmysql_tag_provider_customer, medmysql_tag_direction_destination, "concurrent_calls_count_customer", e->destination_concurrent_calls_count_customer, e)) return -1; + if (medmysql_tag_cdr(batch, medmysql_tag_provider_customer, medmysql_tag_direction_source, + "header=History-Info", e->source_last_hih, e)) + return -1; if (e->mos.filled && batch->mos.def) { if (medmysql_mos_record(&batch->cdr_mos, batch->num_cdrs, e->mos.avg_score,