Revision
15225
Author
anthm
Date
2009-10-24 12:11:03 -0500 (Sat, 24 Oct 2009)

Log Message

MODAPP-357

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c (15224 => 15225)


--- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c	2009-10-24 17:07:44 UTC (rev 15224)
+++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c	2009-10-24 17:11:03 UTC (rev 15225)
@@ -45,6 +45,15 @@
 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_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;