[asterisk-commits] branch oej/test-this-branch r14233 - in /team/oej/test-this-branch: ./ apps/ ...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Mar 22 14:30:22 MST 2006


Author: oej
Date: Wed Mar 22 15:30:10 2006
New Revision: 14233

URL: http://svn.digium.com/view/asterisk?rev=14233&view=rev
Log:
Adding RTP standalone timing from patch 5374 / branch rtptiming

Modified:
    team/oej/test-this-branch/Makefile
    team/oej/test-this-branch/README.test-this-branch
    team/oej/test-this-branch/README.test-this-branch.html
    team/oej/test-this-branch/apps/app_milliwatt.c
    team/oej/test-this-branch/apps/app_sms.c
    team/oej/test-this-branch/asterisk.8
    team/oej/test-this-branch/asterisk.c
    team/oej/test-this-branch/channel.c
    team/oej/test-this-branch/channels/chan_sip.c
    team/oej/test-this-branch/doc/asterisk-conf.txt
    team/oej/test-this-branch/include/asterisk/channel.h
    team/oej/test-this-branch/include/asterisk/options.h
    team/oej/test-this-branch/pbx.c

Modified: team/oej/test-this-branch/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/Makefile?rev=14233&r1=14232&r2=14233&view=diff
==============================================================================
--- team/oej/test-this-branch/Makefile (original)
+++ team/oej/test-this-branch/Makefile Wed Mar 22 15:30:10 2006
@@ -781,6 +781,8 @@
 		echo ";astctlowner = root" ; \
 		echo ";astctlgroup = apache" ; \
 		echo ";astctl = asterisk.ctl" ; \
+		echo ";[options]" ; \
+		echo ";silence_suppression = yes" ; \
 		) > $(DESTDIR)$(ASTCONFPATH) ; \
 	else \
 		echo "Skipping asterisk.conf creation"; \

Modified: team/oej/test-this-branch/README.test-this-branch
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/README.test-this-branch?rev=14233&r1=14232&r2=14233&view=diff
==============================================================================
--- team/oej/test-this-branch/README.test-this-branch (original)
+++ team/oej/test-this-branch/README.test-this-branch Wed Mar 22 15:30:10 2006
@@ -39,6 +39,7 @@
 - disable-ol-and-sub: Settings for disabling sip subscriptions and overlap 
   dialing (#6705, oej) - See configs/sip.conf.sample
 - t38passthrough: Support for Fax passthrough in SIP (#5090, Steve Underwood)
+- rtptiming: Support for timed RTP (#5374, cmantunes/DEA/sokhapkin)
 
 And the following stand-alone patches
 - Additional options for the CHANNEL dialplan function (oej, #6670)

Modified: team/oej/test-this-branch/README.test-this-branch.html
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/README.test-this-branch.html?rev=14233&r1=14232&r2=14233&view=diff
==============================================================================
--- team/oej/test-this-branch/README.test-this-branch.html (original)
+++ team/oej/test-this-branch/README.test-this-branch.html Wed Mar 22 15:30:10 2006
@@ -40,6 +40,7 @@
   dialing (<a href="http://bugs.digium.com/view.php?id=6705">#6705</a>, oej) - See <a href="http://svn.digium.com/view/asterisk/team/oej/test-this-branch/configs/sip.conf.sample?view=markup">configs/sip.conf.sample</a><br />
 <li> t38passthrough: Support for Fax passthrough in SIP (<a href="http://bugs.digium.com/view.php?id=5090">#5090</a>, Steve Underwood)<br />
 See <a href="http://svn.digium.com/view/asterisk/team/oej/test-this-branch/doc/sipt38support.txt?view=markup">doc/sipt38support.txt</a>
+<li> rtptiming: Support for timed RTP (<a href="http://bugs.digium.com/view.php?idi=5374">#5374</a>, cmantunes/DEA/sokhapkin)
 </ul>
 </p>
 <i>And the following stand-alone patches:</i><p>

Modified: team/oej/test-this-branch/apps/app_milliwatt.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/apps/app_milliwatt.c?rev=14233&r1=14232&r2=14233&view=diff
==============================================================================
--- team/oej/test-this-branch/apps/app_milliwatt.c (original)
+++ team/oej/test-this-branch/apps/app_milliwatt.c Wed Mar 22 15:30:10 2006
@@ -84,7 +84,7 @@
 	wf.mallocd = 0;
 	wf.data = buf + AST_FRIENDLY_OFFSET;
 	wf.datalen = len;
-	wf.samples = wf.datalen;
+	wf.samples = samples;
 	wf.src = "app_milliwatt";
 	wf.delivery.tv_sec = 0;
 	wf.delivery.tv_usec = 0;

Modified: team/oej/test-this-branch/apps/app_sms.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/apps/app_sms.c?rev=14233&r1=14232&r2=14233&view=diff
==============================================================================
--- team/oej/test-this-branch/apps/app_sms.c (original)
+++ team/oej/test-this-branch/apps/app_sms.c Wed Mar 22 15:30:10 2006
@@ -1177,32 +1177,31 @@
 {
 	struct ast_frame f = { 0 };
 	unsigned char waste[AST_FRIENDLY_OFFSET];
+#define MAXSAMPLES (800)
 #ifdef OUTALAW
-	unsigned char buf[800];
+	unsigned char buf[MAXSAMPLES];
 #else
-	signed short buf[800];
+	signed short buf[MAXSAMPLES];
 #endif
+#define SAMPLE2LEN (sizeof (buf[0]))
 	sms_t *h = data;
 	int i;
 
-	if (len > sizeof (buf)) {
-		ast_log (LOG_WARNING, "Only doing %d bytes (%d bytes requested)\n", (int)(sizeof (buf) / sizeof (signed short)), len);
-		len = sizeof (buf);
-#ifdef OUTALAW
-		samples = len;
-#else
-		samples = len / 2;
-#endif
-	}
-	waste[0] = 0;					 /* make compiler happy */
+	if (samples > MAXSAMPLES) {
+		ast_log (LOG_WARNING, "Only doing %d samples (%d requested)\n",
+			 MAXSAMPLES, samples);
+		samples = MAXSAMPLES;
+	}
+	len = samples * SAMPLE2LEN;
+
+	waste[0] = 0;				 /* make compiler happy */
 	f.frametype = AST_FRAME_VOICE;
 #ifdef OUTALAW
 	f.subclass = AST_FORMAT_ALAW;
-	f.datalen = samples;
 #else
 	f.subclass = AST_FORMAT_SLINEAR;
-	f.datalen = samples * 2;
 #endif
+	f.datalen = len;
 	f.offset = AST_FRIENDLY_OFFSET;
 	f.mallocd = 0;
 	f.data = buf;
@@ -1254,6 +1253,8 @@
 		return -1;
 	}
 	return 0;
+#undef SAMPLE2LEN
+#undef MAXSAMPLES
 }
 
 static void sms_process (sms_t * h, int samples, signed short *data)

Modified: team/oej/test-this-branch/asterisk.8
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/asterisk.8?rev=14233&r1=14232&r2=14233&view=diff
==============================================================================
--- team/oej/test-this-branch/asterisk.8 (original)
+++ team/oej/test-this-branch/asterisk.8 Wed Mar 22 15:30:10 2006
@@ -114,6 +114,9 @@
 for controlling it. Additionally, if connection to the Asterisk 
 process is lost, attempt to reconnect for as long as 30 seconds.
 .TP
+\fB-s\fR
+Enable silence suppression if timing device is available.
+.TP
 \fB-t\fR
 When recording files, write them first into a temporary holding directory, 
 then move them into the final location when done.

Modified: team/oej/test-this-branch/asterisk.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/asterisk.c?rev=14233&r1=14232&r2=14233&view=diff
==============================================================================
--- team/oej/test-this-branch/asterisk.c (original)
+++ team/oej/test-this-branch/asterisk.c Wed Mar 22 15:30:10 2006
@@ -157,6 +157,9 @@
 
 double option_maxload = 0.0;			/*!< Max load avg on system */
 int option_maxcalls = 0;			/*!< Max number of active calls */
+
+int option_internal_timing = 0;
+
 
 /*! @} */
 
@@ -2073,7 +2076,10 @@
 		/* Transmit SLINEAR silence while a channel is being recorded */
 		} else if (!strcasecmp(v->name, "transmit_silence_during_record")) {
 			ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_TRANSMIT_SILENCE);
-		} else if (!strcasecmp(v->name, "maxcalls")) {
+		/* Enable silence suppression */
+		} else if (!strcasecmp(v->name, "internal_timing")) {
+			option_internal_timing = ast_true(v->value);
+} else if (!strcasecmp(v->name, "maxcalls")) {
 			if ((sscanf(v->value, "%d", &option_maxcalls) != 1) || (option_maxcalls < 0)) {
 				option_maxcalls = 0;
 			}
@@ -2151,7 +2157,7 @@
 	}
 	*/
 	/* Check for options */
-	while((c=getopt(argc, argv, "tThfdvVqprRgcinx:U:G:C:L:M:")) != -1) {
+	while((c=getopt(argc, argv, "tThfdvVqprRgcinsx:U:G:C:L:M:")) != -1) {
 		switch(c) {
 		case 'd':
 			option_debug++;
@@ -2190,6 +2196,7 @@
 		case 'q':
 			ast_set_flag(&ast_options, AST_OPT_FLAG_QUIET);
 			break;
+			break;
 		case 't':
 			ast_set_flag(&ast_options, AST_OPT_FLAG_CACHE_RECORD_FILES);
 			break;
@@ -2204,6 +2211,8 @@
 			ast_copy_string(ast_config_AST_CONFIG_FILE, optarg, sizeof(ast_config_AST_CONFIG_FILE));
 			ast_set_flag(&ast_options, AST_OPT_FLAG_OVERRIDE_CONFIG);
 			break;
+		case 'I':
+			option_internal_timing++;
 		case 'i':
 			ast_set_flag(&ast_options, AST_OPT_FLAG_INIT_KEYS);
 			break;

Modified: team/oej/test-this-branch/channel.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/channel.c?rev=14233&r1=14232&r2=14233&view=diff
==============================================================================
--- team/oej/test-this-branch/channel.c (original)
+++ team/oej/test-this-branch/channel.c Wed Mar 22 15:30:10 2006
@@ -1983,31 +1983,22 @@
 						f = &ast_null_frame;
 				}
 
-				/* Run any generator sitting on the channel */
-				if (chan->generatordata) {
-					/* Mask generator data temporarily and apply.  If there is a timing function, it
-					   will be calling the generator instead */
+				/* Run generator sitting on the line if timing device not available
+				* and synchronous generation of outgoing frames is necessary       */
+				if (f && (f->frametype == AST_FRAME_VOICE) && chan->generatordata && !ast_internal_timing_enabled(chan)) {
 					void *tmp;
 					int res;
 					int (*generate)(struct ast_channel *chan, void *tmp, int datalen, int samples);
 					
-					if (chan->timingfunc) {
-						ast_log(LOG_DEBUG, "Generator got voice, switching to phase locked mode\n");
-						ast_settimeout(chan, 0, NULL, NULL);
-					}
 					tmp = chan->generatordata;
 					chan->generatordata = NULL;
 					generate = chan->generator->generate;
 					res = generate(chan, tmp, f->datalen, f->samples);
 					chan->generatordata = tmp;
 					if (res) {
-						ast_log(LOG_DEBUG, "Auto-deactivating generator\n");
+						if (option_debug > 1)
+							ast_log(LOG_DEBUG, "Auto-deactivating generator\n");
 						ast_deactivate_generator(chan);
-					}
-				} else if (f->frametype == AST_FRAME_CNG) {
-					if (chan->generator && !chan->timingfunc && (chan->timingfd > -1)) {
-						ast_log(LOG_DEBUG, "Generator got CNG, switching to timed mode\n");
-						ast_settimeout(chan, 160, generator_force, chan);
 					}
 				}
 			}
@@ -2032,6 +2023,14 @@
 	ast_mutex_unlock(&chan->lock);
 
 	return f;
+}
+
+int ast_internal_timing_enabled(struct ast_channel *chan)
+{
+	int ret = option_internal_timing && chan->timingfd > -1;
+	if (option_verbose > 2) 
+		ast_verbose(VERBOSE_PREFIX_3 "Internal timing is %s (option_internal_timing=%d chan->timingfd=%d)\n", ret? "enabled": "disabled", option_internal_timing, chan->timingfd);
+	return ret;
 }
 
 struct ast_frame *ast_read(struct ast_channel *chan)

Modified: team/oej/test-this-branch/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/channels/chan_sip.c?rev=14233&r1=14232&r2=14233&view=diff
==============================================================================
--- team/oej/test-this-branch/channels/chan_sip.c (original)
+++ team/oej/test-this-branch/channels/chan_sip.c Wed Mar 22 15:30:10 2006
@@ -5230,7 +5230,8 @@
 				    debug);
 	}
 
-	ast_build_string(&a_audio_next, &a_audio_left, "a=silenceSupp:off - - - -\r\n");
+	if(!ast_internal_timing_enabled(p->owner))
+		ast_build_string(&a_audio_next, &a_audio_left, "a=silenceSupp:off - - - -\r\n");
 
 	if ((m_audio_left < 2) || (m_video_left < 2) || (a_audio_left == 0) || (a_video_left == 0))
 		ast_log(LOG_WARNING, "SIP SDP may be truncated due to undersized buffer!!\n");

Modified: team/oej/test-this-branch/doc/asterisk-conf.txt
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/doc/asterisk-conf.txt?rev=14233&r1=14232&r2=14233&view=diff
==============================================================================
--- team/oej/test-this-branch/doc/asterisk-conf.txt (original)
+++ team/oej/test-this-branch/doc/asterisk-conf.txt Wed Mar 22 15:30:10 2006
@@ -52,6 +52,7 @@
 runuser = asterisk				; User to run asterisk as (-U) NOTE: will require changes to
 						; directory and device permisions
 rungroup = asterisk				; Group to run asterisk as (-G)
+internal_timing = yes | no			; Enable internal timing support (-I)
 
 ;These options have no command line equivalent
 cache_record_files = yes | no			; Cache record() files in another directory until completion

Modified: team/oej/test-this-branch/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/include/asterisk/channel.h?rev=14233&r1=14232&r2=14233&view=diff
==============================================================================
--- team/oej/test-this-branch/include/asterisk/channel.h (original)
+++ team/oej/test-this-branch/include/asterisk/channel.h Wed Mar 22 15:30:10 2006
@@ -1145,6 +1145,16 @@
  */
 void ast_channel_stop_silence_generator(struct ast_channel *chan, struct ast_silence_generator *state);
 
+/*!
+  \brief Check if the channel can run in silence suppression mode.
+  \param chan The channel to check
+  \return boolean
+
+  This function will return 1 if silence suppression is enabled and the timing
+  device is available.
+ */
+int ast_internal_timing_enabled(struct ast_channel *chan);
+
 /* Misc. functions below */
 
 /* if fd is a valid descriptor, set *pfd with the descriptor

Modified: team/oej/test-this-branch/include/asterisk/options.h
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/include/asterisk/options.h?rev=14233&r1=14232&r2=14233&view=diff
==============================================================================
--- team/oej/test-this-branch/include/asterisk/options.h (original)
+++ team/oej/test-this-branch/include/asterisk/options.h Wed Mar 22 15:30:10 2006
@@ -101,10 +101,10 @@
 extern struct ast_flags ast_options;
 
 extern int option_verbose;
-extern int option_debug;
-extern int option_maxcalls;
+extern int option_debug;		/*!< Debugging */
+extern int option_maxcalls;		/*!< Maximum number of simultaneous channels */
 extern double option_maxload;
-
+extern int option_internal_timing;	/*!< Flag for internal timing (RTP) */
 extern char defaultlanguage[];
 
 extern time_t ast_startuptime;

Modified: team/oej/test-this-branch/pbx.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/pbx.c?rev=14233&r1=14232&r2=14233&view=diff
==============================================================================
--- team/oej/test-this-branch/pbx.c (original)
+++ team/oej/test-this-branch/pbx.c Wed Mar 22 15:30:10 2006
@@ -4678,9 +4678,10 @@
 	return NULL;
 }
 
-/*! Function to post an empty cdr after a spool call fails.
+/*! Function to update the cdr after a spool call fails.
  *
- *  This function posts an empty cdr for a failed spool call
+ *  This function updates the cdr for a failed spool call
+ *  and takes the channel of the failed call as an argument.
  *
  */
 int ast_pbx_outgoing_cdr_failed(void)



More information about the asterisk-commits mailing list