diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index ba80ea15f44..8d36cea20b3 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -3117,6 +3117,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_event(switch_core_sess if (switch_dir_make_recursive(path, SWITCH_DEFAULT_DIR_PERMS, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error creating %s\n", path); + if (hangup_on_error) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE); + } set_completion_cause(rh, "uri-failure"); switch_goto_status(SWITCH_STATUS_GENERR, err); }