diff --git a/cdr.c b/cdr.c index cead00b..de018ca 100644 --- a/cdr.c +++ b/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; + } } diff --git a/records.c b/records.c index 186c9d0..f798b31 100644 --- a/records.c +++ b/records.c @@ -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; } }