From 8fc477d080ac1977117a4b454f2f06d7f9676613 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 a8e1385752..1f78d55d9e 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -3612,6 +3612,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; }