\note Generally called by the core_init
*/
SWITCH_DECLARE(void) switch_nat_init(switch_memory_pool_t *pool);
+
+/*!
+ \brief Initilize the rest of the NAT Traversal System
+ \note nat_init is called prior to some other modules being loaded.
+ This method allows us to init the rest of the NAT system.
+*/
+SWITCH_DECLARE(void) switch_nat_late_init(void);
+
/*!
\brief Shuts down the NAT Traversal System
*/
#define MULTICAST_BUFFSIZE 65536
#define IP_LEN 16
+#define NAT_REFRESH_INTERVAL 900
typedef struct {
switch_nat_type_t nat_type;
switch_xml_free(natxml);
}
+SWITCH_STANDARD_SCHED_FUNC(switch_nat_republish_sched)
+{
+ switch_nat_republish();
+ if (nat_globals_perm.running == 1) {
+ task->runtime = switch_epoch_time_now(NULL) + NAT_REFRESH_INTERVAL;
+ }
+}
+
+SWITCH_DECLARE(void) switch_nat_late_init(void)
+{
+ if (nat_globals_perm.running == 1) {
+ switch_scheduler_add_task(switch_epoch_time_now(NULL) + NAT_REFRESH_INTERVAL, switch_nat_republish_sched, "nat_republish", "core", 0, NULL,
+ SSHF_NONE);
+ }
+}
+
SWITCH_DECLARE(char *) switch_nat_status(void)
{
switch_stream_handle_t stream = { 0 };