[asterisk-commits] mmichelson: branch group/issue8824 r164880 - in /team/group/issue8824: ./ cha...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Dec 16 15:29:45 CST 2008


Author: mmichelson
Date: Tue Dec 16 15:29:44 2008
New Revision: 164880

URL: http://svn.digium.com/view/asterisk?view=rev&rev=164880
Log:
Reset automerge and resolve the conflict


Modified:
    team/group/issue8824/   (props changed)
    team/group/issue8824/CHANGES
    team/group/issue8824/channels/chan_sip.c
    team/group/issue8824/configs/sip.conf.sample
    team/group/issue8824/configure
    team/group/issue8824/configure.ac
    team/group/issue8824/contrib/scripts/safe_asterisk
    team/group/issue8824/include/asterisk/autoconfig.h.in
    team/group/issue8824/main/asterisk.c
    team/group/issue8824/main/manager.c
    team/group/issue8824/main/pbx.c

Propchange: team/group/issue8824/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/group/issue8824/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/group/issue8824/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Dec 16 15:29:44 2008
@@ -1,1 +1,1 @@
-/trunk:1-164745
+/trunk:1-164876

Modified: team/group/issue8824/CHANGES
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/CHANGES?view=diff&rev=164880&r1=164879&r2=164880
==============================================================================
--- team/group/issue8824/CHANGES (original)
+++ team/group/issue8824/CHANGES Tue Dec 16 15:29:44 2008
@@ -69,6 +69,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, "qualifygap" and "qualifypeers", which allow
+   finer control over how many peers Asterisk will qualify and the gap between them
+   when all peers need to be qualified at the same time.
 
 Skinny Changes
 --------------

Modified: team/group/issue8824/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/channels/chan_sip.c?view=diff&rev=164880&r1=164879&r2=164880
==============================================================================
--- team/group/issue8824/channels/chan_sip.c (original)
+++ team/group/issue8824/channels/chan_sip.c Tue Dec 16 15:29:44 2008
@@ -490,6 +490,14 @@
 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_QUALIFY_GAP   100
+#define DEFAULT_QUALIFY_PEERS 1
+
+static int global_qualify_gap = DEFAULT_QUALIFY_GAP;              /*!< Time between our group of peer pokes */
+static int global_qualify_peers = DEFAULT_QUALIFY_PEERS;          /*!< Number of peers to poke at a given time */
+
+#define CALLERID_UNKNOWN        "Unknown"
 
 #define DEFAULT_MAXMS                2000             /*!< Qualification: Must be faster than 2 seconds by default */
 #define DEFAULT_QUALIFYFREQ          60 * 1000        /*!< Qualification: How often to check for the host to be up */
@@ -23090,6 +23098,10 @@
 	global_min_se  = DEFAULT_MIN_SE;
 	global_max_se  = DEFAULT_MAX_SE;
 
+	/* Peer poking settings */
+	global_qualify_gap = DEFAULT_QUALIFY_GAP;
+	global_qualify_peers = DEFAULT_QUALIFY_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';
@@ -23547,6 +23559,16 @@
 			} else {
 				global_st_refresher = i;
 			}
+		} else if (!strcasecmp(v->name, "qualifygap")) {
+			if (sscanf(v->value, "%d", &global_qualify_gap) != 1) {
+				ast_log(LOG_WARNING, "Invalid qualifygap '%s' at line %d of %s\n", v->value, v->lineno, config);
+				global_qualify_gap = DEFAULT_QUALIFY_GAP;
+			}
+		} else if (!strcasecmp(v->name, "qualifypeers")) {
+			if (sscanf(v->value, "%d", &global_qualify_peers) != 1) {
+				ast_log(LOG_WARNING, "Invalid pokepeers '%s' at line %d of %s\n", v->value, v->lineno, config);
+				global_qualify_peers = DEFAULT_QUALIFY_PEERS;
+			}
 		}
 	}
 
@@ -24221,13 +24243,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;
 
@@ -24238,7 +24257,12 @@
 
 	while ((peer = ao2_t_iterator_next(&i, "iterate thru peers table"))) {
 		ao2_lock(peer);
-		ms += 100;
+		if (num == global_qualify_peers) {
+			ms += global_qualify_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: team/group/issue8824/configs/sip.conf.sample
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/configs/sip.conf.sample?view=diff&rev=164880&r1=164879&r2=164880
==============================================================================
--- team/group/issue8824/configs/sip.conf.sample (original)
+++ team/group/issue8824/configs/sip.conf.sample Tue Dec 16 15:29:44 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
+;qualifygap=100			; Number of milliseconds between each group of peers being qualified
+;qualifypeers=1			; Number of peers in a group to be qualified 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

Modified: team/group/issue8824/configure.ac
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/configure.ac?view=diff&rev=164880&r1=164879&r2=164880
==============================================================================
--- team/group/issue8824/configure.ac (original)
+++ team/group/issue8824/configure.ac Tue Dec 16 15:29:44 2008
@@ -337,7 +337,7 @@
 AC_FUNC_STRTOD
 AC_FUNC_UTIME_NULL
 AC_FUNC_VPRINTF
-AC_CHECK_FUNCS([asprintf atexit dup2 endpwent ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday ioperm inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtol strtoq unsetenv utime vasprintf getpeereid])
+AC_CHECK_FUNCS([asprintf atexit dup2 endpwent ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday ioperm inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtol strtoq unsetenv utime vasprintf getpeereid sysctl swapctl])
 
 AC_CHECK_FUNCS([glob])
 

Modified: team/group/issue8824/contrib/scripts/safe_asterisk
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/contrib/scripts/safe_asterisk?view=diff&rev=164880&r1=164879&r2=164880
==============================================================================
--- team/group/issue8824/contrib/scripts/safe_asterisk (original)
+++ team/group/issue8824/contrib/scripts/safe_asterisk Tue Dec 16 15:29:44 2008
@@ -23,6 +23,10 @@
 
 # set system filemax on supported OSes if this variable is set
 # SYSMAXFILES=262144
+
+# Asterisk allows full permissions by default, so set a umask, if you want
+# restricted permissions.
+#UMASK=022
 
 # set max files open with ulimit. On linux systems, this will be automatically
 # set to the system's maximum files open devided by two, if not set here.
@@ -89,6 +93,10 @@
 
 fi
 
+if test "x$UMASK" != "x"; then
+	umask $UMASK
+fi
+
 #
 # Let Asterisk dump core
 #

Modified: team/group/issue8824/include/asterisk/autoconfig.h.in
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/include/asterisk/autoconfig.h.in?view=diff&rev=164880&r1=164879&r2=164880
==============================================================================
--- team/group/issue8824/include/asterisk/autoconfig.h.in (original)
+++ team/group/issue8824/include/asterisk/autoconfig.h.in Tue Dec 16 15:29:44 2008
@@ -933,6 +933,12 @@
 
 /* Define to indicate the ${SUPPSERV_DESCRIP} library version */
 #undef HAVE_SUPPSERV_VERSION
+
+/* Define to 1 if you have the `swapctl' function. */
+#undef HAVE_SWAPCTL
+
+/* Define to 1 if you have the `sysctl' function. */
+#undef HAVE_SYSCTL
 
 /* Define to 1 if your system has sysinfo support */
 #undef HAVE_SYSINFO

Modified: team/group/issue8824/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/main/asterisk.c?view=diff&rev=164880&r1=164879&r2=164880
==============================================================================
--- team/group/issue8824/main/asterisk.c (original)
+++ team/group/issue8824/main/asterisk.c Tue Dec 16 15:29:44 2008
@@ -78,6 +78,10 @@
 #include <sys/stat.h>
 #if defined(HAVE_SYSINFO)
 #include <sys/sysinfo.h>
+#elif defined(HAVE_SYSCTL)
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/swap.h>
 #endif
 #include <regex.h>
 
@@ -497,11 +501,114 @@
 	return CLI_SUCCESS;
 }
 
-#if defined(HAVE_SYSINFO)
+#if defined (HAVE_SYSCTL) && defined(HAVE_SWAPCTL)
+/*
+ * swapmode is rewritten by Tobias Weingartner <weingart at openbsd.org>
+ * to be based on the new swapctl(2) system call.
+ */
+static int swapmode(int *used, int *total)
+{
+	struct swapent *swdev;
+	int nswap, rnswap, i;
+
+	nswap = swapctl(SWAP_NSWAP, 0, 0);
+	if (nswap == 0)
+		return 0;
+
+	swdev = ast_calloc(nswap, sizeof(*swdev));
+	if (swdev == NULL)
+		return 0;
+
+	rnswap = swapctl(SWAP_STATS, swdev, nswap);
+	if (rnswap == -1) {
+		ast_free(swdev);
+		return 0;
+	}
+
+	/* if rnswap != nswap, then what? */
+
+	/* Total things up */
+	*total = *used = 0;
+	for (i = 0; i < nswap; i++) {
+		if (swdev[i].se_flags & SWF_ENABLE) {
+			*used += (swdev[i].se_inuse / (1024 / DEV_BSIZE));
+			*total += (swdev[i].se_nblks / (1024 / DEV_BSIZE));
+		}
+	}
+	ast_free(swdev);
+	return 1;
+}
+#elif defined(HAVE_SYSCTL) && !defined(HAVE_SYSINFO)
+static int swapmode(int *used, int *total)
+{
+	used = total = 0;
+	return 1;
+}
+#endif
+
 /*! \brief Give an overview of system statistics */
 static char *handle_show_sysinfo(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
+	int64_t physmem, freeram;
+	int totalswap, freeswap, nprocs;
+	long uptime = 0;
+#if defined(HAVE_SYSINFO)
 	struct sysinfo sys_info;
+	sysinfo(&sys_info);
+	uptime = sys_info.uptime/3600;
+	physmem = sys_info.totalram * sys_info.mem_unit;
+	freeram = (sys_info.freeram * sys_info.mem_unit) / 1024;
+	totalswap = (sys_info.totalswap * sys_info.mem_unit) / 1024;
+	freeswap = (sys_info.freeswap * sys_info.mem_unit) / 1024;
+	nprocs = sys_info.procs;
+#elif defined(HAVE_SYSCTL)
+	static int pageshift;
+	struct vmtotal vmtotal;
+	struct timeval	boottime;
+	time_t	now;
+	int mib[2], pagesize, usedswap;
+	size_t len;
+	/* calculate the uptime by looking at boottime */
+	time(&now);
+	mib[0] = CTL_KERN;
+	mib[1] = KERN_BOOTTIME;
+	len = sizeof(boottime);
+	if (sysctl(mib, 2, &boottime, &len, NULL, 0) != -1) {
+		uptime = now - boottime.tv_sec;
+	}
+	uptime = uptime/3600;
+	/* grab total physical memory  */
+	mib[0] = CTL_HW;
+	mib[1] = HW_PHYSMEM64;
+	len = sizeof(physmem);
+	sysctl(mib, 2, &physmem, &len, NULL, 0);
+
+	pagesize = getpagesize();
+	pageshift = 0;
+	while (pagesize > 1) {
+		pageshift++;
+		pagesize >>= 1;
+	}
+
+	/* we only need the amount of log(2)1024 for our conversion */
+	pageshift -= 10;
+
+	/* grab vm totals */
+	mib[0] = CTL_VM;
+	mib[1] = VM_METER;
+	len = sizeof(vmtotal);
+	sysctl(mib, 2, &vmtotal, &len, NULL, 0);
+	freeram = (vmtotal.t_free << pageshift);
+	/* generate swap usage and totals */
+	swapmode(&usedswap, &totalswap); 
+	freeswap = (totalswap - usedswap);
+	/* grab number of processes */
+	mib[0] = CTL_KERN;
+	mib[1] = KERN_NPROCS;
+	len = sizeof(nprocs);
+	sysctl(mib, 2, &nprocs, &len, NULL, 0);
+#endif
+
 	switch (cmd) {
 	case CLI_INIT:
 		e->command = "core show sysinfo";
@@ -512,22 +619,20 @@
 	case CLI_GENERATE:
 		return NULL;
 	}
-	if (sysinfo(&sys_info)) {
-		ast_cli(a->fd, "FAILED to retrieve system information\n\n");
-		return CLI_FAILURE;
-	}
+
 	ast_cli(a->fd, "\nSystem Statistics\n");
 	ast_cli(a->fd, "-----------------\n");
-	ast_cli(a->fd, "  System Uptime:             %ld hours\n", sys_info.uptime/3600);
-	ast_cli(a->fd, "  Total RAM:                 %ld KiB\n", (sys_info.totalram * sys_info.mem_unit)/1024);
-	ast_cli(a->fd, "  Free RAM:                  %ld KiB\n", (sys_info.freeram * sys_info.mem_unit)/1024);
+	ast_cli(a->fd, "  System Uptime:             %ld hours\n", uptime);
+	ast_cli(a->fd, "  Total RAM:                 %ld KiB\n", (long)physmem/1024);
+	ast_cli(a->fd, "  Free RAM:                  %ld KiB\n", (long)freeram);
+#if defined(HAVE_SYSINFO)
 	ast_cli(a->fd, "  Buffer RAM:                %ld KiB\n", (sys_info.bufferram * sys_info.mem_unit)/1024);
-	ast_cli(a->fd, "  Total Swap Space:          %ld KiB\n", (sys_info.totalswap * sys_info.mem_unit)/1024);
-	ast_cli(a->fd, "  Free Swap Space:           %ld KiB\n\n", (sys_info.freeswap * sys_info.mem_unit)/1024);
-	ast_cli(a->fd, "  Number of Processes:       %d \n\n", sys_info.procs);
+#endif
+	ast_cli(a->fd, "  Total Swap Space:          %ld KiB\n", (long)totalswap);
+	ast_cli(a->fd, "  Free Swap Space:           %ld KiB\n\n", (long)freeswap);
+	ast_cli(a->fd, "  Number of Processes:       %d \n\n", nprocs);
 	return CLI_SUCCESS;
 }
-#endif
 
 struct profile_entry {
 	const char *name;
@@ -1913,7 +2018,7 @@
 #if !defined(LOW_MEMORY)
 	AST_CLI_DEFINE(handle_show_version_files, "List versions of files used to build Asterisk"),
 	AST_CLI_DEFINE(handle_show_threads, "Show running threads"),
-#if defined(HAVE_SYSINFO)
+#if defined(HAVE_SYSINFO) || defined(HAVE_SYSCTL)
 	AST_CLI_DEFINE(handle_show_sysinfo, "Show System Information"),
 #endif
 	AST_CLI_DEFINE(handle_show_profile, "Display profiling info"),

Modified: team/group/issue8824/main/manager.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/main/manager.c?view=diff&rev=164880&r1=164879&r2=164880
==============================================================================
--- team/group/issue8824/main/manager.c (original)
+++ team/group/issue8824/main/manager.c Tue Dec 16 15:29:44 2008
@@ -146,6 +146,7 @@
 } command_blacklist[] = {
 	{{ "module", "load", NULL }},
 	{{ "module", "unload", NULL }},
+	{{ "restart", "gracefully", NULL }},
 };
 
 struct mansession {

Modified: team/group/issue8824/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/main/pbx.c?view=diff&rev=164880&r1=164879&r2=164880
==============================================================================
--- team/group/issue8824/main/pbx.c (original)
+++ team/group/issue8824/main/pbx.c Tue Dec 16 15:29:44 2008
@@ -2017,8 +2017,6 @@
  * Special characters used in patterns:
  *	'_'	underscore is the leading character of a pattern.
  *		In other position it is treated as a regular char.
- *	' ' '-'	space and '-' are separator and ignored. Why? so
- *	        patterns like NXX-XXX-XXXX or NXX XXX XXXX will work.
  *	.	one or more of any character. Only allowed at the end of
  *		a pattern.
  *	!	zero or more of anything. Also impacts the result of CANMATCH
@@ -2041,8 +2039,7 @@
  *		considered specially.
  *
  * When we compare a pattern with a specific extension, all characters in the extension
- * itself are considered literally with the only exception of '-' which is considered
- * as a separator and thus ignored.
+ * itself are considered literally.
  * XXX do we want to consider space as a separator as well ?
  * XXX do we want to consider the separators in non-patterns as well ?
  */
@@ -2079,8 +2076,7 @@
 	/* load, sign extend and advance pointer until we find
 	 * a valid character.
 	 */
-	while ( (c = *(*p)++) && (c == ' ' || c == '-') )
-		;	/* ignore some characters */
+	c = *(*p)++;
 
 	/* always return unless we have a set of chars */
 	switch (toupper(c)) {




More information about the asterisk-commits mailing list