]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
MODAPP-357
authorAnthony Minessale <anthony.minessale@gmail.com>
Sat, 24 Oct 2009 17:11:03 +0000 (17:11 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Sat, 24 Oct 2009 17:11:03 +0000 (17:11 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15225 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/applications/mod_commands/mod_commands.c

index 11968d014b65a9934a0d73f15ca07c6d780ba903..6d7b23b662b9b47bc43aafc75c97e87ce2b97a5d 100644 (file)
@@ -45,6 +45,15 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load);
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_commands_shutdown);
 SWITCH_MODULE_DEFINITION(mod_commands, mod_commands_load, mod_commands_shutdown, NULL);
 
+SWITCH_STANDARD_API(hostname_api_function)
+{
+       char hostname[256]="";
+       gethostname(hostname, sizeof(hostname));
+       stream->write_function(stream, "%s",hostname);
+       return SWITCH_STATUS_SUCCESS;
+}
+
+
 SWITCH_STANDARD_API(host_lookup_function)
 {
        char host[256] = "";
@@ -3760,6 +3769,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
        SWITCH_ADD_API(commands_api_interface, "time_test", "time_test", time_test_function, "<mss>");
        SWITCH_ADD_API(commands_api_interface, "nat_map", "nat_map", nat_map_function, "[status|republish|reinit] | [add|del] <port> [tcp|udp] [static]");
        SWITCH_ADD_API(commands_api_interface, "host_lookup", "host_lookup", host_lookup_function, "<hostname>");
+       SWITCH_ADD_API(commands_api_interface, "hostname", "Returns the system hostname", hostname_api_function, "");
 
        /* indicate that the module should continue to be loaded */
        return SWITCH_STATUS_NOUNLOAD;