From 360ad4c1789e85bb69ae608a00b5c998f3bbea1f Mon Sep 17 00:00:00 2001 From: Andreas Granig Date: Thu, 1 Mar 2012 16:18:55 +0000 Subject: [PATCH 1/3] Parse and insert init_time. --- cdr.c | 14 ++++++++++++-- cdr.h | 1 + medmysql.c | 6 +++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/cdr.c b/cdr.c index ec5cf39..19b1ea6 100644 --- a/cdr.c +++ b/cdr.c @@ -256,13 +256,23 @@ static int cdr_parse_srcleg(char *srcleg, cdr_entry_t *cdr) cdr->source_clir = atoi(tmp2); tmp2 = ++tmp1; - if(len < tmp2 - srcleg + 1) + tmp1 = strchr(tmp2, MED_SEP); + if(tmp1 == NULL) { syslog(LOG_WARNING, "Call-Id '%s' has no separated call type, '%s'", cdr->call_id, tmp2); return -1; } + *tmp1 = '\0'; g_strlcpy(cdr->call_type, tmp2, sizeof(cdr->call_type)); - + tmp2 = ++tmp1; + + if(len < tmp2 - srcleg + 1) + { + syslog(LOG_WARNING, "Call-Id '%s' has no separated init time, '%s'", cdr->call_id, tmp2); + return -1; + } + cdr->init_time = g_strtod(tmp2, NULL); + return 0; } diff --git a/cdr.h b/cdr.h index 49aa814..1950f15 100644 --- a/cdr.h +++ b/cdr.h @@ -47,6 +47,7 @@ typedef struct { char peer_auth_user[256]; char peer_auth_realm[256]; + double init_time; double start_time; double duration; diff --git a/medmysql.c b/medmysql.c index 7187a58..25a5f34 100644 --- a/medmysql.c +++ b/medmysql.c @@ -322,12 +322,13 @@ int medmysql_insert_cdrs(cdr_entry_t *entries, u_int64_t count, struct medmysql_ "source_cli, source_clir, "\ "destination_user_id, destination_provider_id, destination_external_subscriber_id, destination_external_contract_id, destination_account_id, destination_user, destination_domain, " \ "destination_user_in, destination_domain_in, destination_user_dialed, " \ - "peer_auth_user, peer_auth_realm, call_type, call_status, call_code, start_time, duration, call_id, " \ + "peer_auth_user, peer_auth_realm, call_type, call_status, call_code, init_time, start_time, duration, call_id, " \ "carrier_cost, reseller_cost, customer_cost) values "); } cdr_entry_t *e = &(entries[i]); char str_source_clir[2] = ""; + char str_init_time[32] = ""; char str_start_time[32] = ""; char str_duration[32] = ""; char str_carrier_cost[32] = ""; @@ -336,6 +337,7 @@ int medmysql_insert_cdrs(cdr_entry_t *entries, u_int64_t count, struct medmysql_ char str_source_accid[32] = ""; char str_dest_accid[32] = ""; snprintf(str_source_clir, sizeof(str_source_clir), "%u", e->source_clir); + snprintf(str_init_time, sizeof(str_init_time), "%f", e->init_time); snprintf(str_start_time, sizeof(str_start_time), "%f", e->start_time); snprintf(str_duration, sizeof(str_duration), "%f", e->duration); snprintf(str_carrier_cost, sizeof(str_carrier_cost), "%u", e->carrier_cost); @@ -395,6 +397,8 @@ int medmysql_insert_cdrs(cdr_entry_t *entries, u_int64_t count, struct medmysql_ CDRPRINT("','"); CDRESCAPE(e->call_code); CDRPRINT("',"); + CDRESCAPE(str_init_time); + CDRPRINT(","); CDRESCAPE(str_start_time); CDRPRINT(","); CDRESCAPE(str_duration); From 90e0e3cf81b07e5acc664898810a64da19abd41e Mon Sep 17 00:00:00 2001 From: Andrew Pogrebennyk Date: Mon, 5 Mar 2012 14:18:22 +0000 Subject: [PATCH 2/3] new changelog entry for 1.3.5 --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 96062cb..ddbbecb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +ngcp-mediator (1.3.5) unstable; urgency=low + + * Parse and insert init_time. + + -- Andrew Pogrebennyk Mon, 05 Mar 2012 15:15:38 +0100 + ngcp-mediator (1.3.4) unstable; urgency=low * Increase call-id string size. From 613200db4b28711c7c9ce2bf2749c950a5dbc81f Mon Sep 17 00:00:00 2001 From: Andrew Pogrebennyk Date: Mon, 5 Mar 2012 15:26:26 +0000 Subject: [PATCH 3/3] fix wrong tagging (forgot to commit merge before tagging) --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index ddbbecb..6d2966e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +ngcp-mediator (1.3.6) unstable; urgency=low + + * Fixes wrong merging/tagging. + + -- Andrew Pogrebennyk Mon, 05 Mar 2012 16:25:42 +0100 + ngcp-mediator (1.3.5) unstable; urgency=low * Parse and insert init_time.