From 635fbc4bd3769cd4468a5d871f2186b8aa991787 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 18 Dec 2013 03:19:33 +0500 Subject: [PATCH] add loops var durning looped execution --- src/switch_ivr.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/switch_ivr.c b/src/switch_ivr.c index daba288c7e..d3124ca5ce 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -620,6 +620,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se switch_channel_set_variable(channel, "app_uuid", event_uuid); } + switch_channel_set_variable_printf(channel, "current_loop", "%d", x + 1); + switch_channel_set_variable_printf(channel, "total_loops", "%d", loops); if (switch_core_session_execute_application(session, app_name, app_arg) != SWITCH_STATUS_SUCCESS) { if (!inner || switch_channel_test_flag(channel, CF_STOP_BROADCAST)) switch_channel_clear_flag(channel, CF_BROADCAST); @@ -632,6 +634,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se } } + switch_channel_set_variable(channel, "current_loop", NULL); + switch_channel_set_variable(channel, "total_loops", NULL); + if (b_uuid) { if ((b_session = switch_core_session_locate(b_uuid))) { switch_channel_t *b_channel = switch_core_session_get_channel(b_session);