[Core] Fix XML generation
This commit is contained in:
parent
73d6da1342
commit
68855f6acc
|
@ -2663,6 +2663,7 @@ SWITCH_DECLARE(int) switch_ivr_set_xml_call_stats(switch_xml_t xml, switch_core_
|
||||||
{
|
{
|
||||||
const char *name = (type == SWITCH_MEDIA_TYPE_VIDEO) ? "video" : "audio";
|
const char *name = (type == SWITCH_MEDIA_TYPE_VIDEO) ? "video" : "audio";
|
||||||
switch_xml_t x_stat, x_in, x_out, x_tmp = NULL;
|
switch_xml_t x_stat, x_in, x_out, x_tmp = NULL;
|
||||||
|
int xoff = 0;
|
||||||
int loff = 0;
|
int loff = 0;
|
||||||
switch_rtp_stats_t *stats = switch_core_media_get_stats(session, type, NULL);
|
switch_rtp_stats_t *stats = switch_core_media_get_stats(session, type, NULL);
|
||||||
char var_val[35] = "";
|
char var_val[35] = "";
|
||||||
|
@ -2673,11 +2674,11 @@ SWITCH_DECLARE(int) switch_ivr_set_xml_call_stats(switch_xml_t xml, switch_core_
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(x_in = switch_xml_add_child_d(x_stat, "inbound", off++))) {
|
if (!(x_in = switch_xml_add_child_d(x_stat, "inbound", xoff++))) {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(x_out = switch_xml_add_child_d(x_stat, "outbound", off++))) {
|
if (!(x_out = switch_xml_add_child_d(x_stat, "outbound", xoff++))) {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2708,7 +2709,7 @@ SWITCH_DECLARE(int) switch_ivr_set_xml_call_stats(switch_xml_t xml, switch_core_
|
||||||
switch_error_period_t *ep;
|
switch_error_period_t *ep;
|
||||||
int eoff = 0;
|
int eoff = 0;
|
||||||
|
|
||||||
if (!(x_err_log = switch_xml_add_child_d(x_stat, "error-log", off++))) {
|
if (!(x_err_log = switch_xml_add_child_d(x_stat, "error-log", xoff++))) {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2729,19 +2730,20 @@ SWITCH_DECLARE(int) switch_ivr_set_xml_call_stats(switch_xml_t xml, switch_core_
|
||||||
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);
|
switch_snprintf(var_val, sizeof(var_val), "%" SWITCH_TIME_T_FMT, ep->flaws);
|
||||||
x_tmp = switch_xml_add_child_d(x_err, "flaws", 1);
|
x_tmp = switch_xml_add_child_d(x_err, "flaws", 2);
|
||||||
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->consecutive_flaws);
|
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);
|
x_tmp = switch_xml_add_child_d(x_err, "consecutive-flaws", 3);
|
||||||
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->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", 4);
|
||||||
switch_xml_set_txt_d(x_tmp, var_val);
|
switch_xml_set_txt_d(x_tmp, var_val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loff=0;
|
||||||
add_stat(x_out, stats->outbound.raw_bytes, "raw_bytes");
|
add_stat(x_out, stats->outbound.raw_bytes, "raw_bytes");
|
||||||
add_stat(x_out, stats->outbound.media_bytes, "media_bytes");
|
add_stat(x_out, stats->outbound.media_bytes, "media_bytes");
|
||||||
add_stat(x_out, stats->outbound.packet_count, "packet_count");
|
add_stat(x_out, stats->outbound.packet_count, "packet_count");
|
||||||
|
@ -2805,11 +2807,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_generate_xml_cdr(switch_core_session_
|
||||||
{
|
{
|
||||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||||
switch_caller_profile_t *caller_profile;
|
switch_caller_profile_t *caller_profile;
|
||||||
switch_xml_t variables, cdr, x_main_cp, x_caller_profile, x_caller_extension, x_times, time_tag,
|
switch_xml_t call_stats, variables, cdr, x_main_cp, x_caller_profile, x_caller_extension, x_times, time_tag,
|
||||||
x_application, x_callflow, x_inner_extension, x_apps, x_o, x_channel_data, x_field, xhr, x_hold;
|
x_application, x_callflow, x_inner_extension, x_apps, x_o, x_channel_data, x_field, xhr, x_hold;
|
||||||
switch_app_log_t *app_log;
|
switch_app_log_t *app_log;
|
||||||
char tmp[512], *f;
|
char tmp[512], *f;
|
||||||
int cdr_off = 0, v_off = 0, cd_off = 0;
|
int cdr_off = 0, cd_off = 0;
|
||||||
switch_hold_record_t *hold_record = switch_channel_get_hold_record(channel), *hr;
|
switch_hold_record_t *hold_record = switch_channel_get_hold_record(channel), *hr;
|
||||||
const char *text_buffer = NULL;
|
const char *text_buffer = NULL;
|
||||||
|
|
||||||
|
@ -2856,19 +2858,19 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_generate_xml_cdr(switch_core_session_
|
||||||
free(f);
|
free(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(variables = switch_xml_add_child_d(cdr, "call-stats", cdr_off++))) {
|
if (!(call_stats = switch_xml_add_child_d(cdr, "call-stats", cdr_off++))) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_ivr_set_xml_call_stats(variables, session, v_off, SWITCH_MEDIA_TYPE_AUDIO);
|
switch_ivr_set_xml_call_stats(call_stats, session, 0, SWITCH_MEDIA_TYPE_AUDIO);
|
||||||
switch_ivr_set_xml_call_stats(variables, session, v_off, SWITCH_MEDIA_TYPE_VIDEO);
|
switch_ivr_set_xml_call_stats(call_stats, session, 0, SWITCH_MEDIA_TYPE_VIDEO);
|
||||||
|
|
||||||
|
|
||||||
if (!(variables = switch_xml_add_child_d(cdr, "variables", cdr_off++))) {
|
if (!(variables = switch_xml_add_child_d(cdr, "variables", cdr_off++))) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_ivr_set_xml_chan_vars(variables, channel, v_off);
|
switch_ivr_set_xml_chan_vars(variables, channel, 0);
|
||||||
|
|
||||||
|
|
||||||
if ((app_log = switch_core_session_get_app_log(session))) {
|
if ((app_log = switch_core_session_get_app_log(session))) {
|
||||||
|
|
Loading…
Reference in New Issue