[asterisk-commits] branch oej/metermaids-trunk r16578 - in /team/oej/metermaids-trunk: ./ apps/ ...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Mar 30 15:04:33 MST 2006


Author: oej
Date: Thu Mar 30 16:04:27 2006
New Revision: 16578

URL: http://svn.digium.com/view/asterisk?rev=16578&view=rev
Log:
Reset, resolve, go

Modified:
    team/oej/metermaids-trunk/   (props changed)
    team/oej/metermaids-trunk/Makefile
    team/oej/metermaids-trunk/apps/app_dial.c
    team/oej/metermaids-trunk/apps/app_echo.c
    team/oej/metermaids-trunk/apps/app_exec.c
    team/oej/metermaids-trunk/apps/app_macro.c
    team/oej/metermaids-trunk/apps/app_meetme.c
    team/oej/metermaids-trunk/apps/app_milliwatt.c
    team/oej/metermaids-trunk/apps/app_page.c
    team/oej/metermaids-trunk/apps/app_sms.c
    team/oej/metermaids-trunk/apps/app_voicemail.c
    team/oej/metermaids-trunk/apps/app_while.c
    team/oej/metermaids-trunk/asterisk.8
    team/oej/metermaids-trunk/asterisk.c
    team/oej/metermaids-trunk/asterisk.sgml
    team/oej/metermaids-trunk/channel.c
    team/oej/metermaids-trunk/channels/chan_iax2.c
    team/oej/metermaids-trunk/channels/chan_oss.c
    team/oej/metermaids-trunk/channels/chan_sip.c
    team/oej/metermaids-trunk/codecs/gsm/Makefile
    team/oej/metermaids-trunk/doc/asterisk-conf.txt
    team/oej/metermaids-trunk/include/asterisk/channel.h
    team/oej/metermaids-trunk/include/asterisk/indications.h
    team/oej/metermaids-trunk/include/asterisk/lock.h
    team/oej/metermaids-trunk/include/asterisk/options.h
    team/oej/metermaids-trunk/include/asterisk/pbx.h
    team/oej/metermaids-trunk/indications.c
    team/oej/metermaids-trunk/pbx.c
    team/oej/metermaids-trunk/pbx/pbx_dundi.c
    team/oej/metermaids-trunk/pbx/pbx_loopback.c
    team/oej/metermaids-trunk/pbx/pbx_realtime.c
    team/oej/metermaids-trunk/res/res_agi.c
    team/oej/metermaids-trunk/res/res_features.c
    team/oej/metermaids-trunk/res/res_indications.c
    team/oej/metermaids-trunk/res/res_musiconhold.c
    team/oej/metermaids-trunk/res/snmp/agent.c

Propchange: team/oej/metermaids-trunk/
------------------------------------------------------------------------------
    automerge = http://edvina.net/training/

Propchange: team/oej/metermaids-trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.2-blocked' - no diff available.

Propchange: team/oej/metermaids-trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Propchange: team/oej/metermaids-trunk/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Mar 30 16:04:27 2006
@@ -1,1 +1,1 @@
-/trunk:1-16444
+/trunk:1-16577

Modified: team/oej/metermaids-trunk/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/Makefile?rev=16578&r1=16577&r2=16578&view=diff
==============================================================================
--- team/oej/metermaids-trunk/Makefile (original)
+++ team/oej/metermaids-trunk/Makefile Thu Mar 30 16:04:27 2006
@@ -788,6 +788,8 @@
 		echo ";astctlowner = root" ; \
 		echo ";astctlgroup = apache" ; \
 		echo ";astctl = asterisk.ctl" ; \
+		echo ";[options]" ; \
+		echo ";internal_timing = yes" ; \
 		) > $(DESTDIR)$(ASTCONFPATH) ; \
 	else \
 		echo "Skipping asterisk.conf creation"; \

Modified: team/oej/metermaids-trunk/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/apps/app_dial.c?rev=16578&r1=16577&r2=16578&view=diff
==============================================================================
--- team/oej/metermaids-trunk/apps/app_dial.c (original)
+++ team/oej/metermaids-trunk/apps/app_dial.c Thu Mar 30 16:04:27 2006
@@ -1449,7 +1449,7 @@
 					if (*ch == '^')
 						*ch = '|';
 				}
-				res = pbx_exec(peer, app, opt_args[OPT_ARG_CALLEE_MACRO], 1);
+				res = pbx_exec(peer, app, opt_args[OPT_ARG_CALLEE_MACRO]);
 				ast_log(LOG_DEBUG, "Macro exited with status %d\n", res);
 				res = 0;
 			} else {

Modified: team/oej/metermaids-trunk/apps/app_echo.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/apps/app_echo.c?rev=16578&r1=16577&r2=16578&view=diff
==============================================================================
--- team/oej/metermaids-trunk/apps/app_echo.c (original)
+++ team/oej/metermaids-trunk/apps/app_echo.c Thu Mar 30 16:04:27 2006
@@ -59,7 +59,6 @@
 	int res = -1;
 	int format;
 	struct localuser *u;
-	struct ast_frame *f;
 
 	LOCAL_USER_ADD(u);
 
@@ -68,7 +67,7 @@
 	ast_set_read_format(chan, format);
 
 	while (ast_waitfor(chan, -1) > -1) {
-		f = ast_read(chan);
+		struct ast_frame *f = ast_read(chan);
 		if (!f)
 			break;
 		f->delivery.tv_sec = 0;

Modified: team/oej/metermaids-trunk/apps/app_exec.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/apps/app_exec.c?rev=16578&r1=16577&r2=16578&view=diff
==============================================================================
--- team/oej/metermaids-trunk/apps/app_exec.c (original)
+++ team/oej/metermaids-trunk/apps/app_exec.c Thu Mar 30 16:04:27 2006
@@ -82,7 +82,7 @@
 			if (appname) {
 				app = pbx_findapp(appname);
 				if (app) {
-					res = pbx_exec(chan, app, args, 1);
+					res = pbx_exec(chan, app, args);
 				} else {
 					ast_log(LOG_WARNING, "Could not find application (%s)\n", appname);
 					res = -1;

Modified: team/oej/metermaids-trunk/apps/app_macro.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/apps/app_macro.c?rev=16578&r1=16577&r2=16578&view=diff
==============================================================================
--- team/oej/metermaids-trunk/apps/app_macro.c (original)
+++ team/oej/metermaids-trunk/apps/app_macro.c Thu Mar 30 16:04:27 2006
@@ -188,7 +188,7 @@
   		snprintf(varname, sizeof(varname), "ARG%d", argc);
 		s = pbx_builtin_getvar_helper(chan, varname);
 		if (s)
-			oldargs[argc] = strdup(s);
+			oldargs[argc] = ast_strdup(s);
 		pbx_builtin_setvar_helper(chan, varname, cur);
 		argc++;
 	}

Modified: team/oej/metermaids-trunk/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/apps/app_meetme.c?rev=16578&r1=16577&r2=16578&view=diff
==============================================================================
--- team/oej/metermaids-trunk/apps/app_meetme.c (original)
+++ team/oej/metermaids-trunk/apps/app_meetme.c Thu Mar 30 16:04:27 2006
@@ -1143,7 +1143,7 @@
 		app = pbx_findapp("agi");
 		if (app) {
 			char *s = ast_strdupa(agifile);
-			ret = pbx_exec(chan, app, s, 1);
+			ret = pbx_exec(chan, app, s);
 		} else {
 			ast_log(LOG_WARNING, "Could not find application (agi)\n");
 			ret = -2;

Modified: team/oej/metermaids-trunk/apps/app_milliwatt.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/apps/app_milliwatt.c?rev=16578&r1=16577&r2=16578&view=diff
==============================================================================
--- team/oej/metermaids-trunk/apps/app_milliwatt.c (original)
+++ team/oej/metermaids-trunk/apps/app_milliwatt.c Thu Mar 30 16:04:27 2006
@@ -71,20 +71,27 @@
 {
 	struct ast_frame wf;
 	unsigned char buf[AST_FRIENDLY_OFFSET + 640];
-	int i,*indexp = (int *) data;
+	const int maxsamples = sizeof (buf) / sizeof (buf[0]);
+	int i, *indexp = (int *) data;
 
-	if (len + AST_FRIENDLY_OFFSET > sizeof(buf))
-	{
-		ast_log(LOG_WARNING,"Only doing %d bytes (%d bytes requested)\n",(int)(sizeof(buf) - AST_FRIENDLY_OFFSET),len);
-		len = sizeof(buf) - AST_FRIENDLY_OFFSET;
+	/* Instead of len, use samples, because channel.c generator_force
+	* generate(chan, tmp, 0, 160) ignores len. In any case, len is
+	* a multiple of samples, given by number of samples times bytes per
+	* sample. In the case of ulaw, len = samples. for signed linear
+	* len = 2 * samples */
+
+	if (samples > maxsamples) {
+		ast_log(LOG_WARNING, "Only doing %d samples (%d requested)\n", maxsamples, samples);
+		samples = maxsamples;
 	}
+	len = samples * sizeof (buf[0]);
 	wf.frametype = AST_FRAME_VOICE;
 	wf.subclass = AST_FORMAT_ULAW;
 	wf.offset = AST_FRIENDLY_OFFSET;
 	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/metermaids-trunk/apps/app_page.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/apps/app_page.c?rev=16578&r1=16577&r2=16578&view=diff
==============================================================================
--- team/oej/metermaids-trunk/apps/app_page.c (original)
+++ team/oej/metermaids-trunk/apps/app_page.c Thu Mar 30 16:04:27 2006
@@ -186,7 +186,7 @@
 	}
 	if (!res) {
 		snprintf(meetmeopts, sizeof(meetmeopts), "%ud|A%sqxd", confid, ast_test_flag(&flags, PAGE_DUPLEX) ? "" : "t");
-		pbx_exec(chan, app, meetmeopts, 1);
+		pbx_exec(chan, app, meetmeopts);
 	}
 
 	LOCAL_USER_REMOVE(u);

Modified: team/oej/metermaids-trunk/apps/app_sms.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/apps/app_sms.c?rev=16578&r1=16577&r2=16578&view=diff
==============================================================================
--- team/oej/metermaids-trunk/apps/app_sms.c (original)
+++ team/oej/metermaids-trunk/apps/app_sms.c Thu Mar 30 16:04:27 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/metermaids-trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/apps/app_voicemail.c?rev=16578&r1=16577&r2=16578&view=diff
==============================================================================
--- team/oej/metermaids-trunk/apps/app_voicemail.c (original)
+++ team/oej/metermaids-trunk/apps/app_voicemail.c Thu Mar 30 16:04:27 2006
@@ -3422,7 +3422,7 @@
 				old_priority = chan->priority;
 				
 				/* call the the Directory, changes the channel */
-				res = pbx_exec(chan, app, context ? context : "default", 1);
+				res = pbx_exec(chan, app, context ? context : "default");
 				
 				ast_copy_string(username, chan->exten, sizeof(username));
 				

Modified: team/oej/metermaids-trunk/apps/app_while.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/apps/app_while.c?rev=16578&r1=16577&r2=16578&view=diff
==============================================================================
--- team/oej/metermaids-trunk/apps/app_while.c (original)
+++ team/oej/metermaids-trunk/apps/app_while.c Thu Mar 30 16:04:27 2006
@@ -101,7 +101,7 @@
 
 		if (ast_true(expr)) { 
 			if ((app = pbx_findapp(myapp))) {
-				res = pbx_exec(chan, app, mydata, 1);
+				res = pbx_exec(chan, app, mydata);
 			} else {
 				ast_log(LOG_WARNING, "Count not find application! (%s)\n", myapp);
 				res = -1;

Modified: team/oej/metermaids-trunk/asterisk.8
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/asterisk.8?rev=16578&r1=16577&r2=16578&view=diff
==============================================================================
--- team/oej/metermaids-trunk/asterisk.8 (original)
+++ team/oej/metermaids-trunk/asterisk.8 Thu Mar 30 16:04:27 2006
@@ -9,7 +9,7 @@
 asterisk \- All-purpose telephony server.
 .SH SYNOPSIS
 
-\fBasterisk\fR [ \fB-tThfdvVqpRgcin\fR ] [ \fB-C \fIfile\fB\fR ] [ \fB-U \fIuser\fB\fR ] [ \fB-G \fIgroup\fB\fR ] [ \fB-x \fIcommand\fB\fR ] [ \fB-M \fIvalue\fB\fR ]
+\fBasterisk\fR [ \fB-tThfdvVqpRgciIn\fR ] [ \fB-C \fIfile\fB\fR ] [ \fB-U \fIuser\fB\fR ] [ \fB-G \fIgroup\fB\fR ] [ \fB-x \fIcommand\fB\fR ] [ \fB-M \fIvalue\fB\fR ]
 
 
 \fBasterisk -r\fR [ \fB-v\fR ] [ \fB-x \fIcommand\fB\fR ]
@@ -114,6 +114,12 @@
 for controlling it. Additionally, if connection to the Asterisk 
 process is lost, attempt to reconnect for as long as 30 seconds.
 .TP
+\fB-I\fR
+Enable internal timing if Zaptel timer is available
+The default behaviour is that outbound packets are phase locked
+to inbound packets. Enabling this switch causes them to be
+locked to the internal Zaptel timer instead.
+.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/metermaids-trunk/asterisk.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/asterisk.c?rev=16578&r1=16577&r2=16578&view=diff
==============================================================================
--- team/oej/metermaids-trunk/asterisk.c (original)
+++ team/oej/metermaids-trunk/asterisk.c Thu Mar 30 16:04:27 2006
@@ -1970,6 +1970,9 @@
 		/* 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);
+		/* 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, "%d", &option_maxcalls) != 1) || (option_maxcalls < 0)) {
 				option_maxcalls = 0;
@@ -2049,7 +2052,7 @@
 	}
 	*/
 	/* Check for options */
-	while((c=getopt(argc, argv, "tThfdvVqprRgcinx:U:G:C:L:M:")) != -1) {
+	while((c=getopt(argc, argv, "tThfdvVqprRgciInx:U:G:C:L:M:")) != -1) {
 		switch(c) {
 		case 'd':
 			option_debug++;
@@ -2088,6 +2091,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;
@@ -2101,6 +2105,9 @@
 		case 'C':
 			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':
+			ast_set_flag(&ast_options, AST_OPT_FLAG_INTERNAL_TIMING);
 			break;
 		case 'i':
 			ast_set_flag(&ast_options, AST_OPT_FLAG_INIT_KEYS);

Modified: team/oej/metermaids-trunk/asterisk.sgml
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/asterisk.sgml?rev=16578&r1=16577&r2=16578&view=diff
==============================================================================
--- team/oej/metermaids-trunk/asterisk.sgml (original)
+++ team/oej/metermaids-trunk/asterisk.sgml Thu Mar 30 16:04:27 2006
@@ -21,7 +21,7 @@
 <refsynopsisdiv>
 	<cmdsynopsis>
 	<command>asterisk</command>
-<arg><option>-tThfdvVqpRgcin</option></arg>
+<arg><option>-tThfdvVqpRgciIn</option></arg>
 <arg><option>-C </option><replaceable class="parameter">file</replaceable></arg>
 <arg><option>-U </option><replaceable class="parameter">user</replaceable></arg>
 <arg><option>-G </option><replaceable class="parameter">group</replaceable></arg>
@@ -38,7 +38,7 @@
 </refsynopsisdiv>
 <refsect1>
 	<refsect1info>
-		<date>2004-07-01</date>
+		<date>2006-03-29</date>
 	</refsect1info>
 	<title>DESCRIPTION</title>
 	<para>
@@ -154,6 +154,17 @@
 		</listitem>
 	</varlistentry>
 	<varlistentry>
+		<term>-I</term>
+		<listitem>
+			<para>
+			Enable internal timing if Zaptel timing is available.
+			The default behaviour is that outbound packets are phase locked
+			to inbound packets. Enabling this switch causes them to be
+			locked to the internal Zaptel timer instead.
+			</para>
+		</listitem>
+	</varlistentry>
+	<varlistentry>
 		<term>-L <replaceable class="parameter">loadaverage</replaceable></term>
 		<listitem>
 			<para>

Modified: team/oej/metermaids-trunk/channel.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/channel.c?rev=16578&r1=16577&r2=16578&view=diff
==============================================================================
--- team/oej/metermaids-trunk/channel.c (original)
+++ team/oej/metermaids-trunk/channel.c Thu Mar 30 16:04:27 2006
@@ -1976,30 +1976,34 @@
 						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 (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");
+						if (option_debug > 1)
+							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");
+						if (option_debug > 1)
+							ast_log(LOG_DEBUG, "Generator got CNG, switching to timed mode\n");
 						ast_settimeout(chan, 160, generator_force, chan);
 					}
 				}
@@ -2025,6 +2029,14 @@
 	ast_mutex_unlock(&chan->lock);
 
 	return f;
+}
+
+int ast_internal_timing_enabled(struct ast_channel *chan)
+{
+	int ret = ast_opt_internal_timing && chan->timingfd > -1;
+	if (option_debug > 3) 
+		ast_log(LOG_DEBUG, "Internal timing is %s (option_internal_timing=%d chan->timingfd=%d)\n", ret? "enabled": "disabled", ast_opt_internal_timing, chan->timingfd);
+	return ret;
 }
 
 struct ast_frame *ast_read(struct ast_channel *chan)

Modified: team/oej/metermaids-trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/channels/chan_iax2.c?rev=16578&r1=16577&r2=16578&view=diff
==============================================================================
--- team/oej/metermaids-trunk/channels/chan_iax2.c (original)
+++ team/oej/metermaids-trunk/channels/chan_iax2.c Thu Mar 30 16:04:27 2006
@@ -9573,7 +9573,7 @@
 }
 
 /*! \brief Execute IAX2 dialplan switch */
-static int iax2_exec(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, int newstack, const char *data)
+static int iax2_exec(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data)
 {
 	char odata[256];
 	char req[256];
@@ -9589,7 +9589,7 @@
 		if (dialstatus) {
 			dial = pbx_findapp(dialstatus);
 			if (dial) 
-				pbx_exec(chan, dial, "", newstack);
+				pbx_exec(chan, dial, "");
 		}
 		return -1;
 	} else if (priority != 1)
@@ -9618,7 +9618,7 @@
 	ast_mutex_unlock(&dpcache_lock);
 	dial = pbx_findapp("Dial");
 	if (dial) {
-		return pbx_exec(chan, dial, req, newstack);
+		return pbx_exec(chan, dial, req);
 	} else {
 		ast_log(LOG_WARNING, "No dial application registered\n");
 	}

Modified: team/oej/metermaids-trunk/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/channels/chan_oss.c?rev=16578&r1=16577&r2=16578&view=diff
==============================================================================
--- team/oej/metermaids-trunk/channels/chan_oss.c (original)
+++ team/oej/metermaids-trunk/channels/chan_oss.c Thu Mar 30 16:04:27 2006
@@ -671,7 +671,7 @@
 		ast_log(LOG_WARNING, "Failed to set audio device to mono\n");
 		return -1;
 	}
-	fmt = desired = 8000; /* 8000 Hz desired */
+	fmt = desired = DEFAULT_SAMPLE_RATE; /* 8000 Hz desired */
 	res = ioctl(fd, SNDCTL_DSP_SPEED, &fmt);
 
 	if (res < 0) {

Modified: team/oej/metermaids-trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/channels/chan_sip.c?rev=16578&r1=16577&r2=16578&view=diff
==============================================================================
--- team/oej/metermaids-trunk/channels/chan_sip.c (original)
+++ team/oej/metermaids-trunk/channels/chan_sip.c Thu Mar 30 16:04:27 2006
@@ -4699,7 +4699,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");
@@ -11958,6 +11959,8 @@
 static int handle_common_options(struct ast_flags *flags, struct ast_flags *mask, struct ast_variable *v)
 {
 	int res = 0;
+	static int dep_insecure_very = 0;
+	static int dep_insecure_yes = 0;
 
 	if (!strcasecmp(v->name, "trustrpid")) {
 		ast_set_flag(&mask[0], SIP_TRUSTRPID);
@@ -12007,10 +12010,20 @@
 	} else if (!strcasecmp(v->name, "insecure")) {
 		ast_set_flag(&mask[0], SIP_INSECURE_PORT | SIP_INSECURE_INVITE);
 		ast_clear_flag(&flags[0], SIP_INSECURE_PORT | SIP_INSECURE_INVITE);
-		if (!strcasecmp(v->value, "very"))
+		if (!strcasecmp(v->value, "very")) {
 			ast_set_flag(&flags[0], SIP_INSECURE_PORT | SIP_INSECURE_INVITE);
-		else if (ast_true(v->value))
+			if (!dep_insecure_very) {
+				ast_log(LOG_WARNING, "insecure=very at line %d is deprecated; use insecure=port,invite instead\n", v->lineno);
+				dep_insecure_very = 1;
+			}
+		}
+		else if (ast_true(v->value)) {
 			ast_set_flag(&flags[0], SIP_INSECURE_PORT);
+			if (!dep_insecure_yes) {
+				ast_log(LOG_WARNING, "insecure=%s at line %d is deprecated; use insecure=port instead\n", v->value, v->lineno);
+				dep_insecure_yes = 1;
+			}
+		}
 		else if (!ast_false(v->value)) {
 			char buf[64];
 			char *word, *next;

Modified: team/oej/metermaids-trunk/codecs/gsm/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/codecs/gsm/Makefile?rev=16578&r1=16577&r2=16578&view=diff
==============================================================================
--- team/oej/metermaids-trunk/codecs/gsm/Makefile (original)
+++ team/oej/metermaids-trunk/codecs/gsm/Makefile Thu Mar 30 16:04:27 2006
@@ -38,7 +38,7 @@
 ######### probably require gcc. 
 
 ifeq (, $(findstring $(OSARCH) , Darwin SunOS ))
-ifeq (, $(findstring $(PROC) , x86_64 ultrasparc sparc64 arm ppc ppc64 ia64 ))
+ifeq (, $(findstring $(PROC) , x86_64 amd64 ultrasparc sparc64 arm ppc ppc64 ia64 ))
 ifeq (, $(findstring $(shell uname -m) , ppc ppc64 alpha armv4l ))
 OPTIMIZE+=-march=$(PROC)
 endif
@@ -215,7 +215,7 @@
 # XXX Keep a space after each findstring argument
 # XXX should merge with GSM_OBJECTS
 ifeq (${OSARCH},Linux)
-ifeq (,$(findstring $(shell uname -m) , x86_64 ppc ppc64 alpha armv4l sparc64 parisc ))
+ifeq (,$(findstring $(shell uname -m) , x86_64 amd64 ppc ppc64 alpha armv4l sparc64 parisc ))
 ifeq (,$(findstring ${PROC} , arm ia64 ))
 GSM_SOURCES+= $(SRC)/k6opt.s
 endif
@@ -267,7 +267,7 @@
 		$(SRC)/table.o
 
 ifeq (${OSARCH},Linux)
-ifeq (,$(findstring $(shell uname -m) , x86_64 ppc ppc64 alpha armv4l sparc64 parisc ))
+ifeq (,$(findstring $(shell uname -m) , x86_64 amd64 ppc ppc64 alpha armv4l sparc64 parisc ))
 ifeq (,$(findstring ${PROC} , arm ia64 ))
 GSM_OBJECTS+= $(SRC)/k6opt.o
 endif

Modified: team/oej/metermaids-trunk/doc/asterisk-conf.txt
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/doc/asterisk-conf.txt?rev=16578&r1=16577&r2=16578&view=diff
==============================================================================
--- team/oej/metermaids-trunk/doc/asterisk-conf.txt (original)
+++ team/oej/metermaids-trunk/doc/asterisk-conf.txt Thu Mar 30 16:04:27 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/metermaids-trunk/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/include/asterisk/channel.h?rev=16578&r1=16577&r2=16578&view=diff
==============================================================================
--- team/oej/metermaids-trunk/include/asterisk/channel.h (original)
+++ team/oej/metermaids-trunk/include/asterisk/channel.h Thu Mar 30 16:04:27 2006
@@ -317,10 +317,8 @@
 	/*! Procedure causing blocking */
 	const char *blockproc;			
 
-	/*! Current application */
-	char *appl;				
-	/*! Data passed to current application */
-	char *data;				
+	const char *appl;				/*! Current application */
+	const char *data;				/*! Data passed to current application */
 	
 	/*! Which fd had an event detected on */
 	int fdno;				
@@ -1124,6 +1122,16 @@
  */
 void ast_channel_stop_silence_generator(struct ast_channel *chan, struct ast_silence_generator *state);
 
+/*!
+  \brief Check if the channel can run in internal timing mode.
+  \param chan The channel to check
+  \return boolean
+
+  This function will return 1 if internal timing 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/metermaids-trunk/include/asterisk/indications.h
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/include/asterisk/indications.h?rev=16578&r1=16577&r2=16578&view=diff
==============================================================================
--- team/oej/metermaids-trunk/include/asterisk/indications.h (original)
+++ team/oej/metermaids-trunk/include/asterisk/indications.h Thu Mar 30 16:04:27 2006
@@ -59,29 +59,34 @@
 };
 
 /* set the default tone country */
-extern int ast_set_indication_country(const char *country);
+int ast_set_indication_country(const char *country);
 
 /* locate tone_zone, given the country. if country == NULL, use the default country */
-extern struct tone_zone *ast_get_indication_zone(const char *country);
+struct tone_zone *ast_get_indication_zone(const char *country);
 /* locate a tone_zone_sound, given the tone_zone. if tone_zone == NULL, use the default tone_zone */
-extern struct tone_zone_sound *ast_get_indication_tone(const struct tone_zone *zone, const char *indication);
+struct tone_zone_sound *ast_get_indication_tone(const struct tone_zone *zone, const char *indication);
 
 /* add a new country, if country exists, it will be replaced. */
-extern int ast_register_indication_country(struct tone_zone *country);
+int ast_register_indication_country(struct tone_zone *country);
 /* remove an existing country and all its indications, country must exist */
-extern int ast_unregister_indication_country(const char *country);
+int ast_unregister_indication_country(const char *country);
 /* add a new indication to a tone_zone. tone_zone must exist. if the indication already
  * exists, it will be replaced. */
-extern int ast_register_indication(struct tone_zone *zone, const char *indication, const char *tonelist);
+int ast_register_indication(struct tone_zone *zone, const char *indication, const char *tonelist);
 /* remove an existing tone_zone's indication. tone_zone must exist */
-extern int ast_unregister_indication(struct tone_zone *zone, const char *indication);
+int ast_unregister_indication(struct tone_zone *zone, const char *indication);
 
 /* Start a tone-list going */
 int ast_playtones_start(struct ast_channel *chan, int vol, const char* tonelist, int interruptible);
 /*! Stop the tones from playing */
 void ast_playtones_stop(struct ast_channel *chan);
 
+/* support for walking through a list of indications */
+struct tone_zone *ast_walk_indications(const struct tone_zone *cur);
+
+#if 0
 extern struct tone_zone *tone_zones;
 extern ast_mutex_t tzlock;
+#endif
 
 #endif /* _ASTERISK_INDICATIONS_H */

Modified: team/oej/metermaids-trunk/include/asterisk/lock.h
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/include/asterisk/lock.h?rev=16578&r1=16577&r2=16578&view=diff
==============================================================================
--- team/oej/metermaids-trunk/include/asterisk/lock.h (original)
+++ team/oej/metermaids-trunk/include/asterisk/lock.h Thu Mar 30 16:04:27 2006
@@ -18,6 +18,37 @@
 
 /*! \file
  * \brief General Asterisk channel locking definitions.
+ *
+ * - See \ref LockDef
+ */
+/* \page LockDef Asterisk thread locking models
+ *
+ * This file provides several different implementation of the functions,
+ * depending on the platform, the use of DEBUG_THREADS, and the way
+ * global mutexes are initialized.
+ * At the moment, we have 3 ways to initialize global mutexes, depending on
+ *
+ *  - \b static: the mutex is assigned the value AST_MUTEX_INIT_VALUE
+ *        this is done at compile time, and is the way used on Linux.
+ *        This method is not applicable to all platforms e.g. when the
+ *        initialization needs that some code is run.
+ *
+ *  - \b on first use: the mutex is assigned a magic value at compile time,
+ *        and ast_mutex_init() is called when this magic value is detected.
+ *        This technique is generally applicable, though it has a bit of
+ *        overhead on each access to check whether initialization is needed.
+ *        On the other hand, the overall cost of a mutex_lock operation
+ *        is such that this overhead is often negligible.
+
+ *  - \b through constructors: for each mutex, a constructor function is
+ *        defined, which then runs when the program (or the module)
+ *        starts. The problem with this approach is that there is a
+ *        lot of code duplication (a new block of code is created for
+ *        each mutex). Also, it does not prevent a user from declaring
+ *        a global mutex without going through the wrapper macros,
+ *        so sane programming practices are still required.
+ *
+ * Eventually we should converge on a single method for all platforms.
  */
 
 #ifndef _ASTERISK_LOCK_H
@@ -640,7 +671,6 @@
 #define pthread_cond_timedwait use_ast_cond_timedwait_instead_of_pthread_cond_timedwait
 
 #define AST_MUTEX_DEFINE_STATIC(mutex) __AST_MUTEX_DEFINE(static,mutex)
-#define AST_MUTEX_DEFINE_EXPORTED(mutex) __AST_MUTEX_DEFINE(/**/,mutex)
 
 #define AST_MUTEX_INITIALIZER __use_AST_MUTEX_DEFINE_STATIC_rather_than_AST_MUTEX_INITIALIZER__
 

Modified: team/oej/metermaids-trunk/include/asterisk/options.h
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/include/asterisk/options.h?rev=16578&r1=16577&r2=16578&view=diff
==============================================================================
--- team/oej/metermaids-trunk/include/asterisk/options.h (original)
+++ team/oej/metermaids-trunk/include/asterisk/options.h Thu Mar 30 16:04:27 2006
@@ -71,7 +71,9 @@
 	/*! Suppress some warnings */
 	AST_OPT_FLAG_DONT_WARN = (1 << 18),
 	/*! End CDRs before the 'h' extension */
-	AST_OPT_END_CDR_BEFORE_H_EXTEN = (1 << 19)
+	AST_OPT_END_CDR_BEFORE_H_EXTEN = (1 << 19),
+	/*! Use Zaptel Timing for generators if available */
+	AST_OPT_FLAG_INTERNAL_TIMING = (1 << 20)
 };
 
 /*! These are the options that set by default when Asterisk starts */
@@ -97,14 +99,14 @@
 #define ast_opt_transmit_silence	ast_test_flag(&ast_options, AST_OPT_FLAG_TRANSMIT_SILENCE)
 #define ast_opt_dont_warn		ast_test_flag(&ast_options, AST_OPT_FLAG_DONT_WARN)
 #define ast_opt_end_cdr_before_h_exten	ast_test_flag(&ast_options, AST_OPT_END_CDR_BEFORE_H_EXTEN)
+#define ast_opt_internal_timing		ast_test_flag(&ast_options, AST_OPT_FLAG_INTERNAL_TIMING)
 
 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 char defaultlanguage[];
 
 extern time_t ast_startuptime;

Modified: team/oej/metermaids-trunk/include/asterisk/pbx.h
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/include/asterisk/pbx.h?rev=16578&r1=16577&r2=16578&view=diff
==============================================================================
--- team/oej/metermaids-trunk/include/asterisk/pbx.h (original)
+++ team/oej/metermaids-trunk/include/asterisk/pbx.h Thu Mar 30 16:04:27 2006
@@ -82,22 +82,20 @@
 	struct ast_custom_function *next;
 };
 
+/*! \brief All switch functions have the same interface, so define a type for them */
+typedef int (ast_switch_f)(struct ast_channel *chan, const char *context,
+	const char *exten, int priority, const char *callerid, const char *data);
+
 /*! Data structure associated with an asterisk switch */
 struct ast_switch {
-	/*! NULL */
 	struct ast_switch *next;	
-	/*! Name of the switch */
-	const char *name;				
-	/*! Description of the switch */
-	const char *description;		
+	const char *name;			/*! Name of the switch */
+	const char *description;		/*! Description of the switch */
 	
-	int (*exists)(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data);
-	
-	int (*canmatch)(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data);
-	
-	int (*exec)(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, int newstack, const char *data);
-
-	int (*matchmore)(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data);
+	ast_switch_f *exists;
+	ast_switch_f *canmatch;
+	ast_switch_f *exec;
+	ast_switch_f *matchmore;
 };
 
 struct ast_timing {
@@ -160,7 +158,6 @@
  * \param c channel to execute on
  * \param app which app to execute
  * \param data the data passed into the app
- * \param newstack stack pointer
  *
  * This application executes an application on a given channel.  It
  * saves the stack and executes the given appliation passing in
@@ -168,7 +165,7 @@
  *
  * \return 0 on success, and -1 on failure
  */
-int pbx_exec(struct ast_channel *c, struct ast_app *app, void *data, int newstack);
+int pbx_exec(struct ast_channel *c, struct ast_app *app, void *data);
 
 /*!
  * \brief Register a new context
@@ -484,22 +481,6 @@
  * \retval -1 on failure.
  */
 int ast_spawn_extension(struct ast_channel *c, const char *context, 
-	const char *exten, int priority, const char *callerid);
-
-/*! 
- * \brief Execute an extension.
- * 
- * \param c channel to execute upon
- * \param context which context extension is in
- * \param exten extension to execute
- * \param priority priority to execute within the given extension
- * \param callerid Caller-ID
- *
- * If it's not available, do whatever you should do for
- * default extensions and halt the thread if necessary.  This function does not
- * return, except on error.
- */
-int ast_exec_extension(struct ast_channel *c, const char *context, 
 	const char *exten, int priority, const char *callerid);
 
 /*! 

Modified: team/oej/metermaids-trunk/indications.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/indications.c?rev=16578&r1=16577&r2=16578&view=diff
==============================================================================
--- team/oej/metermaids-trunk/indications.c (original)
+++ team/oej/metermaids-trunk/indications.c Thu Mar 30 16:04:27 2006
@@ -330,22 +330,28 @@
 
 /*--------------------------------------------*/
 
-struct tone_zone *tone_zones;
+static struct tone_zone *tone_zones;
 static struct tone_zone *current_tonezone;
 
 /* Protect the tone_zones list (highly unlikely that two things would change
  * it at the same time, but still! */
-AST_MUTEX_DEFINE_EXPORTED(tzlock);
-/* XXX note - this is the only instance of AST_MUTEX_DEFINE_EXPORTED()
- * in the entire asterisk code base, and should be replaced by a static one.
- * The mutex is declared exported because it is accessed
- * by other files, namely res/snmp/agent.c and res/res_indications.c.
- * However there are also unprotected accesses to the list, because
- * some of the functions below export pointers to the elements, so
- * the entire mechanism is useless.
- * This needs to be fixed by providing functions to navigate in the
- * list, and refcounts to prevent entries from being destroyed.
- */
+AST_MUTEX_DEFINE_STATIC(tzlock);
+
+struct tone_zone *ast_walk_indications(const struct tone_zone *cur)
+{
+	struct tone_zone *tz;
+
+	if (cur == NULL)
+		return tone_zones;
+	ast_mutex_lock(&tzlock);
+	for (tz = tone_zones; tz; tz = tz->next)
+		if (tz == cur)
+			break;
+	if (tz)
+		tz = tz->next;
+	ast_mutex_unlock(&tzlock);
+	return tz;
+}
 
 /* Set global indication country */
 int ast_set_indication_country(const char *country)

Modified: team/oej/metermaids-trunk/pbx.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/pbx.c?rev=16578&r1=16577&r2=16578&view=diff
==============================================================================
--- team/oej/metermaids-trunk/pbx.c (original)
+++ team/oej/metermaids-trunk/pbx.c Thu Mar 30 16:04:27 2006
@@ -478,34 +478,29 @@
    how many times it is called, it returns to the same place */
 int pbx_exec(struct ast_channel *c, 		/*!< Channel */
 		struct ast_app *app,		/*!< Application */
-		void *data,			/*!< Data for execution */
-		int newstack)			/*!< Force stack increment */
+		void *data)			/*!< Data for execution */
 {
 	int res;
 	
-	char *saved_c_appl;
-	char *saved_c_data;
+	const char *saved_c_appl;
+	const char *saved_c_data;
 	
 	int (*execute)(struct ast_channel *chan, void *data) = app->execute; 
 
-	if (newstack) {
-		if (c->cdr)
-			ast_cdr_setapp(c->cdr, app->name, data);
-
-		/* save channel values */
-		saved_c_appl= c->appl;
-		saved_c_data= c->data;
-
-		c->appl = app->name;
-		c->data = data;		
-		res = execute(c, data);
-		/* restore channel values */
-		c->appl= saved_c_appl;
-		c->data= saved_c_data;
-		return res;
-	} else
-		ast_log(LOG_WARNING, "You really didn't want to call this function with newstack set to 0\n");
-	return -1;
+	if (c->cdr)
+		ast_cdr_setapp(c->cdr, app->name, data);
+
+	/* save channel values */
+	saved_c_appl= c->appl;
+	saved_c_data= c->data;
+
+	c->appl = app->name;
+	c->data = data;		
+	res = execute(c, data);
+	/* restore channel values */
+	c->appl= saved_c_appl;
+	c->data= saved_c_data;
+	return res;
 }
 
 
@@ -514,7 +509,6 @@
 
 #define HELPER_EXISTS 0
 #define HELPER_SPAWN 1
-#define HELPER_EXEC 2
 #define HELPER_CANMATCH 3
 #define HELPER_MATCHMORE 4

[... 359 lines stripped ...]


More information about the asterisk-commits mailing list