|
|
|
@ -32,7 +32,7 @@
|
|
|
|
|
#include "rtcp.h"
|
|
|
|
|
#include "rtp.h"
|
|
|
|
|
#include "call_interfaces.h"
|
|
|
|
|
|
|
|
|
|
#include "rtpengine_config.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1344,10 +1344,13 @@ static void callmaster_timer(void *ptr) {
|
|
|
|
|
DS(bytes);
|
|
|
|
|
DS(errors);
|
|
|
|
|
|
|
|
|
|
#if (RE_HAS_MEASUREDELAY)
|
|
|
|
|
mutex_lock(&m->statspslock);
|
|
|
|
|
ps->stats.start = m->statsps.start = ke->stats.start;
|
|
|
|
|
ps->stats.end = m->statsps.end = ke->stats.end;
|
|
|
|
|
ps->stats.delay_min = m->statsps.delay_min = ke->stats.delay_min;
|
|
|
|
|
ps->stats.delay_avg = m->statsps.delay_avg = ke->stats.delay_avg;
|
|
|
|
|
ps->stats.delay_max = m->statsps.delay_max = ke->stats.delay_max;
|
|
|
|
|
mutex_unlock(&m->statspslock);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
mutex_lock(&ps->in_lock);
|
|
|
|
|
|
|
|
|
@ -1358,8 +1361,11 @@ static void callmaster_timer(void *ptr) {
|
|
|
|
|
ps->kernel_stats.bytes = ke->stats.bytes;
|
|
|
|
|
ps->kernel_stats.errors = ke->stats.errors;
|
|
|
|
|
|
|
|
|
|
ps->kernel_stats.start = ke->stats.start;
|
|
|
|
|
ps->kernel_stats.end = ke->stats.end;
|
|
|
|
|
#if (RE_HAS_MEASUREDELAY)
|
|
|
|
|
ps->kernel_stats.delay_min = ke->stats.delay_min;
|
|
|
|
|
ps->kernel_stats.delay_avg = ke->stats.delay_avg;
|
|
|
|
|
ps->kernel_stats.delay_max = ke->stats.delay_max;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
update = 0;
|
|
|
|
|
|
|
|
|
@ -2383,13 +2389,6 @@ static void unkernelize(struct packet_stream *p) {
|
|
|
|
|
PS_CLEAR(p, KERNELIZED);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void timespec_subtract (struct timespec *result, const struct timespec *a, const struct timespec *b) {
|
|
|
|
|
long long nanoseconds=0;
|
|
|
|
|
nanoseconds = ((long)a->tv_sec - (long long)b->tv_sec) * 1000000000 + ((long long)a->tv_nsec - (long long)b->tv_nsec);
|
|
|
|
|
result->tv_sec = nanoseconds/(long long)1000000000;
|
|
|
|
|
result->tv_nsec = nanoseconds%(long long)1000000000;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void timeval_subtract (struct timeval *result, const struct timeval *a, const struct timeval *b) {
|
|
|
|
|
long microseconds=0;
|
|
|
|
|
microseconds = ((long)a->tv_sec - (long)b->tv_sec) * 1000000 + ((long)a->tv_usec - (long)b->tv_usec);
|
|
|
|
@ -2502,21 +2501,63 @@ void call_destroy(struct call *c) {
|
|
|
|
|
|
|
|
|
|
if (_log_facility_cdr) {
|
|
|
|
|
const char* protocol = (!PS_ISSET(ps, RTP) && PS_ISSET(ps, RTCP)) ? "rtcp" : "rtp";
|
|
|
|
|
cdrbufcur += sprintf(cdrbufcur,
|
|
|
|
|
"ml%i_midx%u_%s_endpoint_ip=%s, "
|
|
|
|
|
"ml%i_midx%u_%s_endpoint_port=%u, "
|
|
|
|
|
"ml%i_midx%u_%s_local_relay_port=%u, "
|
|
|
|
|
"ml%i_midx%u_%s_relayed_packets=%llu, "
|
|
|
|
|
"ml%i_midx%u_%s_relayed_bytes=%llu, "
|
|
|
|
|
"ml%i_midx%u_%s_relayed_errors=%llu, "
|
|
|
|
|
"ml%i_midx%u_%s_last_packet=%llu, ",
|
|
|
|
|
cdrlinecnt, md->index, protocol, addr,
|
|
|
|
|
cdrlinecnt, md->index, protocol, ps->endpoint.port,
|
|
|
|
|
cdrlinecnt, md->index, protocol, (unsigned int) (ps->sfd ? ps->sfd->fd.localport : 0),
|
|
|
|
|
cdrlinecnt, md->index, protocol, (unsigned long long) ps->stats.packets,
|
|
|
|
|
cdrlinecnt, md->index, protocol, (unsigned long long) ps->stats.bytes,
|
|
|
|
|
cdrlinecnt, md->index, protocol, (unsigned long long) ps->stats.errors,
|
|
|
|
|
cdrlinecnt, md->index, protocol, (unsigned long long) ps->last_packet);
|
|
|
|
|
if(!PS_ISSET(ps, RTP) && PS_ISSET(ps, RTCP)) {
|
|
|
|
|
cdrbufcur += sprintf(cdrbufcur,
|
|
|
|
|
"ml%i_midx%u_%s_endpoint_ip=%s, "
|
|
|
|
|
"ml%i_midx%u_%s_endpoint_port=%u, "
|
|
|
|
|
"ml%i_midx%u_%s_local_relay_port=%u, "
|
|
|
|
|
"ml%i_midx%u_%s_relayed_packets=%llu, "
|
|
|
|
|
"ml%i_midx%u_%s_relayed_bytes=%llu, "
|
|
|
|
|
"ml%i_midx%u_%s_relayed_errors=%llu, "
|
|
|
|
|
"ml%i_midx%u_%s_last_packet=%llu, ",
|
|
|
|
|
cdrlinecnt, md->index, protocol, addr,
|
|
|
|
|
cdrlinecnt, md->index, protocol, ps->endpoint.port,
|
|
|
|
|
cdrlinecnt, md->index, protocol, (unsigned int) (ps->sfd ? ps->sfd->fd.localport : 0),
|
|
|
|
|
cdrlinecnt, md->index, protocol, (unsigned long long) ps->stats.packets,
|
|
|
|
|
cdrlinecnt, md->index, protocol, (unsigned long long) ps->stats.bytes,
|
|
|
|
|
cdrlinecnt, md->index, protocol, (unsigned long long) ps->stats.errors,
|
|
|
|
|
cdrlinecnt, md->index, protocol, (unsigned long long) ps->last_packet);
|
|
|
|
|
} else {
|
|
|
|
|
#if (RE_HAS_MEASUREDELAY)
|
|
|
|
|
cdrbufcur += sprintf(cdrbufcur,
|
|
|
|
|
"ml%i_midx%u_%s_endpoint_ip=%s, "
|
|
|
|
|
"ml%i_midx%u_%s_endpoint_port=%u, "
|
|
|
|
|
"ml%i_midx%u_%s_local_relay_port=%u, "
|
|
|
|
|
"ml%i_midx%u_%s_relayed_packets=%llu, "
|
|
|
|
|
"ml%i_midx%u_%s_relayed_bytes=%llu, "
|
|
|
|
|
"ml%i_midx%u_%s_relayed_errors=%llu, "
|
|
|
|
|
"ml%i_midx%u_%s_last_packet=%llu, "
|
|
|
|
|
"ml%i_midx%u_%s_delay_min=%llu.%09llu, "
|
|
|
|
|
"ml%i_midx%u_%s_delay_avg=%llu.%09llu, "
|
|
|
|
|
"ml%i_midx%u_%s_delay_max=%llu.%09llu, ",
|
|
|
|
|
cdrlinecnt, md->index, protocol, addr,
|
|
|
|
|
cdrlinecnt, md->index, protocol, ps->endpoint.port,
|
|
|
|
|
cdrlinecnt, md->index, protocol, (unsigned int) (ps->sfd ? ps->sfd->fd.localport : 0),
|
|
|
|
|
cdrlinecnt, md->index, protocol, (unsigned long long) ps->stats.packets,
|
|
|
|
|
cdrlinecnt, md->index, protocol, (unsigned long long) ps->stats.bytes,
|
|
|
|
|
cdrlinecnt, md->index, protocol, (unsigned long long) ps->stats.errors,
|
|
|
|
|
cdrlinecnt, md->index, protocol, (unsigned long long) ps->last_packet,
|
|
|
|
|
cdrlinecnt, md->index, protocol, (unsigned long long) ps->stats.delay_min.tv_sec, (unsigned long long) ps->stats.delay_min.tv_nsec,
|
|
|
|
|
cdrlinecnt, md->index, protocol, (unsigned long long) ps->stats.delay_avg.tv_sec, (unsigned long long) ps->stats.delay_avg.tv_nsec,
|
|
|
|
|
cdrlinecnt, md->index, protocol, (unsigned long long) ps->stats.delay_max.tv_sec, (unsigned long long) ps->stats.delay_max.tv_nsec);
|
|
|
|
|
#else
|
|
|
|
|
cdrbufcur += sprintf(cdrbufcur,
|
|
|
|
|
"ml%i_midx%u_%s_endpoint_ip=%s, "
|
|
|
|
|
"ml%i_midx%u_%s_endpoint_port=%u, "
|
|
|
|
|
"ml%i_midx%u_%s_local_relay_port=%u, "
|
|
|
|
|
"ml%i_midx%u_%s_relayed_packets=%llu, "
|
|
|
|
|
"ml%i_midx%u_%s_relayed_bytes=%llu, "
|
|
|
|
|
"ml%i_midx%u_%s_relayed_errors=%llu, "
|
|
|
|
|
"ml%i_midx%u_%s_last_packet=%llu, ",
|
|
|
|
|
cdrlinecnt, md->index, protocol, addr,
|
|
|
|
|
cdrlinecnt, md->index, protocol, ps->endpoint.port,
|
|
|
|
|
cdrlinecnt, md->index, protocol, (unsigned int) (ps->sfd ? ps->sfd->fd.localport : 0),
|
|
|
|
|
cdrlinecnt, md->index, protocol, (unsigned long long) ps->stats.packets,
|
|
|
|
|
cdrlinecnt, md->index, protocol, (unsigned long long) ps->stats.bytes,
|
|
|
|
|
cdrlinecnt, md->index, protocol, (unsigned long long) ps->stats.errors,
|
|
|
|
|
cdrlinecnt, md->index, protocol, (unsigned long long) ps->last_packet);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ilog(LOG_INFO, "------ Media #%u, port %5u <> %15s:%-5hu%s, "
|
|
|
|
|