]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
make sched_hangup +0 the same as uuid_kill
authorAnthony Minessale <anthm@freeswitch.org>
Sat, 5 May 2012 00:44:29 +0000 (19:44 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Sat, 5 May 2012 00:44:29 +0000 (19:44 -0500)
src/mod/applications/mod_commands/mod_commands.c

index 9baa7ce0f1b43e031e68e0043b03f88c0ce12ce2..a812c8b994ef5280d694090aa82a00d71c50502a 100644 (file)
@@ -2644,9 +2644,10 @@ SWITCH_STANDARD_API(sched_hangup_function)
                char *cause_str = argv[2];
                time_t when;
                switch_call_cause_t cause = SWITCH_CAUSE_ALLOTTED_TIMEOUT;
+               int sec = atol(argv[0] + 1);
 
                if (*argv[0] == '+') {
-                       when = switch_epoch_time_now(NULL) + atol(argv[0] + 1);
+                       when = switch_epoch_time_now(NULL) + sec;
                } else {
                        when = atol(argv[0]);
                }
@@ -2656,7 +2657,13 @@ SWITCH_STANDARD_API(sched_hangup_function)
                }
 
                if ((hsession = switch_core_session_locate(uuid))) {
-                       switch_ivr_schedule_hangup(when, uuid, cause, SWITCH_FALSE);
+                       if (sec == 0) {
+                               switch_channel_t *hchannel = switch_core_session_get_channel(hsession);
+                               switch_channel_hangup(hchannel, cause);
+                       } else {
+                               switch_ivr_schedule_hangup(when, uuid, cause, SWITCH_FALSE);
+                       }
+
                        stream->write_function(stream, "+OK\n");
                        switch_core_session_rwunlock(hsession);
                } else {