[svn-commits] file: trunk r164809 - in /trunk: ./ channels/ configs/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Dec 16 14:42:33 CST 2008


Author: file
Date: Tue Dec 16 14:42:33 2008
New Revision: 164809

URL: http://svn.digium.com/view/asterisk?view=rev&rev=164809
Log:
Add configuration options for finer control over how Asterisk handles having to poke all peers at seemingly the same time.
(closes issue #13217)
Reported by: cervajs

Modified:
    trunk/CHANGES
    trunk/channels/chan_sip.c
    trunk/configs/sip.conf.sample

Modified: trunk/CHANGES
URL: http://svn.digium.com/view/asterisk/trunk/CHANGES?view=diff&rev=164809&r1=164808&r2=164809
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Tue Dec 16 14:42:33 2008
@@ -30,6 +30,9 @@
    after T38 is negotiated.  This option is disabled by default.
  * If ATTENDED_TRANSFER_COMPLETE_SOUND is set, the sound will be played to the
    target of an attended transfer
+ * Added two new configuration options, "pokegap" and "pokepeers", which allow
+   finer control over how many peers Asterisk will poke and the gap between them
+   when all peers need to be poked at the same time.
 
 Skinny Changes
 --------------

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=164809&r1=164808&r2=164809
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Tue Dec 16 14:42:33 2008
@@ -490,6 +490,12 @@
 static int max_expiry = DEFAULT_MAX_EXPIRY;        /*!< Maximum accepted registration time */
 static int default_expiry = DEFAULT_DEFAULT_EXPIRY;
 static int mwi_expiry = DEFAULT_MWI_EXPIRY;
+
+#define DEFAULT_POKE_GAP   100
+#define DEFAULT_POKE_PEERS 1
+
+static int global_poke_gap = DEFAULT_POKE_GAP;              /*!< Time between our group of peer pokes */
+static int global_poke_peers = DEFAULT_POKE_PEERS;          /*!< Number of peers to poke at a given time */
 
 #define CALLERID_UNKNOWN        "Unknown"
 
@@ -22544,6 +22550,10 @@
 	global_min_se  = DEFAULT_MIN_SE;
 	global_max_se  = DEFAULT_MAX_SE;
 
+	/* Peer poking settings */
+	global_poke_gap = DEFAULT_POKE_GAP;
+	global_poke_peers = DEFAULT_POKE_PEERS;
+
 	/* Initialize some reasonable defaults at SIP reload (used both for channel and as default for devices */
 	ast_copy_string(default_context, DEFAULT_CONTEXT, sizeof(default_context));
 	default_subscribecontext[0] = '\0';
@@ -23001,6 +23011,16 @@
 			} else {
 				global_st_refresher = i;
 			}
+		} else if (!strcasecmp(v->name, "pokegap")) {
+			if (sscanf(v->value, "%d", &global_poke_gap) != 1) {
+				ast_log(LOG_WARNING, "Invalid pokegap '%s' at line %d of %s\n", v->value, v->lineno, config);
+				global_poke_gap = DEFAULT_POKE_GAP;
+			}
+		} else if (!strcasecmp(v->name, "pokepeers")) {
+			if (sscanf(v->value, "%d", &global_poke_peers) != 1) {
+				ast_log(LOG_WARNING, "Invalid pokepeers '%s' at line %d of %s\n", v->value, v->lineno, config);
+				global_poke_peers = DEFAULT_POKE_PEERS;
+			}
 		}
 	}
 
@@ -23675,13 +23695,10 @@
 	return p->jointcapability ? p->jointcapability : p->capability;	
 }
 
-/*! \brief Send a poke to all known peers 
-	Space them out 100 ms apart
-	XXX We might have a cool algorithm for this or use random - any suggestions?
-*/
+/*! \brief Send a poke to all known peers */
 static void sip_poke_all_peers(void)
 {
-	int ms = 0;
+	int ms = 0, num = 0;
 	struct ao2_iterator i;
 	struct sip_peer *peer;
 
@@ -23692,7 +23709,12 @@
 
 	while ((peer = ao2_t_iterator_next(&i, "iterate thru peers table"))) {
 		ao2_lock(peer);
-		ms += 100;
+		if (num == global_poke_peers) {
+			ms += global_poke_gap;
+			num = 0;
+		} else {
+			num++;
+		}
 		AST_SCHED_REPLACE_UNREF(peer->pokeexpire, sched, ms, sip_poke_peer_s, peer,
 				unref_peer(_data, "removing poke peer ref"),
 				unref_peer(peer, "removing poke peer ref"),

Modified: trunk/configs/sip.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/sip.conf.sample?view=diff&rev=164809&r1=164808&r2=164809
==============================================================================
--- trunk/configs/sip.conf.sample (original)
+++ trunk/configs/sip.conf.sample Tue Dec 16 14:42:33 2008
@@ -148,6 +148,8 @@
                                 ; host to be up in seconds
                                 ; Set to low value if you use low timeout for
                                 ; NAT of UDP sessions
+;pokegap=100			; Number of milliseconds between each group of peers being poked
+;pokepeers=1			; Number of peers in a group to be poked at the same time
 ;notifymimetype=text/plain      ; Allow overriding of mime type in MWI NOTIFY
 ;buggymwi=no                    ; Cisco SIP firmware doesn't support the MWI RFC
                                 ; fully. Enable this option to not get error messages




More information about the svn-commits mailing list