]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-4549 --resolve
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 3 Oct 2012 12:09:59 +0000 (07:09 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 3 Oct 2012 12:09:59 +0000 (07:09 -0500)
src/mod/applications/mod_commands/mod_commands.c

index 892d6e7479563df8e2b61c6b65659a97e641653c..38e85a47c26ed3f62589d77666fad318d384c4f6 100644 (file)
@@ -286,7 +286,28 @@ SWITCH_STANDARD_API(shutdown_function)
 
 SWITCH_STANDARD_API(version_function)
 {
-       stream->write_function(stream, "FreeSWITCH Version %s (%s)\n", SWITCH_VERSION_FULL, SWITCH_VERSION_REVISION_HUMAN);
+       int argc;
+       char *mydata = NULL, *argv[2];
+
+       if (zstr(cmd)) {
+               stream->write_function(stream, "FreeSWITCH Version %s (%s)\n", SWITCH_VERSION_FULL, SWITCH_VERSION_REVISION_HUMAN);
+               goto end;
+       }
+
+       mydata = strdup(cmd);
+       switch_assert(mydata);
+
+       argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+
+       if (argv[0] && switch_stristr("short", argv[0])) {
+               stream->write_function(stream, "%s.%s.%s\n", SWITCH_VERSION_MAJOR,SWITCH_VERSION_MINOR,SWITCH_VERSION_MICRO);
+       } else {
+               stream->write_function(stream, "FreeSWITCH Version %s (%s)\n", SWITCH_VERSION_FULL, SWITCH_VERSION_FULL_HUMAN);
+       }
+
+       switch_safe_free(mydata);
+
+end:
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -5658,7 +5679,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
        SWITCH_ADD_API(commands_api_interface, "fsctl", "control messages", ctl_function, CTL_SYNTAX);
        SWITCH_ADD_API(commands_api_interface, "...", "shutdown", shutdown_function, "");
        SWITCH_ADD_API(commands_api_interface, "shutdown", "shutdown", shutdown_function, "");
-       SWITCH_ADD_API(commands_api_interface, "version", "version", version_function, "");
+       SWITCH_ADD_API(commands_api_interface, "version", "version", version_function, "[short]");
        SWITCH_ADD_API(commands_api_interface, "global_getvar", "global_getvar", global_getvar_function, GLOBAL_GETVAR_SYNTAX);
        SWITCH_ADD_API(commands_api_interface, "global_setvar", "global_setvar", global_setvar_function, GLOBAL_SETVAR_SYNTAX);
        SWITCH_ADD_API(commands_api_interface, "group_call", "Generate a dial string to call a group", group_call_function, "<group>[@<domain>]");