]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
avoid loop and adding a missing complete
authorSeven Du <dujinfang@gmail.com>
Mon, 18 Nov 2013 07:10:51 +0000 (15:10 +0800)
committerSeven Du <dujinfang@gmail.com>
Mon, 18 Nov 2013 07:11:21 +0000 (15:11 +0800)
src/mod/applications/mod_commands/mod_commands.c
src/switch_console.c

index 4ae58d2212735a09af455afd50cf7ecec9870974..019e3f8563141c365320a3ac022ab5ac442dace7 100644 (file)
@@ -34,7 +34,7 @@
  * Rupa Schomaker <rupa@rupa.com>
  * Joseph Sullivan <jossulli@amazon.com>
  * Raymond Chandler <intralanman@freeswitch.org>
- *
+ * Seven Du <dujinfang@gmail.com>
  * Garmt Boekholt <garmt@cimico.com>
  *
  * mod_commands.c -- Misc. Command Module
@@ -6532,6 +6532,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
 
 
        switch_console_set_complete("add alias add");
+       switch_console_set_complete("add alias stickyadd");
        switch_console_set_complete("add alias del");
        switch_console_set_complete("add coalesce");
        switch_console_set_complete("add complete add");
index 63fe5758566f17d129390656c29568d0e2b8c5f7..d43f7702e1358d6bcca5cea5c55c469b20a853a1 100644 (file)
@@ -1921,6 +1921,11 @@ SWITCH_DECLARE(switch_status_t) switch_console_set_alias(const char *string)
                        switch_cache_db_handle_t *db = NULL;
                        char *sql = NULL;
 
+                       if (!strcmp(argv[1], argv[2])) {
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Alias and command cannot be the same, this will cause loop!\n");
+                               return SWITCH_STATUS_FALSE;
+                       }
+
                        if (switch_core_db_handle(&db) != SWITCH_STATUS_SUCCESS) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Database Error\n");
                                free(mydata);