TT#70855 Read source_lcr_id from acc record and use it to generate CDR

Tha value is readed from the last field of the the ACC srcleg.
It contains the ID of the peer_host from where the call was received.
Mediator uses it to find the correct peering_contract_id to write in
the CDR.

Change-Id: I2cfb7d0fadb5ade265fde3c1778475eda431a453
(cherry picked from commit 87ec80a553)
changes/82/35482/2
Marco Capetta 7 years ago
parent f177eca5e0
commit f660ea6afa

16
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));

@ -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];

Loading…
Cancel
Save