FS-5853 #resolve #comment mod_rayo now reports record completion cause

This commit is contained in:
Chris Rienzo 2014-10-27 13:41:52 -04:00
parent 26af9c3d67
commit bea7d8ec71
1 changed files with 7 additions and 1 deletions

View File

@ -134,11 +134,17 @@ static void on_call_record_stop_event(switch_event_t *event)
struct rayo_component *component = RAYO_COMPONENT_LOCATE(file_path);
if (component) {
const char *completion_cause = switch_event_get_header(event, "Record-Completion-Cause");
completion_cause = zstr(completion_cause) ? "" : completion_cause;
RECORD_COMPONENT(component)->duration_ms += (switch_micro_time_now() - RECORD_COMPONENT(component)->start_time) / 1000;
if (RECORD_COMPONENT(component)->stop) {
complete_record(component, COMPONENT_COMPLETE_STOP);
} else if (!strcmp(completion_cause, "no-input-timeout")) {
complete_record(component, RECORD_COMPLETE_INITIAL_TIMEOUT);
} else if (!strcmp(completion_cause, "success-maxtime")) {
complete_record(component, RECORD_COMPLETE_MAX_DURATION);
} else {
/* TODO assume final timeout, for now */
/* assume final timeout */
complete_record(component, RECORD_COMPLETE_FINAL_TIMEOUT);
}
RAYO_RELEASE(component);