[asterisk-commits] crichter: branch crichter/0.4.0 r39129 - in /team/crichter/0.4.0: ./ apps/ ch...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Aug 7 01:15:39 MST 2006


Author: crichter
Date: Mon Aug  7 03:15:38 2006
New Revision: 39129

URL: http://svn.digium.com/view/asterisk?rev=39129&view=rev
Log:
Merged revisions 36915,36940,37003,37147,37171,37177,37215,37229,37310,37322,37354,37364,37384,37405,37421,37444,37461,37507,37519,37534,37549,37574,37615,37700,37768,37811,37837,37862,37957,38171,38203,38237,38292,38313,38332,38350,38373,38424,38505,38553,38589,38614,38656,38658,38676,38689,38734,38764 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/team/crichter/0.3.0

........
r36915 | root | 2006-07-04 17:00:39 +0200 (Di, 04 Jul 2006) | 1 line

automerge commit
........
r36940 | crichter | 2006-07-04 19:02:59 +0200 (Di, 04 Jul 2006) | 1 line

removed the reloading of the ntdebug stuff, since this is a bit buggy, we only set it when loading chan_misdn for now. fixed a litle state problem when receiving RELEASE_COMPLETE. also we may only play tones to a NT when the extension does not match and such cases.
........
r37003 | root | 2006-07-05 18:00:35 +0200 (Mi, 05 Jul 2006) | 1 line

automerge commit
........
r37147 | root | 2006-07-06 16:00:36 +0200 (Do, 06 Jul 2006) | 1 line

automerge commit
........
r37171 | crichter | 2006-07-06 17:05:49 +0200 (Do, 06 Jul 2006) | 8 lines

* removed tone_indicate, we genrate only the dialtone by ourself (and the hanguptone of course)
* removed the state handling from release_chan, and simplified the ast_hangup/ast_queue_hangup stuff
* added pp_l2_check option, for pp lines where the pbx does not initially gets the L2 up
* simplified and fixed a bug in the pid generation code 
* fixed a bug in empty_chan, which might cause segfaults and memorry corruptions
* added prepare_bc function, which is sort of the opposite of empty_bc


........
r37177 | root | 2006-07-06 18:00:35 +0200 (Do, 06 Jul 2006) | 1 line

automerge commit
........
r37215 | root | 2006-07-06 23:00:20 +0200 (Do, 06 Jul 2006) | 1 line

automerge commit
........
r37229 | root | 2006-07-07 00:00:30 +0200 (Fr, 07 Jul 2006) | 1 line

automerge commit
........
r37310 | root | 2006-07-08 02:00:26 +0200 (Sa, 08 Jul 2006) | 1 line

automerge commit
........
r37322 | crichter | 2006-07-10 13:03:27 +0200 (Mo, 10 Jul 2006) | 1 line

removed unnecessary locking, which might have created deadlocks. removed find_chan_by_l3id, since the l3id is not unique over all ports. removed automatic nt_stack reinitialization, since this creates segfaults.
........
r37354 | crichter | 2006-07-10 22:51:40 +0200 (Mo, 10 Jul 2006) | 1 line

removed mqueue branch reference, because mqueue is head now.
........
r37364 | root | 2006-07-11 00:00:21 +0200 (Di, 11 Jul 2006) | 1 line

automerge commit
........
r37384 | root | 2006-07-11 22:00:26 +0200 (Di, 11 Jul 2006) | 1 line

automerge commit
........
r37405 | root | 2006-07-12 06:00:20 +0200 (Mi, 12 Jul 2006) | 1 line

automerge commit
........
r37421 | root | 2006-07-12 16:00:25 +0200 (Mi, 12 Jul 2006) | 1 line

automerge commit
........
r37444 | root | 2006-07-12 18:00:21 +0200 (Mi, 12 Jul 2006) | 1 line

automerge commit
........
r37461 | root | 2006-07-12 21:00:22 +0200 (Mi, 12 Jul 2006) | 1 line

automerge commit
........
r37507 | crichter | 2006-07-13 16:07:28 +0200 (Do, 13 Jul 2006) | 1 line

added even more statefulness for sending out disconnect/release/release_complete messages. added support for incoming presentation/screening. fixed a bug that we generate TONE_EVENTS on hanguptone_indicatem, which caused asterisk to write blocking thread messages. added nodialtone option to prevent dialtone for always_immediate 
........
r37519 | root | 2006-07-13 18:00:59 +0200 (Do, 13 Jul 2006) | 1 line

automerge commit
........
r37534 | root | 2006-07-13 19:00:21 +0200 (Do, 13 Jul 2006) | 1 line

automerge commit
........
r37549 | root | 2006-07-13 21:00:20 +0200 (Do, 13 Jul 2006) | 1 line

automerge commit
........
r37574 | root | 2006-07-14 00:00:21 +0200 (Fr, 14 Jul 2006) | 1 line

automerge commit
........
r37615 | root | 2006-07-14 16:00:24 +0200 (Fr, 14 Jul 2006) | 1 line

automerge commit
........
r37700 | root | 2006-07-16 02:00:20 +0200 (So, 16 Jul 2006) | 1 line

automerge commit
........
r37768 | root | 2006-07-17 18:00:21 +0200 (Mo, 17 Jul 2006) | 1 line

automerge commit
........
r37811 | root | 2006-07-18 01:00:20 +0200 (Di, 18 Jul 2006) | 1 line

automerge commit
........
r37837 | root | 2006-07-18 02:00:19 +0200 (Di, 18 Jul 2006) | 1 line

automerge commit
........
r37862 | root | 2006-07-18 03:00:20 +0200 (Di, 18 Jul 2006) | 1 line

automerge commit
........
r37957 | root | 2006-07-19 20:00:25 +0200 (Mi, 19 Jul 2006) | 1 line

automerge commit
........
r38171 | root | 2006-07-24 20:00:20 +0200 (Mo, 24 Jul 2006) | 1 line

automerge commit
........
r38203 | root | 2006-07-25 22:00:22 +0200 (Di, 25 Jul 2006) | 1 line

automerge commit
........
r38237 | root | 2006-07-26 18:00:33 +0200 (Mi, 26 Jul 2006) | 1 line

automerge commit
........
r38292 | root | 2006-07-27 04:00:21 +0200 (Do, 27 Jul 2006) | 1 line

automerge commit
........
r38313 | root | 2006-07-27 05:00:19 +0200 (Do, 27 Jul 2006) | 1 line

automerge commit
........
r38332 | root | 2006-07-27 07:00:21 +0200 (Do, 27 Jul 2006) | 1 line

automerge commit
........
r38350 | root | 2006-07-27 18:00:23 +0200 (Do, 27 Jul 2006) | 1 line

automerge commit
........
r38373 | root | 2006-07-28 01:00:20 +0200 (Fr, 28 Jul 2006) | 1 line

automerge commit
........
r38424 | root | 2006-07-28 21:00:23 +0200 (Fr, 28 Jul 2006) | 1 line

automerge commit
........
r38505 | root | 2006-07-30 02:00:23 +0200 (So, 30 Jul 2006) | 1 line

automerge commit
........
r38553 | root | 2006-07-31 07:00:22 +0200 (Mo, 31 Jul 2006) | 1 line

automerge commit
........
r38589 | root | 2006-07-31 20:00:24 +0200 (Mo, 31 Jul 2006) | 1 line

automerge commit
........
r38614 | root | 2006-08-01 00:00:20 +0200 (Di, 01 Aug 2006) | 1 line

automerge commit
........
r38656 | crichter | 2006-08-01 21:57:35 +0200 (Di, 01 Aug 2006) | 25 lines

* removed pp_l2_check (fixed L2 bug in mISDNuser)
* added blocking flag to stack object. A port can be blocked/unblocked from the
  cli
* added EVENT_PORT_ALARM to send alarm infos to the chan_misdn.c layer (later	
  we can add a manager event for that)
* added block_on_alarm option, to block the port whenever a ALARM occurs
* added need_busy flag to indicate if we've sended a CONTROL_BUSY already
* changed a bunch of cb_log(-1,..) to cb_log(0,..) due to funny behaviour in 
  recent asterisk ast_log messages..
* fixed a few ETSI state violations, especially when finishing calls in 
  different seldom states
* changed debug levels a lot to make the log more readable in low debuglevels
* some first fixes for the HOLD/RETRIEVE stuff (doesn't work totally still)
* removed the PRECONNECTED state stuff
* added cause 27 when we get a CLEANUP directly after a outgoing SETUP, this
  creates a CHANISUNAVAIL instead of a NOANSWER
* removed the addr pointer from "misdn show stacks" that's not needed anymore 
  and makes the output more unreadable
* added cause saving on RELEASE/RELEASE_COMPLETE
* set cause to 16 on prepare_bc
* removed stack getting from ph_control functions, we don't really need it 
  there
* added beroec api


........
r38658 | root | 2006-08-01 22:00:21 +0200 (Di, 01 Aug 2006) | 1 line

automerge commit
........
r38676 | crichter | 2006-08-01 22:15:57 +0200 (Di, 01 Aug 2006) | 1 line

the alarm message has no call, so we shouldn't search for a chan_list object
........
r38689 | root | 2006-08-02 02:00:20 +0200 (Mi, 02 Aug 2006) | 1 line

automerge commit
........
r38734 | root | 2006-08-02 22:00:27 +0200 (Mi, 02 Aug 2006) | 1 line

automerge commit
........
r38764 | root | 2006-08-03 08:00:21 +0200 (Do, 03 Aug 2006) | 1 line

automerge commit
........

Modified:
    team/crichter/0.4.0/   (props changed)
    team/crichter/0.4.0/app.c
    team/crichter/0.4.0/apps/app_chanspy.c
    team/crichter/0.4.0/apps/app_sms.c
    team/crichter/0.4.0/apps/app_voicemail.c
    team/crichter/0.4.0/apps/app_zapras.c
    team/crichter/0.4.0/asterisk.c
    team/crichter/0.4.0/channel.c
    team/crichter/0.4.0/channels/Makefile
    team/crichter/0.4.0/channels/chan_agent.c
    team/crichter/0.4.0/channels/chan_iax2.c
    team/crichter/0.4.0/channels/chan_misdn.c
    team/crichter/0.4.0/channels/chan_modem.c
    team/crichter/0.4.0/channels/chan_oss.c
    team/crichter/0.4.0/channels/chan_sip.c
    team/crichter/0.4.0/channels/chan_zap.c
    team/crichter/0.4.0/channels/misdn/Makefile
    team/crichter/0.4.0/channels/misdn/chan_misdn_config.h
    team/crichter/0.4.0/channels/misdn/isdn_lib.c
    team/crichter/0.4.0/channels/misdn/isdn_lib.h
    team/crichter/0.4.0/channels/misdn/isdn_lib_intern.h
    team/crichter/0.4.0/channels/misdn/isdn_msg_parser.c
    team/crichter/0.4.0/channels/misdn_config.c
    team/crichter/0.4.0/codecs/gsm/Makefile
    team/crichter/0.4.0/configs/iax.conf.sample
    team/crichter/0.4.0/configs/misdn.conf.sample
    team/crichter/0.4.0/contrib/init.d/rc.mandrake.zaptel
    team/crichter/0.4.0/doc/README.enum
    team/crichter/0.4.0/doc/README.misdn
    team/crichter/0.4.0/enum.c
    team/crichter/0.4.0/formats/format_h263.c
    team/crichter/0.4.0/frame.c
    team/crichter/0.4.0/funcs/func_db.c
    team/crichter/0.4.0/pbx/pbx_config.c
    team/crichter/0.4.0/res/res_agi.c
    team/crichter/0.4.0/res/res_features.c
    team/crichter/0.4.0/res/res_musiconhold.c
    team/crichter/0.4.0/rtp.c
    team/crichter/0.4.0/utils.c

Propchange: team/crichter/0.4.0/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Aug  7 03:15:38 2006
@@ -1,1 +1,1 @@
-/team/crichter/0.3.0:1-36869
+/team/crichter/0.3.0:1-38802

Modified: team/crichter/0.4.0/app.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/app.c?rev=39129&r1=39128&r2=39129&view=diff
==============================================================================
--- team/crichter/0.4.0/app.c (original)
+++ team/crichter/0.4.0/app.c Mon Aug  7 03:15:38 2006
@@ -1158,7 +1158,7 @@
 	snprintf(fs, strlen(path) + 19, "%s/.lock-%08x", path, rand());
 	fd = open(fs, O_WRONLY | O_CREAT | O_EXCL, 0600);
 	if (fd < 0) {
-		fprintf(stderr, "Unable to create lock file '%s': %s\n", path, strerror(errno));
+		ast_log(LOG_ERROR, "Unable to create lock file '%s': %s\n", path, strerror(errno));
 		return AST_LOCK_PATH_NOT_FOUND;
 	}
 	close(fd);
@@ -1167,11 +1167,13 @@
 	time(&start);
 	while (((res = link(fs, s)) < 0) && (errno == EEXIST) && (time(NULL) - start < 5))
 		usleep(1);
+
+	unlink(fs);
+
 	if (res) {
 		ast_log(LOG_WARNING, "Failed to lock path '%s': %s\n", path, strerror(errno));
 		return AST_LOCK_TIMEOUT;
 	} else {
-		unlink(fs);
 		ast_log(LOG_DEBUG, "Locked path '%s'\n", path);
 		return AST_LOCK_SUCCESS;
 	}
@@ -1180,12 +1182,22 @@
 int ast_unlock_path(const char *path)
 {
 	char *s;
+	int res;
+
 	s = alloca(strlen(path) + 10);
-	if (!s)
+	if (!s) {
+		ast_log(LOG_WARNING, "Out of memory!\n");
 		return -1;
+	}
+
 	snprintf(s, strlen(path) + 9, "%s/%s", path, ".lock");
-	ast_log(LOG_DEBUG, "Unlocked path '%s'\n", path);
-	return unlink(s);
+
+	if ((res = unlink(s)))
+		ast_log(LOG_ERROR, "Could not unlock path '%s': %s\n", path, strerror(errno));
+	else
+		ast_log(LOG_DEBUG, "Unlocked path '%s'\n", path);
+
+	return res;
 }
 
 int ast_record_review(struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime, const char *fmt, int *duration, const char *path) 

Modified: team/crichter/0.4.0/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/apps/app_chanspy.c?rev=39129&r1=39128&r2=39129&view=diff
==============================================================================
--- team/crichter/0.4.0/apps/app_chanspy.c (original)
+++ team/crichter/0.4.0/apps/app_chanspy.c Mon Aug  7 03:15:38 2006
@@ -419,19 +419,19 @@
 		char *opts[OPT_ARG_ARRAY_SIZE];
 		ast_app_parse_options(chanspy_opts, &flags, opts, options);
 		if (ast_test_flag(&flags, OPTION_GROUP)) {
-			mygroup = opts[1];
+			mygroup = opts[OPT_ARG_GROUP];
 		}
 		if (ast_test_flag(&flags, OPTION_RECORD)) {
-			if (!(recbase = opts[2])) {
+			if (!(recbase = opts[OPT_ARG_RECORD])) {
 				recbase = "chanspy";
 			}
 		}
 		silent = ast_test_flag(&flags, OPTION_QUIET);
 		bronly = ast_test_flag(&flags, OPTION_BRIDGED);
-		if (ast_test_flag(&flags, OPTION_VOLUME) && opts[1]) {
+		if (ast_test_flag(&flags, OPTION_VOLUME) && opts[OPT_ARG_VOLUME]) {
 			int vol;
 
-			if ((sscanf(opts[0], "%d", &vol) != 1) || (vol > 4) || (vol < -4))
+			if ((sscanf(opts[OPT_ARG_VOLUME], "%d", &vol) != 1) || (vol > 4) || (vol < -4))
 				ast_log(LOG_NOTICE, "Volume factor must be a number between -4 and 4\n");
 			else
 				volfactor = vol;

Modified: team/crichter/0.4.0/apps/app_sms.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/apps/app_sms.c?rev=39129&r1=39128&r2=39129&view=diff
==============================================================================
--- team/crichter/0.4.0/apps/app_sms.c (original)
+++ team/crichter/0.4.0/apps/app_sms.c Mon Aug  7 03:15:38 2006
@@ -1205,7 +1205,8 @@
 	f.datalen = samples * 2;
 #endif
 	f.offset = AST_FRIENDLY_OFFSET;
-	f.data = buf + AST_FRIENDLY_OFFSET;
+	f.mallocd = 0;
+	f.data = buf;
 	f.samples = samples;
 	f.src = "app_sms";
 	/* create a buffer containing the digital sms pattern */

Modified: team/crichter/0.4.0/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/apps/app_voicemail.c?rev=39129&r1=39128&r2=39129&view=diff
==============================================================================
--- team/crichter/0.4.0/apps/app_voicemail.c (original)
+++ team/crichter/0.4.0/apps/app_voicemail.c Mon Aug  7 03:15:38 2006
@@ -2617,7 +2617,8 @@
 				} else if (ast_fileexists(tmptxtfile, NULL, NULL) <= 0) {
 					if (option_debug) 
 						ast_log(LOG_DEBUG, "The recorded media file is gone, so we should remove the .txt file too!\n");
-					unlink(tmptxtfile);	
+					unlink(tmptxtfile);
+					ast_unlock_path(dir);
 				} else {
 					for (;;) {
 						make_file(fn, sizeof(fn), dir, msgnum);
@@ -3632,6 +3633,11 @@
 	if (!ast_strlen_zero(category))
 		res = ast_play_and_wait(chan, category);
 
+	if (res) {
+		ast_log(LOG_WARNING, "No sound file for category '%s' was found.\n", category);
+		res = 0;
+	}
+
 	return res;
 }
 
@@ -4374,7 +4380,7 @@
 		if (vms->newmessages) {
 			res = say_and_wait(chan, vms->newmessages, chan->language);
 			if (!res) {
-				if (vms->oldmessages == 1)
+				if (vms->newmessages == 1)
 					res = ast_play_and_wait(chan, "vm-INBOXs");
 				else
 					res = ast_play_and_wait(chan, "vm-INBOX");

Modified: team/crichter/0.4.0/apps/app_zapras.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/apps/app_zapras.c?rev=39129&r1=39128&r2=39129&view=diff
==============================================================================
--- team/crichter/0.4.0/apps/app_zapras.c (original)
+++ team/crichter/0.4.0/apps/app_zapras.c Mon Aug  7 03:15:38 2006
@@ -127,12 +127,6 @@
 	argv[argc++] = "plugin";
 	argv[argc++] = "zaptel.so";
 	argv[argc++] = "stdin";
-
-#if 0
-	for (x=0;x<argc;x++) {
-		fprintf(stderr, "Arg %d: %s\n", x, argv[x]);
-	}
-#endif
 
 	/* Finally launch PPP */
 	execv(PPP_EXEC, argv);

Modified: team/crichter/0.4.0/asterisk.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/asterisk.c?rev=39129&r1=39128&r2=39129&view=diff
==============================================================================
--- team/crichter/0.4.0/asterisk.c (original)
+++ team/crichter/0.4.0/asterisk.c Mon Aug  7 03:15:38 2006
@@ -734,15 +734,9 @@
  Called by soft_hangup to interrupt the poll, read, or other
  system call.  We don't actually need to do anything though.  
  Remember: Cannot EVER ast_log from within a signal handler 
- SLD: seems to be some pthread activity relating to the printf anyway:
- which is leading to a deadlock? 
  */
 static void urg_handler(int num)
 {
-#if 0
-	if (option_debug > 2) 
-		printf("-- Asterisk Urgent handler\n");
-#endif
 	signal(num, urg_handler);
 	return;
 }
@@ -1000,46 +994,40 @@
 {
 	printf(term_end());
 	fflush(stdout);
+
 	/* Called when readline data is available */
-	if (s && !ast_all_zeros(s))
+	if (!ast_all_zeros(s))
 		ast_el_add_history(s);
-	/* Give the console access to the shell */
-	if (s) {
-		/* The real handler for bang */
-		if (s[0] == '!') {
-			if (s[1])
-				ast_safe_system(s+1);
-			else
-				ast_safe_system(getenv("SHELL") ? getenv("SHELL") : "/bin/sh");
-		} else 
+	/* The real handler for bang */
+	if (s[0] == '!') {
+		if (s[1])
+			ast_safe_system(s+1);
+		else
+			ast_safe_system(getenv("SHELL") ? getenv("SHELL") : "/bin/sh");
+	} else 
 		ast_cli_command(STDOUT_FILENO, s);
-	} else
-		fprintf(stdout, "\nUse \"quit\" to exit\n");
 }
 
 static int remoteconsolehandler(char *s)
 {
 	int ret = 0;
+
 	/* Called when readline data is available */
-	if (s && !ast_all_zeros(s))
+	if (!ast_all_zeros(s))
 		ast_el_add_history(s);
-	/* Give the console access to the shell */
-	if (s) {
-		/* The real handler for bang */
-		if (s[0] == '!') {
-			if (s[1])
-				ast_safe_system(s+1);
-			else
-				ast_safe_system(getenv("SHELL") ? getenv("SHELL") : "/bin/sh");
-			ret = 1;
-		}
-		if ((strncasecmp(s, "quit", 4) == 0 || strncasecmp(s, "exit", 4) == 0) &&
-		    (s[4] == '\0' || isspace(s[4]))) {
-			quit_handler(0, 0, 0, 0);
-			ret = 1;
-		}
-	} else
-		fprintf(stdout, "\nUse \"quit\" to exit\n");
+	/* The real handler for bang */
+	if (s[0] == '!') {
+		if (s[1])
+			ast_safe_system(s+1);
+		else
+			ast_safe_system(getenv("SHELL") ? getenv("SHELL") : "/bin/sh");
+		ret = 1;
+	}
+	if ((strncasecmp(s, "quit", 4) == 0 || strncasecmp(s, "exit", 4) == 0) &&
+	    (s[4] == '\0' || isspace(s[4]))) {
+		quit_handler(0, 0, 0, 0);
+		ret = 1;
+	}
 
 	return ret;
 }
@@ -2431,7 +2419,7 @@
 				consolehandler((char *)buf);
 			} else {
 				if (write(STDOUT_FILENO, "\nUse EXIT or QUIT to exit the asterisk console\n",
-								  strlen("\nUse EXIT or QUIT to exit the asterisk console\n")) < 0) {
+					  strlen("\nUse EXIT or QUIT to exit the asterisk console\n")) < 0) {
 					/* Whoa, stdout disappeared from under us... Make /dev/null's */
 					int fd;
 					fd = open("/dev/null", O_RDWR);

Modified: team/crichter/0.4.0/channel.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/channel.c?rev=39129&r1=39128&r2=39129&view=diff
==============================================================================
--- team/crichter/0.4.0/channel.c (original)
+++ team/crichter/0.4.0/channel.c Mon Aug  7 03:15:38 2006
@@ -2345,6 +2345,13 @@
 	
 	/* Now we have a good choice for both. */
 	ast_mutex_lock(&chan->lock);
+
+	if ((*rawformat == native) && (*format == fmt)) {
+		/* the channel is already in these formats, so nothing to do */
+		ast_mutex_unlock(&chan->lock);
+		return 0;
+	}
+
 	*rawformat = native;
 	/* User perspective is fmt */
 	*format = fmt;
@@ -2748,25 +2755,43 @@
 {
 	struct ast_frame null = { AST_FRAME_NULL, };
 	int res = -1;
-
-	/* each of these channels may be sitting behind a channel proxy (i.e. chan_agent)
-	   and if so, we don't really want to masquerade it, but its proxy */
-	if (original->_bridge && (original->_bridge != ast_bridged_channel(original)))
-		original = original->_bridge;
-
-	if (clone->_bridge && (clone->_bridge != ast_bridged_channel(clone)))
-		clone = clone->_bridge;
-
-	if (original == clone) {
-		ast_log(LOG_WARNING, "Can't masquerade channel '%s' into itself!\n", original->name);
-		return -1;
-	}
+	struct ast_channel *final_orig = original, *final_clone = clone;
+
 	ast_mutex_lock(&original->lock);
 	while(ast_mutex_trylock(&clone->lock)) {
 		ast_mutex_unlock(&original->lock);
 		usleep(1);
 		ast_mutex_lock(&original->lock);
 	}
+
+	/* each of these channels may be sitting behind a channel proxy (i.e. chan_agent)
+	   and if so, we don't really want to masquerade it, but its proxy */
+	if (original->_bridge && (original->_bridge != ast_bridged_channel(original)))
+		final_orig = original->_bridge;
+
+	if (clone->_bridge && (clone->_bridge != ast_bridged_channel(clone)))
+		final_clone = clone->_bridge;
+
+	if ((final_orig != original) || (final_clone != clone)) {
+		ast_mutex_lock(&final_orig->lock);
+		while(ast_mutex_trylock(&final_clone->lock)) {
+			ast_mutex_unlock(&final_orig->lock);
+			usleep(1);
+			ast_mutex_lock(&final_orig->lock);
+		}
+		ast_mutex_unlock(&clone->lock);
+		ast_mutex_unlock(&original->lock);
+		original = final_orig;
+		clone = final_clone;
+	}
+
+	if (original == clone) {
+		ast_log(LOG_WARNING, "Can't masquerade channel '%s' into itself!\n", original->name);
+		ast_mutex_unlock(&clone->lock);
+		ast_mutex_unlock(&original->lock);
+		return -1;
+	}
+
 	ast_log(LOG_DEBUG, "Planning to masquerade channel %s into the structure of %s\n",
 		clone->name, original->name);
 	if (original->masq) {
@@ -2783,8 +2808,10 @@
 		ast_log(LOG_DEBUG, "Done planning to masquerade channel %s into the structure of %s\n", clone->name, original->name);
 		res = 0;
 	}
+
 	ast_mutex_unlock(&clone->lock);
 	ast_mutex_unlock(&original->lock);
+
 	return res;
 }
 
@@ -3353,7 +3380,6 @@
 	struct timeval nexteventts = { 0, };
 	char caller_warning = 0;
 	char callee_warning = 0;
-	int to;
 
 	if (c0->_bridge) {
 		ast_log(LOG_WARNING, "%s is already in a bridge with %s\n", 
@@ -3405,20 +3431,28 @@
 	o0nativeformats = c0->nativeformats;
 	o1nativeformats = c1->nativeformats;
 
-	if (config->timelimit) {
+	if (config->feature_timer) {
+		nexteventts = ast_tvadd(config->start_time, ast_samp2tv(config->feature_timer, 1000));
+	} else if (config->timelimit) {
 		nexteventts = ast_tvadd(config->start_time, ast_samp2tv(config->timelimit, 1000));
 		if (caller_warning || callee_warning)
 			nexteventts = ast_tvsub(nexteventts, ast_samp2tv(config->play_warning, 1000));
 	}
 
 	for (/* ever */;;) {
+		struct timeval now;
+		int to;
+
 		to = -1;
-		if (config->timelimit) {
-			struct timeval now;
+
+		if (!ast_tvzero(nexteventts)) {
 			now = ast_tvnow();
 			to = ast_tvdiff_ms(nexteventts, now);
 			if (to < 0)
 				to = 0;
+		}
+
+		if (config->timelimit) {
 			time_left_ms = config->timelimit - ast_tvdiff_ms(now, config->start_time);
 			if (time_left_ms < to)
 				to = time_left_ms;
@@ -3483,7 +3517,8 @@
 		    (config->timelimit == 0) &&
 		    (c0->tech->bridge == c1->tech->bridge) &&
 		    !nativefailed && !c0->monitor && !c1->monitor &&
-		    !c0->spies && !c1->spies) {
+		    !c0->spies && !c1->spies && !ast_test_flag(&(config->features_callee),AST_FEATURE_REDIRECT) &&
+		    !ast_test_flag(&(config->features_caller),AST_FEATURE_REDIRECT) ) {
 			/* Looks like they share a bridge method and nothing else is in the way */
 			if (option_verbose > 2) 
 				ast_verbose(VERBOSE_PREFIX_3 "Attempting native bridge of %s and %s\n", c0->name, c1->name);

Modified: team/crichter/0.4.0/channels/Makefile
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/channels/Makefile?rev=39129&r1=39128&r2=39129&view=diff
==============================================================================
--- team/crichter/0.4.0/channels/Makefile (original)
+++ team/crichter/0.4.0/channels/Makefile Mon Aug  7 03:15:38 2006
@@ -83,7 +83,12 @@
 
 ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/mISDNuser/mISDNlib.h),)
   CHANNEL_LIBS+=chan_misdn.so
-  CFLAGS+=-Imisdn 
+  CFLAGS+=-Imisdn  
+endif
+
+ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/lib/libbnec.so),)
+  MISDNECLIB=-lbnec
+  CFLAGS+=-DWITH_BEROEC
 endif
 
 CFLAGS+=-Wno-missing-prototypes -Wno-missing-declarations
@@ -237,8 +242,8 @@
 misdn/chan_misdn_lib.a:
 	make -C misdn
 
-chan_misdn.so: chan_misdn.o misdn_config.o misdn/chan_misdn_lib.a
-	$(CC) -shared -Xlinker -x -L/usr/lib -o $@ $^ -lisdnnet -lmISDN
+chan_misdn.so: chan_misdn.o misdn_config.o misdn/chan_misdn_lib.a 
+	$(CC) -shared -Xlinker -x -L/usr/lib -o $@ $^ -lisdnnet -lmISDN $(MISDNECLIB)
 
 chan_misdn.o: chan_misdn.c 
 	$(CC) $(CFLAGS) -DCHAN_MISDN_VERSION=\"0.4.0\" -c $< -o $@

Modified: team/crichter/0.4.0/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/channels/chan_agent.c?rev=39129&r1=39128&r2=39129&view=diff
==============================================================================
--- team/crichter/0.4.0/channels/chan_agent.c (original)
+++ team/crichter/0.4.0/channels/chan_agent.c Mon Aug  7 03:15:38 2006
@@ -795,14 +795,16 @@
 			ast_mutex_lock(&p->chan->lock);
 			ast_softhangup(p->chan, AST_SOFTHANGUP_EXPLICIT);
 			ast_mutex_unlock(&p->chan->lock);
-		} else {
+		} else if (p->loginstart) {
 			ast_mutex_lock(&p->chan->lock);
 			ast_moh_start(p->chan, p->moh);
 			ast_mutex_unlock(&p->chan->lock);
 		}
 	}
 	ast_mutex_unlock(&p->lock);
-	ast_device_state_changed("Agent/%s", p->agent);
+	/* Only register a device state change if the agent is still logged in */
+	if (p->loginstart)
+		ast_device_state_changed("Agent/%s", p->agent);
 
 	if (p->pending) {
 		ast_mutex_lock(&agentlock);

Modified: team/crichter/0.4.0/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/channels/chan_iax2.c?rev=39129&r1=39128&r2=39129&view=diff
==============================================================================
--- team/crichter/0.4.0/channels/chan_iax2.c (original)
+++ team/crichter/0.4.0/channels/chan_iax2.c Mon Aug  7 03:15:38 2006
@@ -147,6 +147,7 @@
 static char language[MAX_LANGUAGE] = "";
 static char regcontext[AST_MAX_CONTEXT] = "";
 
+static int maxauthreq = 0;
 static int max_retries = 4;
 static int ping_time = 20;
 static int lagrq_time = 10;
@@ -264,7 +265,8 @@
 	IAX_RTAUTOCLEAR = 	(1 << 19), 	/*!< erase me on expire */ 
 	IAX_FORCEJITTERBUF =	(1 << 20),	/*!< Force jitterbuffer, even when bridged to a channel that can take jitter */ 
 	IAX_RTIGNOREREGEXPIRE =	(1 << 21),	/*!< When using realtime, ignore registration expiration */
-	IAX_TRUNKTIMESTAMPS =	(1 << 22)	/*!< Send trunk timestamps */
+	IAX_TRUNKTIMESTAMPS =	(1 << 22),	/*!< Send trunk timestamps */
+	IAX_MAXAUTHREQ =        (1 << 23)       /*!< Maximum outstanding AUTHREQ restriction is in place */
 } iax2_flags;
 
 static int global_rtautoclear = 120;
@@ -285,6 +287,8 @@
 	int amaflags;
 	unsigned int flags;
 	int capability;
+	int maxauthreq; /*!< Maximum allowed outstanding AUTHREQs */
+	int curauthreq; /*!< Current number of outstanding AUTHREQs */
 	char cid_num[AST_MAX_EXTENSION];
 	char cid_name[AST_MAX_EXTENSION];
 	struct ast_codec_pref prefs;
@@ -659,6 +663,15 @@
 static void destroy_peer(struct iax2_peer *peer);
 static int ast_cli_netstats(int fd, int limit_fmt);
 
+#ifdef __AST_DEBUG_MALLOC
+static void FREE(void *ptr)
+{
+	free(ptr);
+}
+#else
+#define FREE free
+#endif
+
 static void iax_debug_output(const char *data)
 {
 	if (iaxdebug)
@@ -1525,6 +1538,7 @@
 {
 	struct ast_channel *c;
 	struct chan_iax2_pvt *pvt;
+	struct iax2_user *user;
 	ast_mutex_lock(&iaxsl[callno]);
 	pvt = iaxs[callno];
 	if (!pvt) {
@@ -1532,6 +1546,18 @@
 		return -1;
 	}
 	if (!ast_test_flag(pvt, IAX_ALREADYGONE)) {
+		if (ast_test_flag(pvt, IAX_MAXAUTHREQ)) {
+			ast_mutex_lock(&userl.lock);
+			user = userl.users;
+			while (user) {
+				if (!strcmp(user->name, pvt->username)) {
+					user->curauthreq--;
+					break;
+				}
+				user = user->next;
+			}
+			ast_mutex_unlock(&userl.lock);
+		}
 		/* No more pings or lagrq's */
 		if (pvt->pingid > -1)
 			ast_sched_del(sched, pvt->pingid);
@@ -1586,6 +1612,7 @@
 	struct chan_iax2_pvt *pvt;
 	struct iax_frame *cur;
 	struct ast_channel *owner;
+	struct iax2_user *user;
 
 retry:
 	ast_mutex_lock(&iaxsl[callno]);
@@ -1609,6 +1636,18 @@
 	if (pvt) {
 		if (!owner)
 			pvt->owner = NULL;
+		if (ast_test_flag(pvt, IAX_MAXAUTHREQ)) {
+			ast_mutex_lock(&userl.lock);
+			user = userl.users;
+			while (user) {
+				if (!strcmp(user->name, pvt->username)) {
+					user->curauthreq--;
+					break;
+				}
+				user = user->next;
+			}
+			ast_mutex_unlock(&userl.lock);
+		}
 		/* No more pings or lagrq's */
 		if (pvt->pingid > -1)
 			ast_sched_del(sched, pvt->pingid);
@@ -2153,10 +2192,7 @@
 
     when = ast_tvdiff_ms(ast_tvnow(), pvt->rxcore);
 
-    /*    fprintf(stderr, "now = %d, next=%d\n", when, jb_next(pvt->jb)); */
-
     when = jb_next(pvt->jb) - when;
-    /*   fprintf(stderr, "when = %d\n", when); */
 
     if(pvt->jbid > -1) ast_sched_del(sched, pvt->jbid);
 
@@ -2180,7 +2216,6 @@
     struct timeval tv;
 
     ast_mutex_lock(&iaxsl[pvt->callno]);
-    /*  fprintf(stderr, "get_from_jb called\n"); */
     pvt->jbid = -1;
 
     gettimeofday(&tv,NULL);
@@ -2195,7 +2230,6 @@
 		ret = jb_get(pvt->jb,&frame,now,ast_codec_interp_len(pvt->voiceformat));
 		switch(ret) {
 		case JB_OK:
-			/*if(frame.type == JB_TYPE_VOICE && next + 20 != jb_next(pvt->jb)) fprintf(stderr, "NEXT %ld is not %ld+20!\n", jb_next(pvt->jb), next); */
 			fr = frame.data;
 			__do_deliver(fr);
 		    break;
@@ -2203,10 +2237,7 @@
 		    {
 			struct ast_frame af;
 	
-			/*if(next + 20 != jb_next(pvt->jb)) fprintf(stderr, "NEXT %ld is not %ld+20!\n", jb_next(pvt->jb), next); */
-	
 			/* create an interpolation frame */
-			/*fprintf(stderr, "Making Interpolation frame\n"); */
 			af.frametype = AST_FRAME_VOICE;
 			af.subclass = pvt->voiceformat;
 			af.datalen  = 0;
@@ -2224,7 +2255,6 @@
 		    }
 		    break;
 		case JB_DROP:
-			/*if(next != jb_next(pvt->jb)) fprintf(stderr, "NEXT %ld is not next %ld!\n", jb_next(pvt->jb), next); */
 			iax2_frame_free(frame.data);
 		    break;
 		case JB_NOFRAME:
@@ -3608,9 +3638,6 @@
 	p->lastsent = ms;
 	if (voice)
 		p->nextpred = p->nextpred + f->samples / 8;
-#if 0
-	printf("TS: %s - %dms\n", voice ? "Audio" : "Control", ms);
-#endif	
 	return ms;
 }
 
@@ -4713,7 +4740,7 @@
 	int version = 2;
 	struct iax2_user *user, *best = NULL;
 	int bestscore = 0;
-	int gotcapability=0;
+	int gotcapability = 0;
 	char iabuf[INET_ADDRSTRLEN];
 	struct ast_variable *v = NULL, *tmpvar = NULL;
 
@@ -4832,6 +4859,9 @@
 				iaxs[callno]->vars = tmpvar;
 			}
 		}
+		/* If a max AUTHREQ restriction is in place, activate it */
+		if (user->maxauthreq > 0)
+			ast_set_flag(iaxs[callno], IAX_MAXAUTHREQ);
 		iaxs[callno]->prefs = user->prefs;
 		ast_copy_flags(iaxs[callno], user, IAX_CODEC_USER_FIRST);
 		ast_copy_flags(iaxs[callno], user, IAX_CODEC_NOPREFS);
@@ -4936,9 +4966,37 @@
 
 static int authenticate_request(struct chan_iax2_pvt *p)
 {
+	struct iax2_user *user = NULL;
 	struct iax_ie_data ied;
-	int res;
+	int res = -1, authreq_restrict = 0;
+
 	memset(&ied, 0, sizeof(ied));
+
+	/* If an AUTHREQ restriction is in place, make sure we can send an AUTHREQ back */
+	if (ast_test_flag(p, IAX_MAXAUTHREQ)) {
+		ast_mutex_lock(&userl.lock);
+		user = userl.users;
+		while (user) {
+			if (!strcmp(user->name, p->username)) {
+				if (user->curauthreq == user->maxauthreq)
+					authreq_restrict = 1;
+				else
+					user->curauthreq++;
+				break;
+			}
+			user = user->next;
+		}
+		ast_mutex_unlock(&userl.lock);
+	}
+
+	/* If the AUTHREQ limit test failed, send back an error */
+	if (authreq_restrict) {
+		iax_ie_append_str(&ied, IAX_IE_CAUSE, "Unauthenticated call limit reached");
+		iax_ie_append_byte(&ied, IAX_IE_CAUSECODE, AST_CAUSE_CALL_REJECTED);
+		send_command_final(p, AST_FRAME_IAX, IAX_COMMAND_REJECT, 0, ied.buf, ied.pos, -1);
+		return 0;
+	}
+
 	iax_ie_append_short(&ied, IAX_IE_AUTHMETHODS, p->authmethods);
 	if (p->authmethods & (IAX_AUTH_MD5 | IAX_AUTH_RSA)) {
 		snprintf(p->challenge, sizeof(p->challenge), "%d", rand());
@@ -4946,10 +5004,14 @@
 	}
 	if (p->encmethods)
 		iax_ie_append_short(&ied, IAX_IE_ENCRYPTION, p->encmethods);
+
 	iax_ie_append_str(&ied,IAX_IE_USERNAME, p->username);
+
 	res = send_command(p, AST_FRAME_IAX, IAX_COMMAND_AUTHREQ, 0, ied.buf, ied.pos, -1);
+
 	if (p->encmethods)
 		ast_set_flag(p, IAX_ENCRYPTED);
+
 	return res;
 }
 
@@ -4961,7 +5023,22 @@
 	char rsasecret[256] = "";
 	int res = -1; 
 	int x;
-	
+	struct iax2_user *user = NULL;
+
+	if (ast_test_flag(p, IAX_MAXAUTHREQ)) {
+		ast_mutex_lock(&userl.lock);
+		user = userl.users;
+		while (user) {
+			if (!strcmp(user->name, p->username)) {
+				user->curauthreq--;
+				break;
+			}
+			user = user->next;
+		}
+		ast_mutex_unlock(&userl.lock);
+		ast_clear_flag(p, IAX_MAXAUTHREQ);
+	}
+
 	if (!ast_test_flag(&p->state, IAX_STATE_AUTHENTICATED))
 		return res;
 	if (ies->password)
@@ -5559,7 +5636,7 @@
 		while((ext = strsep(&stringp, "&"))) {
 			if (onoff) {
 				if (!ast_exists_extension(NULL, regcontext, ext, 1, NULL))
-					ast_add_extension(regcontext, 1, ext, 1, NULL, NULL, "Noop", strdup(peer->name), free, channeltype);
+					ast_add_extension(regcontext, 1, ext, 1, NULL, NULL, "Noop", strdup(peer->name), FREE, channeltype);
 			} else
 				ast_context_remove_extension(regcontext, ext, 1, NULL);
 		}
@@ -6960,8 +7037,8 @@
 					merge_encryption(iaxs[fr->callno],ies.encmethods);
 				else
 					iaxs[fr->callno]->encmethods = 0;
-				authenticate_request(iaxs[fr->callno]);
-				ast_set_flag(&iaxs[fr->callno]->state, IAX_STATE_AUTHENTICATED);
+				if (!authenticate_request(iaxs[fr->callno]))
+					ast_set_flag(&iaxs[fr->callno]->state, IAX_STATE_AUTHENTICATED);
 				break;
 			case IAX_COMMAND_DPREQ:
 				/* Request status in the dialplan */
@@ -8325,6 +8402,7 @@
 	struct ast_ha *oldha = NULL;
 	struct iax2_context *oldcon = NULL;
 	int format;
+	int oldcurauthreq = 0;
 	char *varname = NULL, *varval = NULL;
 	struct ast_variable *tmpvar = NULL;
 	
@@ -8343,6 +8421,7 @@
 		user = NULL;
 	
 	if (user) {
+		oldcurauthreq = user->curauthreq;
 		oldha = user->ha;
 		oldcon = user->contexts;
 		user->ha = NULL;
@@ -8363,6 +8442,8 @@
 	
 	if (user) {
 		memset(user, 0, sizeof(struct iax2_user));
+		user->maxauthreq = maxauthreq;
+		user->curauthreq = oldcurauthreq;
 		user->prefs = prefs;
 		user->capability = iax2_capability;
 		user->encmethods = iax2_encryption;
@@ -8445,6 +8526,10 @@
 				}
 			} else if (!strcasecmp(v->name, "inkeys")) {
 				ast_copy_string(user->inkeys, v->value, sizeof(user->inkeys));
+			} else if (!strcasecmp(v->name, "maxauthreq")) {
+				user->maxauthreq = atoi(v->value);
+				if (user->maxauthreq < 0)
+					user->maxauthreq = 0;
 			}/* else if (strcasecmp(v->name,"type")) */
 			/*	ast_log(LOG_WARNING, "Ignoring %s\n", v->name); */
 			v = v->next;
@@ -8637,6 +8722,8 @@
 
 	min_reg_expire = IAX_DEFAULT_REG_EXPIRE;
 	max_reg_expire = IAX_DEFAULT_REG_EXPIRE;
+
+	maxauthreq = 0;
 
 	v = ast_variable_browse(cfg, "general");
 
@@ -8794,6 +8881,10 @@
 			}
 		} else if (!strcasecmp(v->name, "language")) {
                         ast_copy_string(language, v->value, sizeof(language));
+		} else if (!strcasecmp(v->name, "maxauthreq")) {
+			maxauthreq = atoi(v->value);
+			if (maxauthreq < 0)
+				maxauthreq = 0;
 		} /*else if (strcasecmp(v->name,"type")) */
 		/*	ast_log(LOG_WARNING, "Ignoring %s\n", v->name); */
 		v = v->next;

Modified: team/crichter/0.4.0/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/channels/chan_misdn.c?rev=39129&r1=39128&r2=39129&view=diff
==============================================================================
--- team/crichter/0.4.0/channels/chan_misdn.c (original)
+++ team/crichter/0.4.0/channels/chan_misdn.c Mon Aug  7 03:15:38 2006
@@ -65,12 +65,6 @@
 
 #include <chan_misdn_config.h>
 #include <isdn_lib.h>
-
-ast_mutex_t release_lock_mutex;
-
-#define release_lock ast_mutex_lock(&release_lock_mutex)
-#define release_unlock ast_mutex_unlock(&release_lock_mutex)
-
 
 char global_tracefile[BUFFERSIZE+1];
 
@@ -138,6 +132,10 @@
 	char allowed_bearers[BUFFERSIZE+1];
 	
 	enum misdn_chan_state state;
+	int need_queue_hangup;
+	int need_hangup;
+	int need_busy;
+	
 	int holded; 
 	int orginator;
 
@@ -314,8 +312,9 @@
 
 
 
-
-static int tone_indicate( struct chan_list *cl, enum tone_e tone);
+static int dialtone_indicate(struct chan_list *cl);
+static int hanguptone_indicate(struct chan_list *cl);
+static int stop_indicate(struct chan_list *cl);
 
 static int start_bc_tones(struct chan_list *cl);
 static int stop_bc_tones(struct chan_list *cl);
@@ -559,7 +558,7 @@
 
 	if (diff <= 100) {
 		/* if we are 100ms near the timeout, we are satisfied.. */
-		tone_indicate(ch,TONE_NONE);
+		stop_indicate(ch);
 		if (ast_exists_extension(ch->ast, ch->context, ch->bc->dad, 1, ch->bc->oad)) {
 			ch->state=MISDN_DIALING;
 			if (ast_pbx_start(ch->ast) < 0) {
@@ -568,7 +567,7 @@
 			}
 		} else {
 misdn_overlap_dial_task_disconnect:
-			tone_indicate(ch,TONE_BUSY);
+			hanguptone_indicate(ch);
 			if (ch->bc->nt)
 				misdn_lib_send_event(ch->bc, EVENT_RELEASE_COMPLETE );
 			else
@@ -682,6 +681,35 @@
 }
 
 
+static int misdn_port_block(int fd, int argc, char *argv[])
+{
+	int port;
+  
+	if (argc != 4)
+		return RESULT_SHOWUSAGE;
+  
+	port = atoi(argv[3]);
+
+	misdn_lib_port_block(port);
+
+	return 0;
+}
+
+static int misdn_port_unblock(int fd, int argc, char *argv[])
+{
+	int port;
+  
+	if (argc != 4)
+		return RESULT_SHOWUSAGE;
+  
+	port = atoi(argv[3]);
+
+	misdn_lib_port_unblock(port);
+
+	return 0;
+}
+
+
 static int misdn_restart_port (int fd, int argc, char *argv[])
 {
 	int port;
@@ -844,6 +872,7 @@
 	{MISDN_ALERTING,"ALERTING"}, /*  when Alerting */
 	{MISDN_BUSY,"BUSY"}, /*  when BUSY */
 	{MISDN_CONNECTED,"CONNECTED"}, /*  when connected */
+	{MISDN_PRECONNECTED,"PRECONNECTED"}, /*  when connected */
 	{MISDN_DISCONNECTED,"DISCONNECTED"}, /*  when connected */
 	{MISDN_RELEASED,"RELEASED"}, /*  when connected */
 	{MISDN_BRIDGED,"BRIDGED"}, /*  when bridged */
@@ -876,7 +905,6 @@
 void reload_config(void)
 {
 	int i, cfg_debug;
-	chan_misdn_log(-1, 0, "Dynamic Crypting Activation is not support during reload at the moment\n");
 	
 	free_robin_list();
 	misdn_cfg_reload();
@@ -888,7 +916,6 @@
 		misdn_debug[i] = cfg_debug;
 		misdn_debug_only[i] = 0;
 	}
-
 }
 
 static int misdn_reload (int fd, int argc, char *argv[])
@@ -1349,6 +1376,19 @@
   complete_ch
 };
 
+static struct ast_cli_entry cli_port_block=
+{ {"misdn","port","block", NULL},
+  misdn_port_block,
+  "Blocks the given port", 
+  "Usage: misdn port block\n"
+};
+
+static struct ast_cli_entry cli_port_unblock=
+{ {"misdn","port","unblock", NULL},
+  misdn_port_unblock,
+  "Unblocks the given port", 
+  "Usage: misdn port unblock\n"
+};
 
 
 static struct ast_cli_entry cli_restart_port =
@@ -1527,12 +1567,12 @@
 	} else {
 		
 		if (len <=100 || len > 8000) {
-			chan_misdn_log(-1,bc->port,"config_jb: Jitterbuffer out of Bounds, setting to 1000\n");
+			chan_misdn_log(0,bc->port,"config_jb: Jitterbuffer out of Bounds, setting to 1000\n");
 			len=1000;
 		}
 		
 		if ( threshold > len ) {
-			chan_misdn_log(-1,bc->port,"config_jb: Jitterbuffer Threshold > Jitterbuffer setting to Jitterbuffer -1\n");
+			chan_misdn_log(0,bc->port,"config_jb: Jitterbuffer Threshold > Jitterbuffer setting to Jitterbuffer -1\n");
 		}
 		
 		if ( ch->jb) {
@@ -1644,21 +1684,38 @@
 	
 	ast_copy_string (ast->context,ch->context,sizeof(ast->context));	
 	{
-		int ec, ectr;
+		int ec;
 		
 		misdn_cfg_get( port, MISDN_CFG_ECHOCANCEL, &ec, sizeof(int));
 		
-		misdn_cfg_get( port, MISDN_CFG_ECHOTRAINING, &ectr, sizeof(int));
 		if (ec == 1 ) {
 			bc->ec_enable=1;
 		} else if ( ec > 1 ) {
 			bc->ec_enable=1;
 			bc->ec_deftaps=ec;
 		}
+#ifdef WITH_ECHOTRAINING 
+		int ectr;
+		misdn_cfg_get( port, MISDN_CFG_ECHOTRAINING, &ectr, sizeof(int));
 		
 		if ( ectr >= 0 ) {
 			bc->ec_training=ectr;
 		}
+#endif
+
+#ifdef WITH_BEROEC
+		misdn_cfg_get(port, MISDN_CFG_BNECHOCANCEL,&bc->bnec_tail, sizeof(int));
+		misdn_cfg_get(port, MISDN_CFG_BNEC_ANTIHOWL, &bc->bnec_ah, sizeof(int));
+		misdn_cfg_get(port, MISDN_CFG_BNEC_NLP, &bc->bnec_nlp, sizeof(int));
+		misdn_cfg_get(port, MISDN_CFG_BNEC_TD, &bc->bnec_td, sizeof(int));
+		misdn_cfg_get(port, MISDN_CFG_BNEC_ADAPT, &bc->bnec_adapt, sizeof(int));
+		misdn_cfg_get(port, MISDN_CFG_BNEC_ZEROCOEFF, &bc->bnec_zero, sizeof(int));
+
+		if (bc->bnec_tail && bc->ec_enable) {

[... 3759 lines stripped ...]


More information about the asterisk-commits mailing list