From 2d5860af3b6bfd0563d439a18856c8e8f2be85be Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 24 Oct 2009 17:11:03 +0000 Subject: [PATCH] MODAPP-357 git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15225 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/applications/mod_commands/mod_commands.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 11968d014b..6d7b23b662 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -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, ""); SWITCH_ADD_API(commands_api_interface, "nat_map", "nat_map", nat_map_function, "[status|republish|reinit] | [add|del] [tcp|udp] [static]"); SWITCH_ADD_API(commands_api_interface, "host_lookup", "host_lookup", host_lookup_function, ""); + 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;