TT#170203 skip "foreign" BYE records

When processing acc records for a call that was the result of a REFER,
there will be two BYE records, one for the call itself without further
info in dst_leg, and another one for the original call that includes the
record for the REFER, with extra info in dst_leg that points back to the
original call. Skip the BYE with this extra info when processing record
so that it's still present when the other call (with the REFER) is being
processed.

Change-Id: Ia8b405c1d9d556ccb30f9b51a0bbd001f48da180
mr11.0
Richard Fuchs 3 years ago
parent 3251683507
commit 32ab6e9418

@ -352,12 +352,12 @@ int main(int argc, char **argv)
gettimeofday(&tv_start, NULL);
#endif
int ret = medmysql_fetch_records(mysql_callid, &acc_records, 1, NULL, NULL);
int ret = medmysql_fetch_records(mysql_callid, &acc_records, 1, records_no_refer_bleg_bye, NULL);
if (ret < 0)
goto out;
int must_sort = (ret > 0);
ret = medredis_fetch_records(mysql_callid, &acc_records, NULL, NULL);
ret = medredis_fetch_records(mysql_callid, &acc_records, records_no_refer_bleg_bye, NULL);
if (ret > 0)
must_sort = 1;
@ -402,10 +402,10 @@ int main(int argc, char **argv)
gettimeofday(&tv_start, NULL);
#endif
if(medredis_fetch_records(redis_callid, &acc_records, NULL, NULL) < 0)
if(medredis_fetch_records(redis_callid, &acc_records, records_no_refer_bleg_bye, NULL) < 0)
goto out;
medmysql_fetch_records(redis_callid, &acc_records, 0, NULL, NULL);
medmysql_fetch_records(redis_callid, &acc_records, 0, records_no_refer_bleg_bye, NULL);
// always sort records from Redis, regardless of whether records from MySQL were merged
records_sort(&acc_records);

@ -89,11 +89,13 @@ static const char *records_get_extras_bleg_cid(med_entry_t *e) {
static gboolean records_only_refer_bleg_bye(med_entry_t *e, void *data)
{
const char *callid = data; // original REFER call ID
const char *callid = data; // original REFER call ID, can be NULL
const char *legb_cid_o = records_get_extras_bleg_cid(e);
if (!legb_cid_o)
return FALSE;
if (!callid)
return TRUE;
gboolean keep = FALSE;
char *legb_cid = g_strdup(legb_cid_o);
@ -108,6 +110,11 @@ static gboolean records_only_refer_bleg_bye(med_entry_t *e, void *data)
return keep;
}
gboolean records_no_refer_bleg_bye(med_entry_t *e, void *data)
{
return ! records_only_refer_bleg_bye(e, data);
}
// returns whether any records were fetched, which in turn then requires the list to be sorted
int records_handle_refer(GQueue *records, med_entry_t *e, const char *callid)
{

@ -7,5 +7,6 @@
void records_sort(GQueue *records);
int records_complete(GQueue *records);
int records_handle_refer(GQueue *records, med_entry_t *, const char *callid);
gboolean records_no_refer_bleg_bye(med_entry_t *e, void *data);
#endif

Loading…
Cancel
Save