Skip to content

Commit

Permalink
MT#59993 New field header_ppi (P-Preferred-Identity header)
Browse files Browse the repository at this point in the history
New field "header_ppi" is now managed and inserted into
cdr_tag_data mysql table.
This field will store into the aggregated cdr data the
P-Preferred-Identity header of the INVITE.

Change-Id: Ib875976fd7332e80ae100f257c7af701ffe9f661
  • Loading branch information
marcocapetta committed May 31, 2024
1 parent 42dee46 commit b2212ef
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
22 changes: 22 additions & 0 deletions cdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,15 @@ static int cdr_parse_srcleg_json(json_object *json, cdr_entry_t *cdr)
goto err;
}

// header_ppi
if (!cdr_parse_json_get_g_string(json, "ppi", cdr->header_ppi)) {
L_ERROR("Call-Id '%s' does not contain 'ppi' key (P-Preferred-Identity header), '%s'", cdr->call_id->str, json_object_get_string(json));
/// Simply return 0 in order to avoid issues with ACC records in the OLD format during an upgrade
/// Added in mr12.5, it should be changed to 'err' in mr13.+
/// goto err;
goto ret;
}

ret:
return 0;

Expand Down Expand Up @@ -1030,6 +1039,19 @@ static int cdr_parse_srcleg_list(char *srcleg, cdr_entry_t *cdr)
*tmp1 = MED_SEP;
tmp2 = ++tmp1;

tmp1 = strchr(tmp2, MED_SEP);
if(tmp1 == NULL)
{
L_ERROR("Call-Id '%s' has no separated P-Preferred-Identity header, '%s'", cdr->call_id->str, tmp2);
/// Simply return 0 in order to avoid issues with ACC records in the OLD format during an upgrade
/// Added in mr12.5, it should be changed to -1 in mr13.+
return 0;
}
*tmp1 = '\0';
g_string_assign(cdr->header_ppi, tmp2);
*tmp1 = MED_SEP;
tmp2 = ++tmp1;

return 0;
}

Expand Down
1 change: 1 addition & 0 deletions cdr_field_names.inc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ F(furnished_charging_info)
F(header_diversion)
F(header_pai)
F(header_u2u)
F(header_ppi)

F(group)

Expand Down
3 changes: 3 additions & 0 deletions medmysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,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_source,
"concurrent_calls_count_customer", e->source_concurrent_calls_count_customer, e))
return -1;
if (medmysql_tag_cdr(batch, medmysql_tag_provider_customer, medmysql_tag_direction_source,
"header=P-Preferred-Identity", e->header_ppi, e))
return -1;

if (medmysql_tag_cdr(batch, medmysql_tag_provider_customer, medmysql_tag_direction_destination,
"furnished_charging_info", e->furnished_charging_info, e))
Expand Down

0 comments on commit b2212ef

Please sign in to comment.