[asterisk-commits] dvossel: branch dvossel/stun_monitor r281721 - in /team/dvossel/stun_monitor:...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Aug 11 10:11:09 CDT 2010


Author: dvossel
Date: Wed Aug 11 10:11:05 2010
New Revision: 281721

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=281721
Log:
sends out all outbound sip subscriptions on a network change

Modified:
    team/dvossel/stun_monitor/channels/chan_sip.c
    team/dvossel/stun_monitor/configs/sip.conf.sample

Modified: team/dvossel/stun_monitor/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/stun_monitor/channels/chan_sip.c?view=diff&rev=281721&r1=281720&r2=281721
==============================================================================
--- team/dvossel/stun_monitor/channels/chan_sip.c (original)
+++ team/dvossel/stun_monitor/channels/chan_sip.c Wed Aug 11 10:11:05 2010
@@ -13446,10 +13446,10 @@
 
 static void network_change_event_cb(const struct ast_event *event, void *userdata)
 {
-
-	//todohere
-	ast_log(LOG_NOTICE, "SIP, got a network change event\n");
-
+	if (option_debug) {
+		ast_log(LOG_DEBUG, "SIP, got a network change event, renewing all SIP registrations.\n");
+	}
+	sip_send_all_registers();
 }
 
 /*! \brief Callback for the devicestate notification (SUBSCRIBE) support subsystem
@@ -26873,6 +26873,14 @@
 				ast_log(LOG_WARNING, "'%s' is not a valid maxforwards value at line %d.  Using default.\n", v->value, v->lineno);
 				sip_cfg.default_max_forwards = DEFAULT_MAX_FORWARDS;
 			}
+		} else if (!strcasecmp(v->name, "subscribe_network_change_event")) {
+			if (ast_true(v->value)) {
+				network_change_event_subscribe();
+			} else if (ast_false(v->value)) {
+				network_change_event_unsubscribe();
+			} else {
+				ast_log(LOG_WARNING, "subscribe_network_change_event value %s is not valid at line %d.\n", v->value, v->lineno);
+			}
 		} else if (!strcasecmp(v->name, "snom_aoc_enabled")) {
 				ast_set2_flag(&global_flags[2], ast_true(v->value), SIP_PAGE3_SNOM_AOC);
 		}

Modified: team/dvossel/stun_monitor/configs/sip.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/stun_monitor/configs/sip.conf.sample?view=diff&rev=281721&r1=281720&r2=281721
==============================================================================
--- team/dvossel/stun_monitor/configs/sip.conf.sample (original)
+++ team/dvossel/stun_monitor/configs/sip.conf.sample Wed Aug 11 10:11:05 2010
@@ -783,6 +783,16 @@
 ; can not be set per-user or per-peer.
 ;
 ; media_address = 172.16.42.1
+;
+; Through the use of the res_stun_monitor module, Asterisk has the ability to detect when the
+; perceived external network address has changed.  This change generates an event which
+; chan_sip subscribes to.  Upon receiving this event chan_sip will renew all outbound
+; registrations. By default this option is enabled, but only takes affect once
+; res_stun_monitor is configured.  If res_stun_monitor is enabled and you wish to not
+; generate all outbound registrations on a network change use the option below to disable
+; this feature.
+;
+; subscribe_network_change_event = yes;
 
 ;----------------------------------- MEDIA HANDLING --------------------------------
 ; By default, Asterisk tries to re-invite media streams to an optimal path. If there's




More information about the asterisk-commits mailing list