[svn-commits] tilghman: branch 1.6.0 r160386 - in /branches/1.6.0: ./ channels/ channels/mi...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Dec 2 15:46:38 CST 2008


Author: tilghman
Date: Tue Dec  2 15:46:38 2008
New Revision: 160386

URL: http://svn.digium.com/view/asterisk?view=rev&rev=160386
Log:
Merged revisions 115313,121770,123272,139624,140205,144257 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
  r115313 | tilghman | 2008-05-05 15:22:08 -0500 (Mon, 05 May 2008) | 10 lines
  
  Merged revisions 115312 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
  r115312 | tilghman | 2008-05-05 15:17:55 -0500 (Mon, 05 May 2008) | 2 lines
  
  Reverse order, such that user configs override default selections
  
  ........
................
  r121770 | crichter | 2008-06-11 06:52:18 -0500 (Wed, 11 Jun 2008) | 9 lines
  
  Merged revisions 121751 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
  r121751 | crichter | 2008-06-11 11:28:04 +0200 (Mi, 11 Jun 2008) | 1 line
  
  fixed issue with previous commit, the find_free_channel test for channels which where inuse was broken.
  ........
................
  r123272 | russell | 2008-06-17 10:52:13 -0500 (Tue, 17 Jun 2008) | 12 lines
  
  Merged revisions 123271 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
  r123271 | russell | 2008-06-17 10:48:31 -0500 (Tue, 17 Jun 2008) | 4 lines
  
  Fix a memory leak in astobj2 that was pointed out by seanbright.  When a container
  got destroyed, the underlying bucket list entry for each object that was in the
  container at that time did not get free'd.
  
  ........
................
  r139624 | jpeeler | 2008-08-22 16:57:32 -0500 (Fri, 22 Aug 2008) | 13 lines
  
  Merged revisions 139621 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
  r139621 | jpeeler | 2008-08-22 16:36:13 -0500 (Fri, 22 Aug 2008) | 5 lines
  
  (closes issue #13359)
  Reported by: Laureano
  Patches:
        originate_channel_check.patch uploaded by Laureano (license 265)
  
  ........
................
  r140205 | jpeeler | 2008-08-26 13:48:55 -0500 (Tue, 26 Aug 2008) | 17 lines
  
  Merged revisions 140056 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
  r140056 | jpeeler | 2008-08-26 10:57:02 -0500 (Tue, 26 Aug 2008) | 9 lines
  
  (closes issue #12071)
  Reported by: tzafrir
  Patches:
        dahdi_close.diff uploaded by tzafrir (license 46)
  Tested by: tzafrir, jpeeler
  
  This patch fixes closing open file descriptors in the case of an error.
  
  
  ........
................
  r144257 | crichter | 2008-09-24 03:42:55 -0500 (Wed, 24 Sep 2008) | 9 lines
  
  Merged revisions 144238 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
  r144238 | crichter | 2008-09-24 10:20:52 +0200 (Mi, 24 Sep 2008) | 1 line
  
  improved helptext of misdn_set_opt.
  ........
................

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/Makefile
    branches/1.6.0/channels/chan_dahdi.c
    branches/1.6.0/channels/chan_misdn.c
    branches/1.6.0/channels/misdn/isdn_lib.c
    branches/1.6.0/main/manager.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/Makefile
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/Makefile?view=diff&rev=160386&r1=160385&r2=160386
==============================================================================
--- branches/1.6.0/Makefile (original)
+++ branches/1.6.0/Makefile Tue Dec  2 15:46:38 2008
@@ -353,7 +353,7 @@
 	@exit 1
 
 menuselect.makeopts: menuselect/menuselect menuselect-tree makeopts
-	menuselect/menuselect --check-deps $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts
+	menuselect/menuselect --check-deps menuselect.makeopts $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS)
 
 $(MOD_SUBDIRS_EMBED_LDSCRIPT):
 	@echo "EMBED_LDSCRIPTS+="`$(SILENTMAKE) -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
@@ -837,18 +837,8 @@
 
 nmenuconfig: nmenuselect
 
-menuselect: menuselect/cmenuselect menuselect/nmenuselect menuselect/gmenuselect
-	@if [ -x menuselect/nmenuselect ]; then \
-		$(MAKE) nmenuselect; \
-	elif [ -x menuselect/cmenuselect ]; then \
-		$(MAKE) cmenuselect; \
-	elif [ -x menuselect/gmenuselect ]; then \
-		$(MAKE) gmenuselect; \
-	else \
-		echo "No menuselect user interface found. Install ncurses,"; \
-		echo "newt or GTK libraries to build one and re-rerun"; \
-		echo "'make menuselect'."; \
-	fi
+menuselect: menuselect/menuselect menuselect-tree
+	- at menuselect/menuselect menuselect.makeopts $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
 
 cmenuselect: menuselect/cmenuselect menuselect-tree
 	- at menuselect/cmenuselect menuselect.makeopts $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
@@ -896,6 +886,4 @@
 asterisk.pdf:
 	$(MAKE) -C doc/tex asterisk.pdf
 
-.PHONY: menuselect main sounds clean dist-clean distclean all prereqs cleantest uninstall _uninstall uninstall-all pdf dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_DIST_CLEAN) $(SUBDIRS_CLEAN) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS) badshell installdirs _clean
-
-FORCE:
+.PHONY: menuselect menuselect.makeopts main sounds clean dist-clean distclean all prereqs cleantest uninstall _uninstall uninstall-all pdf dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_DIST_CLEAN) $(SUBDIRS_CLEAN) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS) badshell main/version.c include/asterisk/version.h installdirs

Modified: branches/1.6.0/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/channels/chan_dahdi.c?view=diff&rev=160386&r1=160385&r2=160386
==============================================================================
--- branches/1.6.0/channels/chan_dahdi.c (original)
+++ branches/1.6.0/channels/chan_dahdi.c Tue Dec  2 15:46:38 2008
@@ -1130,6 +1130,28 @@
 		close(fd);
 }
 
+static void dahdi_close_sub(struct dahdi_pvt *chan_pvt, int sub_num)
+{
+	dahdi_close(chan_pvt->subs[sub_num].dfd);
+	chan_pvt->subs[sub_num].dfd = -1;
+}
+
+#ifdef HAVE_PRI
+static void dahdi_close_pri_fd(struct dahdi_pri *pri, int fd_num)
+{
+	dahdi_close(pri->fds[fd_num]);
+	pri->fds[fd_num] = -1;
+}
+#endif
+
+#ifdef HAVE_SS7
+static void dahdi_close_ss7_fd(struct dahdi_ss7 *ss7, int fd_num)
+{
+	dahdi_close(ss7->fds[fd_num]);
+	ss7->fds[fd_num] = -1;
+}
+#endif
+
 static int dahdi_setlinear(int dfd, int linear)
 {
 	int res;
@@ -1169,7 +1191,7 @@
 
 	if (ioctl(p->subs[x].dfd, DAHDI_CHANNO, &p->subs[x].chan) == 1) {
 		ast_log(LOG_WARNING, "Unable to get channel number for pseudo channel on FD %d: %s\n", p->subs[x].dfd, strerror(errno));
-		dahdi_close(p->subs[x].dfd);
+		dahdi_close_sub(p, x);
 		p->subs[x].dfd = -1;
 		return -1;
 	}
@@ -1184,10 +1206,7 @@
 		return -1;
 	}
 	ast_debug(1, "Released sub %d of channel %d\n", x, p->channel);
-	if (p->subs[x].dfd > -1) {
-		dahdi_close(p->subs[x].dfd);
-	}
-	p->subs[x].dfd = -1;
+	dahdi_close_sub(p, x);
 	p->subs[x].linear = 0;
 	p->subs[x].chan = 0;
 	p->subs[x].owner = NULL;
@@ -2771,6 +2790,7 @@
 	if (p->vars)
 		ast_variables_destroy(p->vars);
 	ast_mutex_destroy(&p->lock);
+	dahdi_close_sub(p, SUB_REAL);
 	if (p->owner)
 		p->owner->tech_pvt = NULL;
 	free(p);
@@ -2806,9 +2826,6 @@
 				else
 					ifend = NULL;
 			}
-			if (cur->subs[SUB_REAL].dfd > -1) {
-				dahdi_close(cur->subs[SUB_REAL].dfd);
-			}
 			destroy_dahdi_pvt(&cur);
 		}
 	} else {
@@ -2825,9 +2842,6 @@
 			else
 				ifend = NULL;
 		}
-		if (cur->subs[SUB_REAL].dfd > -1) {
-			dahdi_close(cur->subs[SUB_REAL].dfd);
-		}
 		destroy_dahdi_pvt(&cur);
 	}
 	return 0;
@@ -2849,9 +2863,6 @@
 		/* Free any callerid */
 		if (p->cidspill)
 			ast_free(p->cidspill);
-		/* Close the DAHDI thingy */
-		if (p->subs[SUB_REAL].dfd > -1)
-			dahdi_close(p->subs[SUB_REAL].dfd);
 		pl = p;
 		p = p->next;
 		x = pl->channel;
@@ -8010,7 +8021,7 @@
 		x = channels[y];
 		if (ioctl(fd, DAHDI_SPECIFY, &x)) {
 			ast_log(LOG_WARNING, "Failed to specify channel %d: %s\n", channels[y], strerror(errno));
-			dahdi_close(fd);
+			close(fd);
 			return -1;
 		}
 		if (ioctl(fd, DAHDI_GET_PARAMS, &p)) {
@@ -8019,18 +8030,18 @@
 		}
 		if (ioctl(fd, DAHDI_SPANSTAT, &si)) {
 			ast_log(LOG_WARNING, "Failed go get span information on channel %d (span %d): %s\n", channels[y], p.spanno, strerror(errno));
-			dahdi_close(fd);
+			close(fd);
 			return -1;
 		}
 		span = p.spanno - 1;
 		if (pris[span].trunkgroup) {
 			ast_log(LOG_WARNING, "Span %d is already provisioned for trunk group %d\n", span + 1, pris[span].trunkgroup);
-			dahdi_close(fd);
+			close(fd);
 			return -1;
 		}
 		if (pris[span].pvts[0]) {
 			ast_log(LOG_WARNING, "Span %d is already provisioned with channels (implicit PRI maybe?)\n", span + 1);
-			dahdi_close(fd);
+			close(fd);
 			return -1;
 		}
 		if (!y) {
@@ -8041,7 +8052,7 @@
 		pris[ospan].dchannels[y] = channels[y];
 		pris[ospan].dchanavail[y] |= DCHAN_PROVISIONED;
 		pris[span].span = span + 1;
-		dahdi_close(fd);
+		close(fd);
 	}
 	return 0;	
 }
@@ -9986,7 +9997,7 @@
 			else {
 				/* Looks good.  Drop the pseudo channel now, clear up the assignment, and
 				   wakeup the potential sleeper */
-				dahdi_close(crv->subs[SUB_REAL].dfd);
+				dahdi_close_sub(crv, SUB_REAL);
 				pri->pvts[principle]->call = crv->call;
 				pri_assign_bearer(crv, pri, pri->pvts[principle]);
 				ast_debug(1, "Assigning bearer %d/%d to CRV %d:%d\n",
@@ -11334,22 +11345,19 @@
 		}
 		res = ioctl(pri->fds[i], DAHDI_GET_PARAMS, &p);
 		if (res) {
-			dahdi_close(pri->fds[i]);
-			pri->fds[i] = -1;
+			dahdi_close_pri_fd(pri, i);
 			ast_log(LOG_ERROR, "Unable to get parameters for D-channel %d (%s)\n", x, strerror(errno));
 			return -1;
 		}
 		if ((p.sigtype != DAHDI_SIG_HDLCFCS) && (p.sigtype != DAHDI_SIG_HARDHDLC)) {
-			dahdi_close(pri->fds[i]);
-			pri->fds[i] = -1;
+			dahdi_close_pri_fd(pri, i);
 			ast_log(LOG_ERROR, "D-channel %d is not in HDLC/FCS mode.\n", x);
 			return -1;
 		}
 		memset(&si, 0, sizeof(si));
 		res = ioctl(pri->fds[i], DAHDI_SPANSTAT, &si);
 		if (res) {
-			dahdi_close(pri->fds[i]);
-			pri->fds[i] = -1;
+			dahdi_close_pri_fd(pri, i);
 			ast_log(LOG_ERROR, "Unable to get span state for D-channel %d (%s)\n", x, strerror(errno));
 		}
 		if (!si.alarms)
@@ -11362,8 +11370,7 @@
 		bi.bufsize = 1024;
 		if (ioctl(pri->fds[i], DAHDI_SET_BUFINFO, &bi)) {
 			ast_log(LOG_ERROR, "Unable to set appropriate buffering on channel %d: %s\n", x, strerror(errno));
-			dahdi_close(pri->fds[i]);
-			pri->fds[i] = -1;
+			dahdi_close_pri_fd(pri, i);
 			return -1;
 		}
 		switch (pri->sig) {
@@ -11387,8 +11394,7 @@
 		if (i)
 			pri_enslave(pri->dchans[0], pri->dchans[i]);
 		if (!pri->dchans[i]) {
-			dahdi_close(pri->fds[i]);
-			pri->fds[i] = -1;
+			dahdi_close_pri_fd(pri, i);
 			ast_log(LOG_ERROR, "Unable to create PRI structure\n");
 			return -1;
 		}
@@ -11408,8 +11414,7 @@
 		for (i = 0; i < NUM_DCHANS; i++) {
 			if (!pri->dchannels[i])
 				break;
-			dahdi_close(pri->fds[i]);
-			pri->fds[i] = -1;
+			dahdi_close_pri_fd(pri, i);
 		}
 		ast_log(LOG_ERROR, "Unable to spawn D-channel: %s\n", strerror(errno));
 		return -1;
@@ -11888,7 +11893,7 @@
 #ifdef HAVE_PRI
 	for (i = 0; i < NUM_SPANS; i++) {
 		for (j = 0; j < NUM_DCHANS; j++)
-			dahdi_close(pris[i].fds[j]);
+			dahdi_close_pri_fd(&(pris[i]), j);
 	}
 
 	memset(pris, 0, sizeof(pris));
@@ -11905,7 +11910,7 @@
 #ifdef HAVE_SS7
 	for (i = 0; i < NUM_SPANS; i++) {
 		for (j = 0; j < NUM_DCHANS; j++)
-			dahdi_close(linksets[i].fds[j]);
+			dahdi_close_ss7_fd(&(linksets[i]), j);
 	}
 
 	memset(linksets, 0, sizeof(linksets));
@@ -12904,14 +12909,12 @@
 		}
 		res = ioctl(link->fds[curfd], DAHDI_GET_PARAMS, &p);
 		if (res) {
-			dahdi_close(link->fds[curfd]);
-			link->fds[curfd] = -1;
+			dahdi_close_ss7_fd(link, curfd);
 			ast_log(LOG_ERROR, "Unable to get parameters for sigchan %d (%s)\n", sigchan, strerror(errno));
 			return -1;
 		}
 		if ((p.sigtype != DAHDI_SIG_HDLCFCS) && (p.sigtype != DAHDI_SIG_HARDHDLC) && (p.sigtype != DAHDI_SIG_MTP2)) {
-			dahdi_close(link->fds[curfd]);
-			link->fds[curfd] = -1;
+			dahdi_close_ss7_fd(link, curfd);
 			ast_log(LOG_ERROR, "sigchan %d is not in HDLC/FCS mode.\n", sigchan);
 			return -1;
 		}
@@ -12923,8 +12926,7 @@
 
 		if (ioctl(link->fds[curfd], DAHDI_SET_BUFINFO, &bi)) {
 			ast_log(LOG_ERROR, "Unable to set appropriate buffering on channel %d: %s\n", sigchan, strerror(errno));
-			dahdi_close(link->fds[curfd]);
-			link->fds[curfd] = -1;
+			dahdi_close_ss7_fd(link, curfd);
 			return -1;
 		}
 
@@ -12938,8 +12940,7 @@
 		memset(&si, 0, sizeof(si));
 		res = ioctl(link->fds[curfd], DAHDI_SPANSTAT, &si);
 		if (res) {
-			dahdi_close(link->fds[curfd]);
-			link->fds[curfd] = -1;
+			dahdi_close_ss7_fd(link, curfd);
 			ast_log(LOG_ERROR, "Unable to get span state for sigchan %d (%s)\n", sigchan, strerror(errno));
 		}
 
@@ -13287,8 +13288,7 @@
 
 static int __unload_module(void)
 {
-	int x;
-	struct dahdi_pvt *p, *pl;
+	struct dahdi_pvt *p;
 #if defined(HAVE_PRI) || defined(HAVE_SS7)
 	int i, j;
 #endif
@@ -13336,34 +13336,14 @@
 	monitor_thread = AST_PTHREADT_STOP;
 	ast_mutex_unlock(&monlock);
 
-	ast_mutex_lock(&iflock);
-	/* Destroy all the interfaces and free their memory */
-	p = iflist;
-	while (p) {
-		/* Free any callerid */
-		if (p->cidspill)
-			ast_free(p->cidspill);
-		/* Close the DAHDI thingy */
-		if (p->subs[SUB_REAL].dfd > -1)
-			dahdi_close(p->subs[SUB_REAL].dfd);
-		pl = p;
-		p = p->next;
-		x = pl->channel;
-		/* Free associated memory */
-		if (pl)
-			destroy_dahdi_pvt(&pl);
-		ast_verb(3, "Unregistered channel %d\n", x);
-	}
-	iflist = NULL;
-	ifcount = 0;
-	ast_mutex_unlock(&iflock);
+	destroy_all_channels();
 
 #if defined(HAVE_PRI)
 	for (i = 0; i < NUM_SPANS; i++) {
 		if (pris[i].master && (pris[i].master != AST_PTHREADT_NULL))
 			pthread_join(pris[i].master, NULL);
 		for (j = 0; j < NUM_DCHANS; j++) {
-			dahdi_close(pris[i].fds[j]);
+			dahdi_close_pri_fd(&(pris[i]), j);
 		}
 	}
 #endif
@@ -13373,7 +13353,7 @@
 		if (linksets[i].master && (linksets[i].master != AST_PTHREADT_NULL))
 			pthread_join(linksets[i].master, NULL);
 		for (j = 0; j < NUM_DCHANS; j++) {
-			dahdi_close(linksets[i].fds[j]);
+			dahdi_close_ss7_fd(&(linksets[i]), j);
 		}
 	}
 #endif

Modified: branches/1.6.0/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/channels/chan_misdn.c?view=diff&rev=160386&r1=160385&r2=160386
==============================================================================
--- branches/1.6.0/channels/chan_misdn.c (original)
+++ branches/1.6.0/channels/chan_misdn.c Tue Dec  2 15:46:38 2008
@@ -5113,20 +5113,30 @@
 	ast_cli_register_multiple(chan_misdn_clis, sizeof(chan_misdn_clis) / sizeof(struct ast_cli_entry));
 
 	ast_register_application("misdn_set_opt", misdn_set_opt_exec, "misdn_set_opt",
-				 "misdn_set_opt(:<opt><optarg>:<opt><optarg>..):\n"
-				 "Sets mISDN opts. and optargs\n"
-				 "\n"
-				 "The available options are:\n"
-				 "    d - Send display text on called phone, text is the optparam\n"
-				 "    n - don't detect dtmf tones on called channel\n"
-				 "    h - make digital outgoing call\n" 
-				 "    c - make crypted outgoing call, param is keyindex\n"
-				 "    e - perform echo cancelation on this channel,\n"
-				 "        takes taps as arguments (32,64,128,256)\n"
-				 "    s - send Non Inband DTMF as inband\n"
-				 "   vr - rxgain control\n"
-				 "   vt - txgain control\n"
-				 "    i - Ignore detected dtmf tones, don't signal them to asterisk, they will be transported inband.\n"
+		"misdn_set_opt(:<opt><optarg>:<opt><optarg>...):\n"
+		"Sets mISDN opts. and optargs\n"
+		"\n"
+		"The available options are:\n"
+		"    a - Have Asterisk detect DTMF tones on called channel\n"
+		"    c - Make crypted outgoing call, optarg is keyindex\n"
+		"    d - Send display text to called phone, text is the optarg\n"
+		"    e - Perform echo cancelation on this channel,\n"
+		"        takes taps as optarg (32,64,128,256)\n"
+		"   e! - Disable echo cancelation on this channel\n"
+		"    f - Enable fax detection\n"
+		"    h - Make digital outgoing call\n" 
+		"   h1 - Make HDLC mode digital outgoing call\n" 
+		"    i - Ignore detected DTMF tones, don't signal them to Asterisk,\n"
+		"        they will be transported inband.\n"
+		"   jb - Set jitter buffer length, optarg is length\n"
+		"   jt - Set jitter buffer upper threshold, optarg is threshold\n"
+		"   jn - Disable jitter buffer\n"
+		"    n - disable DSP on channel, disables: Echocancel, DTMF Detection and Volume Control.\n"
+		"    p - Caller ID presentation,\n"
+		"        optarg is either 'allowed' or 'restricted'\n"
+		"    s - Send Non-inband DTMF as inband\n"
+		"   vr - Rx gain control, optarg is gain\n"
+		"   vt - Tx gain control, optarg is gain\n"
 		);
 
 	

Modified: branches/1.6.0/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/channels/misdn/isdn_lib.c?view=diff&rev=160386&r1=160385&r2=160386
==============================================================================
--- branches/1.6.0/channels/misdn/isdn_lib.c (original)
+++ branches/1.6.0/channels/misdn/isdn_lib.c Tue Dec  2 15:46:38 2008
@@ -3134,12 +3134,18 @@
 	struct timeval now;
 	gettimeofday(&now, NULL);
 	if (!bc->in_use) {
-		if (misdn_lib_port_is_pri(bc->port) && bc->last_used.tv_sec == now.tv_sec ) {
+		if ( bc->last_used.tv_sec == now.tv_sec ) {
 			cb_log(2,bc->port, "channel with stid:%x for one second still in use! (n:%d lu:%d)\n", bc->b_stid, (int) now.tv_sec, (int) bc->last_used.tv_sec);
 			return 1;
 		}
-	}
-	return 0;
+		
+
+		cb_log(3,bc->port, "channel with stid:%x not in use!\n", bc->b_stid);
+		return 0;
+	}
+	
+	cb_log(2,bc->port, "channel with stid:%x in use!\n", bc->b_stid);
+	return 1;
 }
 
 
@@ -3188,9 +3194,15 @@
 			if (channel > 0) {
 				if (channel <= stack->b_num) {
 					for (i = 0; i < stack->b_num; i++) {
-						if ( test_inuse(&stack->bc[i]) && stack->bc[i].channel == channel) {
-							cb_log(0,port,"Requested channel:%d on port:%d is already in use\n",channel, port);
-							return NULL;
+						if ( stack->bc[i].channel == channel) {
+							if (test_inuse(&stack->bc[i])) { 
+								cb_log(0,port,"Requested channel:%d on port:%d is already in use\n",channel, port);
+								return NULL;
+
+							} else {
+								prepare_bc(&stack->bc[i], channel);
+								return &stack->bc[i];
+							}
 						}
 					}
 				} else {
@@ -3203,7 +3215,7 @@
 
 			if (dec) {
 				for (i = maxnum-1; i>=0; i--) {
-					if (test_inuse(&stack->bc[i])) {
+					if (!test_inuse(&stack->bc[i])) {
 						/* 3. channel on bri means CW*/
 						if (!stack->pri && i==stack->b_num)
 							stack->bc[i].cw=1;
@@ -3215,7 +3227,7 @@
 				}
 			} else {
 				for (i = 0; i <maxnum; i++) {
-					if (test_inuse(&stack->bc[i])) {
+					if (!test_inuse(&stack->bc[i])) {
 						/* 3. channel on bri means CW*/
 						if (!stack->pri && i==stack->b_num)
 							stack->bc[i].cw=1;

Modified: branches/1.6.0/main/manager.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/manager.c?view=diff&rev=160386&r1=160385&r2=160386
==============================================================================
--- branches/1.6.0/main/manager.c (original)
+++ branches/1.6.0/main/manager.c Tue Dec  2 15:46:38 2008
@@ -2162,7 +2162,7 @@
 	int format = AST_FORMAT_SLINEAR;
 
 	pthread_t th;
-	if (!name) {
+	if (!ast_strlen_zero(name)) {
 		astman_send_error(s, m, "Channel not specified");
 		return 0;
 	}




More information about the svn-commits mailing list