[asterisk-commits] branch oej/test-this-branch r16583 - in /team/oej/test-this-branch: ./ channe...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Mar 30 15:59:03 MST 2006


Author: oej
Date: Thu Mar 30 16:58:58 2006
New Revision: 16583

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

Modified:
    team/oej/test-this-branch/   (props changed)
    team/oej/test-this-branch/Makefile
    team/oej/test-this-branch/asterisk.c
    team/oej/test-this-branch/asterisk.sgml
    team/oej/test-this-branch/channel.c
    team/oej/test-this-branch/channels/chan_sip.c
    team/oej/test-this-branch/include/asterisk/channel.h
    team/oej/test-this-branch/include/asterisk/indications.h
    team/oej/test-this-branch/include/asterisk/lock.h
    team/oej/test-this-branch/include/asterisk/options.h
    team/oej/test-this-branch/indications.c
    team/oej/test-this-branch/res/res_indications.c
    team/oej/test-this-branch/res/res_musiconhold.c
    team/oej/test-this-branch/res/snmp/agent.c

Propchange: team/oej/test-this-branch/
------------------------------------------------------------------------------
    automerge = http://edvina.net/training/

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

Propchange: team/oej/test-this-branch/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Mar 30 16:58:58 2006
@@ -1,1 +1,1 @@
-/trunk:1-16458
+/trunk:1-16557

Modified: team/oej/test-this-branch/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/Makefile?rev=16583&r1=16582&r2=16583&view=diff
==============================================================================
--- team/oej/test-this-branch/Makefile (original)
+++ team/oej/test-this-branch/Makefile Thu Mar 30 16:58:58 2006
@@ -791,7 +791,7 @@
 		echo ";astctlgroup = apache" ; \
 		echo ";astctl = asterisk.ctl" ; \
 		echo ";[options]" ; \
-		echo ";silence_suppression = yes" ; \
+		echo ";internal_timing = yes" ; \
 		) > $(DESTDIR)$(ASTCONFPATH) ; \
 	else \
 		echo "Skipping asterisk.conf creation"; \

Modified: team/oej/test-this-branch/asterisk.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/asterisk.c?rev=16583&r1=16582&r2=16583&view=diff
==============================================================================
--- team/oej/test-this-branch/asterisk.c (original)
+++ team/oej/test-this-branch/asterisk.c Thu Mar 30 16:58:58 2006
@@ -2078,9 +2078,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 silence suppression */
+		/* Enable internal timing */
 		} else if (!strcasecmp(v->name, "internal_timing")) {
-			option_internal_timing = ast_true(v->value);
+			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;
@@ -2215,7 +2215,8 @@
 			ast_set_flag(&ast_options, AST_OPT_FLAG_OVERRIDE_CONFIG);
 			break;
 		case 'I':
-			option_internal_timing = 1;
+			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/test-this-branch/asterisk.sgml
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/asterisk.sgml?rev=16583&r1=16582&r2=16583&view=diff
==============================================================================
--- team/oej/test-this-branch/asterisk.sgml (original)
+++ team/oej/test-this-branch/asterisk.sgml Thu Mar 30 16:58:58 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/test-this-branch/channel.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/channel.c?rev=16583&r1=16582&r2=16583&view=diff
==============================================================================
--- team/oej/test-this-branch/channel.c (original)
+++ team/oej/test-this-branch/channel.c Thu Mar 30 16:58:58 2006
@@ -1985,11 +1985,17 @@
 
 				/* 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)) {
+				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) {
+						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;
@@ -2000,6 +2006,13 @@
 							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)) {
+						if (option_debug > 1)
+							ast_log(LOG_DEBUG, "Generator got CNG, switching to timed mode\n");
+						ast_settimeout(chan, 160, generator_force, chan);
+					}
 				}
 			}
 		}
@@ -2027,9 +2040,9 @@
 
 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);
+	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;
 }
 

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=16583&r1=16582&r2=16583&view=diff
==============================================================================
--- team/oej/test-this-branch/channels/chan_sip.c (original)
+++ team/oej/test-this-branch/channels/chan_sip.c Thu Mar 30 16:58:58 2006
@@ -12768,6 +12768,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);
@@ -12817,10 +12819,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/test-this-branch/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/include/asterisk/channel.h?rev=16583&r1=16582&r2=16583&view=diff
==============================================================================
--- team/oej/test-this-branch/include/asterisk/channel.h (original)
+++ team/oej/test-this-branch/include/asterisk/channel.h Thu Mar 30 16:58:58 2006
@@ -1143,11 +1143,11 @@
 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.
+  \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 silence suppression is enabled and the timing
+  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);

Modified: team/oej/test-this-branch/include/asterisk/indications.h
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/include/asterisk/indications.h?rev=16583&r1=16582&r2=16583&view=diff
==============================================================================
--- team/oej/test-this-branch/include/asterisk/indications.h (original)
+++ team/oej/test-this-branch/include/asterisk/indications.h Thu Mar 30 16:58:58 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/test-this-branch/include/asterisk/lock.h
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/include/asterisk/lock.h?rev=16583&r1=16582&r2=16583&view=diff
==============================================================================
--- team/oej/test-this-branch/include/asterisk/lock.h (original)
+++ team/oej/test-this-branch/include/asterisk/lock.h Thu Mar 30 16:58:58 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/test-this-branch/include/asterisk/options.h
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/include/asterisk/options.h?rev=16583&r1=16582&r2=16583&view=diff
==============================================================================
--- team/oej/test-this-branch/include/asterisk/options.h (original)
+++ team/oej/test-this-branch/include/asterisk/options.h Thu Mar 30 16:58:58 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,6 +99,7 @@
 #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;
 
@@ -104,7 +107,6 @@
 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/indications.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/indications.c?rev=16583&r1=16582&r2=16583&view=diff
==============================================================================
--- team/oej/test-this-branch/indications.c (original)
+++ team/oej/test-this-branch/indications.c Thu Mar 30 16:58:58 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/test-this-branch/res/res_indications.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/res/res_indications.c?rev=16583&r1=16582&r2=16583&view=diff
==============================================================================
--- team/oej/test-this-branch/res/res_indications.c (original)
+++ team/oej/test-this-branch/res/res_indications.c Thu Mar 30 16:58:58 2006
@@ -149,26 +149,20 @@
  */
 static int handle_show_indications(int fd, int argc, char *argv[])
 {
-	struct tone_zone *tz;
+	struct tone_zone *tz = NULL;
 	char buf[256];
 	int found_country = 0;
 
-	if (ast_mutex_lock(&tzlock)) {
-		ast_log(LOG_WARNING, "Unable to lock tone_zones list\n");
-		return 0;
-	}
 	if (argc == 2) {
 		/* no arguments, show a list of countries */
 		ast_cli(fd,"Country Alias   Description\n"
 			   "===========================\n");
-		for (tz=tone_zones; tz; tz=tz->next) {
+		while ( (tz = ast_walk_indications(tz) ) )
 			ast_cli(fd,"%-7.7s %-7.7s %s\n", tz->country, tz->alias, tz->description);
-		}
-		ast_mutex_unlock(&tzlock);
 		return 0;
 	}
 	/* there was a request for specific country(ies), lets humor them */
-	for (tz=tone_zones; tz; tz=tz->next) {
+	while ( (tz = ast_walk_indications(tz) ) ) {
 		int i,j;
 		for (i=2; i<argc; i++) {
 			if (strcasecmp(tz->country,argv[i])==0 &&
@@ -183,7 +177,8 @@
 				for (i=0; i<tz->nrringcadence; i++) {
 					j += snprintf(buf+j,sizeof(buf)-j,"%d,",tz->ringcadence[i]);
 				}
-				if (tz->nrringcadence) j--;
+				if (tz->nrringcadence)
+					j--;
 				ast_copy_string(buf+j,"\n",sizeof(buf)-j);
 				ast_cli(fd,buf);
 				for (ts=tz->tones; ts; ts=ts->next)
@@ -194,7 +189,6 @@
 	}
 	if (!found_country)
 		ast_cli(fd,"No countries matched your criteria.\n");
-	ast_mutex_unlock(&tzlock);
 	return -1;
 }
 

Modified: team/oej/test-this-branch/res/res_musiconhold.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/res/res_musiconhold.c?rev=16583&r1=16582&r2=16583&view=diff
==============================================================================
--- team/oej/test-this-branch/res/res_musiconhold.c (original)
+++ team/oej/test-this-branch/res/res_musiconhold.c Thu Mar 30 16:58:58 2006
@@ -776,6 +776,11 @@
 
 		if (i == class->total_files)
 			strcpy(class->filearray[class->total_files++], filepath);
+
+		/* If the new total files is equal to the maximum allowed, stop adding new ones */
+		if (class->total_files == MAX_MOHFILES)
+			break;
+
 	}
 
 	closedir(files_DIR);

Modified: team/oej/test-this-branch/res/snmp/agent.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/res/snmp/agent.c?rev=16583&r1=16582&r2=16583&view=diff
==============================================================================
--- team/oej/test-this-branch/res/snmp/agent.c (original)
+++ team/oej/test-this-branch/res/snmp/agent.c Thu Mar 30 16:58:58 2006
@@ -631,22 +631,16 @@
 								  int exact, size_t *var_len, WriteMethod **write_method)
 {
     static unsigned long long_ret;
-    struct tone_zone *tz;
+    struct tone_zone *tz = NULL;
 
     if (header_generic(vp, name, length, exact, var_len, write_method))
 		return NULL;
 
     switch (vp->magic) {
 	case ASTINDCOUNT:
-		if (ast_mutex_lock(&tzlock)) {
-			ast_log(LOG_WARNING, "Unable to lock tone_zones list\n");
-			snmp_log(LOG_ERR, "Unable to lock tone_zones list in ast_var_indications\n");
-			return NULL;
-		}
 		long_ret = 0;
-		for (tz = tone_zones; tz; tz = tz->next)
+		while ( (tz = ast_walk_indications(tz)) )
 			long_ret++;
-		ast_mutex_unlock(&tzlock);
 
 		return (u_char *)&long_ret;
 	case ASTINDCURRENT:
@@ -667,21 +661,15 @@
 									   int exact, size_t *var_len, WriteMethod **write_method)
 {
     static unsigned long long_ret;
-    struct tone_zone *tz;
+    struct tone_zone *tz = NULL;
     int i;
 
     if (header_simple_table(vp, name, length, exact, var_len, write_method, -1))
 		return NULL;
 
-    if (ast_mutex_lock(&tzlock)) {
-		ast_log(LOG_WARNING, "Unable to lock tone_zones list\n");
-		snmp_log(LOG_ERR, "Unable to lock tone_zones list in ast_var_indications_table\n");
-		return NULL;
-    }
     i = name[*length - 1] - 1;
-    for (tz = tone_zones; tz && i; tz = tz->next)
-		i--;
-    ast_mutex_unlock(&tzlock);
+    while ( (tz = ast_walk_indications(tz)) && i )
+	i--;
     if (tz == NULL)
 		return NULL;
 



More information about the asterisk-commits mailing list