regression from FS-5614 on forward

This commit is contained in:
Brian West 2013-09-09 13:37:48 -05:00
parent 9ad4cdb2d5
commit de2ddb0fab
1 changed files with 60 additions and 53 deletions

View File

@ -1671,8 +1671,9 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t
char *new_file_path = NULL;
char vm_cc[256] = "";
char macro_buf[80] = "";
int ok = 0;
switch_xml_t xml_root, x_domain, x_param, x_params, x_user = NULL;
switch_xml_t x_param, x_params, x_user = NULL;
switch_event_t *my_params = NULL;
switch_bool_t vm_enabled = SWITCH_TRUE;
@ -1704,7 +1705,11 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t
new_file_path = cbt->file_path;
}
get_exten:
while (!ok) {
if (x_user) {
switch_xml_free(x_user);
}
switch_snprintf(macro_buf, sizeof(macro_buf), "phrase:%s:%s", VM_FORWARD_MESSAGE_ENTER_EXTENSION_MACRO, profile->terminator_key);
vm_cc[0] = '\0';
@ -1718,14 +1723,14 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t
switch_event_create(&my_params, SWITCH_EVENT_REQUEST_PARAMS);
switch_assert(my_params);
if (switch_xml_locate_domain(cbt->domain, my_params, &xml_root, &x_domain) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Failed to forward message - Cannot locate domain %s\n", cbt->domain);
status = switch_xml_locate_user_merged("id", vm_cc, cbt->domain, NULL, &x_user, my_params);
switch_event_destroy(&my_params);
if (status != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
"Failed to forward message - Cannot locate user %s@%s\n", vm_cc, cbt->domain);
TRY_CODE(switch_ivr_phrase_macro(session, VM_INVALID_EXTENSION_MACRO, vm_cc, NULL, NULL));
goto get_exten;
} else if (switch_xml_locate_user_in_domain(vm_cc, x_domain, &x_user, NULL) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Failed to forward message - Cannot locate user %s@%s\n", vm_cc, cbt->domain);
TRY_CODE(switch_ivr_phrase_macro(session, VM_INVALID_EXTENSION_MACRO, vm_cc, NULL, NULL));
goto get_exten;
continue;
} else {
x_params = switch_xml_child(x_user, "params");
@ -1744,7 +1749,7 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t
if (!vm_enabled) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Failed to forward message - Voicemail is disabled for user %s@%s\n", vm_cc, cbt->domain);
TRY_CODE(switch_ivr_phrase_macro(session, VM_INVALID_EXTENSION_MACRO, vm_cc, NULL, NULL));
goto get_exten;
continue;
} else {
if (voicemail_inject(cmd, session) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Forwarded message to %s\n", vm_cc);
@ -1753,13 +1758,15 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to forward message to %s\n", vm_cc);
TRY_CODE(switch_ivr_phrase_macro(session, VM_INVALID_EXTENSION_MACRO, vm_cc, NULL, NULL));
goto get_exten;
continue;
}
}
}
switch_xml_free(xml_root);
switch_event_destroy(&my_params);
switch_xml_free(x_user);
break;
}
} else if (!strcmp(input, profile->delete_file_key) || (!strcmp(input, profile->email_key) && !zstr(cbt->email))) {
char *sql = switch_mprintf("update voicemail_msgs set flags='delete' where uuid='%s'", cbt->uuid);
vm_execute_sql(profile, sql, profile->mutex);