提交 8eda172a authored 作者: Anthony Minessale's avatar Anthony Minessale

FS-9503 #resolve [Add flaws and consecutive_flaws to error_log in rtp]

上级 f3b22f61
...@@ -621,6 +621,8 @@ typedef uint32_t switch_vad_flag_t; ...@@ -621,6 +621,8 @@ typedef uint32_t switch_vad_flag_t;
typedef struct error_period { typedef struct error_period {
int64_t start; int64_t start;
int64_t stop; int64_t stop;
uint32_t flaws;
uint32_t consecutive_flaws;
struct error_period *next; struct error_period *next;
} switch_error_period_t; } switch_error_period_t;
......
...@@ -2645,6 +2645,14 @@ SWITCH_DECLARE(int) switch_ivr_set_xml_call_stats(switch_xml_t xml, switch_core_ ...@@ -2645,6 +2645,14 @@ SWITCH_DECLARE(int) switch_ivr_set_xml_call_stats(switch_xml_t xml, switch_core_
x_tmp = switch_xml_add_child_d(x_err, "stop", 1); x_tmp = switch_xml_add_child_d(x_err, "stop", 1);
switch_xml_set_txt_d(x_tmp, var_val); switch_xml_set_txt_d(x_tmp, var_val);
switch_snprintf(var_val, sizeof(var_val), "%" SWITCH_TIME_T_FMT, ep->flaws);
x_tmp = switch_xml_add_child_d(x_err, "flaws", 1);
switch_xml_set_txt_d(x_tmp, var_val);
switch_snprintf(var_val, sizeof(var_val), "%" SWITCH_TIME_T_FMT, ep->consecutive_flaws);
x_tmp = switch_xml_add_child_d(x_err, "consecutive-flaws", 1);
switch_xml_set_txt_d(x_tmp, var_val);
switch_snprintf(var_val, sizeof(var_val), "%" SWITCH_TIME_T_FMT, (ep->stop - ep->start) / 1000); switch_snprintf(var_val, sizeof(var_val), "%" SWITCH_TIME_T_FMT, (ep->stop - ep->start) / 1000);
x_tmp = switch_xml_add_child_d(x_err, "duration-msec", 2); x_tmp = switch_xml_add_child_d(x_err, "duration-msec", 2);
switch_xml_set_txt_d(x_tmp, var_val); switch_xml_set_txt_d(x_tmp, var_val);
...@@ -3127,6 +3135,8 @@ SWITCH_DECLARE(void) switch_ivr_set_json_call_stats(cJSON *json, switch_core_ses ...@@ -3127,6 +3135,8 @@ SWITCH_DECLARE(void) switch_ivr_set_json_call_stats(cJSON *json, switch_core_ses
cJSON_AddItemToObject(j_err, "start", cJSON_CreateNumber(ep->start)); cJSON_AddItemToObject(j_err, "start", cJSON_CreateNumber(ep->start));
cJSON_AddItemToObject(j_err, "stop", cJSON_CreateNumber(ep->stop)); cJSON_AddItemToObject(j_err, "stop", cJSON_CreateNumber(ep->stop));
cJSON_AddItemToObject(j_err, "flaws", cJSON_CreateNumber(ep->flaws));
cJSON_AddItemToObject(j_err, "Consecutiveflaws", cJSON_CreateNumber(ep->consecutive_flaws));
cJSON_AddItemToObject(j_err, "durationMS", cJSON_CreateNumber((ep->stop - ep->start) / 1000)); cJSON_AddItemToObject(j_err, "durationMS", cJSON_CreateNumber((ep->stop - ep->start) / 1000));
cJSON_AddItemToArray(j_err_log, j_err); cJSON_AddItemToArray(j_err_log, j_err);
} }
......
...@@ -1544,6 +1544,11 @@ static void do_mos(switch_rtp_t *rtp_session, int force) { ...@@ -1544,6 +1544,11 @@ static void do_mos(switch_rtp_t *rtp_session, int force) {
rtp_session->consecutive_flaws, penalty); rtp_session->consecutive_flaws, penalty);
rtp_session->bad_stream++; rtp_session->bad_stream++;
rtp_session->stats.inbound.flaws += penalty; rtp_session->stats.inbound.flaws += penalty;
if (rtp_session->stats.inbound.error_log) {
rtp_session->stats.inbound.error_log->flaws += penalty;
rtp_session->stats.inbound.error_log->consecutive_flaws++;
}
} }
R = (int)((double)((double)(rtp_session->stats.inbound.recved - rtp_session->stats.inbound.flaws) / (double)rtp_session->stats.inbound.recved) * 100.0); R = (int)((double)((double)(rtp_session->stats.inbound.recved - rtp_session->stats.inbound.flaws) / (double)rtp_session->stats.inbound.recved) * 100.0);
...@@ -1643,6 +1648,11 @@ static void check_jitter(switch_rtp_t *rtp_session) ...@@ -1643,6 +1648,11 @@ static void check_jitter(switch_rtp_t *rtp_session)
rtp_session->bad_stream++; rtp_session->bad_stream++;
rtp_session->stats.inbound.flaws += lost; rtp_session->stats.inbound.flaws += lost;
if (rtp_session->stats.inbound.error_log) {
rtp_session->stats.inbound.error_log->flaws += lost;
}
} else { } else {
rtp_session->stats.inbound.last_loss = 0; rtp_session->stats.inbound.last_loss = 0;
} }
...@@ -6291,6 +6301,10 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ ...@@ -6291,6 +6301,10 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
rtp_session->bad_stream++; rtp_session->bad_stream++;
rtp_session->stats.inbound.flaws += rtp_session->sync_packets; rtp_session->stats.inbound.flaws += rtp_session->sync_packets;
if (rtp_session->stats.inbound.error_log) {
rtp_session->stats.inbound.error_log->flaws += rtp_session->sync_packets;
}
} }
switch_core_timer_sync(&rtp_session->timer); switch_core_timer_sync(&rtp_session->timer);
...@@ -6857,6 +6871,9 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ ...@@ -6857,6 +6871,9 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "%s %s timeout\n", switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "%s %s timeout\n",
rtp_session_name(rtp_session), rtp_type(rtp_session)); rtp_session_name(rtp_session), rtp_type(rtp_session));
if (rtp_session->stats.inbound.error_log) {
rtp_session->stats.inbound.error_log->flaws++;
}
rtp_session->stats.inbound.flaws++; rtp_session->stats.inbound.flaws++;
do_mos(rtp_session, SWITCH_FALSE); do_mos(rtp_session, SWITCH_FALSE);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论