From 16bdee13fc993220f63914dd7ece9e0ad30a1dc4 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 20 Jun 2013 21:29:31 -0500 Subject: [PATCH] add answer_delay variable to sleep N ms when answer is called from the channel thread --- src/switch_channel.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/switch_channel.c b/src/switch_channel.c index c4812f47a3..421390723a 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -3632,6 +3632,19 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_answer(switch_channel_t * switch_channel_hangup(channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION); } + + if (switch_core_session_in_thread(channel->session)) { + const char *delay; + + if ((delay = switch_channel_get_variable(channel, "answer_delay"))) { + long msec = atol(delay); + + if (msec) { + switch_ivr_sleep(channel->session, msec, SWITCH_TRUE, NULL); + } + } + } + return status; } -- 2.47.2