TT#170203 determine SIP method code early

With this we can directly use the method code for decision making
purposes before the CDR generation routine runs.

Change-Id: I8967e77e6cd717bb4d3342a1bf7052c33d0f9b45
mr11.0
Richard Fuchs 4 years ago
parent d86e326745
commit ba137dcc17

32
cdr.c

@ -94,30 +94,23 @@ int cdr_process_records(GQueue *records, uint64_t *ext_count,
if (e->timed_out)
timed_out = 1;
if(!e->valid)
{
++msg_unknowns;
e->method = MED_UNRECOGNIZED;
}
else if(strcmp(e->sip_method, MSG_INVITE) == 0)
if(e->method == MED_INVITE)
{
++msg_invites;
e->method = MED_INVITE;
if(strncmp("200", e->sip_code, 3) == 0)
{
++invite_200;
}
}
else if(strcmp(e->sip_method, MSG_BYE) == 0)
else if(e->method == MED_BYE)
{
++msg_byes;
e->method = MED_BYE;
}
else
{
L_DEBUG("Unrecognized record with method '%s' for cid '%s'\n", e->sip_method, callid);
if (e->valid)
L_DEBUG("Unrecognized record with method '%s' for cid '%s'\n", e->sip_method, callid);
++msg_unknowns;
e->method = MED_UNRECOGNIZED;
}
if (check_shutdown())
@ -1623,4 +1616,21 @@ void cdr_parse_entry(med_entry_t *e)
{
e->dst_leg_json = json_tokener_parse(e->dst_leg);
}
if (!e->valid)
{
e->method = MED_UNRECOGNIZED;
}
else if (strcmp(e->sip_method, MSG_INVITE) == 0)
{
e->method = MED_INVITE;
}
else if (strcmp(e->sip_method, MSG_BYE) == 0)
{
e->method = MED_BYE;
}
else
{
e->method = MED_UNRECOGNIZED;
}
}

@ -46,10 +46,9 @@ int records_complete(GQueue *records)
for (GList *l = records->head; l; l = l->next)
{
med_entry_t *s = l->data;
if (s->sip_method[0] == 'I' && s->sip_method[1] == 'N' && s->sip_method[2] == 'V' &&
s->sip_code[0] == '2') {
if (s->method == MED_INVITE && s->sip_code[0] == '2') {
has_inv_200 |= 1;
} else if (s->sip_method[0] == 'B' && s->sip_method[1] == 'Y' && s->sip_method[2] == 'E') {
} else if (s->method == MED_BYE) {
has_bye |= 1;
}
}

Loading…
Cancel
Save