[asterisk-commits] mmichelson: branch group/CCSS r247033 - in /team/group/CCSS: ./ apps/ channel...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Feb 16 16:37:13 CST 2010


Author: mmichelson
Date: Tue Feb 16 16:37:05 2010
New Revision: 247033

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


Added:
    team/group/CCSS/tests/test_pbx.c
      - copied unchanged from r246985, trunk/tests/test_pbx.c
Modified:
    team/group/CCSS/   (props changed)
    team/group/CCSS/apps/app_voicemail.c
    team/group/CCSS/channels/chan_sip.c
    team/group/CCSS/channels/chan_usbradio.c
    team/group/CCSS/include/asterisk/strings.h
    team/group/CCSS/main/channel.c
    team/group/CCSS/main/strings.c
    team/group/CCSS/main/tcptls.c

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

Propchange: team/group/CCSS/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Feb 16 16:37:05 2010
@@ -1,1 +1,1 @@
-/trunk:1-246717
+/trunk:1-247032

Modified: team/group/CCSS/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/apps/app_voicemail.c?view=diff&rev=247033&r1=247032&r2=247033
==============================================================================
--- team/group/CCSS/apps/app_voicemail.c (original)
+++ team/group/CCSS/apps/app_voicemail.c Tue Feb 16 16:37:05 2010
@@ -42,7 +42,7 @@
  ***/
 
 /*** MAKEOPTS
-<category name="MENUSELECT_OPTS_app_voicemail" displayname="Voicemail Build Options" positive_output="yes" remove_on_change="apps/app_voicemail.o apps/app_voicemail.so apps/app_directory.o apps/app_directory.so">
+<category name="MENUSELECT_OPTS_app_voicemail" displayname="Voicemail Build Options" positive_output="yes" touch_on_change="apps/app_voicemail.c apps/app_directory.c">
 	<member name="FILE_STORAGE" displayname="Storage of Voicemail using filesystem">
 		<conflict>ODBC_STORAGE</conflict>
 		<conflict>IMAP_STORAGE</conflict>

Modified: team/group/CCSS/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/channels/chan_sip.c?view=diff&rev=247033&r1=247032&r2=247033
==============================================================================
--- team/group/CCSS/channels/chan_sip.c (original)
+++ team/group/CCSS/channels/chan_sip.c Tue Feb 16 16:37:05 2010
@@ -3924,6 +3924,8 @@
 	if (ms < 0) {
 		if (p->timer_t1 == 0) {
 			p->timer_t1 = global_t1;	/* Set timer T1 if not set (RFC 3261) */
+		}
+		if (p->timer_b == 0) {
 			p->timer_b = global_timer_b;  /* Set timer B if not set (RFC 3261) */
 		}
 		ms = p->timer_t1 * 64;
@@ -25031,6 +25033,7 @@
 	int firstpass = 1;
 	uint16_t port = 0;
 	int format = 0;		/* Ama flags */
+	int timerb_set = 0, timert1_set = 0;
 	time_t regseconds = 0;
 	struct ast_flags peerflags[2] = {{(0)}};
 	struct ast_flags mask[2] = {{(0)}};
@@ -25328,26 +25331,17 @@
 					peer->rtpkeepalive = global_rtpkeepalive;
 				}
 			} else if (!strcasecmp(v->name, "timert1")) {
-				if ((sscanf(v->value, "%30d", &peer->timer_t1) != 1) || (peer->timer_t1 < 0)) {
+				if ((sscanf(v->value, "%30d", &peer->timer_t1) != 1) || (peer->timer_t1 < 200) || (peer->timer_t1 < global_t1min)) {
 					ast_log(LOG_WARNING, "'%s' is not a valid T1 time at line %d.  Using default.\n", v->value, v->lineno);
-					peer->timer_t1 = global_t1;
+					peer->timer_t1 = global_t1min;
 				}
-				/* Note that Timer B is dependent upon T1 and MUST NOT be lower
-				 * than T1 * 64, according to RFC 3261, Section 17.1.1.2 */
-				if (peer->timer_b < peer->timer_t1 * 64) {
-					peer->timer_b = peer->timer_t1 * 64;
-				}
+				timert1_set = 1;
 			} else if (!strcasecmp(v->name, "timerb")) {
-				if ((sscanf(v->value, "%30d", &peer->timer_b) != 1) || (peer->timer_b < 0)) {
+				if ((sscanf(v->value, "%30d", &peer->timer_b) != 1) || (peer->timer_b < 200)) {
 					ast_log(LOG_WARNING, "'%s' is not a valid Timer B time at line %d.  Using default.\n", v->value, v->lineno);
 					peer->timer_b = global_timer_b;
 				}
-				if (peer->timer_b < peer->timer_t1 * 64) {
-					static int warning = 0;
-					if (warning++ % 20 == 0) {
-						ast_log(LOG_WARNING, "Timer B has been set lower than recommended. (RFC 3261, 17.1.1.2)\n");
-					}
-				}
+				timerb_set = 1;
 			} else if (!strcasecmp(v->name, "setvar")) {
 				peer->chanvars = add_var(v->value, peer->chanvars);
 			} else if (!strcasecmp(v->name, "header")) {
@@ -25467,6 +25461,23 @@
 		ast_set_cc_agent_policy(peer->cc_params, AST_CC_AGENT_NEVER);
 	}
 
+	/* Note that Timer B is dependent upon T1 and MUST NOT be lower
+	 * than T1 * 64, according to RFC 3261, Section 17.1.1.2 */
+	if (peer->timer_b < peer->timer_t1 * 64) {
+		if (timerb_set && timert1_set) {
+			ast_log(LOG_WARNING, "Timer B has been set lower than recommended for peer %s (%d < 64 * Timer-T1=%d)\n", peer->name, peer->timer_b, peer->timer_t1);
+		} else if (timerb_set) {
+			if ((peer->timer_t1 = peer->timer_b / 64) < global_t1min) {
+				ast_log(LOG_WARNING, "Timer B has been set lower than recommended (%d < 64 * timert1=%d). (RFC 3261, 17.1.1.2)\n", peer->timer_b, peer->timer_t1);
+				peer->timer_t1 = global_t1min;
+				peer->timer_b = peer->timer_t1 * 64;
+			}
+			peer->timer_t1 = peer->timer_b / 64;
+		} else {
+			peer->timer_b = peer->timer_t1 * 64;
+		}
+	}
+
 	if (!peer->default_outbound_transport) {
 		/* Set default set of transports */
 		peer->transports = default_transports;
@@ -25613,7 +25624,7 @@
 	struct ast_flags config_flags = { reason == CHANNEL_MODULE_LOAD ? 0 : ast_test_flag(&global_flags[1], SIP_PAGE2_RTCACHEFRIENDS) ? 0 : CONFIG_FLAG_FILEUNCHANGED };
 	int auto_sip_domains = FALSE;
 	struct sockaddr_in old_bindaddr = bindaddr;
-	int registry_count = 0, peer_count = 0;
+	int registry_count = 0, peer_count = 0, timerb_set = 0, timert1_set = 0;
 	time_t run_start, run_end;
 	
 	run_start = time(0);
@@ -25903,8 +25914,13 @@
 			 * for the value to be set higher, though a lower value is only
 			 * allowed on private networks unconnected to the Internet. */
 			global_t1 = atoi(v->value);
-			/* Note that timer B is dependent on the value of T1 */
-			global_timer_b = global_t1 * 64;
+		} else if (!strcasecmp(v->name, "timerb")) {
+			int tmp = atoi(v->value);
+			if (tmp < 500) {
+				global_timer_b = global_t1 * 64;
+				ast_log(LOG_WARNING, "Invalid value for timerb ('%s').  Setting to default ('%d').\n", v->value, global_timer_b);
+			}
+			timerb_set = 1;
 		} else if (!strcasecmp(v->name, "t1min")) {
 			global_t1min = atoi(v->value);
 		} else if (!strcasecmp(v->name, "transport") && !ast_strlen_zero(v->value)) {
@@ -26282,6 +26298,24 @@
 		}
 	}
 
+	if (global_t1 < global_t1min) {
+		ast_log(LOG_WARNING, "'t1min' (%d) cannot be greater than 't1timer' (%d).  Resetting 't1timer' to the value of 't1min'\n", global_t1min, global_t1);
+		global_t1 = global_t1min;
+	}
+
+	if (global_timer_b < global_t1 * 64) {
+		if (timerb_set && timert1_set) {
+			ast_log(LOG_WARNING, "Timer B has been set lower than recommended (%d < 64 * timert1=%d). (RFC 3261, 17.1.1.2)\n", global_timer_b, global_t1);
+		} else if (timerb_set) {
+			if ((global_t1 = global_timer_b / 64) < global_t1min) {
+				ast_log(LOG_WARNING, "Timer B has been set lower than recommended (%d < 64 * timert1=%d). (RFC 3261, 17.1.1.2)\n", global_timer_b, global_t1);
+				global_t1 = global_t1min;
+				global_timer_b = global_t1 * 64;
+			}
+		} else {
+			global_timer_b = global_t1 * 64;
+		}
+	}
 	if (!sip_cfg.allow_external_domains && AST_LIST_EMPTY(&domain_list)) {
 		ast_log(LOG_WARNING, "To disallow external domains, you need to configure local SIP domains.\n");
 		sip_cfg.allow_external_domains = 1;

Modified: team/group/CCSS/channels/chan_usbradio.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/channels/chan_usbradio.c?view=diff&rev=247033&r1=247032&r2=247033
==============================================================================
--- team/group/CCSS/channels/chan_usbradio.c (original)
+++ team/group/CCSS/channels/chan_usbradio.c Tue Feb 16 16:37:05 2010
@@ -40,12 +40,12 @@
  ***/
 
 /*** MAKEOPTS
-<category name="MENUSELECT_CFLAGS" displayname="Compiler Flags" positive_output="yes" remove_on_change=".lastclean">
-	<member name="RADIO_RTX" displayname="Build RTX/DTX Radio Programming">
+<category name="MENUSELECT_CFLAGS" displayname="Compiler Flags" positive_output="yes">
+	<member name="RADIO_RTX" displayname="Build RTX/DTX Radio Programming" touch_on_change="channels/chan_usbradio.c channels/xpmr/xpmr.h">
 		<defaultenabled>no</defaultenabled>
 		<depend>chan_usbradio</depend>
 	</member>
-	<member name="RADIO_XPMRX" displayname="Build Experimental Radio Protocols">
+	<member name="RADIO_XPMRX" displayname="Build Experimental Radio Protocols" touch_on_change="channels/chan_usbradio.c">
 		<defaultenabled>no</defaultenabled>
 		<depend>chan_usbradio</depend>
 	</member>

Modified: team/group/CCSS/include/asterisk/strings.h
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/include/asterisk/strings.h?view=diff&rev=247033&r1=247032&r2=247033
==============================================================================
--- team/group/CCSS/include/asterisk/strings.h (original)
+++ team/group/CCSS/include/asterisk/strings.h Tue Feb 16 16:37:05 2010
@@ -342,11 +342,16 @@
  *	ast_str_set_va(&buf, max_len, ap)
  *	ast_str_append_va(&buf, max_len, ap)
  *
- * \param max_len The maximum allowed length, reallocating if needed.
+ * \param max_len The maximum allowed capacity of the ast_str. Note that
+ *  if the value of max_len is less than the current capacity of the
+ *  ast_str (as returned by ast_str_size), then the parameter is effectively
+ *  ignored.
  * 	0 means unlimited, -1 means "at most the available space"
  *
  * \return All the functions return <0 in case of error, or the
- *	length of the string added to the buffer otherwise.
+ *	length of the string added to the buffer otherwise. Note that
+ *	in most cases where an error is returned, characters ARE written
+ *	to the ast_str.
  */
 
 /*! \brief The descriptor of a dynamic string

Modified: team/group/CCSS/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/channel.c?view=diff&rev=247033&r1=247032&r2=247033
==============================================================================
--- team/group/CCSS/main/channel.c (original)
+++ team/group/CCSS/main/channel.c Tue Feb 16 16:37:05 2010
@@ -37,6 +37,7 @@
 
 #include "asterisk/pbx.h"
 #include "asterisk/frame.h"
+#include "asterisk/mod_format.h"
 #include "asterisk/sched.h"
 #include "asterisk/channel.h"
 #include "asterisk/musiconhold.h"
@@ -3088,6 +3089,28 @@
 	}
 
 	return 0;
+}
+
+/*!
+ * \brief calculates the number of samples to jump forward with in a monitor stream.
+ 
+ * \note When using ast_seekstream() with the read and write streams of a monitor,
+ * the number of samples to seek forward must be of the same sample rate as the stream
+ * or else the jump will not be calculated correctly.
+ *
+ * \retval number of samples to seek forward after rate conversion.
+ */
+static inline int calc_monitor_jump(int samples, int sample_rate, int seek_rate)
+{
+	int diff = sample_rate - seek_rate;
+
+	if (diff > 0) {
+		samples = samples / (float) (sample_rate / seek_rate);
+	} else if (diff < 0) {
+		samples = samples * (float) (seek_rate / sample_rate);
+	}
+
+	return samples;
 }
 
 static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
@@ -3472,18 +3495,18 @@
 #ifndef MONITOR_CONSTANT_DELAY
 					int jump = chan->outsmpl - chan->insmpl - 4 * f->samples;
 					if (jump >= 0) {
-						jump = chan->outsmpl - chan->insmpl;
+						jump = calc_monitor_jump((chan->outsmpl - chan->insmpl), ast_format_rate(f->subclass.codec), ast_format_rate(chan->monitor->read_stream->fmt->format));
 						if (ast_seekstream(chan->monitor->read_stream, jump, SEEK_FORCECUR) == -1)
 							ast_log(LOG_WARNING, "Failed to perform seek in monitoring read stream, synchronization between the files may be broken\n");
-						chan->insmpl += jump + f->samples;
+						chan->insmpl += (chan->outsmpl - chan->insmpl) + f->samples;
 					} else
 						chan->insmpl+= f->samples;
 #else
-					int jump = chan->outsmpl - chan->insmpl;
+					int jump = calc_monitor_jump((chan->outsmpl - chan->insmpl), ast_format_rate(f->subclass.codec), ast_format_rate(chan->monitor->read_stream->fmt->format));
 					if (jump - MONITOR_DELAY >= 0) {
 						if (ast_seekstream(chan->monitor->read_stream, jump - f->samples, SEEK_FORCECUR) == -1)
 							ast_log(LOG_WARNING, "Failed to perform seek in monitoring read stream, synchronization between the files may be broken\n");
-						chan->insmpl += jump;
+						chan->insmpl += chan->outsmpl - chan->insmpl;
 					} else
 						chan->insmpl += f->samples;
 #endif
@@ -4087,19 +4110,19 @@
 #ifndef MONITOR_CONSTANT_DELAY
 				int jump = chan->insmpl - chan->outsmpl - 4 * cur->samples;
 				if (jump >= 0) {
-					jump = chan->insmpl - chan->outsmpl;
+					jump = calc_monitor_jump((chan->insmpl - chan->outsmpl), ast_format_rate(f->subclass.codec), ast_format_rate(chan->monitor->read_stream->fmt->format));
 					if (ast_seekstream(chan->monitor->write_stream, jump, SEEK_FORCECUR) == -1)
 						ast_log(LOG_WARNING, "Failed to perform seek in monitoring write stream, synchronization between the files may be broken\n");
-					chan->outsmpl += jump + cur->samples;
+					chan->outsmpl += (chan->insmpl - chan->outsmpl) + cur->samples;
 				} else {
 					chan->outsmpl += cur->samples;
 				}
 #else
-				int jump = chan->insmpl - chan->outsmpl;
+				int jump = calc_monitor_jump((chan->insmpl - chan->outsmpl), ast_format_rate(f->subclass.codec), ast_format_rate(chan->monitor->read_stream->fmt->format));
 				if (jump - MONITOR_DELAY >= 0) {
 					if (ast_seekstream(chan->monitor->write_stream, jump - cur->samples, SEEK_FORCECUR) == -1)
 						ast_log(LOG_WARNING, "Failed to perform seek in monitoring write stream, synchronization between the files may be broken\n");
-					chan->outsmpl += jump;
+					chan->outsmpl += chan->insmpl - chan->outsmpl;
 				} else {
 					chan->outsmpl += cur->samples;
 				}

Modified: team/group/CCSS/main/strings.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/strings.c?view=diff&rev=247033&r1=247032&r2=247033
==============================================================================
--- team/group/CCSS/main/strings.c (original)
+++ team/group/CCSS/main/strings.c Tue Feb 16 16:37:05 2010
@@ -24,8 +24,8 @@
  */
 
 /*** MAKEOPTS
-<category name="MENUSELECT_CFLAGS" displayname="Compiler Flags" positive_output="yes" remove_on_change=".lastclean">
-	<member name="DEBUG_OPAQUE" displayname="Change ast_str internals to detect improper usage">
+<category name="MENUSELECT_CFLAGS" displayname="Compiler Flags" positive_output="yes">
+	<member name="DEBUG_OPAQUE" displayname="Change ast_str internals to detect improper usage" touch_on_change="include/asterisk/strings.h">
 		<defaultenabled>yes</defaultenabled>
 	</member>
 </category>

Modified: team/group/CCSS/main/tcptls.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/tcptls.c?view=diff&rev=247033&r1=247032&r2=247033
==============================================================================
--- team/group/CCSS/main/tcptls.c (original)
+++ team/group/CCSS/main/tcptls.c Tue Feb 16 16:37:05 2010
@@ -215,6 +215,11 @@
 	if (!tcptls_session->f) {
 		close(tcptls_session->fd);
 		ast_log(LOG_WARNING, "FILE * open failed!\n");
+#ifndef DO_SSL
+		if (tcptls_session->parent->tls_cfg) {
+			ast_log(LOG_WARNING, "Attempted a TLS connection without OpenSSL support.  This will not work!\n");
+		}
+#endif
 		ao2_ref(tcptls_session, -1);
 		return NULL;
 	}




More information about the asterisk-commits mailing list