]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-9132: [mod_kazoo] remove whitespaces
authorHesaam Farhang <hesaam@2600hz.com>
Fri, 6 May 2016 17:44:34 +0000 (10:44 -0700)
committerHesaam Farhang <hesaam@2600hz.com>
Fri, 6 May 2016 17:47:51 +0000 (10:47 -0700)
src/mod/event_handlers/mod_kazoo/kazoo_commands.c
src/mod/event_handlers/mod_kazoo/kazoo_dptools.c
src/mod/event_handlers/mod_kazoo/kazoo_event_stream.c
src/mod/event_handlers/mod_kazoo/kazoo_node.c
src/mod/event_handlers/mod_kazoo/mod_kazoo.c

index ab9b65386b636397766b3caff61743d7190f7a43..4de71398f46a66bd6d7774a1801a32e0e5129923 100644 (file)
@@ -148,5 +148,5 @@ void add_kz_commands(switch_loadable_module_interface_t **module_interface, swit
        SWITCH_ADD_API(api_interface, "kz_uuid_setvar_multi", UUID_SET_DESC, uuid_setvar_multi_function, UUID_MULTISET_SYNTAX);
        switch_console_set_complete("add kz_uuid_setvar_multi ::console::list_uuid");
        SWITCH_ADD_API(api_interface, "kz_uuid_setvar", UUID_MULTISET_DESC, uuid_setvar_function, UUID_SET_SYNTAX);
-       switch_console_set_complete("add kz_uuid_setvar ::console::list_uuid");  
+       switch_console_set_complete("add kz_uuid_setvar ::console::list_uuid");
 }
index e6453d6490efe76a38abbeb732f09b40073dbd77..352edaae820eac3510a9deb57d49da3247b075c5 100644 (file)
@@ -141,7 +141,7 @@ SWITCH_STANDARD_APP(multiset_function) {
 
                arg = switch_core_session_strdup(session, arg);
                argc = switch_split(arg, delim, array);
-               
+
                for(i = 0; i < argc; i++) {
                        base_set(session, array[i], SWITCH_STACK_BOTTOM);
                }
@@ -178,7 +178,7 @@ SWITCH_STANDARD_APP(unset_function) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "UNSET [%s]\n", (char *) data);
                switch_channel_set_variable(switch_core_session_get_channel(session), data, NULL);
        }
-       
+
        if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) {
                switch_channel_event_set_data(channel, event);
                switch_event_fire(&event);
@@ -242,7 +242,7 @@ void add_kz_dptools(switch_loadable_module_interface_t **module_interface, switc
        SWITCH_ADD_APP(app_interface, "kz_unset", UNSET_SHORT_DESC, UNSET_LONG_DESC, unset_function, UNSET_SYNTAX,
                                   SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC);
        SWITCH_ADD_APP(app_interface, "kz_multiunset", MULTISET_SHORT_DESC, MULTISET_LONG_DESC, multiunset_function, MULTIUNSET_SYNTAX,
-                                  SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC);  
+                                  SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC);
         SWITCH_ADD_APP(app_interface, "kz_export", EXPORT_SHORT_DESC, EXPORT_LONG_DESC, export_function, EXPORT_SYNTAX,
                                    SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC);
 }
index 00eb06a1264bbcc564c5431505c8983f6955959e..cf43ce1f45ff8cf5f9b1caedc103eb0d08841620 100644 (file)
@@ -37,7 +37,7 @@ static char *my_dup(const char *s) {
        size_t len = strlen(s) + 1;
        void *new = malloc(len);
        switch_assert(new);
-       
+
        return (char *) memcpy(new, s, len);
 }
 
@@ -58,21 +58,21 @@ static int is_private_header(const char *name) {
 
 static switch_status_t kazoo_event_dup(switch_event_t **clone, switch_event_t *event, switch_hash_t *filter) {
        switch_event_header_t *header;
-       
+
        if (switch_event_create_subclass(clone, SWITCH_EVENT_CLONE, event->subclass_name) != SWITCH_STATUS_SUCCESS) {
                return SWITCH_STATUS_GENERR;
        }
-       
+
        (*clone)->event_id = event->event_id;
        (*clone)->event_user_data = event->event_user_data;
        (*clone)->bind_user_data = event->bind_user_data;
        (*clone)->flags = event->flags;
-       
+
        for (header = event->headers; header; header = header->next) {
                if (event->subclass_name && !strcmp(header->name, "Event-Subclass")) {
                        continue;
                }
-               
+
                if (strncmp(header->name, globals.kazoo_var_prefix, globals.var_prefix_length)
                        && filter
                        && !switch_core_hash_find(filter, header->name)
@@ -82,7 +82,7 @@ static switch_status_t kazoo_event_dup(switch_event_t **clone, switch_event_t *e
                        {
                                continue;
                        }
-               
+
         if (header->idx) {
             int i;
             for (i = 0; i < header->idx; i++) {
@@ -92,33 +92,33 @@ static switch_status_t kazoo_event_dup(switch_event_t **clone, switch_event_t *e
             switch_event_add_header_string(*clone, SWITCH_STACK_BOTTOM, header->name, header->value);
         }
     }
-       
+
     if (event->body) {
         (*clone)->body = DUP(event->body);
     }
-       
+
     (*clone)->key = event->key;
-       
+
     return SWITCH_STATUS_SUCCESS;
 }
 
 static void event_handler(switch_event_t *event) {
        switch_event_t *clone = NULL;
        ei_event_stream_t *event_stream = (ei_event_stream_t *) event->bind_user_data;
-       
+
        /* if mod_kazoo or the event stream isn't running dont push a new event */
        if (!switch_test_flag(event_stream, LFLAG_RUNNING) || !switch_test_flag(&globals, LFLAG_RUNNING)) {
                return;
        }
-       
+
        if (event->event_id == SWITCH_EVENT_CUSTOM) {
                ei_event_binding_t *event_binding = event_stream->bindings;
                unsigned short int found = 0;
-               
+
                if (!event->subclass_name) {
                        return;
                }
-               
+
                while(event_binding != NULL) {
                        if (event_binding->type == SWITCH_EVENT_CUSTOM) {
                                if(event_binding->subclass_name
@@ -238,9 +238,9 @@ static void *SWITCH_THREAD_FUNC event_stream_loop(switch_thread_t *thread, void
                                } else {
                                        ei_x_new_with_version(&ebuf);
                                }
-                                
+
                                ei_encode_switch_event(&ebuf, event);
-                                
+
                                if (globals.event_stream_preallocate > 0 && ebuf.buffsz > globals.event_stream_preallocate) {
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "increased event stream buffer size to %d\n", ebuf.buffsz);
                                }
index 0ffd3ffdf029656adbb5fa7245b191896d841e4e..1efe7e3e82e29f7887f2b4ca778be231f0f9303f 100644 (file)
@@ -1092,7 +1092,7 @@ static void *SWITCH_THREAD_FUNC handle_node(switch_thread_t *thread, void *obj)
                                ei_x_new(&received_msg->buf);
                        }
                }
-                
+
                while (switch_queue_trypop(ei_node->send_msgs, &pop) == SWITCH_STATUS_SUCCESS
                           && ++send_msg_count <= globals.send_msg_batch) {
                        ei_send_msg_t *send_msg = (ei_send_msg_t *) pop;
index 4771f53c2da52cf7cee16d733f60a9f432a92952..dd305fe911cacabaa7d0ffc3fcfcd7eb2110686b 100644 (file)
@@ -53,16 +53,16 @@ static switch_status_t api_erlang_status(switch_stream_handle_t *stream) {
        char ipbuf[25];
        const char *ip_addr;
        ei_node_t *ei_node;
-       
+
        switch_socket_addr_get(&sa, SWITCH_FALSE, globals.acceptor);
-       
+
        port = switch_sockaddr_get_port(sa);
        ip_addr = switch_get_addr(ipbuf, sizeof (ipbuf), sa);
-       
+
        stream->write_function(stream, "Running %s\n", VERSION);
        stream->write_function(stream, "Listening for new Erlang connections on %s:%u with cookie %s\n", ip_addr, port, globals.ei_cookie);
        stream->write_function(stream, "Registered as Erlang node %s, visible as %s\n", globals.ei_cnode.thisnodename, globals.ei_cnode.thisalivename);
-       
+
        if (globals.ei_compat_rel) {
                stream->write_function(stream, "Using Erlang compatibility mode: %d\n", globals.ei_compat_rel);
        }
@@ -75,7 +75,7 @@ static switch_status_t api_erlang_status(switch_stream_handle_t *stream) {
                stream->write_function(stream, "Connected to:\n");
                while(ei_node != NULL) {
                        unsigned int year, day, hour, min, sec, delta;
-                       
+
                        delta = (switch_micro_time_now() - ei_node->created_time) / 1000000;
                        sec = delta % 60;
                        min = delta / 60 % 60;
@@ -88,14 +88,14 @@ static switch_status_t api_erlang_status(switch_stream_handle_t *stream) {
                }
        }
        switch_thread_rwlock_unlock(globals.ei_nodes_lock);
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t api_erlang_event_filter(switch_stream_handle_t *stream) {
        switch_hash_index_t *hi = NULL;
        int column = 0;
-       
+
        for (hi = (switch_hash_index_t *)switch_core_hash_first_iter(globals.event_filter, hi); hi; hi = switch_core_hash_next(&hi)) {
                const void *key;
                void *val;
@@ -106,20 +106,20 @@ static switch_status_t api_erlang_event_filter(switch_stream_handle_t *stream) {
                        column = 0;
                }
        }
-       
+
        if (++column > 2) {
                stream->write_function(stream, "\n");
                column = 0;
        }
-       
+
        stream->write_function(stream, "%-50s", globals.kazoo_var_prefix);
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t api_erlang_nodes_list(switch_stream_handle_t *stream) {
        ei_node_t *ei_node;
-       
+
        switch_thread_rwlock_rdlock(globals.ei_nodes_lock);
        ei_node = globals.ei_nodes;
        while(ei_node != NULL) {
@@ -127,14 +127,14 @@ static switch_status_t api_erlang_nodes_list(switch_stream_handle_t *stream) {
                ei_node = ei_node->next;
        }
        switch_thread_rwlock_unlock(globals.ei_nodes_lock);
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t api_erlang_nodes_count(switch_stream_handle_t *stream) {
        ei_node_t *ei_node;
        int count = 0;
-       
+
        switch_thread_rwlock_rdlock(globals.ei_nodes_lock);
        ei_node = globals.ei_nodes;
        while(ei_node != NULL) {
@@ -142,9 +142,9 @@ static switch_status_t api_erlang_nodes_count(switch_stream_handle_t *stream) {
                ei_node = ei_node->next;
        }
        switch_thread_rwlock_unlock(globals.ei_nodes_lock);
-       
+
        stream->write_function(stream, "%d\n", count);
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -152,7 +152,7 @@ static switch_status_t api_complete_erlang_node(const char *line, const char *cu
        switch_console_callback_match_t *my_matches = NULL;
        switch_status_t status = SWITCH_STATUS_FALSE;
        ei_node_t *ei_node;
-       
+
        switch_thread_rwlock_rdlock(globals.ei_nodes_lock);
        ei_node = globals.ei_nodes;
        while(ei_node != NULL) {
@@ -160,34 +160,34 @@ static switch_status_t api_complete_erlang_node(const char *line, const char *cu
                ei_node = ei_node->next;
        }
        switch_thread_rwlock_unlock(globals.ei_nodes_lock);
-       
+
        if (my_matches) {
                *matches = my_matches;
                status = SWITCH_STATUS_SUCCESS;
        }
-       
+
        return status;
 }
 
 static switch_status_t handle_node_api_event_stream(ei_event_stream_t *event_stream, switch_stream_handle_t *stream) {
        ei_event_binding_t *binding;
        int column = 0;
-       
+
        switch_mutex_lock(event_stream->socket_mutex);
        if (event_stream->connected == SWITCH_FALSE) {
                switch_sockaddr_t *sa;
                uint16_t port;
                char ipbuf[25] = {0};
                const char *ip_addr;
-               
+
                switch_socket_addr_get(&sa, SWITCH_TRUE, event_stream->acceptor);
                port = switch_sockaddr_get_port(sa);
                ip_addr = switch_get_addr(ipbuf, sizeof (ipbuf), sa);
-               
+
                if (zstr(ip_addr)) {
                        ip_addr = globals.ip;
                }
-               
+
                stream->write_function(stream, "%s:%d -> disconnected\n"
                                                           ,ip_addr, port);
        } else {
@@ -195,7 +195,7 @@ static switch_status_t handle_node_api_event_stream(ei_event_stream_t *event_str
                                                           ,event_stream->local_ip, event_stream->local_port
                                                           ,event_stream->remote_ip, event_stream->remote_port);
        }
-       
+
        binding = event_stream->bindings;
        while(binding != NULL) {
                if (binding->type == SWITCH_EVENT_CUSTOM) {
@@ -203,22 +203,22 @@ static switch_status_t handle_node_api_event_stream(ei_event_stream_t *event_str
                } else {
                        stream->write_function(stream, "%-50s", switch_event_name(binding->type));
                }
-               
+
                if (++column > 2) {
                        stream->write_function(stream, "\n");
                        column = 0;
                }
-               
+
                binding = binding->next;
        }
        switch_mutex_unlock(event_stream->socket_mutex);
-       
+
        if (!column) {
                stream->write_function(stream, "\n");
        } else {
                stream->write_function(stream, "\n\n");
        }
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -232,13 +232,13 @@ static switch_status_t handle_node_api_event_streams(ei_node_t *ei_node, switch_
                event_stream = event_stream->next;
        }
        switch_mutex_unlock(ei_node->event_streams_mutex);
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t handle_node_api_command(ei_node_t *ei_node, switch_stream_handle_t *stream, uint32_t command) {
        unsigned int year, day, hour, min, sec, delta;
-       
+
        switch (command) {
        case API_COMMAND_DISCONNECT:
                stream->write_function(stream, "Disconnecting erlang node %s at managers request\n", ei_node->peer_nodename);
@@ -251,7 +251,7 @@ static switch_status_t handle_node_api_command(ei_node_t *ei_node, switch_stream
                hour = delta / 3600 % 24;
                day = delta / 86400 % 7;
                year = delta / 31556926 % 12;
-               
+
                stream->write_function(stream, "Uptime           %d years, %d days, %d hours, %d minutes, %d seconds\n", year, day, hour, min, sec);
                stream->write_function(stream, "Local Address    %s:%d\n", ei_node->local_ip, ei_node->local_port);
                stream->write_function(stream, "Remote Address   %s:%d\n", ei_node->remote_ip, ei_node->remote_port);
@@ -265,28 +265,28 @@ static switch_status_t handle_node_api_command(ei_node_t *ei_node, switch_stream
        default:
                break;
        }
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t api_erlang_node_command(switch_stream_handle_t *stream, const char *nodename, uint32_t command) {
        ei_node_t *ei_node;
-       
+
        switch_thread_rwlock_rdlock(globals.ei_nodes_lock);
        ei_node = globals.ei_nodes;
        while(ei_node != NULL) {
                int length = strlen(ei_node->peer_nodename);
-               
+
                if (!strncmp(ei_node->peer_nodename, nodename, length)) {
                        handle_node_api_command(ei_node, stream, command);
                        switch_thread_rwlock_unlock(globals.ei_nodes_lock);
                        return SWITCH_STATUS_SUCCESS;
                }
-               
+
                ei_node = ei_node->next;
        }
        switch_thread_rwlock_unlock(globals.ei_nodes_lock);
-       
+
        return SWITCH_STATUS_NOTFOUND;
 }
 
@@ -296,7 +296,7 @@ static int read_cookie_from_file(char *filename) {
        char *end;
        struct stat buf;
        ssize_t res;
-       
+
        if (!stat(filename, &buf)) {
                if ((buf.st_mode & S_IRWXG) || (buf.st_mode & S_IRWXO)) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s must only be accessible by owner only.\n", filename);
@@ -311,24 +311,24 @@ static int read_cookie_from_file(char *filename) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to open cookie file %s : %d.\n", filename, errno);
                        return 2;
                }
-               
+
                if ((res = read(fd, cookie, MAXATOMLEN)) < 1) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to read cookie file %s : %d.\n", filename, errno);
                }
-               
+
                cookie[MAXATOMLEN] = '\0';
-               
+
                /* replace any end of line characters with a null */
                if ((end = strchr(cookie, '\n'))) {
                        *end = '\0';
                }
-               
+
                if ((end = strchr(cookie, '\r'))) {
                        *end = '\0';
                }
-               
+
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Set cookie from file %s: %s\n", filename, cookie);
-               
+
                set_pref_ei_cookie(cookie);
                return 0;
        } else {
@@ -349,7 +349,7 @@ static switch_status_t config(void) {
        globals.send_msg_batch = 10;
        globals.event_stream_framing = 2;
        globals.port = 0;
-       
+
        if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to open configuration file %s\n", cf);
                return SWITCH_STATUS_FALSE;
@@ -358,7 +358,7 @@ static switch_status_t config(void) {
                        for (param = switch_xml_child(child, "param"); param; param = param->next) {
                                char *var = (char *) switch_xml_attr_soft(param, "name");
                                char *val = (char *) switch_xml_attr_soft(param, "value");
-                               
+
                                if (!strcmp(var, "listen-ip")) {
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Set bind ip address: %s\n", val);
                                        set_pref_ip(val);
@@ -413,19 +413,19 @@ static switch_status_t config(void) {
                                }
                        }
                }
-               
+
                if ((child = switch_xml_child(cfg, "event-filter"))) {
                        switch_hash_t *filter;
-                       
+
                        switch_core_hash_init(&filter);
                        for (param = switch_xml_child(child, "header"); param; param = param->next) {
                                char *var = (char *) switch_xml_attr_soft(param, "name");
                                switch_core_hash_insert(filter, var, "1");
                        }
-                       
+
                        globals.event_filter = filter;
                }
-               
+
                switch_xml_free(xml);
        }
 
@@ -433,17 +433,17 @@ static switch_status_t config(void) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid receive message preallocate value, disabled\n");
                globals.receive_msg_preallocate = 0;
        }
-       
+
        if (globals.event_stream_preallocate < 0) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid event stream preallocate value, disabled\n");
                globals.event_stream_preallocate = 0;
        }
-       
+
        if (globals.send_msg_batch < 1) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid send message batch size, reverting to default\n");
                globals.send_msg_batch = 10;
        }
-       
+
        if (!globals.event_filter) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Event filter not found in configuration, using default\n");
                globals.event_filter = create_default_filter();
@@ -453,7 +453,7 @@ static switch_status_t config(void) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid event stream framing value, using default\n");
                globals.event_stream_framing = 2;
        }
-       
+
        if (zstr(globals.kazoo_var_prefix)) {
                set_pref_kazoo_var_prefix("variable_ecallmgr*");
                globals.var_prefix_length = 17; //ignore the *
@@ -462,33 +462,33 @@ static switch_status_t config(void) {
                 * free the pointer if it was not drawn from the XML */
                char *buf;
                int size = switch_snprintf(NULL, 0, "variable_%s*", globals.kazoo_var_prefix) + 1;
-               
+
                switch_malloc(buf, size);
                switch_snprintf(buf, size, "variable_%s*", globals.kazoo_var_prefix);
                switch_safe_free(globals.kazoo_var_prefix);
                globals.kazoo_var_prefix = buf;
                globals.var_prefix_length = size - 2; //ignore the *
        }
-       
+
        if (!globals.num_worker_threads) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Number of worker threads not found in configuration, using default\n");
                globals.num_worker_threads = 10;
        }
-       
+
        if (zstr(globals.ip)) {
                set_pref_ip("0.0.0.0");
        }
-       
+
        if (zstr(globals.ei_cookie)) {
                int res;
                char *home_dir = getenv("HOME");
                char path_buf[1024];
-               
+
                if (!zstr(home_dir)) {
                        /* $HOME/.erlang.cookie */
                        switch_snprintf(path_buf, sizeof (path_buf), "%s%s%s", home_dir, SWITCH_PATH_SEPARATOR, ".erlang.cookie");
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking for cookie at path: %s\n", path_buf);
-                       
+
                        res = read_cookie_from_file(path_buf);
                        if (res) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No cookie or valid cookie file specified, using default cookie\n");
@@ -496,15 +496,15 @@ static switch_status_t config(void) {
                        }
                }
        }
-       
+
        if (!globals.ei_nodename) {
                set_pref_ei_nodename("freeswitch");
        }
-       
+
        if (!globals.nat_map) {
                globals.nat_map = 0;
        }
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -513,38 +513,38 @@ static switch_status_t create_acceptor() {
        uint16_t port;
     char ipbuf[25];
     const char *ip_addr;
-       
+
        /* if the config has specified an erlang release compatibility then pass that along to the erlang interface */
        if (globals.ei_compat_rel) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Compatability with OTP R%d requested\n", globals.ei_compat_rel);
                ei_set_compat_rel(globals.ei_compat_rel);
        }
-       
+
        if (!(globals.acceptor = create_socket_with_port(globals.pool, globals.port))) {
                return SWITCH_STATUS_SOCKERR;
        }
-       
+
        switch_socket_addr_get(&sa, SWITCH_FALSE, globals.acceptor);
-       
+
        port = switch_sockaddr_get_port(sa);
        ip_addr = switch_get_addr(ipbuf, sizeof (ipbuf), sa);
-       
+
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Erlang connection acceptor listening on %s:%u\n", ip_addr, port);
-       
+
        /* try to initialize the erlang interface */
        if (create_ei_cnode(ip_addr, globals.ei_nodename, &globals.ei_cnode) != SWITCH_STATUS_SUCCESS) {
                return SWITCH_STATUS_SOCKERR;
        }
-       
+
        /* tell the erlang port manager where we can be reached.  this returns a file descriptor pointing to epmd or -1 */
        if ((globals.epmdfd = ei_publish(&globals.ei_cnode, port)) == -1) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
                                                  "Failed to publish port to epmd. Try starting it yourself or run an erl shell with the -sname or -name option.\n");
                return SWITCH_STATUS_SOCKERR;
        }
-       
+
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connected to epmd and published erlang cnode name %s at port %d\n", globals.ei_cnode.thisnodename, port);
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -553,7 +553,7 @@ SWITCH_STANDARD_API(exec_api_cmd)
        char *argv[1024] = { 0 };
        int unknown_command = 1, argc = 0;
        char *mycmd = NULL;
-       
+
        const char *usage_string = "USAGE:\n"
                "--------------------------------------------------------------------------------------------------------------------\n"
                "erlang status                            - provides an overview of the current status\n"
@@ -565,28 +565,28 @@ SWITCH_STANDARD_API(exec_api_cmd)
                "erlang node <node_name> event_streams    - lists the event streams for an Erlang node\n"
                "erlang node <node_name> fetch_bindings   - lists the XML fetch bindings for an Erlang node\n"
                "---------------------------------------------------------------------------------------------------------------------\n";
-       
+
        if (zstr(cmd)) {
                stream->write_function(stream, "%s", usage_string);
                return SWITCH_STATUS_SUCCESS;
        }
-       
+
        if (!(mycmd = strdup(cmd))) {
                return SWITCH_STATUS_MEMERR;
        }
-       
+
        if (!(argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
                stream->write_function(stream, "%s", usage_string);
                switch_safe_free(mycmd);
                return SWITCH_STATUS_SUCCESS;
        }
-       
+
        if (zstr(argv[0])) {
                stream->write_function(stream, "%s", usage_string);
                switch_safe_free(mycmd);
                return SWITCH_STATUS_SUCCESS;
        }
-       
+
        if (!strncmp(argv[0], "status", 6)) {
                unknown_command = 0;
                api_erlang_status(stream);
@@ -616,11 +616,11 @@ SWITCH_STANDARD_API(exec_api_cmd)
                        api_erlang_node_command(stream, argv[1], API_COMMAND_BINDINGS);
                }
        }
-       
+
        if (unknown_command) {
                stream->write_function(stream, "%s", usage_string);
        }
-       
+
        switch_safe_free(mycmd);
        return SWITCH_STATUS_SUCCESS;
 }
@@ -628,28 +628,28 @@ SWITCH_STANDARD_API(exec_api_cmd)
 SWITCH_MODULE_LOAD_FUNCTION(mod_kazoo_load) {
        switch_api_interface_t *api_interface = NULL;
        switch_application_interface_t *app_interface = NULL;
-       
+
        memset(&globals, 0, sizeof(globals));
-       
+
        globals.pool = pool;
        globals.ei_nodes = NULL;
-       
+
        if(config() != SWITCH_STATUS_SUCCESS) {
                // TODO: what would we need to clean up here?
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Improper configuration!\n");
                return SWITCH_STATUS_TERM;
        }
-       
+
        if(create_acceptor() != SWITCH_STATUS_SUCCESS) {
                // TODO: what would we need to clean up here
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to create erlang connection acceptor!\n");
                close_socket(&globals.acceptor);
                return SWITCH_STATUS_TERM;
        }
-       
+
        /* connect my internal structure to the blank pointer passed to me */
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
-       
+
        /* create an api for cli debug commands */
        SWITCH_ADD_API(api_interface, "erlang", KAZOO_DESC, exec_api_cmd, KAZOO_SYNTAX);
        switch_console_set_complete("add erlang status");
@@ -661,13 +661,13 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_kazoo_load) {
        switch_console_set_complete("add erlang node ::erlang::node event_streams");
        switch_console_set_complete("add erlang node ::erlang::node fetch_bindings");
        switch_console_add_complete_func("::erlang::node", api_complete_erlang_node);
-       
+
        switch_thread_rwlock_create(&globals.ei_nodes_lock, pool);
-       
+
        switch_set_flag(&globals, LFLAG_RUNNING);
-       
+
        /* create all XML fetch agents */
-       bind_fetch_agents();    
+       bind_fetch_agents();
 
        /* add our modified commands */
        add_kz_commands(module_interface, api_interface);
@@ -681,13 +681,13 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_kazoo_load) {
 
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_kazoo_shutdown) {
        int sanity = 0;
-       
+
        switch_console_set_complete("del erlang");
        switch_console_del_complete_func("::erlang::node");
-       
+
        /* stop taking new requests and start shuting down the threads */
        switch_clear_flag(&globals, LFLAG_RUNNING);
-       
+
        /* give everyone time to cleanly shutdown */
        while (switch_atomic_read(&globals.threads)) {
                switch_yield(100000);
@@ -696,52 +696,52 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_kazoo_shutdown) {
                        break;
                }
        }
-       
+
        if (globals.event_filter) {
                switch_core_hash_destroy(&globals.event_filter);
        }
-       
+
        switch_thread_rwlock_wrlock(globals.ei_nodes_lock);
        switch_thread_rwlock_unlock(globals.ei_nodes_lock);
        switch_thread_rwlock_destroy(globals.ei_nodes_lock);
-       
+
        /* close the connection to epmd and the acceptor */
        close_socketfd(&globals.epmdfd);
        close_socket(&globals.acceptor);
-       
+
        /* remove all XML fetch agents */
        unbind_fetch_agents();
-       
+
        /* Close the port we reserved for uPnP/Switch behind firewall, if necessary */
        //      if (globals.nat_map && switch_nat_get_type()) {
        //              switch_nat_del_mapping(globals.port, SWITCH_NAT_TCP);
        //      }
-       
+
        /* clean up our allocated preferences */
        switch_safe_free(globals.ip);
        switch_safe_free(globals.ei_cookie);
        switch_safe_free(globals.ei_nodename);
        switch_safe_free(globals.kazoo_var_prefix);
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
 SWITCH_MODULE_RUNTIME_FUNCTION(mod_kazoo_runtime) {
        switch_os_socket_t os_socket;
-       
+
        switch_atomic_inc(&globals.threads);
-       
+
        switch_os_sock_get(&os_socket, globals.acceptor);
-       
+
        while (switch_test_flag(&globals, LFLAG_RUNNING)) {
                int nodefd;
                ErlConnect conn;
-               
+
                /* zero out errno because ei_accept doesn't differentiate between a */
                /* failed authentication or a socket failure, or a client version */
                /* mismatch or a godzilla attack (and a godzilla attack is highly likely) */
                errno = 0;
-               
+
                /* wait here for an erlang node to connect, timming out to check if our module is still running every now-and-again */
                if ((nodefd = ei_accept_tmo(&globals.ei_cnode, (int) os_socket, &conn, globals.connection_timeout)) == ERL_ERROR) {
                        if (erl_errno == ETIMEDOUT) {
@@ -754,19 +754,19 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_kazoo_runtime) {
                        }
                        continue;
                }
-               
+
                if (!switch_test_flag(&globals, LFLAG_RUNNING)) {
                        break;
                }
-               
+
                /* NEW ERLANG NODE CONNECTION! Hello friend! */
                new_kazoo_node(nodefd, &conn);
        }
-       
+
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Erlang connection acceptor shut down\n");
-       
+
        switch_atomic_dec(&globals.threads);
-       
+
        return SWITCH_STATUS_TERM;
 }