diff --git a/cdr.c b/cdr.c index 0f262ad..6da6f78 100644 --- a/cdr.c +++ b/cdr.c @@ -476,6 +476,16 @@ static int cdr_parse_srcleg(char *srcleg, cdr_entry_t *cdr) g_strlcpy(cdr->header_u2u, tmp2, sizeof(cdr->header_u2u)); tmp2 = ++tmp1; + tmp1 = strchr(tmp2, MED_SEP); + if(tmp1 == NULL) + { + L_WARNING("Call-Id '%s' has no separated source lcr id, '%s'", cdr->call_id, tmp2); + return -1; + } + *tmp1 = '\0'; + cdr->source_lcr_id = atoll(tmp2); + tmp2 = ++tmp1; + return 0; } @@ -905,6 +915,12 @@ void cdr_set_provider(cdr_entry_t *cdr) g_strlcpy(cdr->source_provider_id, "0", sizeof(cdr->source_provider_id)); } } + else if (cdr->source_lcr_id) { + snprintf(cdr->source_provider_id, sizeof(cdr->source_provider_id), + "%llu", (unsigned long long) cdr->source_lcr_id); + val = g_hash_table_lookup(med_peer_id_table, cdr->source_provider_id); + g_strlcpy(cdr->source_provider_id, val ? : "0", sizeof(cdr->source_provider_id)); + } else if((val = g_hash_table_lookup(med_peer_ip_table, cdr->source_domain)) != NULL) { g_strlcpy(cdr->source_provider_id, val, sizeof(cdr->source_provider_id)); diff --git a/cdr.h b/cdr.h index a1a5119..31901c6 100644 --- a/cdr.h +++ b/cdr.h @@ -37,6 +37,7 @@ typedef struct { char source_cli[65]; char source_ip[65]; uint8_t source_clir; + uint64_t source_lcr_id; char source_gpp[10][255]; char source_lnp_prefix[256]; char source_user_out[256];