]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-5154 --resolve
authorMarc Olivier Chouinard <mochouinard@moctel.com>
Mon, 24 Feb 2014 21:12:50 +0000 (16:12 -0500)
committerMarc Olivier Chouinard <mochouinard@moctel.com>
Mon, 24 Feb 2014 21:12:50 +0000 (16:12 -0500)
src/mod/applications/mod_voicemail_ivr/menu.c

index 4bd434ff30e6abdd8fa05298ebd67cbdf03635f2..54393da349b88b8a1eefdccd50594209542dfaf5 100644 (file)
@@ -97,6 +97,13 @@ void vmivr_menu_main(switch_core_session_t *session, vmivr_profile_t *profile) {
                cmd = switch_core_session_sprintf(session, "json %s %s %s %s", profile->api_profile, profile->domain, profile->id, profile->folder_name);
                jsonapi2event(session, menu.phrase_params, profile->api_msg_count, cmd);
 
+               /* Verify that phrases returned values, if not, exit */
+               if (!switch_event_get_header(menu.phrase_params, "VM-Total-New-Messages")) {
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Return from API is invalid. Check that the context exist on your DB backend\n");
+                       menu_instance_free(&menu);
+                       break;
+               }
+
                ivre_playback(session, &menu.ivre_d, switch_event_get_header(menu.event_phrases, "msg_count"), NULL, menu.phrase_params, NULL, 0);
 
                if (atoi(switch_event_get_header(menu.phrase_params, "VM-Total-New-Messages")) > 0 && menu.ivre_d.result == RES_WAITFORMORE && !action_on_new_message_occured && action_on_new_message) {