Sat Apr 26 2014 22:03:12

Asterisk developer's documentation


res_stun_monitor.c File Reference

STUN Network Monitor. More...

#include "asterisk.h"
#include "asterisk/module.h"
#include "asterisk/event.h"
#include "asterisk/sched.h"
#include "asterisk/config.h"
#include "asterisk/stun.h"
#include "asterisk/netsock2.h"
#include "asterisk/lock.h"
#include "asterisk/acl.h"
#include "asterisk/cli.h"
#include <fcntl.h>
Include dependency graph for res_stun_monitor.c:

Go to the source code of this file.

Defines

#define DATALN   "%-25s %-5d %-7d %-8d %-7s %-16s %-d\n"
#define DEFAULT_MONITOR_REFRESH   30
#define DEFAULT_RETRIES   3
#define HEADER   "%-25s %-5s %-7s %-8s %-7s %-16s %-s\n"

Functions

static void __reg_module (void)
static int __reload (int startup)
static void __unreg_module (void)
static void _stun_show_status (int fd)
 Execute stun show status command.
static char * handle_cli_stun_show_status (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int load_config (int startup)
static int load_module (void)
static int reload (void)
static int setup_stunaddr (const char *value)
static void stun_close_sock (void)
static int stun_monitor_request (const void *blarg)
static int stun_start_monitor (void)
static void stun_stop_monitor (void)
static int unload_module (void)

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER , .description = "STUN Network Monitor" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .reload = reload, .load_pri = AST_MODPRI_CHANNEL_DEPEND }
struct {
   struct sockaddr_in   external_addr
   unsigned int   external_addr_known:1
   ast_mutex_t   lock
   unsigned int   monitor_enabled:1
   unsigned int   refresh
   const char *   server_hostname
   unsigned int   stun_poll_failed_gripe:1
   unsigned int   stun_port
   int   stun_sock
args
static struct ast_module_infoast_module_info = &__mod_info
static struct ast_cli_entry cli_stun []
static struct ast_sched_contextsched
static const char stun_conf_file [] = "res_stun_monitor.conf"

Detailed Description

STUN Network Monitor.

Author:
David Vossel <dvossel@digium.com>

Definition in file res_stun_monitor.c.


Define Documentation

#define DATALN   "%-25s %-5d %-7d %-8d %-7s %-16s %-d\n"

Referenced by _stun_show_status().

#define DEFAULT_MONITOR_REFRESH   30

Default refresh period in seconds

Definition at line 46 of file res_stun_monitor.c.

Referenced by load_config().

#define DEFAULT_RETRIES   3

retries shown in stun show status matching static retries in stun.c

Definition at line 47 of file res_stun_monitor.c.

Referenced by _stun_show_status().

#define HEADER   "%-25s %-5s %-7s %-8s %-7s %-16s %-s\n"

Referenced by _stun_show_status().


Function Documentation

static void __reg_module ( void  ) [static]

Definition at line 466 of file res_stun_monitor.c.

static int __reload ( int  startup) [static]

Definition at line 413 of file res_stun_monitor.c.

References args, ast_mutex_lock, ast_mutex_unlock, load_config(), stun_start_monitor(), and stun_stop_monitor().

Referenced by load_module(), and reload().

{
   int res;

   ast_mutex_lock(&args.lock);
   if (!(res = load_config(startup)) && args.monitor_enabled) {
      res = stun_start_monitor();
   }
   ast_mutex_unlock(&args.lock);

   if (res < 0 || !args.monitor_enabled) {
      stun_stop_monitor();
   }

   return res;
}
static void __unreg_module ( void  ) [static]

Definition at line 466 of file res_stun_monitor.c.

static void _stun_show_status ( int  fd) [static]

Execute stun show status command.

we only have one stun server, but start to play well with more

Definition at line 357 of file res_stun_monitor.c.

References args, ast_cli(), ast_inet_ntoa(), DATALN, DEFAULT_RETRIES, HEADER, and status.

Referenced by handle_cli_stun_show_status().

{
   const char *status;

#define DATALN "%-25s %-5d %-7d %-8d %-7s %-16s %-d\n"
#define HEADER "%-25s %-5s %-7s %-8s %-7s %-16s %-s\n"

   /*! we only have one stun server, but start to play well with more */
   ast_cli(fd, HEADER, "Hostname", "Port", "Period", "Retries", "Status", "ExternAddr", "ExternPort");

   if (args.stun_poll_failed_gripe) {
      status = "FAIL";
   } else if (args.external_addr_known) {
      status = "OK";
   } else {
      status = "INIT";
   }
   ast_cli( fd, DATALN,
           args.server_hostname,
           args.stun_port,
           args.refresh,
           DEFAULT_RETRIES,
           status,
           ast_inet_ntoa(args.external_addr.sin_addr),
           ntohs(args.external_addr.sin_port)
         );

#undef HEADER
#undef DATALN
}
static char* handle_cli_stun_show_status ( struct ast_cli_entry e,
int  cmd,
struct ast_cli_args a 
) [static]

Definition at line 388 of file res_stun_monitor.c.

References _stun_show_status(), ast_cli_args::argc, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, and ast_cli_entry::usage.

{
   switch (cmd) {
   case CLI_INIT:
      e->command = "stun show status";
      e->usage =
          "Usage: stun show status\n"
          "       List all known STUN servers and statuses.\n";
      return NULL;
   case CLI_GENERATE:
      return NULL;
   }

   if (a->argc != 3) {
      return CLI_SHOWUSAGE;
   }

   _stun_show_status(a->fd);
   return CLI_SUCCESS;
}
static int load_config ( int  startup) [static]

Definition at line 307 of file res_stun_monitor.c.

References args, ast_config_destroy(), ast_config_load2(), ast_log(), ast_set_flag, ast_variable_browse(), CONFIG_FLAG_FILEUNCHANGED, CONFIG_STATUS_FILEINVALID, CONFIG_STATUS_FILEUNCHANGED, DEFAULT_MONITOR_REFRESH, ast_variable::lineno, LOG_WARNING, ast_variable::name, ast_variable::next, setup_stunaddr(), stun_close_sock(), and ast_variable::value.

Referenced by __reload().

{
   struct ast_flags config_flags = { 0, };
   struct ast_config *cfg;
   struct ast_variable *v;

   if (!startup) {
      ast_set_flag(&config_flags, CONFIG_FLAG_FILEUNCHANGED);
   }

   cfg = ast_config_load2(stun_conf_file, "res_stun_monitor", config_flags);
   if (!cfg || cfg == CONFIG_STATUS_FILEINVALID) {
      ast_log(LOG_WARNING, "Unable to load config %s\n", stun_conf_file);
      return -1;
   }
   if (cfg == CONFIG_STATUS_FILEUNCHANGED) {
      return 0;
   }

   /* clean up any previous open socket */
   stun_close_sock();
   args.stun_poll_failed_gripe = 0;

   /* set defaults */
   args.monitor_enabled = 0;
   args.refresh = DEFAULT_MONITOR_REFRESH;

   for (v = ast_variable_browse(cfg, "general"); v; v = v->next) {
      if (!strcasecmp(v->name, "stunaddr")) {
         if (setup_stunaddr(v->value)) {
            ast_log(LOG_WARNING, "Invalid STUN server address: %s at line %d\n",
               v->value, v->lineno);
         }
      } else if (!strcasecmp(v->name, "stunrefresh")) {
         if ((sscanf(v->value, "%30u", &args.refresh) != 1) || !args.refresh) {
            ast_log(LOG_WARNING, "Invalid stunrefresh value '%s', must be an integer > 0 at line %d\n", v->value, v->lineno);
            args.refresh = DEFAULT_MONITOR_REFRESH;
         }
      } else {
         ast_log(LOG_WARNING, "Invalid config option %s at line %d\n",
            v->value, v->lineno);
      }
   }

   ast_config_destroy(cfg);

   return 0;
}
static int load_module ( void  ) [static]

Register CLI commands

Definition at line 446 of file res_stun_monitor.c.

References __reload(), args, ast_cli_register_multiple(), AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_mutex_destroy, and ast_mutex_init.

{
   ast_mutex_init(&args.lock);
   args.stun_sock = -1;
   if (__reload(1)) {
      ast_mutex_destroy(&args.lock);
      return AST_MODULE_LOAD_DECLINE;
   }

   /*! Register CLI commands */
   ast_cli_register_multiple(cli_stun, sizeof(cli_stun) / sizeof(struct ast_cli_entry));

   return AST_MODULE_LOAD_SUCCESS;
}
static int reload ( void  ) [static]

Definition at line 430 of file res_stun_monitor.c.

References __reload().

{
   return __reload(0);
}
static int setup_stunaddr ( const char *  value) [static]

Definition at line 257 of file res_stun_monitor.c.

References args, ast_free, ast_get_ip(), ast_log(), ast_sockaddr_split_hostport(), ast_strdup, ast_strlen_zero(), LOG_WARNING, ast_sockaddr::ss, and STANDARD_STUN_PORT.

Referenced by load_config().

{
   char *val;
   char *host_str;
   char *port_str;
   unsigned int port;
   struct ast_sockaddr stun_addr;

   if (ast_strlen_zero(value)) {
      /* Setting to an empty value disables STUN monitoring. */
      args.monitor_enabled = 0;
      return 0;
   }

   val = ast_strdupa(value);
   if (!ast_sockaddr_split_hostport(val, &host_str, &port_str, 0)
      || ast_strlen_zero(host_str)) {
      return -1;
   }

   /* Determine STUN port */
   if (ast_strlen_zero(port_str)
      || 1 != sscanf(port_str, "%30u", &port)) {
      port = STANDARD_STUN_PORT;
   }

   host_str = ast_strdup(host_str);
   if (!host_str) {
      return -1;
   }

   /* Lookup STUN address. */
   memset(&stun_addr, 0, sizeof(stun_addr));
   stun_addr.ss.ss_family = AF_INET;
   if (ast_get_ip(&stun_addr, host_str)) {
      ast_log(LOG_WARNING, "Unable to lookup STUN server '%s'\n", host_str);
      ast_free(host_str);
      return -1;
   }

   /* Save STUN server information. */
   ast_free((char *) args.server_hostname);
   args.server_hostname = host_str;
   args.stun_port = port;

   /* Enable STUN monitor */
   args.monitor_enabled = 1;
   return 0;
}
static void stun_close_sock ( void  ) [static]

Definition at line 74 of file res_stun_monitor.c.

References args.

Referenced by load_config(), stun_monitor_request(), stun_start_monitor(), and stun_stop_monitor().

{
   if (0 <= args.stun_sock) {
      close(args.stun_sock);
      args.stun_sock = -1;
   }
}
static int stun_monitor_request ( const void *  blarg) [static]

Definition at line 83 of file res_stun_monitor.c.

References args, ast_connect(), ast_event_destroy(), AST_EVENT_IE_END, AST_EVENT_NETWORK_CHANGE, ast_event_new(), ast_event_queue(), ast_get_ip(), ast_inet_ntoa(), ast_log(), ast_mutex_lock, ast_mutex_unlock, ast_sockaddr_set_port, ast_sockaddr_stringify(), ast_stun_request(), errno, LOG_ERROR, LOG_NOTICE, LOG_WARNING, ast_sockaddr::ss, and stun_close_sock().

Referenced by stun_start_monitor().

{
   int res;
   struct sockaddr_in answer;
   static const struct sockaddr_in no_addr = { 0, };

   ast_mutex_lock(&args.lock);
   if (!args.monitor_enabled) {
      goto monitor_request_cleanup;
   }

   if (args.stun_sock < 0) {
      struct ast_sockaddr stun_addr;

      /* STUN socket not open.  Refresh the server DNS address resolution. */
      if (!args.server_hostname) {
         /* No STUN hostname? */
         goto monitor_request_cleanup;
      }

      /* Lookup STUN address. */
      memset(&stun_addr, 0, sizeof(stun_addr));
      stun_addr.ss.ss_family = AF_INET;
      if (ast_get_ip(&stun_addr, args.server_hostname)) {
         /* Lookup failed. */
         ast_log(LOG_WARNING, "Unable to lookup STUN server '%s'\n",
            args.server_hostname);
         goto monitor_request_cleanup;
      }
      ast_sockaddr_set_port(&stun_addr, args.stun_port);

      /* open socket binding */
      args.stun_sock = socket(AF_INET, SOCK_DGRAM, 0);
      if (args.stun_sock < 0) {
         ast_log(LOG_WARNING, "Unable to create STUN socket: %s\n", strerror(errno));
         goto monitor_request_cleanup;
      }
      if (ast_connect(args.stun_sock, &stun_addr)) {
         ast_log(LOG_WARNING, "STUN Failed to connect to %s: %s\n",
            ast_sockaddr_stringify(&stun_addr), strerror(errno));
         stun_close_sock();
         goto monitor_request_cleanup;
      }
   }

   res = ast_stun_request(args.stun_sock, NULL, NULL, &answer);
   if (res) {
      /*
       * STUN request timed out or errored.
       *
       * Refresh the server DNS address resolution next time around.
       */
      if (!args.stun_poll_failed_gripe) {
         args.stun_poll_failed_gripe = 1;
         ast_log(LOG_WARNING, "STUN poll %s. Re-evaluating STUN server address.\n",
            res < 0 ? "failed" : "got no response");
      }
      stun_close_sock();
   } else {
      args.stun_poll_failed_gripe = 0;
      if (memcmp(&no_addr, &answer, sizeof(no_addr))
         && memcmp(&args.external_addr, &answer, sizeof(args.external_addr))) {
         const char *newaddr = ast_strdupa(ast_inet_ntoa(answer.sin_addr));
         int newport = ntohs(answer.sin_port);

         ast_log(LOG_NOTICE, "Old external address/port %s:%d now seen as %s:%d.\n",
            ast_inet_ntoa(args.external_addr.sin_addr),
            ntohs(args.external_addr.sin_port), newaddr, newport);

         args.external_addr = answer;

         if (args.external_addr_known) {
            struct ast_event *event;

            /*
             * The external address was already known, and has changed...
             * generate event.
             */
            event = ast_event_new(AST_EVENT_NETWORK_CHANGE, AST_EVENT_IE_END);
            if (!event) {
               ast_log(LOG_ERROR, "Could not create AST_EVENT_NETWORK_CHANGE event.\n");
            } else if (ast_event_queue(event)) {
               ast_event_destroy(event);
               ast_log(LOG_ERROR, "Could not queue AST_EVENT_NETWORK_CHANGE event.\n");
            }
         } else {
            /* this was the first external address we found, do not alert listeners
             * until this address changes to something else. */
            args.external_addr_known = 1;
         }
      }
   }

monitor_request_cleanup:
   /* always refresh this scheduler item.  It will be removed elsewhere when
    * it is supposed to go away */
   res = args.refresh * 1000;
   ast_mutex_unlock(&args.lock);

   return res;
}
static int stun_start_monitor ( void  ) [static]

Definition at line 217 of file res_stun_monitor.c.

References args, ast_log(), ast_sched_add_variable(), ast_sched_context_create(), ast_sched_context_destroy(), ast_sched_start_thread(), LOG_ERROR, LOG_NOTICE, stun_close_sock(), and stun_monitor_request().

Referenced by __reload().

{
   /* if scheduler thread is not started, make sure to start it now */
   if (sched) {
      return 0; /* already started */
   }

   if (!(sched = ast_sched_context_create())) {
      ast_log(LOG_ERROR, "Failed to create stun monitor scheduler context\n");
      return -1;
   }

   if (ast_sched_start_thread(sched)) {
      ast_sched_context_destroy(sched);
      sched = NULL;
      stun_close_sock();
      return -1;
   }

   if (ast_sched_add_variable(sched, (args.refresh * 1000), stun_monitor_request, NULL, 1) < 0) {
      ast_log(LOG_ERROR, "Unable to schedule STUN network monitor \n");
      ast_sched_context_destroy(sched);
      sched = NULL;
      return -1;
   }

   ast_log(LOG_NOTICE, "STUN monitor started\n");

   return 0;
}
static void stun_stop_monitor ( void  ) [static]

Definition at line 193 of file res_stun_monitor.c.

References args, ast_free, ast_log(), ast_mutex_lock, ast_mutex_unlock, ast_sched_context_destroy(), LOG_NOTICE, and stun_close_sock().

Referenced by __reload(), and unload_module().

{
   ast_mutex_lock(&args.lock);
   args.monitor_enabled = 0;
   ast_free((char *) args.server_hostname);
   args.server_hostname = NULL;
   stun_close_sock();
   ast_mutex_unlock(&args.lock);

   if (sched) {
      ast_sched_context_destroy(sched);
      sched = NULL;
      ast_log(LOG_NOTICE, "STUN monitor stopped\n");
   }
}
static int unload_module ( void  ) [static]

Unregister CLI commands

Definition at line 435 of file res_stun_monitor.c.

References args, ARRAY_LEN, ast_cli_unregister_multiple(), ast_mutex_destroy, and stun_stop_monitor().

{
   stun_stop_monitor();
   ast_mutex_destroy(&args.lock);

   /*! Unregister CLI commands */
   ast_cli_unregister_multiple(cli_stun, ARRAY_LEN(cli_stun));

   return 0;
}

Variable Documentation

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER , .description = "STUN Network Monitor" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .reload = reload, .load_pri = AST_MODPRI_CHANNEL_DEPEND } [static]

Definition at line 466 of file res_stun_monitor.c.

struct { ... } args [static]

Referenced by __reload(), _stun_show_status(), acf_curl_helper(), acf_isexten_exec(), acf_jabberreceive_read(), acf_jabberstatus_read(), acf_meetme_info(), acf_odbc_read(), acf_odbc_write(), acf_rand_exec(), acf_strftime(), acf_strptime(), acf_transaction_read(), acf_transaction_write(), acf_version_exec(), acf_vmcount_exec(), add_agent(), add_cfg_entry(), add_rt_cfg_entry(), add_rt_multi_cfg_entry(), admin_exec(), adsi_process(), aelsub_exec(), aes_helper(), agi_exec_full(), aji_join_exec(), aji_leave_exec(), aji_send_exec(), aji_sendgroup_exec(), aji_status_exec(), answer_exec_enable(), app_exec(), aqm_exec(), ast_cc_agent_callback(), ast_cc_agent_status_response(), ast_cli_command_full(), ast_eivr_senddtmf(), ast_func_read(), ast_func_read2(), ast_func_write(), ast_queue_log(), asyncgoto_exec(), background_detect_exec(), bridge_exec(), build_profile(), builtin_automixmonitor(), builtin_automonitor(), calendar_query_exec(), calendar_query_result_exec(), callerid_read(), cc_agent_callback_helper(), cc_do_state_change(), cc_request_state_change(), cc_status_response(), cdr_read(), cdr_write(), celgenuserevent_exec(), chanavail_exec(), channel_admin_exec(), channel_set_debug(), chanspy_exec(), cli_odbc_read(), cli_odbc_write(), conf_exec(), confbridge_exec(), config_function_read(), controlplayback_exec(), count_exec(), cut_internal(), dahdi_accept_r2_call_exec(), dahdi_call(), dahdi_send_callrerouting_facility_exec(), dahdiras_exec(), determine_starting_point(), dial_exec_full(), dial_trunk(), dialgroup_write(), dictate_exec(), directory_exec(), disa_exec(), dundi_query_read(), dundi_result_read(), dundifunc_read(), enable_jack_hook(), enum_query_read(), enum_result_read(), exec_exec(), extenspy_exec(), festival_exec(), file_count_line(), file_read(), file_write(), filter(), find_call(), find_conf(), find_realtime_gw(), func_args(), func_confbridge_info(), func_header_read(), function_agent(), function_amiclient(), function_db_delete(), function_db_exists(), function_db_read(), function_db_write(), function_enum(), function_fieldnum_helper(), function_fieldqty_helper(), function_realtime_read(), function_realtime_readdestroy(), function_realtime_write(), function_txtcidname(), gosubif_exec(), handle_cli_presencestate_change(), hangupcause_read(), hint_read(), iconv_read(), import_helper(), isAnsweringMachine(), isexten_function_read(), jb_debug_output(), jb_error_output(), jb_framedata_init(), jb_warning_output(), jingle_request(), kqueue_timer_cmp(), listfilter(), load_config(), load_module(), log_exec(), login_exec(), man_do_variable_value(), manager_mixmonitor(), math(), misdn_call(), misdn_check_l2l1(), misdn_facility_exec(), misdn_request(), mixmonitor_exec(), msg_send_exec(), my_pri_make_cc_dialstring(), originate_exec(), ospauth_exec(), ospfinished_exec(), osplookup_exec(), ospnext_exec(), oss_call(), oss_request(), page_exec(), parkandannounce_exec(), pbx_builtin_answer(), pbx_builtin_background(), pbx_builtin_resetcdr(), pbx_builtin_setvar_multiple(), pbx_builtin_waitexten(), peek_read(), pickup_by_name_cb(), pickupchan_exec(), playback_exec(), pp_each_extension_helper(), pp_each_user_helper(), pqm_exec(), presence_read(), presence_write(), privacy_exec(), process_applicationmap_line(), pvalAppCallWalkArgs(), pvalMacroCallWalkArgs(), ql_exec(), queue_exec(), queue_function_mem_read(), queue_function_mem_write(), queue_function_memberpenalty_read(), queue_function_memberpenalty_write(), rcvfax_exec(), realtimefield_read(), receivefax_exec(), record_exec(), recordthread(), reg_source_db(), regex(), reload_single_member(), replace(), retrydial_exec(), rqm_exec(), run_station(), saycountedadj_exec(), saycountednoun_exec(), sayunixtime_exec(), senddtmf_exec(), sendfax_exec(), sendurl_exec(), setup_stunaddr(), shared_read(), shared_write(), shift_pop(), sig_pri_call(), sig_pri_extract_called_num_subaddr(), sip_acf_channel_read(), sip_request_call(), sip_tcptls_client_args_destructor(), sla_trunk_exec(), smdi_msg_read(), smdi_msg_retrieve_read(), sndfax_exec(), softhangup_exec(), spawn_ras(), speech_background(), speech_load(), srv_result_read(), stackpeek_read(), start_monitor_exec(), static_realtime_cb(), stop_mixmonitor_full(), strreplace(), stun_close_sock(), stun_monitor_request(), stun_start_monitor(), stun_stop_monitor(), timerfd_timer_cmp(), transfer_exec(), tryexec_exec(), unload_module(), unshift_push(), upqm_exec(), user_chan_cb(), userevent_exec(), verbose_exec(), vm_box_exists(), vm_exec(), vm_execmain(), vm_playmsgexec(), volume_write(), xmpp_join_exec(), xmpp_leave_exec(), xmpp_send_exec(), xmpp_sendgroup_exec(), xmpp_status_exec(), and zapateller_exec().

Definition at line 466 of file res_stun_monitor.c.

struct ast_cli_entry cli_stun[] [static]
Initial value:
 {
   AST_CLI_DEFINE(handle_cli_stun_show_status, "Show STUN servers and statuses"),
}

Definition at line 409 of file res_stun_monitor.c.

struct sockaddr_in external_addr

Current perceived external address.

Definition at line 57 of file res_stun_monitor.c.

unsigned int external_addr_known

TRUE if the perceived external address is valid/known.

Definition at line 69 of file res_stun_monitor.c.

STUN monitor protection lock.

Definition at line 55 of file res_stun_monitor.c.

unsigned int monitor_enabled

TRUE if the STUN monitor is enabled.

Definition at line 67 of file res_stun_monitor.c.

unsigned int refresh

Number of seconds between polls to the STUN server for the external address.

Definition at line 63 of file res_stun_monitor.c.

Referenced by iax2_ack_registry(), and update_registry().

struct ast_sched_context* sched [static]

Definition at line 51 of file res_stun_monitor.c.

const char* server_hostname

STUN server host name.

Definition at line 59 of file res_stun_monitor.c.

const char stun_conf_file[] = "res_stun_monitor.conf" [static]

Definition at line 50 of file res_stun_monitor.c.

unsigned int stun_poll_failed_gripe

TRUE if we have already griped about a STUN poll failing.

Definition at line 71 of file res_stun_monitor.c.

unsigned int stun_port

Port of STUN server to use

Definition at line 61 of file res_stun_monitor.c.

int stun_sock

Monitoring STUN socket.

Definition at line 65 of file res_stun_monitor.c.