]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add all modifier to break command
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 21 Oct 2008 17:41:55 +0000 (17:41 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 21 Oct 2008 17:41:55 +0000 (17:41 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10093 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/applications/mod_commands/mod_commands.c

index 46070d45f75908a037f61974e9fa6d4f731339d6..9671c569a4161a706ccafabbaa5ab04ae73f33aa 100644 (file)
@@ -1604,11 +1604,12 @@ SWITCH_STANDARD_API(session_displace_function)
        return SWITCH_STATUS_SUCCESS;
 }
 
-#define BREAK_SYNTAX "<uuid>"
+#define BREAK_SYNTAX "<uuid> [all]"
 SWITCH_STANDARD_API(break_function)
 {
        switch_core_session_t *psession = NULL;
-
+       char *mycmd, *flag;
+       
        if (session) {
                return SWITCH_STATUS_FALSE;
        }
@@ -1618,11 +1619,22 @@ SWITCH_STANDARD_API(break_function)
                return SWITCH_STATUS_SUCCESS;
        }
 
-       if (!(psession = switch_core_session_locate(cmd))) {
+       mycmd = strdup(cmd);
+       switch_assert(mycmd);
+
+       if ((flag = strchr(mycmd, ' '))) {
+               *flag++ = '\0';
+       }
+
+       if (!(psession = switch_core_session_locate(mycmd))) {
                stream->write_function(stream, "-ERR No Such Channel!\n");
                return SWITCH_STATUS_SUCCESS;
        }
 
+       if (flag && !strcasecmp(flag, "all")) {
+               switch_core_session_flush_private_events(session);
+       }
+
        switch_channel_set_flag(switch_core_session_get_channel(psession), CF_BREAK);
        switch_core_session_rwunlock(psession);