add timestamps for on and off hold times to put in xml cdrs

This commit is contained in:
Anthony Minessale
2012-09-07 18:17:57 -05:00
parent e2544415ad
commit c2893801cb
4 changed files with 75 additions and 2 deletions

View File

@@ -2195,11 +2195,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_generate_xml_cdr(switch_core_session_
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_caller_profile_t *caller_profile;
switch_xml_t 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;
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;
char tmp[512], *f;
int cdr_off = 0, v_off = 0, cd_off = 0;
switch_hold_record_t *hold_record = switch_channel_get_hold_record(channel), *hr;
if (*xml_cdr) {
cdr = *xml_cdr;
} else {
@@ -2266,6 +2267,36 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_generate_xml_cdr(switch_core_session_
}
}
if (hold_record) {
int cf_off = 0;
if (!(xhr = switch_xml_add_child_d(cdr, "hold-record", cdr_off++))) {
goto error;
}
for (hr = hold_record; hr; hr = hr->next) {
char *t = tmp;
if (!(x_hold = switch_xml_add_child_d(xhr, "hold", cf_off++))) {
goto error;
}
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, hr->on);
switch_xml_set_attr_d(x_hold, "on", t);
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, hr->off);
switch_xml_set_attr_d(x_hold, "off", t);
if (hr->uuid) {
switch_xml_set_attr_d(x_hold, "bridged-to", hr->uuid);
}
}
}
caller_profile = switch_channel_get_caller_profile(channel);