[svn-commits] kaii: branch kaii/1.8-multicall r316204 - in /team/kaii/1.8-multicall: ./ add...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue May 3 09:36:16 CDT 2011


Author: kaii
Date: Tue May  3 09:35:51 2011
New Revision: 316204

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=316204
Log:
Merge changes for 1.8.4-rc3


Modified:
    team/kaii/1.8-multicall/   (props changed)
    team/kaii/1.8-multicall/addons/cdr_mysql.c
    team/kaii/1.8-multicall/addons/chan_ooh323.c
    team/kaii/1.8-multicall/apps/app_dial.c
    team/kaii/1.8-multicall/apps/app_dumpchan.c
    team/kaii/1.8-multicall/apps/app_meetme.c
    team/kaii/1.8-multicall/apps/app_voicemail.c
    team/kaii/1.8-multicall/cel/cel_odbc.c   (props changed)
    team/kaii/1.8-multicall/channels/chan_agent.c
    team/kaii/1.8-multicall/channels/chan_dahdi.c
    team/kaii/1.8-multicall/channels/chan_local.c
    team/kaii/1.8-multicall/channels/chan_misdn.c
    team/kaii/1.8-multicall/channels/chan_sip.c
    team/kaii/1.8-multicall/channels/chan_skinny.c
    team/kaii/1.8-multicall/channels/chan_unistim.c
    team/kaii/1.8-multicall/channels/sig_analog.c
    team/kaii/1.8-multicall/channels/sig_pri.c
    team/kaii/1.8-multicall/channels/sig_pri.h
    team/kaii/1.8-multicall/channels/sip/include/sip.h
    team/kaii/1.8-multicall/configs/cel_odbc.conf.sample   (props changed)
    team/kaii/1.8-multicall/configs/http.conf.sample
    team/kaii/1.8-multicall/configs/manager.conf.sample
    team/kaii/1.8-multicall/configs/sip.conf.sample
    team/kaii/1.8-multicall/configs/skinny.conf.sample
    team/kaii/1.8-multicall/configure
    team/kaii/1.8-multicall/configure.ac
    team/kaii/1.8-multicall/contrib/realtime/mysql/iaxfriends.sql   (props changed)
    team/kaii/1.8-multicall/contrib/realtime/mysql/meetme.sql   (props changed)
    team/kaii/1.8-multicall/contrib/realtime/mysql/sipfriends.sql   (props changed)
    team/kaii/1.8-multicall/contrib/realtime/mysql/voicemail.sql   (props changed)
    team/kaii/1.8-multicall/contrib/realtime/postgresql/realtime.sql   (props changed)
    team/kaii/1.8-multicall/funcs/func_channel.c
    team/kaii/1.8-multicall/include/asterisk/autoconfig.h.in
    team/kaii/1.8-multicall/include/asterisk/frame.h
    team/kaii/1.8-multicall/include/asterisk/rtp_engine.h
    team/kaii/1.8-multicall/include/asterisk/select.h
    team/kaii/1.8-multicall/main/asterisk.c
    team/kaii/1.8-multicall/main/ccss.c
    team/kaii/1.8-multicall/main/channel.c
    team/kaii/1.8-multicall/main/cli.c
    team/kaii/1.8-multicall/main/features.c
    team/kaii/1.8-multicall/main/http.c
    team/kaii/1.8-multicall/main/lock.c
    team/kaii/1.8-multicall/main/manager.c
    team/kaii/1.8-multicall/main/rtp_engine.c
    team/kaii/1.8-multicall/main/tcptls.c
    team/kaii/1.8-multicall/res/res_agi.c
    team/kaii/1.8-multicall/res/res_fax_spandsp.c
    team/kaii/1.8-multicall/sounds/Makefile   (props changed)

Propchange: team/kaii/1.8-multicall/
------------------------------------------------------------------------------
Binary property 'branch-1.6.2-merged' - no diff available.

Propchange: team/kaii/1.8-multicall/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May  3 09:35:51 2011
@@ -1,1 +1,2 @@
 /be/branches/C.3:256426
+/branches/1.8:311976-315199

Modified: team/kaii/1.8-multicall/addons/cdr_mysql.c
URL: http://svnview.digium.com/svn/asterisk/team/kaii/1.8-multicall/addons/cdr_mysql.c?view=diff&rev=316204&r1=316203&r2=316204
==============================================================================
--- team/kaii/1.8-multicall/addons/cdr_mysql.c (original)
+++ team/kaii/1.8-multicall/addons/cdr_mysql.c Tue May  3 09:35:51 2011
@@ -428,7 +428,7 @@
 	int res;
 	struct ast_config *cfg;
 	struct ast_variable *var;
-	struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
+	struct ast_flags config_flags = { 0 };
 	struct column *entry;
 	char *temp;
 	struct ast_str *compat;
@@ -439,6 +439,9 @@
 	my_bool my_bool_true = 1;
 #endif
 
+	/* Cannot use a conditionally different flag, because the table layout may
+	 * have changed, which is not detectable by config file change detection,
+	 * but should still cause the configuration to be re-parsed. */
 	cfg = ast_config_load(config, config_flags);
 	if (!cfg) {
 		ast_log(LOG_WARNING, "Unable to load config for mysql CDR's: %s\n", config);

Modified: team/kaii/1.8-multicall/addons/chan_ooh323.c
URL: http://svnview.digium.com/svn/asterisk/team/kaii/1.8-multicall/addons/chan_ooh323.c?view=diff&rev=316204&r1=316203&r2=316204
==============================================================================
--- team/kaii/1.8-multicall/addons/chan_ooh323.c (original)
+++ team/kaii/1.8-multicall/addons/chan_ooh323.c Tue May  3 09:35:51 2011
@@ -1256,10 +1256,14 @@
 	    }
 	 break;
 	case AST_CONTROL_SRCUPDATE:
-		ast_rtp_instance_update_source(p->rtp);
+		if (p->rtp) {
+			ast_rtp_instance_update_source(p->rtp);
+		}
 		break;
 	case AST_CONTROL_SRCCHANGE:
-		ast_rtp_instance_change_source(p->rtp);
+		if (p->rtp) {
+			ast_rtp_instance_change_source(p->rtp);
+		}
 		break;
 	case AST_CONTROL_CONNECTED_LINE:
 		if (!ast->connected.id.name.valid

Modified: team/kaii/1.8-multicall/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/kaii/1.8-multicall/apps/app_dial.c?view=diff&rev=316204&r1=316203&r2=316204
==============================================================================
--- team/kaii/1.8-multicall/apps/app_dial.c (original)
+++ team/kaii/1.8-multicall/apps/app_dial.c Tue May  3 09:35:51 2011
@@ -1244,14 +1244,17 @@
 					/* Setup early media if appropriate */
 					if (single && CAN_EARLY_BRIDGE(peerflags, in, c))
 						ast_channel_early_bridge(in, c);
-					if (!ast_test_flag64(outgoing, OPT_RINGBACK))
+					if (!ast_test_flag64(outgoing, OPT_RINGBACK)) {
 						if (single || (!single && !pa->sentringing)) {
 							ast_indicate(in, AST_CONTROL_PROGRESS);
 						}
-						if(!ast_strlen_zero(dtmf_progress)) {
-							ast_verb(3, "Sending DTMF '%s' to the called party as result of receiving a PROGRESS message.\n", dtmf_progress);
-							ast_dtmf_stream(c, in, dtmf_progress, 250, 0);
-						}
+					}
+					if (!ast_strlen_zero(dtmf_progress)) {
+						ast_verb(3,
+							"Sending DTMF '%s' to the called party as result of receiving a PROGRESS message.\n",
+							dtmf_progress);
+						ast_dtmf_stream(c, in, dtmf_progress, 250, 0);
+					}
 					break;
 				case AST_CONTROL_VIDUPDATE:
 					ast_verb(3, "%s requested a video update, passing it to %s\n", c->name, in->name);
@@ -1418,30 +1421,56 @@
 				}
 			}
 
-			/* Forward HTML stuff */
-			if (single && (f->frametype == AST_FRAME_HTML) && !ast_test_flag64(outgoing, DIAL_NOFORWARDHTML))
-				if (ast_channel_sendhtml(outgoing->chan, f->subclass.integer, f->data.ptr, f->datalen) == -1)
-					ast_log(LOG_WARNING, "Unable to send URL\n");
-
-			if (single && ((f->frametype == AST_FRAME_VOICE) || (f->frametype == AST_FRAME_DTMF_BEGIN) || (f->frametype == AST_FRAME_DTMF_END)))  {
-				if (ast_write(outgoing->chan, f))
-					ast_log(LOG_WARNING, "Unable to forward voice or dtmf\n");
-			}
-			if (single && (f->frametype == AST_FRAME_CONTROL)) { 
-				if ((f->subclass.integer == AST_CONTROL_HOLD) ||
-				    (f->subclass.integer == AST_CONTROL_UNHOLD) ||
-				    (f->subclass.integer == AST_CONTROL_VIDUPDATE) ||
-				    (f->subclass.integer == AST_CONTROL_SRCUPDATE)) {
-					ast_verb(3, "%s requested special control %d, passing it to %s\n", in->name, f->subclass.integer, outgoing->chan->name);
-					ast_indicate_data(outgoing->chan, f->subclass.integer, f->data.ptr, f->datalen);
-				} else if (f->subclass.integer == AST_CONTROL_CONNECTED_LINE) {
-					if (ast_channel_connected_line_macro(in, outgoing->chan, f, 0, 1)) {
-						ast_indicate_data(outgoing->chan, f->subclass.integer, f->data.ptr, f->datalen);
+			/* Send the frame from the in channel to all outgoing channels. */
+			for (o = outgoing; o; o = o->next) {
+				if (!o->chan || !ast_test_flag64(o, DIAL_STILLGOING)) {
+					/* This outgoing channel has died so don't send the frame to it. */
+					continue;
+				}
+				switch (f->frametype) {
+				case AST_FRAME_HTML:
+					/* Forward HTML stuff */
+					if (!ast_test_flag64(o, DIAL_NOFORWARDHTML)
+						&& ast_channel_sendhtml(o->chan, f->subclass.integer, f->data.ptr, f->datalen) == -1) {
+						ast_log(LOG_WARNING, "Unable to send URL\n");
 					}
-				} else if (f->subclass.integer == AST_CONTROL_REDIRECTING) {
-					if (ast_channel_redirecting_macro(in, outgoing->chan, f, 0, 1)) {
-						ast_indicate_data(outgoing->chan, f->subclass.integer, f->data.ptr, f->datalen);
+					break;
+				case AST_FRAME_VOICE:
+				case AST_FRAME_IMAGE:
+				case AST_FRAME_TEXT:
+				case AST_FRAME_DTMF_BEGIN:
+				case AST_FRAME_DTMF_END:
+					if (ast_write(o->chan, f)) {
+						ast_log(LOG_WARNING, "Unable to forward frametype: %d\n",
+							f->frametype);
 					}
+					break;
+				case AST_FRAME_CONTROL:
+					switch (f->subclass.integer) {
+					case AST_CONTROL_HOLD:
+					case AST_CONTROL_UNHOLD:
+					case AST_CONTROL_VIDUPDATE:
+					case AST_CONTROL_SRCUPDATE:
+						ast_verb(3, "%s requested special control %d, passing it to %s\n",
+							in->name, f->subclass.integer, o->chan->name);
+						ast_indicate_data(o->chan, f->subclass.integer, f->data.ptr, f->datalen);
+						break;
+					case AST_CONTROL_CONNECTED_LINE:
+						if (ast_channel_connected_line_macro(in, o->chan, f, 0, 1)) {
+							ast_indicate_data(o->chan, f->subclass.integer, f->data.ptr, f->datalen);
+						}
+						break;
+					case AST_CONTROL_REDIRECTING:
+						if (ast_channel_redirecting_macro(in, o->chan, f, 0, 1)) {
+							ast_indicate_data(o->chan, f->subclass.integer, f->data.ptr, f->datalen);
+						}
+						break;
+					default:
+						break;
+					}
+					break;
+				default:
+					break;
 				}
 			}
 			ast_frfree(f);
@@ -1919,7 +1948,7 @@
 			pbx_builtin_setvar_helper(chan, "DIALSTATUS", pa.status);
 			goto done;
 		}
-		ast_verb(3, "Setting call duration limit to %.3lf milliseconds.\n", calldurationlimit.tv_sec + calldurationlimit.tv_usec / 1000000.0);
+		ast_verb(3, "Setting call duration limit to %.3lf seconds.\n", calldurationlimit.tv_sec + calldurationlimit.tv_usec / 1000000.0);
 	}
 
 	if (ast_test_flag64(&opts, OPT_SENDDTMF) && !ast_strlen_zero(opt_args[OPT_ARG_SENDDTMF])) {

Modified: team/kaii/1.8-multicall/apps/app_dumpchan.c
URL: http://svnview.digium.com/svn/asterisk/team/kaii/1.8-multicall/apps/app_dumpchan.c?view=diff&rev=316204&r1=316203&r2=316204
==============================================================================
--- team/kaii/1.8-multicall/apps/app_dumpchan.c (original)
+++ team/kaii/1.8-multicall/apps/app_dumpchan.c Tue May  3 09:35:51 2011
@@ -36,6 +36,7 @@
 #include "asterisk/module.h"
 #include "asterisk/channel.h"
 #include "asterisk/app.h"
+#include "asterisk/translate.h"
 
 /*** DOCUMENTATION
 	<application name="DumpChan" language="en_US">
@@ -67,9 +68,15 @@
 	struct timeval now;
 	long elapsed_seconds = 0;
 	int hour = 0, min = 0, sec = 0;
-	char cgrp[BUFSIZ/2];
-	char pgrp[BUFSIZ/2];
-	char formatbuf[BUFSIZ/2];
+	char nf[256];
+	char wf[256];
+	char rf[256];
+	char rwf[256];
+	char rrf[256];
+	char cgrp[256];
+	char pgrp[256];
+	struct ast_str *write_transpath = ast_str_alloca(256);
+	struct ast_str *read_transpath = ast_str_alloca(256);
 
 	now = ast_tvnow();
 	memset(buf, 0, size);
@@ -84,65 +91,83 @@
 	}
 
 	snprintf(buf,size,
-			"Name=               %s\n"
-			"Type=               %s\n"
-			"UniqueID=           %s\n"
-			"CallerIDNum=        %s\n"
-			"CallerIDName=       %s\n"
-			"DNIDDigits=         %s\n"
-			"RDNIS=              %s\n"
-			"Parkinglot=         %s\n"
-			"Language=           %s\n"
-			"State=              %s (%d)\n"
-			"Rings=              %d\n"
-			"NativeFormat=       %s\n"
-			"WriteFormat=        %s\n"
-			"ReadFormat=         %s\n"
-			"RawWriteFormat=     %s\n"
-			"RawReadFormat=      %s\n"
-			"1stFileDescriptor=  %d\n"
-			"Framesin=           %d %s\n"
-			"Framesout=          %d %s\n"
-			"TimetoHangup=       %ld\n"
-			"ElapsedTime=        %dh%dm%ds\n"
-			"Context=            %s\n"
-			"Extension=          %s\n"
-			"Priority=           %d\n"
-			"CallGroup=          %s\n"
-			"PickupGroup=        %s\n"
-			"Application=        %s\n"
-			"Data=               %s\n"
-			"Blocking_in=        %s\n",
-			c->name,
-			c->tech->type,
-			c->uniqueid,
-			S_COR(c->caller.id.number.valid, c->caller.id.number.str, "(N/A)"),
-			S_COR(c->caller.id.name.valid, c->caller.id.name.str, "(N/A)"),
-			S_OR(c->dialed.number.str, "(N/A)"),
-			S_COR(c->redirecting.from.number.valid, c->redirecting.from.number.str, "(N/A)"),
-			c->parkinglot,
-			c->language,
-			ast_state2str(c->_state),
-			c->_state,
-			c->rings,
-			ast_getformatname_multiple(formatbuf, sizeof(formatbuf), c->nativeformats),
-			ast_getformatname_multiple(formatbuf, sizeof(formatbuf), c->writeformat),
-			ast_getformatname_multiple(formatbuf, sizeof(formatbuf), c->readformat),
-			ast_getformatname_multiple(formatbuf, sizeof(formatbuf), c->rawwriteformat),
-			ast_getformatname_multiple(formatbuf, sizeof(formatbuf), c->rawreadformat),
-			c->fds[0], c->fin & ~DEBUGCHAN_FLAG, (c->fin & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "",
-			c->fout & ~DEBUGCHAN_FLAG, (c->fout & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "", (long)c->whentohangup.tv_sec,
-			hour,
-			min,
-			sec,
-			c->context,
-			c->exten,
-			c->priority,
-			ast_print_group(cgrp, sizeof(cgrp), c->callgroup),
-			ast_print_group(pgrp, sizeof(pgrp), c->pickupgroup),
-			( c->appl ? c->appl : "(N/A)" ),
-			( c-> data ? S_OR(c->data, "(Empty)") : "(None)"),
-			(ast_test_flag(c, AST_FLAG_BLOCKING) ? c->blockproc : "(Not Blocking)"));
+		"Name=               %s\n"
+		"Type=               %s\n"
+		"UniqueID=           %s\n"
+		"LinkedID=           %s\n"
+		"CallerIDNum=        %s\n"
+		"CallerIDName=       %s\n"
+		"ConnectedLineIDNum= %s\n"
+		"ConnectedLineIDName=%s\n"
+		"DNIDDigits=         %s\n"
+		"RDNIS=              %s\n"
+		"Parkinglot=         %s\n"
+		"Language=           %s\n"
+		"State=              %s (%d)\n"
+		"Rings=              %d\n"
+		"NativeFormat=       %s\n"
+		"WriteFormat=        %s\n"
+		"ReadFormat=         %s\n"
+		"RawWriteFormat=     %s\n"
+		"RawReadFormat=      %s\n"
+		"WriteTranscode=     %s %s\n"
+		"ReadTranscode=      %s %s\n"
+		"1stFileDescriptor=  %d\n"
+		"Framesin=           %d %s\n"
+		"Framesout=          %d %s\n"
+		"TimetoHangup=       %ld\n"
+		"ElapsedTime=        %dh%dm%ds\n"
+		"DirectBridge=       %s\n"
+		"IndirectBridge=     %s\n"
+		"Context=            %s\n"
+		"Extension=          %s\n"
+		"Priority=           %d\n"
+		"CallGroup=          %s\n"
+		"PickupGroup=        %s\n"
+		"Application=        %s\n"
+		"Data=               %s\n"
+		"Blocking_in=        %s\n",
+		c->name,
+		c->tech->type,
+		c->uniqueid,
+		c->linkedid,
+		S_COR(c->caller.id.number.valid, c->caller.id.number.str, "(N/A)"),
+		S_COR(c->caller.id.name.valid, c->caller.id.name.str, "(N/A)"),
+		S_COR(c->connected.id.number.valid, c->connected.id.number.str, "(N/A)"),
+		S_COR(c->connected.id.name.valid, c->connected.id.name.str, "(N/A)"),
+		S_OR(c->dialed.number.str, "(N/A)"),
+		S_COR(c->redirecting.from.number.valid, c->redirecting.from.number.str, "(N/A)"),
+		c->parkinglot,
+		c->language,	
+		ast_state2str(c->_state),
+		c->_state,
+		c->rings, 
+		ast_getformatname_multiple(nf, sizeof(nf), c->nativeformats),
+		ast_getformatname_multiple(wf, sizeof(wf), c->writeformat),
+		ast_getformatname_multiple(rf, sizeof(rf), c->readformat),
+		ast_getformatname_multiple(rwf, sizeof(rwf), c->rawwriteformat),
+		ast_getformatname_multiple(rrf, sizeof(rrf), c->rawreadformat),
+		c->writetrans ? "Yes" : "No",
+		ast_translate_path_to_str(c->writetrans, &write_transpath),
+		c->readtrans ? "Yes" : "No",
+		ast_translate_path_to_str(c->readtrans, &read_transpath),
+		c->fds[0],
+		c->fin & ~DEBUGCHAN_FLAG, (c->fin & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "",
+		c->fout & ~DEBUGCHAN_FLAG, (c->fout & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "",
+		(long)c->whentohangup.tv_sec,
+		hour,
+		min,
+		sec,
+		c->_bridge ? c->_bridge->name : "<none>",
+		ast_bridged_channel(c) ? ast_bridged_channel(c)->name : "<none>", 
+		c->context,
+		c->exten,
+		c->priority,
+		ast_print_group(cgrp, sizeof(cgrp), c->callgroup),
+		ast_print_group(pgrp, sizeof(pgrp), c->pickupgroup),
+		c->appl ? c->appl : "(N/A)",
+		c->data ? S_OR(c->data, "(Empty)") : "(None)",
+		(ast_test_flag(c, AST_FLAG_BLOCKING) ? c->blockproc : "(Not Blocking)"));
 
 	return 0;
 }
@@ -150,7 +175,7 @@
 static int dumpchan_exec(struct ast_channel *chan, const char *data)
 {
 	struct ast_str *vars = ast_str_thread_get(&ast_str_thread_global_buf, 16);
-	char info[1024];
+	char info[2048];
 	int level = 0;
 	static char *line = "================================================================================";
 
@@ -160,7 +185,13 @@
 	if (option_verbose >= level) {
 		serialize_showchan(chan, info, sizeof(info));
 		pbx_builtin_serialize_variables(chan, &vars);
-		ast_verbose("\nDumping Info For Channel: %s:\n%s\nInfo:\n%s\nVariables:\n%s%s\n", chan->name, line, info, ast_str_buffer(vars), line);
+		ast_verbose("\n"
+			"Dumping Info For Channel: %s:\n"
+			"%s\n"
+			"Info:\n"
+			"%s\n"
+			"Variables:\n"
+			"%s%s\n", chan->name, line, info, ast_str_buffer(vars), line);
 	}
 
 	return 0;

Modified: team/kaii/1.8-multicall/apps/app_meetme.c
URL: http://svnview.digium.com/svn/asterisk/team/kaii/1.8-multicall/apps/app_meetme.c?view=diff&rev=316204&r1=316203&r2=316204
==============================================================================
--- team/kaii/1.8-multicall/apps/app_meetme.c (original)
+++ team/kaii/1.8-multicall/apps/app_meetme.c Tue May  3 09:35:51 2011
@@ -2287,7 +2287,15 @@
  					play_warning = warning_freq = 0;
  			}
  		}
- 		
+
+		ast_verb(3, "Setting conference duration limit to: %ldms.\n", timelimit);
+		if (play_warning) {
+			ast_verb(3, "Setting warning time to %ldms from the conference duration limit.\n", play_warning);
+		}
+		if (warning_freq) {
+			ast_verb(3, "Setting warning frequency to %ldms.\n", warning_freq);
+		}
+
 		ast_channel_lock(chan);
 		if ((var = pbx_builtin_getvar_helper(chan, "CONF_LIMIT_WARNING_FILE"))) {
 			var = ast_strdupa(var);

Modified: team/kaii/1.8-multicall/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/team/kaii/1.8-multicall/apps/app_voicemail.c?view=diff&rev=316204&r1=316203&r2=316204
==============================================================================
--- team/kaii/1.8-multicall/apps/app_voicemail.c (original)
+++ team/kaii/1.8-multicall/apps/app_voicemail.c Tue May  3 09:35:51 2011
@@ -3410,7 +3410,7 @@
 		ast_odbc_release_obj(obj);
 	} else
 		ast_log(AST_LOG_WARNING, "Failed to obtain database object for '%s'!\n", odbc_database);
-yuck:	
+yuck:
 	if (f)
 		fclose(f);
 	if (fd > -1)
@@ -3426,7 +3426,8 @@
  * This method is used when mailboxes are stored in an ODBC back end.
  * Typical use to set the msgnum would be to take the value returned from this method and add one to it.
  *
- * \return the value of zero or greaterto indicate the last message index in use, -1 to indicate none.
+ * \return the value of zero or greater to indicate the last message index in use, -1 to indicate none.
+
  */
 static int last_message_index(struct ast_vm_user *vmu, char *dir)
 {
@@ -3441,7 +3442,8 @@
 	struct odbc_obj *obj;
 	obj = ast_odbc_request_obj(odbc_database, 0);
 	if (obj) {
-		snprintf(sql, sizeof(sql), "SELECT COUNT(*) FROM %s WHERE dir=?", odbc_table);
+		snprintf(sql, sizeof(sql), "SELECT msgnum FROM %s WHERE dir=? order by msgnum desc limit 1", odbc_table);
+
 		stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, &gps);
 		if (!stmt) {
 			ast_log(AST_LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
@@ -3450,7 +3452,12 @@
 		}
 		res = SQLFetch(stmt);
 		if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
-			ast_log(AST_LOG_WARNING, "SQL Fetch error!\n[%s]\n\n", sql);
+			if (res == SQL_NO_DATA) {
+				ast_log(AST_LOG_DEBUG, "Directory '%s' has no messages and therefore no index was retrieved.\n", dir);
+			} else {
+				ast_log(AST_LOG_WARNING, "SQL Fetch error!\n[%s]\n\n", sql);
+			}
+
 			SQLFreeHandle (SQL_HANDLE_STMT, stmt);
 			ast_odbc_release_obj(obj);
 			goto yuck;
@@ -3463,12 +3470,13 @@
 			goto yuck;
 		}
 		if (sscanf(rowdata, "%30d", &x) != 1)
-			ast_log(AST_LOG_WARNING, "Failed to read message count!\n");
+			ast_log(AST_LOG_WARNING, "Failed to read message index!\n");
 		SQLFreeHandle (SQL_HANDLE_STMT, stmt);
 		ast_odbc_release_obj(obj);
+		return x;
 	} else
 		ast_log(AST_LOG_WARNING, "Failed to obtain database object for '%s'!\n", odbc_database);
-yuck:	
+yuck:
 	return x - 1;
 }
 
@@ -3523,25 +3531,63 @@
 		ast_odbc_release_obj(obj);
 	} else
 		ast_log(AST_LOG_WARNING, "Failed to obtain database object for '%s'!\n", odbc_database);
-yuck:	
+yuck:
 	return x;
 }
 
 /*!
- * \brief returns the one-based count for messages.
+ * \brief returns the number of messages found.
  * \param vmu
  * \param dir the folder the mailbox folder to look for messages. Used to construct the SQL where clause.
  *
  * This method is used when mailboxes are stored in an ODBC back end.
- * The message index is zero-based, the first message will be index 0. For convenient display it is good to have the
- * one-based messages.
- * This method just calls last_message_index and returns +1 of its value.
  *
- * \return the value greater than zero on success to indicate the one-based count of messages, less than zero on error.
+ * \return The count of messages being zero or more, less than zero on error.
  */
 static int count_messages(struct ast_vm_user *vmu, char *dir)
 {
-	return last_message_index(vmu, dir) + 1;
+	int x = 0;
+	int res;
+	SQLHSTMT stmt;
+	char sql[PATH_MAX];
+	char rowdata[20];
+	char *argv[] = { dir };
+	struct generic_prepare_struct gps = { .sql = sql, .argc = 1, .argv = argv };
+
+	struct odbc_obj *obj;
+	obj = ast_odbc_request_obj(odbc_database, 0);
+	if (obj) {
+		snprintf(sql, sizeof(sql), "SELECT COUNT(*) FROM %s WHERE dir=?", odbc_table);
+		stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, &gps);
+		if (!stmt) {
+			ast_log(AST_LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
+			ast_odbc_release_obj(obj);
+			goto yuck;
+		}
+		res = SQLFetch(stmt);
+		if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
+			ast_log(AST_LOG_WARNING, "SQL Fetch error!\n[%s]\n\n", sql);
+			SQLFreeHandle (SQL_HANDLE_STMT, stmt);
+			ast_odbc_release_obj(obj);
+			goto yuck;
+		}
+		res = SQLGetData(stmt, 1, SQL_CHAR, rowdata, sizeof(rowdata), NULL);
+		if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
+			ast_log(AST_LOG_WARNING, "SQL Get Data error!\n[%s]\n\n", sql);
+			SQLFreeHandle (SQL_HANDLE_STMT, stmt);
+			ast_odbc_release_obj(obj);
+			goto yuck;
+		}
+		if (sscanf(rowdata, "%30d", &x) != 1)
+			ast_log(AST_LOG_WARNING, "Failed to read message count!\n");
+		SQLFreeHandle (SQL_HANDLE_STMT, stmt);
+		ast_odbc_release_obj(obj);
+		return x;
+	} else
+		ast_log(AST_LOG_WARNING, "Failed to obtain database object for '%s'!\n", odbc_database);
+yuck:
+	return x - 1;
+
 }
 
 /*!
@@ -5108,7 +5154,6 @@
 	if (obj) {
 		ast_odbc_release_obj(obj);
 	}
-
 	return x;
 }
 
@@ -6036,7 +6081,7 @@
 	return res;
 }
 
-#if !defined(IMAP_STORAGE) && !defined(ODBC_STORAGE)
+#if !defined(IMAP_STORAGE)
 static int resequence_mailbox(struct ast_vm_user *vmu, char *dir, int stopcount)
 {
     /* we know the actual number of messages, so stop process when number is hit */
@@ -7782,21 +7827,21 @@
 
 	if (last_msg < -1) {
 		return last_msg;
-#ifndef ODBC_STORAGE
 	} else if (vms->lastmsg != last_msg) {
-		ast_log(LOG_NOTICE, "Resequencing mailbox: %s, expected %d but found %d message(s) in box with max threshold of %d.\n", vms->curdir, last_msg + 1, vms->lastmsg + 1, vmu->maxmsg);
-        resequence_mailbox(vmu, vms->curdir, count_msg);
+		ast_log(LOG_NOTICE, "Resequencing Mailbox: %s, expected %d but found %d message(s) in box with max threshold of %d.\n", vms->curdir, last_msg + 1, vms->lastmsg + 1, vmu->maxmsg);
+		resequence_mailbox(vmu, vms->curdir, count_msg);
+	}
+
+	return 0;
+}
 #endif
-	}
-
-	return 0;
-}
-#endif
 
 static int close_mailbox(struct vm_state *vms, struct ast_vm_user *vmu)
 {
 	int x = 0;
+
 #ifndef IMAP_STORAGE
+	int last_msg_idx;
 	int res = 0, nummsg;
 	char fn2[PATH_MAX];
 #endif
@@ -7812,8 +7857,14 @@
 		return ERROR_LOCK_PATH;
 	}
 
+	/* update count as message may have arrived while we've got mailbox open */
+	last_msg_idx = last_message_index(vmu, vms->curdir);
+	if (last_msg_idx != vms->lastmsg) {
+		ast_log(AST_LOG_NOTICE, "%d messages received after mailbox opened.\n", last_msg_idx - vms->lastmsg);
+	}
+
 	/* must check up to last detected message, just in case it is erroneously greater than maxmsg */
-	for (x = 0; x < vms->lastmsg + 1; x++) {
+	for (x = 0; x < last_msg_idx + 1; x++) {
 		if (!vms->deleted[x] && ((strcasecmp(vms->curbox, "INBOX") && strcasecmp(vms->curbox, "Urgent")) || !vms->heard[x] || (vms->heard[x] && !ast_test_flag(vmu, VM_MOVEHEARD)))) {
 			/* Save this message.  It's not in INBOX or hasn't been heard */
 			make_file(vms->fn, sizeof(vms->fn), vms->curdir, x);
@@ -10219,7 +10270,7 @@
 #endif
 			break;
 	
-		case '8': /* Forward the current messgae */
+		case '8': /* Forward the current message */
 			if (vms.lastmsg > -1) {
 				cmd = forward_message(chan, context, &vms, vmu, vmfmts, 0, record_gain, in_urgent);
 				if (cmd == ERROR_LOCK_PATH) {

Propchange: team/kaii/1.8-multicall/cel/cel_odbc.c
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May  3 09:35:51 2011
@@ -1,1 +1,2 @@
 /be/branches/C.3/cel/cel_adaptive_odbc.c:256426
+/branches/1.8/cel/cel_odbc.c:311976-315199

Modified: team/kaii/1.8-multicall/channels/chan_agent.c
URL: http://svnview.digium.com/svn/asterisk/team/kaii/1.8-multicall/channels/chan_agent.c?view=diff&rev=316204&r1=316203&r2=316204
==============================================================================
--- team/kaii/1.8-multicall/channels/chan_agent.c (original)
+++ team/kaii/1.8-multicall/channels/chan_agent.c Tue May  3 09:35:51 2011
@@ -269,9 +269,9 @@
 	char agent[AST_MAX_AGENT];     /*!< Agent ID */
 	char password[AST_MAX_AGENT];  /*!< Password for Agent login */
 	char name[AST_MAX_AGENT];
-	ast_mutex_t app_lock;          /**< Synchronization between owning applications */
 	int app_lock_flag;
 	ast_cond_t app_complete_cond;
+	ast_cond_t login_wait_cond;
 	volatile int app_sleep_cond;   /**< Sleep condition for the login app */
 	struct ast_channel *owner;     /**< Agent */
 	char logincallerid[80];        /**< Caller ID they had when they logged in */
@@ -430,8 +430,8 @@
 			return NULL;
 		ast_copy_string(p->agent, agt, sizeof(p->agent));
 		ast_mutex_init(&p->lock);
-		ast_mutex_init(&p->app_lock);
 		ast_cond_init(&p->app_complete_cond, NULL);
+		ast_cond_init(&p->login_wait_cond, NULL);
 		p->app_lock_flag = 0;
 		p->app_sleep_cond = 1;
 		p->group = group;
@@ -484,20 +484,23 @@
  */
 static int agent_cleanup(struct agent_pvt *p)
 {
-	struct ast_channel *chan = p->owner;
+	struct ast_channel *chan = NULL;
+	ast_mutex_lock(&p->lock);
+	chan = p->owner;
 	p->owner = NULL;
 	chan->tech_pvt = NULL;
+	/* Release ownership of the agent to other threads (presumably running the login app). */
 	p->app_sleep_cond = 1;
-	/* Release ownership of the agent to other threads (presumably running the login app). */
 	p->app_lock_flag = 0;
 	ast_cond_signal(&p->app_complete_cond);
 	if (chan) {
 		chan = ast_channel_release(chan);
 	}
 	if (p->dead) {
+		ast_mutex_unlock(&p->lock);
 		ast_mutex_destroy(&p->lock);
-		ast_mutex_destroy(&p->app_lock);
 		ast_cond_destroy(&p->app_complete_cond);
+		ast_cond_destroy(&p->login_wait_cond);
 		ast_free(p);
         }
 	return 0;
@@ -774,30 +777,42 @@
 	struct agent_pvt *p = ast->tech_pvt;
 	int res = -1;
 	int newstate=0;
+	struct ast_channel *chan;
+
 	ast_mutex_lock(&p->lock);
 	p->acknowledged = 0;
+
+	if (p->pending) {
+		ast_log(LOG_DEBUG, "Pretending to dial on pending agent\n");
+		ast_mutex_unlock(&p->lock);
+		ast_setstate(ast, AST_STATE_DIALING);
+		return 0;
+	}
+
 	if (!p->chan) {
-		if (p->pending) {
-			ast_debug(1, "Pretending to dial on pending agent\n");
-			newstate = AST_STATE_DIALING;
-			res = 0;
-		} else {
-			ast_log(LOG_NOTICE, "Whoa, they hung up between alloc and call...  what are the odds of that?\n");
-			res = -1;
-		}
+		ast_log(LOG_DEBUG, "Agent disconnected while we were connecting the call\n");
 		ast_mutex_unlock(&p->lock);
-		if (newstate)
-			ast_setstate(ast, newstate);
 		return res;
 	}
 	ast_verb(3, "agent_call, call to agent '%s' call on '%s'\n", p->agent, p->chan->name);
 	ast_debug(3, "Playing beep, lang '%s'\n", p->chan->language);
-	res = ast_streamfile(p->chan, beep, p->chan->language);
+	
+	chan = p->chan;
+	ast_mutex_unlock(&p->lock);
+
+	res = ast_streamfile(chan, beep, chan->language);
 	ast_debug(3, "Played beep, result '%d'\n", res);
 	if (!res) {
-		res = ast_waitstream(p->chan, "");
+		res = ast_waitstream(chan, "");
 		ast_debug(3, "Waited for stream, result '%d'\n", res);
 	}
+	
+	ast_mutex_lock(&p->lock);
+	if (!p->chan) {
+		/* chan went away while we were streaming, this shouldn't be possible */
+		res = -1;
+	}
+
 	if (!res) {
 		res = ast_set_read_format(p->chan, ast_best_codec(p->chan->nativeformats));
 		ast_debug(3, "Set read format, result '%d'\n", res);
@@ -878,6 +893,10 @@
 	ast->tech_pvt = NULL;
 	p->app_sleep_cond = 1;
 	p->acknowledged = 0;
+
+	/* Release ownership of the agent to other threads (presumably running the login app). */
+	p->app_lock_flag = 0;
+	ast_cond_signal(&p->app_complete_cond);
 
 	/* if they really are hung up then set start to 0 so the test
 	 * later if we're called on an already downed channel
@@ -929,8 +948,8 @@
 		p->abouttograb = 0;
 	} else if (p->dead) {
 		ast_mutex_destroy(&p->lock);
-		ast_mutex_destroy(&p->app_lock);
 		ast_cond_destroy(&p->app_complete_cond);
+		ast_cond_destroy(&p->login_wait_cond);
 		ast_free(p);
 	} else {
 		if (p->chan) {
@@ -940,9 +959,6 @@
 			p->lastdisc = ast_tvadd(ast_tvnow(), ast_samp2tv(p->wrapuptime, 1000));
 			ast_mutex_unlock(&p->lock);
 		}
-		/* Release ownership of the agent to other threads (presumably running the login app). */
-		p->app_lock_flag = 0;
-		ast_cond_signal(&p->app_complete_cond);
 	}
 	return 0;
 }
@@ -1029,7 +1045,6 @@
 static struct ast_channel *agent_new(struct agent_pvt *p, int state, const char *linkedid)
 {
 	struct ast_channel *tmp;
-	int alreadylocked;
 #if 0
 	if (!p->chan) {
 		ast_log(LOG_WARNING, "No channel? :(\n");
@@ -1067,38 +1082,6 @@
 	tmp->tech_pvt = p;
 	p->owner = tmp;
 	tmp->priority = 1;
-	/* Wake up and wait for other applications (by definition the login app)
-	 * to release this channel). Takes ownership of the agent channel
-	 * to this thread only.
-	 * For signalling the other thread, ast_queue_frame is used until we
-	 * can safely use signals for this purpose. The pselect() needs to be
-	 * implemented in the kernel for this.
-	 */
-	p->app_sleep_cond = 0;
-
-	alreadylocked = p->app_lock_flag;
-	p->app_lock_flag = 1;
-
-	if (alreadylocked) {
-		if (p->chan) {
-			ast_queue_frame(p->chan, &ast_null_frame);
-			ast_mutex_unlock(&p->lock);	/* For other thread to read the condition. */
-			p->app_lock_flag = 1;
-			ast_mutex_lock(&p->lock);
-		} else {
-			ast_log(LOG_WARNING, "Agent disconnected while we were connecting the call\n");
-			p->owner = NULL;
-			tmp->tech_pvt = NULL;
-			p->app_sleep_cond = 1;
-			tmp = ast_channel_release(tmp);
-			ast_mutex_unlock(&p->lock);	/* For other thread to read the condition. */
-			p->app_lock_flag = 0;
-			ast_cond_signal(&p->app_complete_cond);
-			return NULL;
-		}
-	} 
-	if (p->chan)
-		ast_indicate(p->chan, AST_CONTROL_UNHOLD);
 	return tmp;
 }
 
@@ -1256,8 +1239,8 @@
 			if (!p->owner) {
 				if (!p->chan) {
 					ast_mutex_destroy(&p->lock);
-					ast_mutex_destroy(&p->app_lock);
 					ast_cond_destroy(&p->app_complete_cond);
+					ast_cond_destroy(&p->login_wait_cond);
 					ast_free(p);
 				} else {
 					/* Cause them to hang up */
@@ -1458,6 +1441,45 @@
 	}
 	*cause = hasagent ? AST_CAUSE_BUSY : AST_CAUSE_UNREGISTERED;
 	AST_LIST_UNLOCK(&agents);
+
+	if (chan) {
+		ast_mutex_lock(&p->lock);
+		if (p->pending) {
+			ast_mutex_unlock(&p->lock);
+			return chan;
+		}
+
+		if (!p->chan) {
+			ast_log(LOG_DEBUG, "Agent disconnected while we were connecting the call\n");
+			*cause = AST_CAUSE_UNREGISTERED;
+			ast_mutex_unlock(&p->lock);
+			agent_hangup(chan);
+			return NULL;
+		}
+
+		/* we need to take control of the channel from the login app
+		 * thread */
+		p->app_sleep_cond = 0;
+		p->app_lock_flag = 1;
+
+		ast_queue_frame(p->chan, &ast_null_frame);
+		ast_cond_wait(&p->login_wait_cond, &p->lock);
+
+		if (!p->chan) {
+			ast_log(LOG_DEBUG, "Agent disconnected while we were connecting the call\n");
+			p->app_sleep_cond = 1;
+			p->app_lock_flag = 0;
+			ast_cond_signal(&p->app_complete_cond);
+			ast_mutex_unlock(&p->lock);
+			*cause = AST_CAUSE_UNREGISTERED;
+			agent_hangup(chan);
+			return NULL;
+		}
+
+		ast_indicate(p->chan, AST_CONTROL_UNHOLD);
+		ast_mutex_unlock(&p->lock);
+	}
+
 	return chan;
 }
 
@@ -2065,13 +2087,13 @@
 							}
 							ast_mutex_unlock(&p->lock);
 							AST_LIST_UNLOCK(&agents);
+
 							/*	Synchronize channel ownership between call to agent and itself. */
-							ast_mutex_lock(&p->app_lock);
+							ast_mutex_lock(&p->lock);
 							if (p->app_lock_flag == 1) {
-								ast_cond_wait(&p->app_complete_cond, &p->app_lock);
+								ast_cond_signal(&p->login_wait_cond);
+								ast_cond_wait(&p->app_complete_cond, &p->lock);
 							}
-							ast_mutex_unlock(&p->app_lock);
-							ast_mutex_lock(&p->lock);
 							ast_mutex_unlock(&p->lock);
 							if (p->ackcall) {
 								res = agent_ack_sleep(p);
@@ -2089,12 +2111,20 @@
 							sched_yield();
 						}
 						ast_mutex_lock(&p->lock);
-						if (res && p->owner) 
-							ast_log(LOG_WARNING, "Huh?  We broke out when there was still an owner?\n");
 						/* Log us off if appropriate */
 						if (p->chan == chan) {
 							p->chan = NULL;
 						}
+
+						/* Synchronize channel ownership between call to agent and itself. */
+						if (p->app_lock_flag == 1) {
+							ast_cond_signal(&p->login_wait_cond);
+							ast_cond_wait(&p->app_complete_cond, &p->lock);
+						}
+
+						if (res && p->owner)
+							ast_log(LOG_WARNING, "Huh?  We broke out when there was still an owner?\n");
+
 						p->acknowledged = 0;
 						logintime = time(NULL) - p->loginstart;
 						p->loginstart = 0;
@@ -2110,8 +2140,8 @@
 						ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "Agent/%s", p->agent);
 						if (p->dead && !p->owner) {
 							ast_mutex_destroy(&p->lock);
-							ast_mutex_destroy(&p->app_lock);
 							ast_cond_destroy(&p->app_complete_cond);
+							ast_cond_destroy(&p->login_wait_cond);
 							ast_free(p);
 						}
 					}

Modified: team/kaii/1.8-multicall/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/kaii/1.8-multicall/channels/chan_dahdi.c?view=diff&rev=316204&r1=316203&r2=316204
==============================================================================
--- team/kaii/1.8-multicall/channels/chan_dahdi.c (original)
+++ team/kaii/1.8-multicall/channels/chan_dahdi.c Tue May  3 09:35:51 2011
@@ -235,7 +235,9 @@
 		</synopsis>
 		<syntax>
 			<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
-			<parameter name="DAHDIChannel" required="true" />
+			<parameter name="DAHDIChannel">
+				<para>Specify the specific channel to show.  Show all channels if zero or not present.</para>
+			</parameter>
 		</syntax>
 		<description>
 		</description>
@@ -2920,18 +2922,21 @@
 		return -1;
 	}
 
-	if (sub != ANALOG_SUB_REAL)
-		printf("Trying to dial digits on sub %d\n", sub);
+	if (sub != ANALOG_SUB_REAL) {
+		ast_log(LOG_ERROR, "Trying to dial_digits '%s' on channel %d subchannel %d\n",
+			dop->dialstr, p->channel, sub);
+		return -1;
+	}
 
 	ddop.op = DAHDI_DIAL_OP_REPLACE;
-	strncpy(ddop.dialstr, dop->dialstr, sizeof(ddop.dialstr));
-
-	printf("Dialing %s on %d\n", ddop.dialstr, p->channel);
+	ast_copy_string(ddop.dialstr, dop->dialstr, sizeof(ddop.dialstr));
+
+	ast_debug(1, "Channel %d: Sending '%s' to DAHDI_DIAL.\n", p->channel, ddop.dialstr);
 
 	res = ioctl(p->subs[index].dfd, DAHDI_DIAL, &ddop);
-
-	if (res == -1)
-		ast_log(LOG_DEBUG, "DAHDI_DIAL ioctl failed on %s: %s\n", p->owner->name, strerror(errno));
+	if (res == -1) {
+		ast_debug(1, "DAHDI_DIAL ioctl failed on %s: %s\n", p->owner->name, strerror(errno));
+	}
 
 	return res;
 }
@@ -3221,12 +3226,7 @@
 		if (pri->pvts[idx] && !pri->pvts[idx]->no_b_channel) {
 			/* This is a B channel interface. */
 			++num_b_chans;
-			if (pri->pvts[idx]->owner
-#if defined(HAVE_PRI_SERVICE_MESSAGES)
-				/* Out-of-service B channels are "in-use". */
-				|| pri->pvts[idx]->service_status
-#endif	/* defined(HAVE_PRI_SERVICE_MESSAGES) */
-				) {
+			if (!sig_pri_is_chan_available(pri->pvts[idx])) {
 				++in_use;
 			}
 			if (!pri->pvts[idx]->inalarm) {
@@ -6413,11 +6413,9 @@
 	p->cidspill = NULL;
 
 	ast_mutex_unlock(&p->lock);
-	ast_module_unref(ast_module_info->self);
 	ast_verb(3, "Hungup '%s'\n", ast->name);
 
 	ast_mutex_lock(&iflock);
-
 	if (p->restartpending) {
 		num_restart_pending--;
 	}
@@ -6426,6 +6424,8 @@
 		destroy_channel(p, 0);
 	}
 	ast_mutex_unlock(&iflock);
+
+	ast_module_unref(ast_module_info->self);
 	return 0;
 }
 
@@ -8710,14 +8710,27 @@
 
 static struct ast_frame *dahdi_read(struct ast_channel *ast)
 {
-	struct dahdi_pvt *p = ast->tech_pvt;
+	struct dahdi_pvt *p;
 	int res;
 	int idx;
 	void *readbuf;
 	struct ast_frame *f;
 
+	/*
+	 * For analog channels, we must do deadlock avoidance because
+	 * analog ports can have more than one Asterisk channel using
+	 * the same private structure.
+	 */
+	p = ast->tech_pvt;
 	while (ast_mutex_trylock(&p->lock)) {
 		CHANNEL_DEADLOCK_AVOIDANCE(ast);
+
+		/*
+		 * For PRI channels, we must refresh the private pointer because
+		 * the call could move to another B channel while the Asterisk
+		 * channel is unlocked.
+		 */
+		p = ast->tech_pvt;
 	}
 
 	idx = dahdi_get_index(ast, p, 0);
@@ -9913,7 +9926,10 @@
 			/* some switches require a minimum guard time between
 			   the last FGD wink and something that answers
 			   immediately. This ensures it */
-			if (ast_safe_sleep(chan,100)) goto quit;
+			if (ast_safe_sleep(chan, 100)) {
+				ast_hangup(chan);
+				goto quit;
+			}
 		}
 		dahdi_enable_ec(p);
 		if (NEED_MFDETECT(p)) {
@@ -11252,7 +11268,9 @@
 		switch (i->sig) {
 #if defined(HAVE_PRI)
 		case SIG_PRI_LIB_HANDLE_CASES:
+			ast_mutex_lock(&i->lock);
 			sig_pri_chan_alarm_notify(i->sig_pvt, 1);
+			ast_mutex_unlock(&i->lock);
 			break;
 #endif	/* defined(HAVE_PRI) */
 #if defined(HAVE_SS7)
@@ -11270,7 +11288,9 @@
 		switch (i->sig) {
 #if defined(HAVE_PRI)
 		case SIG_PRI_LIB_HANDLE_CASES:
+			ast_mutex_lock(&i->lock);
 			sig_pri_chan_alarm_notify(i->sig_pvt, 0);
+			ast_mutex_unlock(&i->lock);
 			break;
 #endif	/* defined(HAVE_PRI) */
 #if defined(HAVE_SS7)
@@ -12049,6 +12069,13 @@
 	if (tmp) {
 		int chan_sig = conf->chan.sig;
 
+		/* If there are variables in tmp before it is updated to match the new config, clear them */
+		if (reloading && tmp->vars) {
+			ast_variables_destroy(tmp->vars);
+			tmp->vars = NULL;
+		}
+
+
 		if (!here) {
 			/* Can only get here if this is a new channel interface being created. */
 			if ((channel != CHAN_PSEUDO)) {
@@ -12665,7 +12692,7 @@
 				switch (tmp->sig) {
 #ifdef HAVE_PRI
 				case SIG_PRI_LIB_HANDLE_CASES:
-					sig_pri_chan_alarm_notify(tmp->sig_pvt, si.alarms);
+					sig_pri_set_alarm(tmp->sig_pvt, !si.alarms);
 					break;
 #endif
 #if defined(HAVE_SS7)
@@ -13382,6 +13409,7 @@
 				}
 			}
 

[... 5946 lines stripped ...]



More information about the svn-commits mailing list