[asterisk-commits] oej: branch oej/pinequeue-1.8 r411767 - in /team/oej/pinequeue-1.8: ./ channe...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Apr 5 02:11:19 CDT 2014


Author: oej
Date: Sat Apr  5 02:11:09 2014
New Revision: 411767

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=411767
Log:
Resolve, reset

Modified:
    team/oej/pinequeue-1.8/   (props changed)
    team/oej/pinequeue-1.8/UPGRADE.txt
    team/oej/pinequeue-1.8/channels/chan_sip.c
    team/oej/pinequeue-1.8/configs/asterisk.conf.sample
    team/oej/pinequeue-1.8/include/asterisk/options.h
    team/oej/pinequeue-1.8/main/asterisk.c
    team/oej/pinequeue-1.8/main/channel.c

Propchange: team/oej/pinequeue-1.8/
------------------------------------------------------------------------------
    automerge = Is-there-life-off-net?

Propchange: team/oej/pinequeue-1.8/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sat Apr  5 02:11:09 2014
@@ -1,1 +1,1 @@
-/branches/1.8:1-411621
+/branches/1.8:1-411766

Modified: team/oej/pinequeue-1.8/UPGRADE.txt
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinequeue-1.8/UPGRADE.txt?view=diff&rev=411767&r1=411766&r2=411767
==============================================================================
--- team/oej/pinequeue-1.8/UPGRADE.txt (original)
+++ team/oej/pinequeue-1.8/UPGRADE.txt Sat Apr  5 02:11:09 2014
@@ -18,6 +18,10 @@
 ===
 ===========================================================
 
+from 1.8.27.0 to 1.8.28.0:
+* The asterisk command line -I option and the asterisk.conf internal_timing
+  option are removed and always enabled if any timing module is loaded.
+
 from 1.8.26.0 to 1.8.27.0:
 * res_fax now returns the correct rates for V.27ter (4800 or 9600 bit/s).
   Because of this the default settings would not load, so the minrate (minimum

Modified: team/oej/pinequeue-1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinequeue-1.8/channels/chan_sip.c?view=diff&rev=411767&r1=411766&r2=411767
==============================================================================
--- team/oej/pinequeue-1.8/channels/chan_sip.c (original)
+++ team/oej/pinequeue-1.8/channels/chan_sip.c Sat Apr  5 02:11:09 2014
@@ -12016,8 +12016,9 @@
 
 		ast_debug(3, "-- Done with adding codecs to SDP\n");
 
-		if (!p->owner || !ast_internal_timing_enabled(p->owner))
+		if (!p->owner || p->owner->timingfd == -1) {
 			ast_str_append(&a_audio, 0, "a=silenceSupp:off - - - -\r\n");
+		}
 
 		if (min_audio_packet_size)
 			ast_str_append(&a_audio, 0, "a=ptime:%d\r\n", min_audio_packet_size);

Modified: team/oej/pinequeue-1.8/configs/asterisk.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinequeue-1.8/configs/asterisk.conf.sample?view=diff&rev=411767&r1=411766&r2=411767
==============================================================================
--- team/oej/pinequeue-1.8/configs/asterisk.conf.sample (original)
+++ team/oej/pinequeue-1.8/configs/asterisk.conf.sample Sat Apr  5 02:11:09 2014
@@ -27,7 +27,6 @@
 ;dontwarn = yes			; Disable some warnings.
 ;dumpcore = yes			; Dump core on crash (same as -g at startup).
 ;languageprefix = yes		; Use the new sound prefix path syntax.
-;internal_timing = yes
 ;systemname = my_system_name	; Prefix uniqueid with a system name for
 				; Global uniqueness issues.
 ;autosystemname = yes		; Automatically set systemname to hostname,

Modified: team/oej/pinequeue-1.8/include/asterisk/options.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinequeue-1.8/include/asterisk/options.h?view=diff&rev=411767&r1=411766&r2=411767
==============================================================================
--- team/oej/pinequeue-1.8/include/asterisk/options.h (original)
+++ team/oej/pinequeue-1.8/include/asterisk/options.h Sat Apr  5 02:11:09 2014
@@ -74,7 +74,7 @@
 	AST_OPT_FLAG_DONT_WARN = (1 << 18),
 	/*! End CDRs before the 'h' extension */
 	AST_OPT_FLAG_END_CDR_BEFORE_H_EXTEN = (1 << 19),
-	/*! Use DAHDI Timing for generators if available */
+	/*! Use DAHDI Timing for generators if available (No longer used) */
 	AST_OPT_FLAG_INTERNAL_TIMING = (1 << 20),
 	/*! Always fork, even if verbose or debug settings are non-zero */
 	AST_OPT_FLAG_ALWAYS_FORK = (1 << 21),
@@ -99,11 +99,7 @@
 };
 
 /*! These are the options that set by default when Asterisk starts */
-#if (defined(HAVE_DAHDI_VERSION) && HAVE_DAHDI_VERSION >= 230)
-#define AST_DEFAULT_OPTIONS AST_OPT_FLAG_TRANSCODE_VIA_SLIN | AST_OPT_FLAG_INTERNAL_TIMING
-#else
 #define AST_DEFAULT_OPTIONS AST_OPT_FLAG_TRANSCODE_VIA_SLIN
-#endif
 
 #define ast_opt_exec_includes		ast_test_flag(&ast_options, AST_OPT_FLAG_EXEC_INCLUDES)
 #define ast_opt_no_fork			ast_test_flag(&ast_options, AST_OPT_FLAG_NO_FORK)

Modified: team/oej/pinequeue-1.8/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinequeue-1.8/main/asterisk.c?view=diff&rev=411767&r1=411766&r2=411767
==============================================================================
--- team/oej/pinequeue-1.8/main/asterisk.c (original)
+++ team/oej/pinequeue-1.8/main/asterisk.c Sat Apr  5 02:11:09 2014
@@ -484,7 +484,6 @@
 	ast_cli(a->fd, "  User name and group:         %s/%s\n", ast_config_AST_RUN_USER, ast_config_AST_RUN_GROUP);
 	ast_cli(a->fd, "  Executable includes:         %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_EXEC_INCLUDES) ? "Enabled" : "Disabled");
 	ast_cli(a->fd, "  Transcode via SLIN:          %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_TRANSCODE_VIA_SLIN) ? "Enabled" : "Disabled");
-	ast_cli(a->fd, "  Internal timing:             %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_INTERNAL_TIMING) ? "Enabled" : "Disabled");
 	ast_cli(a->fd, "  Transmit silence during rec: %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_TRANSMIT_SILENCE) ? "Enabled" : "Disabled");
 	ast_cli(a->fd, "  Generic PLC:                 %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_GENERIC_PLC) ? "Enabled" : "Disabled");
 
@@ -3003,7 +3002,6 @@
 	printf("   -g              Dump core in case of a crash\n");
 	printf("   -h              This help screen\n");
 	printf("   -i              Initialize crypto keys at startup\n");
-	printf("   -I              Enable internal timing if DAHDI timer is available\n");
 	printf("   -L <load>       Limit the maximum load average before rejecting new calls\n");
 	printf("   -M <value>      Limit the maximum number of calls to the specified value\n");
 	printf("   -m              Mute debugging and console output on the console\n");
@@ -3171,9 +3169,6 @@
 		/* Transmit SLINEAR silence while a channel is being recorded or DTMF is being generated on a channel */
 		} else if (!strcasecmp(v->name, "transmit_silence_during_record") || !strcasecmp(v->name, "transmit_silence")) {
 			ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_TRANSMIT_SILENCE);
-		/* Enable internal timing */
-		} else if (!strcasecmp(v->name, "internal_timing")) {
-			ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_INTERNAL_TIMING);
 		} else if (!strcasecmp(v->name, "maxcalls")) {
 			if ((sscanf(v->value, "%30d", &option_maxcalls) != 1) || (option_maxcalls < 0)) {
 				option_maxcalls = 0;
@@ -3482,9 +3477,6 @@
 		case 'h':
 			show_cli_help();
 			exit(0);
-		case 'I':
-			ast_set_flag(&ast_options, AST_OPT_FLAG_INTERNAL_TIMING);
-			break;
 		case 'i':
 			ast_set_flag(&ast_options, AST_OPT_FLAG_INIT_KEYS);
 			break;

Modified: team/oej/pinequeue-1.8/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinequeue-1.8/main/channel.c?view=diff&rev=411767&r1=411766&r2=411767
==============================================================================
--- team/oej/pinequeue-1.8/main/channel.c (original)
+++ team/oej/pinequeue-1.8/main/channel.c Sat Apr  5 02:11:09 2014
@@ -3088,13 +3088,14 @@
 	return __ast_answer(chan, 0, 1);
 }
 
-void ast_deactivate_generator(struct ast_channel *chan)
-{
-	ast_debug(3, "ast_deactivate_generator() called on chan %s\n", chan->name);
-	ast_channel_lock(chan);
+static void deactivate_generator_nolock(struct ast_channel *chan)
+{
 	if (chan->generatordata) {
-		if (chan->generator && chan->generator->release)
-			chan->generator->release(chan, chan->generatordata);
+		struct ast_generator *generator = chan->generator;
+
+		if (generator && generator->release) {
+			generator->release(chan, chan->generatordata);
+		}
 		ast_debug(3,"removing the generator stuff on chan %s\n", chan->name);
 		chan->generatordata = NULL;
 		chan->generator = NULL;
@@ -3102,6 +3103,12 @@
 		ast_clear_flag(chan, AST_FLAG_WRITE_INT);
 		ast_settimeout(chan, 0, NULL, NULL);
 	}
+}
+
+void ast_deactivate_generator(struct ast_channel *chan)
+{
+	ast_channel_lock(chan);
+	deactivate_generator_nolock(chan);
 	ast_channel_unlock(chan);
 	ast_debug(3, "ast_deactivate_generator() done on chan %s\n", chan->name);
 }
@@ -3149,8 +3156,11 @@
 
 	ast_channel_lock(chan);
 	if (chan->generatordata) {
-		if (chan->generator && chan->generator->release)
-			chan->generator->release(chan, chan->generatordata);
+		struct ast_generator *generator_old = chan->generator;
+
+		if (generator_old && generator_old->release) {
+			generator_old->release(chan, chan->generatordata);
+		}
 		chan->generatordata = NULL;
 	}
 	if (gen->alloc && !(chan->generatordata = gen->alloc(chan, params))) {
@@ -3717,49 +3727,58 @@
 
 static void ast_read_generator_actions(struct ast_channel *chan, struct ast_frame *f)
 {
+	struct ast_generator *generator;
+	void *gendata;
+	int res;
+	int samples;
+
 	ast_debug(3, "----- Jost poking around. Have a happy life. \n");
-	if (chan->generator && chan->generator->generate && chan->generatordata &&  !ast_internal_timing_enabled(chan)) {
-		void *tmp = chan->generatordata;
-		int (*generate)(struct ast_channel *chan, void *tmp, int datalen, int samples) = chan->generator->generate;
-		int res;
-		int samples;
-
-		if (chan->timingfunc) {
-			ast_debug(1, "Generator got voice, switching to phase locked mode\n");
-			ast_settimeout(chan, 0, NULL, NULL);
-		}
-
-		chan->generatordata = NULL;     /* reset, to let writes go through */
-
-		if (f->subclass.codec != chan->writeformat) {
-			float factor;
-			factor = ((float) ast_format_rate(chan->writeformat)) / ((float) ast_format_rate(f->subclass.codec));
-			samples = (int) ( ((float) f->samples) * factor );
-		} else {
-			samples = f->samples;
-		}
-		
-		/* This unlock is here based on two assumptions that hold true at this point in the
-		 * code. 1) this function is only called from within __ast_read() and 2) all generators
-		 * call ast_write() in their generate callback.
-		 *
-		 * The reason this is added is so that when ast_write is called, the lock that occurs 
-		 * there will not recursively lock the channel. Doing this will cause intended deadlock 
-		 * avoidance not to work in deeper functions
-		 */
-		ast_channel_unlock(chan);
-		res = generate(chan, tmp, f->datalen, samples);
-		ast_channel_lock(chan);
-		chan->generatordata = tmp;
+
+	generator = chan->generator;
+	if (!generator
+		|| !generator->generate
+		|| f->frametype != AST_FRAME_VOICE
+		|| !chan->generatordata
+		|| chan->timingfunc) {
+		return;
+	}
+
+	/*
+	 * We must generate frames in phase locked mode since
+	 * we have no internal timer available.
+	 */
+
+	if (f->subclass.codec != chan->writeformat) {
+		float factor;
+
+		factor = ((float) ast_format_rate(chan->writeformat)) / ((float) ast_format_rate(f->subclass.codec));
+		samples = (int) (((float) f->samples) * factor);
+	} else {
+		samples = f->samples;
+	}
+
+	gendata = chan->generatordata;
+	chan->generatordata = NULL;     /* reset, to let writes go through */
+
+	/*
+	 * This unlock is here based on two assumptions that hold true at
+	 * this point in the code. 1) this function is only called from
+	 * within __ast_read() and 2) all generators call ast_write() in
+	 * their generate callback.
+	 *
+	 * The reason this is added is so that when ast_write is called,
+	 * the lock that occurs there will not recursively lock the
+	 * channel.  Doing this will allow deadlock avoidance to work in
+	 * deeper functions.
+	 */
+	ast_channel_unlock(chan);
+	res = generator->generate(chan, gendata, f->datalen, samples);
+	ast_channel_lock(chan);
+	if (generator == chan->generator) {
+		chan->generatordata = gendata;
 		if (res) {
 			ast_debug(1, "Auto-deactivating generator\n");
 			ast_deactivate_generator(chan);
-		}
-
-	} else if (f->frametype == AST_FRAME_CNG) {
-		if (chan->generator && !chan->timingfunc && (chan->timingfd > -1)) {
-			ast_debug(1, "Generator got CNG, switching to timed mode\n");
-			ast_settimeout(chan, 50, generator_force, chan);
 		}
 	}
 }
@@ -4367,7 +4386,7 @@
 
 int ast_internal_timing_enabled(struct ast_channel *chan)
 {
-	return (ast_opt_internal_timing && chan->timingfd > -1);
+	return chan->timingfd > -1;
 }
 
 struct ast_frame *ast_read(struct ast_channel *chan)
@@ -8309,30 +8328,24 @@
 	return state;
 }
 
-static int internal_deactivate_generator(struct ast_channel *chan, void* generator)
+static int deactivate_silence_generator(struct ast_channel *chan)
 {
 	ast_channel_lock(chan);
 
 	if (!chan->generatordata) {
-		ast_debug(1, "Trying to stop silence generator when there is no "
-		    "generator on '%s'\n", chan->name);
+		ast_debug(1, "Trying to stop silence generator when there is no generator on '%s'\n",
+			chan->name);
 		ast_channel_unlock(chan);
 		return 0;
 	}
-	if (chan->generator != generator) {
-		ast_debug(1, "Trying to stop silence generator when it is not the current "
-		    "generator on '%s'\n", chan->name);
+	if (chan->generator != &silence_generator) {
+		ast_debug(1, "Trying to stop silence generator when it is not the current generator on '%s'\n",
+			chan->name);
 		ast_channel_unlock(chan);
 		return 0;
 	}
-	if (chan->generator && chan->generator->release) {
-		chan->generator->release(chan, chan->generatordata);
-	}
-	chan->generatordata = NULL;
-	chan->generator = NULL;
-	ast_channel_set_fd(chan, AST_GENERATOR_FD, -1);
-	ast_clear_flag(chan, AST_FLAG_WRITE_INT);
-	ast_settimeout(chan, 0, NULL, NULL);
+	deactivate_generator_nolock(chan);
+
 	ast_channel_unlock(chan);
 
 	return 1;
@@ -8340,10 +8353,11 @@
 
 void ast_channel_stop_silence_generator(struct ast_channel *chan, struct ast_silence_generator *state)
 {
-	if (!state)
+	if (!state) {
 		return;
-
-	if (internal_deactivate_generator(chan, &silence_generator)) {
+	}
+
+	if (deactivate_silence_generator(chan)) {
 		ast_debug(1, "Stopped silence generator on '%s'\n", chan->name);
 
 		if (ast_set_write_format(chan, state->old_write_format) < 0)




More information about the asterisk-commits mailing list