TT#97150 restore strings broken up by separator parsing

This is relevant for records coming from Redis, as the insertion into
the trash and backup tables is done from the strings kept in memory.

Change-Id: I1398f7bfc0d4a0c2da8b8104dc4589ea9d983da7
(cherry picked from commit 6e957e69b7)
(cherry picked from commit d9dd8eebdf)
mr6.5.1
Richard Fuchs 6 years ago
parent 991946952c
commit 88e2df2e4b

35
cdr.c

@ -249,6 +249,7 @@ static int cdr_parse_srcleg(char *srcleg, cdr_entry_t *cdr)
}
*tmp1 = '\0';
g_strlcpy(cdr->source_user_id, tmp2, sizeof(cdr->source_user_id));
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
tmp1 = strchr(tmp2, MED_SEP);
@ -260,6 +261,7 @@ static int cdr_parse_srcleg(char *srcleg, cdr_entry_t *cdr)
*tmp1 = '\0';
g_strlcpy(cdr->source_user, tmp2, sizeof(cdr->source_user));
uri_unescape(cdr->source_user);
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
tmp1 = strchr(tmp2, MED_SEP);
@ -270,6 +272,7 @@ static int cdr_parse_srcleg(char *srcleg, cdr_entry_t *cdr)
}
*tmp1 = '\0';
g_strlcpy(cdr->source_domain, tmp2, sizeof(cdr->source_domain));
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
@ -282,6 +285,7 @@ static int cdr_parse_srcleg(char *srcleg, cdr_entry_t *cdr)
*tmp1 = '\0';
g_strlcpy(cdr->source_cli, tmp2, sizeof(cdr->source_cli));
uri_unescape(cdr->source_cli);
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
tmp1 = strchr(tmp2, MED_SEP);
@ -293,6 +297,7 @@ static int cdr_parse_srcleg(char *srcleg, cdr_entry_t *cdr)
*tmp1 = '\0';
g_strlcpy(cdr->source_ext_subscriber_id, tmp2, sizeof(cdr->source_ext_subscriber_id));
uri_unescape(cdr->source_ext_subscriber_id);
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
tmp1 = strchr(tmp2, MED_SEP);
@ -304,6 +309,7 @@ static int cdr_parse_srcleg(char *srcleg, cdr_entry_t *cdr)
*tmp1 = '\0';
g_strlcpy(cdr->source_ext_contract_id, tmp2, sizeof(cdr->source_ext_contract_id));
uri_unescape(cdr->source_ext_contract_id);
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
tmp1 = strchr(tmp2, MED_SEP);
@ -314,6 +320,7 @@ static int cdr_parse_srcleg(char *srcleg, cdr_entry_t *cdr)
}
*tmp1 = '\0';
cdr->source_account_id = atoll(tmp2);
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
tmp1 = strchr(tmp2, MED_SEP);
@ -324,6 +331,7 @@ static int cdr_parse_srcleg(char *srcleg, cdr_entry_t *cdr)
}
*tmp1 = '\0';
g_strlcpy(cdr->peer_auth_user, tmp2, sizeof(cdr->peer_auth_user));
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
tmp1 = strchr(tmp2, MED_SEP);
@ -334,6 +342,7 @@ static int cdr_parse_srcleg(char *srcleg, cdr_entry_t *cdr)
}
*tmp1 = '\0';
g_strlcpy(cdr->peer_auth_realm, tmp2, sizeof(cdr->peer_auth_realm));
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
tmp1 = strchr(tmp2, MED_SEP);
@ -344,6 +353,7 @@ static int cdr_parse_srcleg(char *srcleg, cdr_entry_t *cdr)
}
*tmp1 = '\0';
cdr->source_clir = atoi(tmp2);
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
tmp1 = strchr(tmp2, MED_SEP);
@ -354,6 +364,7 @@ static int cdr_parse_srcleg(char *srcleg, cdr_entry_t *cdr)
}
*tmp1 = '\0';
g_strlcpy(cdr->call_type, tmp2, sizeof(cdr->call_type));
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
tmp1 = strchr(tmp2, MED_SEP);
@ -364,6 +375,7 @@ static int cdr_parse_srcleg(char *srcleg, cdr_entry_t *cdr)
}
*tmp1 = '\0';
g_strlcpy(cdr->source_ip, tmp2, sizeof(cdr->source_ip));
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
tmp1 = strchr(tmp2, MED_SEP);
@ -374,6 +386,7 @@ static int cdr_parse_srcleg(char *srcleg, cdr_entry_t *cdr)
}
*tmp1 = '\0';
cdr->init_time = g_strtod(tmp2, NULL);
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
int i;
@ -387,6 +400,7 @@ static int cdr_parse_srcleg(char *srcleg, cdr_entry_t *cdr)
}
*tmp1 = '\0';
g_strlcpy(cdr->source_gpp[i], tmp2, sizeof(cdr->source_gpp[i]));
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
}
@ -405,6 +419,7 @@ static int cdr_parse_srcleg(char *srcleg, cdr_entry_t *cdr)
}
*tmp1 = '\0';
g_strlcpy(cdr->source_lnp_prefix, tmp2, sizeof(cdr->source_lnp_prefix));
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
tmp1 = strchr(tmp2, MED_SEP);
@ -422,6 +437,7 @@ static int cdr_parse_srcleg(char *srcleg, cdr_entry_t *cdr)
*tmp1 = '\0';
g_strlcpy(cdr->source_user_out, tmp2, sizeof(cdr->source_user_out));
uri_unescape(cdr->source_user_out);
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
tmp1 = strchr(tmp2, MED_SEP);
@ -432,6 +448,7 @@ static int cdr_parse_srcleg(char *srcleg, cdr_entry_t *cdr)
}
*tmp1 = '\0';
g_strlcpy(cdr->source_lnp_type, tmp2, sizeof(cdr->source_lnp_type));
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
tmp1 = strchr(tmp2, MED_SEP);
@ -442,6 +459,7 @@ static int cdr_parse_srcleg(char *srcleg, cdr_entry_t *cdr)
}
*tmp1 = '\0';
g_strlcpy(cdr->header_pai, tmp2, sizeof(cdr->header_pai));
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
tmp1 = strchr(tmp2, MED_SEP);
@ -452,6 +470,7 @@ static int cdr_parse_srcleg(char *srcleg, cdr_entry_t *cdr)
}
*tmp1 = '\0';
g_strlcpy(cdr->header_diversion, tmp2, sizeof(cdr->header_diversion));
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
return 0;
@ -471,6 +490,7 @@ static int cdr_parse_dstleg(char *dstleg, cdr_entry_t *cdr)
}
*tmp1 = '\0';
cdr->split = atoi(tmp2);
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
tmp1 = strchr(tmp2, MED_SEP);
@ -482,6 +502,7 @@ static int cdr_parse_dstleg(char *dstleg, cdr_entry_t *cdr)
*tmp1 = '\0';
g_strlcpy(cdr->destination_ext_subscriber_id, tmp2, sizeof(cdr->destination_ext_subscriber_id));
uri_unescape(cdr->destination_ext_subscriber_id);
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
tmp1 = strchr(tmp2, MED_SEP);
@ -493,6 +514,7 @@ static int cdr_parse_dstleg(char *dstleg, cdr_entry_t *cdr)
*tmp1 = '\0';
g_strlcpy(cdr->destination_ext_contract_id, tmp2, sizeof(cdr->destination_ext_contract_id));
uri_unescape(cdr->destination_ext_contract_id);
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
tmp1 = strchr(tmp2, MED_SEP);
@ -503,6 +525,7 @@ static int cdr_parse_dstleg(char *dstleg, cdr_entry_t *cdr)
}
*tmp1 = '\0';
cdr->destination_account_id = atoll(tmp2);
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
tmp1 = strchr(tmp2, MED_SEP);
@ -513,6 +536,7 @@ static int cdr_parse_dstleg(char *dstleg, cdr_entry_t *cdr)
}
*tmp1 = '\0';
g_strlcpy(cdr->destination_dialed, tmp2, sizeof(cdr->destination_dialed));
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
tmp1 = strchr(tmp2, MED_SEP);
@ -523,6 +547,7 @@ static int cdr_parse_dstleg(char *dstleg, cdr_entry_t *cdr)
}
*tmp1 = '\0';
g_strlcpy(cdr->destination_user_id, tmp2, sizeof(cdr->destination_user_id));
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
tmp1 = strchr(tmp2, MED_SEP);
@ -533,6 +558,7 @@ static int cdr_parse_dstleg(char *dstleg, cdr_entry_t *cdr)
}
*tmp1 = '\0';
g_strlcpy(cdr->destination_user, tmp2, sizeof(cdr->destination_user));
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
tmp1 = strchr(tmp2, MED_SEP);
@ -543,6 +569,7 @@ static int cdr_parse_dstleg(char *dstleg, cdr_entry_t *cdr)
}
*tmp1 = '\0';
g_strlcpy(cdr->destination_domain, tmp2, sizeof(cdr->destination_domain));
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
tmp1 = strchr(tmp2, MED_SEP);
@ -553,6 +580,7 @@ static int cdr_parse_dstleg(char *dstleg, cdr_entry_t *cdr)
}
*tmp1 = '\0';
g_strlcpy(cdr->destination_user_in, tmp2, sizeof(cdr->destination_user_in));
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
tmp1 = strchr(tmp2, MED_SEP);
@ -563,6 +591,7 @@ static int cdr_parse_dstleg(char *dstleg, cdr_entry_t *cdr)
}
*tmp1 = '\0';
g_strlcpy(cdr->destination_domain_in, tmp2, sizeof(cdr->destination_domain_in));
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
tmp1 = strchr(tmp2, MED_SEP);
@ -573,6 +602,7 @@ static int cdr_parse_dstleg(char *dstleg, cdr_entry_t *cdr)
}
*tmp1 = '\0';
cdr->destination_lcr_id = atoll(tmp2);
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
int i;
@ -586,6 +616,7 @@ static int cdr_parse_dstleg(char *dstleg, cdr_entry_t *cdr)
}
*tmp1 = '\0';
g_strlcpy(cdr->destination_gpp[i], tmp2, sizeof(cdr->destination_gpp[i]));
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
}
@ -604,6 +635,7 @@ static int cdr_parse_dstleg(char *dstleg, cdr_entry_t *cdr)
}
*tmp1 = '\0';
g_strlcpy(cdr->destination_lnp_prefix, tmp2, sizeof(cdr->destination_lnp_prefix));
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
tmp1 = strchr(tmp2, MED_SEP);
@ -620,6 +652,7 @@ static int cdr_parse_dstleg(char *dstleg, cdr_entry_t *cdr)
}
*tmp1 = '\0';
g_strlcpy(cdr->destination_user_out, tmp2, sizeof(cdr->destination_user_out));
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
tmp1 = strchr(tmp2, MED_SEP);
@ -630,6 +663,7 @@ static int cdr_parse_dstleg(char *dstleg, cdr_entry_t *cdr)
}
*tmp1 = '\0';
g_strlcpy(cdr->destination_lnp_type, tmp2, sizeof(cdr->destination_lnp_type));
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
tmp1 = strchr(tmp2, MED_SEP);
@ -640,6 +674,7 @@ static int cdr_parse_dstleg(char *dstleg, cdr_entry_t *cdr)
}
*tmp1 = '\0';
g_strlcpy(cdr->furnished_charging_info, tmp2, sizeof(cdr->furnished_charging_info));
*tmp1 = MED_SEP;
tmp2 = ++tmp1;
return 0;

Loading…
Cancel
Save