]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add answer_delay variable to sleep N ms when answer is called from the channel thread
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 21 Jun 2013 02:29:31 +0000 (21:29 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 21 Jun 2013 02:29:31 +0000 (21:29 -0500)
src/switch_channel.c

index c4812f47a37a39114f2bc4542fb3cb8da881c95a..421390723a7842c4fceceba6e97bf7739461c0ed 100644 (file)
@@ -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;
 }