TT#22470 introduce source_lnp_type, destination_lnp_type

* added acc fields: source_lnp_type, destination_lnp_type
    * source_lnp_type is stored as NULL if the string is empty
    * destination_lnp_type is stored as NULL if the string is empty

Change-Id: Ia81debf9ff56aca87e4f1bcc4a82f8c8b9c1edec
changes/63/15763/5
Kirill Solomko 8 years ago
parent 16757c96f8
commit 27220822bd

20
cdr.c

@ -388,6 +388,16 @@ static int cdr_parse_srcleg(char *srcleg, cdr_entry_t *cdr)
g_strlcpy(cdr->source_user_out, tmp2, sizeof(cdr->source_user_out));
tmp2 = ++tmp1;
tmp1 = strchr(tmp2, MED_SEP);
if(tmp1 == NULL)
{
syslog(LOG_WARNING, "Call-Id '%s' has no separated source lnp type, '%s'", cdr->call_id, tmp2);
return -1;
}
*tmp1 = '\0';
g_strlcpy(cdr->source_lnp_type, tmp2, sizeof(cdr->source_lnp_type));
tmp2 = ++tmp1;
return 0;
}
@ -556,6 +566,16 @@ static int cdr_parse_dstleg(char *dstleg, cdr_entry_t *cdr)
g_strlcpy(cdr->destination_user_out, tmp2, sizeof(cdr->destination_user_out));
tmp2 = ++tmp1;
tmp1 = strchr(tmp2, MED_SEP);
if(tmp1 == NULL)
{
syslog(LOG_WARNING, "Call-Id '%s' has no separated destination lnp type, '%s'", cdr->call_id, tmp2);
return -1;
}
*tmp1 = '\0';
g_strlcpy(cdr->destination_lnp_type, tmp2, sizeof(cdr->destination_lnp_type));
tmp2 = ++tmp1;
return 0;
}

@ -32,6 +32,7 @@ typedef struct {
char source_gpp[10][255];
char source_lnp_prefix[256];
char source_user_out[256];
char source_lnp_type[256];
char destination_user_id[37];
char destination_provider_id[256];
@ -47,6 +48,7 @@ typedef struct {
char destination_gpp[10][255];
char destination_lnp_prefix[256];
char destination_user_out[256];
char destination_lnp_type[256];
char call_type[8];
char call_status[16];

@ -408,7 +408,8 @@ int medmysql_insert_cdrs(cdr_entry_t *entries, u_int64_t count, struct medmysql_
"destination_gpp0, destination_gpp1, destination_gpp2, destination_gpp3, destination_gpp4, " \
"destination_gpp5, destination_gpp6, destination_gpp7, destination_gpp8, destination_gpp9, " \
"source_lnp_prefix, destination_lnp_prefix, " \
"source_user_out, destination_user_out" \
"source_user_out, destination_user_out, " \
"source_lnp_type, destination_lnp_type" \
") values ");
}
@ -549,7 +550,31 @@ int medmysql_insert_cdrs(cdr_entry_t *entries, u_int64_t count, struct medmysql_
CDRESCAPE(e->source_user_out);
CDRPRINT("','");
CDRESCAPE(e->destination_user_out);
CDRPRINT("'),");
CDRPRINT("'");
if(strnlen(e->source_lnp_type, sizeof(e->source_lnp_type)) > 0)
{
CDRPRINT(",'");
CDRESCAPE(e->source_lnp_type);
CDRPRINT("'");
}
else
{
CDRPRINT(",NULL");
}
if(strnlen(e->destination_lnp_type, sizeof(e->destination_lnp_type)) > 0)
{
CDRPRINT(",'");
CDRESCAPE(e->destination_lnp_type);
CDRPRINT("'");
}
else
{
CDRPRINT(",NULL");
}
CDRPRINT("),");
// no check for return codes here we should keep on nevertheless
medmysql_update_call_stat_info(e->call_code, e->start_time, batches);

Loading…
Cancel
Save