[asterisk-commits] mmichelson: branch mmichelson/threadpool r377980 - in /team/mmichelson/thread...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Dec 13 10:39:43 CST 2012


Author: mmichelson
Date: Thu Dec 13 10:39:40 2012
New Revision: 377980

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=377980
Log:
Resolve conflict and reset automerge.


Modified:
    team/mmichelson/threadpool/   (props changed)
    team/mmichelson/threadpool/channels/chan_sip.c
    team/mmichelson/threadpool/channels/sip/include/sip.h
    team/mmichelson/threadpool/configs/sip.conf.sample
    team/mmichelson/threadpool/configure
    team/mmichelson/threadpool/configure.ac
    team/mmichelson/threadpool/include/asterisk/autoconfig.h.in
    team/mmichelson/threadpool/main/taskprocessor.c
    team/mmichelson/threadpool/main/utils.c
    team/mmichelson/threadpool/res/res_calendar_exchange.c
    team/mmichelson/threadpool/res/res_clialiases.c

Propchange: team/mmichelson/threadpool/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/mmichelson/threadpool/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Dec 13 10:39:40 2012
@@ -1,1 +1,1 @@
-/trunk:1-377967
+/trunk:1-377979

Modified: team/mmichelson/threadpool/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/threadpool/channels/chan_sip.c?view=diff&rev=377980&r1=377979&r2=377980
==============================================================================
--- team/mmichelson/threadpool/channels/chan_sip.c (original)
+++ team/mmichelson/threadpool/channels/chan_sip.c Thu Dec 13 10:39:40 2012
@@ -13167,10 +13167,11 @@
 		   - Then other codecs in capabilities, including video
 		*/
 
-		/* Prefer the audio codec we were requested to use, first, no matter what
-		   Note that p->prefcodec can include video codecs, so mask them out
-		*/
-		if (ast_format_cap_has_joint(tmpcap, p->prefcaps)) {
+
+		/* Unless otherwise configured, the prefcaps is added before the peer's
+		 * configured codecs.
+		 */
+		if (!ast_test_flag(&p->flags[2], SIP_PAGE3_IGNORE_PREFCAPS) && ast_format_cap_has_joint(tmpcap, p->prefcaps)) {
 			ast_format_cap_iter_start(p->prefcaps);
 			while (!(ast_format_cap_iter_next(p->prefcaps, &tmp_fmt))) {
 				if (AST_FORMAT_GET_TYPE(tmp_fmt.id) != AST_FORMAT_TYPE_AUDIO) {
@@ -30766,6 +30767,8 @@
 				ast_set2_flag(&peer->flags[2], ast_true(v->value), SIP_PAGE3_USE_AVPF);
 			} else if (!strcasecmp(v->name, "icesupport")) {
 				ast_set2_flag(&peer->flags[2], ast_true(v->value), SIP_PAGE3_ICE_SUPPORT);
+			} else if (!strcasecmp(v->name, "ignore_requested_pref")) {
+				ast_set2_flag(&peer->flags[2], ast_true(v->value), SIP_PAGE3_IGNORE_PREFCAPS);
 			} else {
 				ast_rtp_dtls_cfg_parse(&peer->dtls_cfg, v->name, v->value);
 			}

Modified: team/mmichelson/threadpool/channels/sip/include/sip.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/threadpool/channels/sip/include/sip.h?view=diff&rev=377980&r1=377979&r2=377980
==============================================================================
--- team/mmichelson/threadpool/channels/sip/include/sip.h (original)
+++ team/mmichelson/threadpool/channels/sip/include/sip.h Thu Dec 13 10:39:40 2012
@@ -373,10 +373,11 @@
 #define SIP_PAGE3_DIRECT_MEDIA_OUTGOING  (1 << 4)  /*!< DP: Only send direct media reinvites on outgoing calls */
 #define SIP_PAGE3_USE_AVPF               (1 << 5)  /*!< DGP: Support a minimal AVPF-compatible profile */
 #define SIP_PAGE3_ICE_SUPPORT            (1 << 6)  /*!< DGP: Enable ICE support */
+#define SIP_PAGE3_IGNORE_PREFCAPS        (1 << 7)  /*!< DP: Ignore prefcaps when setting up an outgoing call leg */
 
 #define SIP_PAGE3_FLAGS_TO_COPY \
 	(SIP_PAGE3_SNOM_AOC | SIP_PAGE3_SRTP_TAG_32 | SIP_PAGE3_NAT_AUTO_RPORT | SIP_PAGE3_NAT_AUTO_COMEDIA | \
-	 SIP_PAGE3_DIRECT_MEDIA_OUTGOING | SIP_PAGE3_USE_AVPF | SIP_PAGE3_ICE_SUPPORT)
+	 SIP_PAGE3_DIRECT_MEDIA_OUTGOING | SIP_PAGE3_USE_AVPF | SIP_PAGE3_ICE_SUPPORT | SIP_PAGE3_IGNORE_PREFCAPS )
 
 #define CHECK_AUTH_BUF_INITLEN   256
 

Modified: team/mmichelson/threadpool/configs/sip.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/threadpool/configs/sip.conf.sample?view=diff&rev=377980&r1=377979&r2=377980
==============================================================================
--- team/mmichelson/threadpool/configs/sip.conf.sample (original)
+++ team/mmichelson/threadpool/configs/sip.conf.sample Thu Dec 13 10:39:40 2012
@@ -1259,6 +1259,8 @@
 ; dtlscafile
 ; dtlscapath
 ; dtlssetup
+; ignore_requested_pref ; Ignore the requested codec and determine the preferred codec
+;						; from the peer's configuration.
 ;
 
 ;------------------------------------------------------------------------------

Modified: team/mmichelson/threadpool/configure.ac
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/threadpool/configure.ac?view=diff&rev=377980&r1=377979&r2=377980
==============================================================================
--- team/mmichelson/threadpool/configure.ac (original)
+++ team/mmichelson/threadpool/configure.ac Thu Dec 13 10:39:40 2012
@@ -494,7 +494,7 @@
 AST_EXT_LIB_CHECK([TINFO], [tinfo], [tgetent], [])
 AST_EXT_LIB_CHECK([CURSES], [curses], [initscr], [curses.h])
 AST_EXT_LIB_CHECK([NCURSES], [ncurses], [initscr], [curses.h])
-AST_EXT_LIB_CHECK([UUID], [uuid], [uuid_generate_random], [uuid.h], [-luuid])
+AST_EXT_LIB_CHECK([UUID], [uuid], [uuid_generate_random], [uuid/uuid.h], [-luuid])
 
 EDITLINE_LIB=""
 if test "x$TERMCAP_LIB" != "x" ; then
@@ -718,11 +718,6 @@
 AC_DEFINE([HAVE_SYS_ENDIAN_BSWAP16], 1, [Define to 1 if your sys/endian.h header file provides the bswap16 macro.]),
 AC_MSG_RESULT(no)
 )
-
-if test "${cross_compiling}" = "no";
-then
-  AC_CHECK_FILE(/dev/urandom, AC_DEFINE([HAVE_DEV_URANDOM], 1, [Define to 1 if your system has /dev/urandom.]))
-fi
 
 AC_MSG_CHECKING(for locale_t in locale.h)
 AC_LINK_IFELSE(

Modified: team/mmichelson/threadpool/include/asterisk/autoconfig.h.in
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/threadpool/include/asterisk/autoconfig.h.in?view=diff&rev=377980&r1=377979&r2=377980
==============================================================================
--- team/mmichelson/threadpool/include/asterisk/autoconfig.h.in (original)
+++ team/mmichelson/threadpool/include/asterisk/autoconfig.h.in Thu Dec 13 10:39:40 2012
@@ -172,9 +172,6 @@
 
 /* Define DAHDI headers version */
 #undef HAVE_DAHDI_VERSION
-
-/* Define to 1 if your system has /dev/urandom. */
-#undef HAVE_DEV_URANDOM
 
 /* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
    */

Modified: team/mmichelson/threadpool/main/taskprocessor.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/threadpool/main/taskprocessor.c?view=diff&rev=377980&r1=377979&r2=377980
==============================================================================
--- team/mmichelson/threadpool/main/taskprocessor.c (original)
+++ team/mmichelson/threadpool/main/taskprocessor.c Thu Dec 13 10:39:40 2012
@@ -224,10 +224,15 @@
 	.destroy = default_listener_destroy,
 };
 
-/*! \internal \brief Clean up resources on Asterisk shutdown */
+/*!
+ * \internal
+ * \brief Clean up resources on Asterisk shutdown
+ */
 static void tps_shutdown(void)
 {
+	ast_cli_unregister_multiple(taskprocessor_clis, ARRAY_LEN(taskprocessor_clis));
 	ao2_t_ref(tps_singletons, -1, "Unref tps_singletons in shutdown");
+	tps_singletons = NULL;
 }
 
 /* initialize the taskprocessor container and register CLI operations */

Modified: team/mmichelson/threadpool/main/utils.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/threadpool/main/utils.c?view=diff&rev=377980&r1=377979&r2=377980
==============================================================================
--- team/mmichelson/threadpool/main/utils.c (original)
+++ team/mmichelson/threadpool/main/utils.c Thu Dec 13 10:39:40 2012
@@ -35,9 +35,7 @@
 #include <sys/stat.h>
 #include <sys/stat.h>
 
-#ifdef HAVE_DEV_URANDOM
 #include <fcntl.h>
-#endif
 
 #include <sys/syscall.h>
 #if defined(__APPLE__)
@@ -496,9 +494,7 @@
 	return inet_ntop(AF_INET, &ia, buf, INET_ADDRSTRLEN);
 }
 
-#ifdef HAVE_DEV_URANDOM
 static int dev_urandom_fd;
-#endif
 
 #ifndef __linux__
 #undef pthread_create /* For ast_pthread_create function only */
@@ -1494,7 +1490,7 @@
 long int ast_random(void)
 {
 	long int res;
-#ifdef HAVE_DEV_URANDOM
+
 	if (dev_urandom_fd >= 0) {
 		int read_res = read(dev_urandom_fd, &res, sizeof(res));
 		if (read_res > 0) {
@@ -1504,7 +1500,7 @@
 			return res % rm;
 		}
 	}
-#endif
+
 	/* XXX - Thread safety really depends on the libc, not the OS.
 	 *
 	 * But... popular Linux libc's (uClibc, glibc, eglibc), all have a
@@ -2035,9 +2031,7 @@
 
 int ast_utils_init(void)
 {
-#ifdef HAVE_DEV_URANDOM
 	dev_urandom_fd = open("/dev/urandom", O_RDONLY);
-#endif
 	base64_init();
 #ifdef DEBUG_THREADS
 #if !defined(LOW_MEMORY)

Modified: team/mmichelson/threadpool/res/res_calendar_exchange.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/threadpool/res/res_calendar_exchange.c?view=diff&rev=377980&r1=377979&r2=377980
==============================================================================
--- team/mmichelson/threadpool/res/res_calendar_exchange.c (original)
+++ team/mmichelson/threadpool/res/res_calendar_exchange.c Thu Dec 13 10:39:40 2012
@@ -44,6 +44,7 @@
 #include "asterisk/lock.h"
 #include "asterisk/config.h"
 #include "asterisk/astobj2.h"
+#include "asterisk/uuid.h"
 
 static void *exchangecal_load_calendar(void *data);
 static void *unref_exchangecal(void *obj);
@@ -241,36 +242,30 @@
 /* It is very important to use the return value of this function as a realloc could occur */
 static struct ast_str *generate_exchange_uuid(struct ast_str *uid)
 {
-	unsigned short val[8];
-	int x;
-
-	for (x = 0; x < 8; x++) {
-		val[x] = ast_random();
-	}
-	ast_str_set(&uid, 0, "%04x%04x-%04x-%04x-%04x-%04x%04x%04x", val[0], val[1], val[2], val[3], val[4], val[5], val[6], val[7]);
+	char buffer[AST_UUID_STR_LEN];
+	struct ast_uuid *uuid = ast_uuid_generate();
+
+	if (!uuid) {
+		return NULL;
+	}
+
+	ast_str_set(&uid, 0, "%s", ast_uuid_to_str(uuid, buffer, AST_UUID_STR_LEN));
+
+	ast_free(uuid);
 
 	return uid;
 }
 
 static int is_valid_uuid(struct ast_str *uid)
 {
-	int i;
-
-	if (ast_str_strlen(uid) != 36) {
-		return 0;
-	}
-
-	for (i = 0; i < ast_str_strlen(uid); i++) {
-		if (i == 8 || i == 13 || i == 18 || i == 23) {
-			if (ast_str_buffer(uid)[i] != '-') {
-				return 0;
-			}
-		} else if (!((ast_str_buffer(uid)[i] > 47 && ast_str_buffer(uid)[i] < 58) || (ast_str_buffer(uid)[i] > 96 && ast_str_buffer(uid)[i] < 103))) {
-			return 0;
-		}
-	}
-
-	return 1;
+	struct ast_uuid *uuid = ast_str_to_uuid(ast_str_buffer(uid));
+
+	if (uuid) {
+		ast_free(uuid);
+		return 1;
+	}
+
+	return 0;
 }
 
 static struct ast_str *xml_encode_str(struct ast_str *dst, const char *src)

Modified: team/mmichelson/threadpool/res/res_clialiases.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/threadpool/res/res_clialiases.c?view=diff&rev=377980&r1=377979&r2=377980
==============================================================================
--- team/mmichelson/threadpool/res/res_clialiases.c (original)
+++ team/mmichelson/threadpool/res/res_clialiases.c Thu Dec 13 10:39:40 2012
@@ -218,7 +218,10 @@
 			alias->cli_entry.command = alias->alias;
 			alias->cli_entry.usage = "Aliased CLI Command\n";
 
-			ast_cli_register(&alias->cli_entry);
+			if (ast_cli_register(&alias->cli_entry)) {
+				ao2_ref(alias, -1);
+				continue;
+			}
 			ao2_link(cli_aliases, alias);
 			ast_verb(2, "Aliased CLI command '%s' to '%s'\n", v1->name, v1->value);
 			ao2_ref(alias, -1);




More information about the asterisk-commits mailing list