[asterisk-commits] russell: branch russell/dtls r219814 - in /team/russell/dtls: ./ addons/ apps...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 22 14:20:10 CDT 2009


Author: russell
Date: Tue Sep 22 14:20:02 2009
New Revision: 219814

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=219814
Log:
resolve, reset

Added:
    team/russell/dtls/doc/IAX2-security.pdf
      - copied unchanged from r219721, trunk/doc/IAX2-security.pdf
    team/russell/dtls/doc/IAX2-security.txt
      - copied unchanged from r219721, trunk/doc/IAX2-security.txt
    team/russell/dtls/doc/lang/language-criteria.txt
      - copied unchanged from r219721, trunk/doc/lang/language-criteria.txt
Removed:
    team/russell/dtls/contrib/firmware/iax/iaxy.bin
Modified:
    team/russell/dtls/   (props changed)
    team/russell/dtls/CHANGES
    team/russell/dtls/UPGRADE-1.6.txt
    team/russell/dtls/UPGRADE.txt
    team/russell/dtls/addons/format_mp3.c
    team/russell/dtls/apps/app_chanspy.c
    team/russell/dtls/apps/app_directed_pickup.c
    team/russell/dtls/apps/app_disa.c
    team/russell/dtls/apps/app_followme.c
    team/russell/dtls/apps/app_meetme.c
    team/russell/dtls/apps/app_playback.c
    team/russell/dtls/apps/app_queue.c
    team/russell/dtls/apps/app_voicemail.c
    team/russell/dtls/channels/chan_dahdi.c
    team/russell/dtls/channels/chan_iax2.c
    team/russell/dtls/channels/chan_phone.c
    team/russell/dtls/channels/chan_sip.c
    team/russell/dtls/channels/iax2-parser.c
    team/russell/dtls/channels/iax2-parser.h
    team/russell/dtls/channels/iax2.h
    team/russell/dtls/channels/sig_analog.c
    team/russell/dtls/channels/sig_analog.h
    team/russell/dtls/channels/sig_pri.c
    team/russell/dtls/channels/sig_pri.h
    team/russell/dtls/configs/extensions.conf.sample
    team/russell/dtls/configs/func_odbc.conf.sample
    team/russell/dtls/configs/iax.conf.sample
    team/russell/dtls/configs/sip.conf.sample
    team/russell/dtls/configs/voicemail.conf.sample
    team/russell/dtls/configure
    team/russell/dtls/configure.ac
    team/russell/dtls/contrib/scripts/iax-friends.sql
    team/russell/dtls/contrib/scripts/live_ast
    team/russell/dtls/doc/janitor-projects.txt
    team/russell/dtls/doc/manager_1_1.txt
    team/russell/dtls/funcs/func_odbc.c
    team/russell/dtls/include/asterisk/acl.h
    team/russell/dtls/include/asterisk/astobj2.h
    team/russell/dtls/include/asterisk/autoconfig.h.in
    team/russell/dtls/include/asterisk/callerid.h
    team/russell/dtls/include/asterisk/cdr.h
    team/russell/dtls/include/asterisk/event.h
    team/russell/dtls/include/asterisk/lock.h
    team/russell/dtls/main/acl.c
    team/russell/dtls/main/astobj2.c
    team/russell/dtls/main/channel.c
    team/russell/dtls/main/config.c
    team/russell/dtls/main/features.c
    team/russell/dtls/main/file.c
    team/russell/dtls/main/manager.c
    team/russell/dtls/main/pbx.c
    team/russell/dtls/main/utils.c
    team/russell/dtls/res/res_config_odbc.c
    team/russell/dtls/res/res_jabber.c
    team/russell/dtls/res/res_limit.c
    team/russell/dtls/res/res_musiconhold.c
    team/russell/dtls/res/res_phoneprov.c
    team/russell/dtls/res/res_rtp_asterisk.c
    team/russell/dtls/sounds/Makefile

Propchange: team/russell/dtls/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/russell/dtls/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.

Propchange: team/russell/dtls/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/russell/dtls/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Sep 22 14:20:02 2009
@@ -1,1 +1,1 @@
-/trunk:1-215921
+/trunk:1-219813

Modified: team/russell/dtls/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/russell/dtls/CHANGES?view=diff&rev=219814&r1=219813&r2=219814
==============================================================================
--- team/russell/dtls/CHANGES (original)
+++ team/russell/dtls/CHANGES Tue Sep 22 14:20:02 2009
@@ -63,9 +63,11 @@
    exit the application.
  * The Voicemail application has been improved to automatically ignore messages
    that only contain silence.
- * The ChanSpy application now has the 's' option, which makes the application
+ * The ChanSpy application now has the 'S' option, which makes the application
    automatically exit once it hits a point where no more channels are available
    to spy on.
+ * The ChanSpy application also now has the 'E' option, which spies on a single
+   channel and exits when that channel hangs up.
 
 Dialplan Functions
 ------------------
@@ -105,6 +107,10 @@
    channel, is one approach that will avoid conflicts.
  * Added new dialplan function MUTEAUDIO() for muting inbound and/or outbound
    audio in a channel.
+ * func_odbc now allows multiple row results to be retrieved without using
+   mode=multirow.  If rowlimit is set, then additional rows may be retrieved
+   from the same query by using the name of the function which retrieved the
+   first row as an argument to ODBC_FETCH().
 
 Dialplan Variables
 ------------------

Modified: team/russell/dtls/UPGRADE-1.6.txt
URL: http://svnview.digium.com/svn/asterisk/team/russell/dtls/UPGRADE-1.6.txt?view=diff&rev=219814&r1=219813&r2=219814
==============================================================================
--- team/russell/dtls/UPGRADE-1.6.txt (original)
+++ team/russell/dtls/UPGRADE-1.6.txt Tue Sep 22 14:20:02 2009
@@ -71,6 +71,12 @@
   You now only need to quote strings in configuration files if you literally
   want quotation marks within a string.
 
+* Any applications run that contain the pipe symbol but not a comma symbol will
+  get a warning printed to the effect that the application delimiter has changed.
+  However, there are legitimate reasons why this might be useful in certain
+  situations, so this warning can be turned off with the dontwarn option in
+  asterisk.conf.
+
 * The logger.conf option 'rotatetimestamp' has been deprecated in favor of
   'rotatestrategy'.  This new option supports a 'rotate' strategy that more
   closely mimics the system logger in terms of file rotation.

Modified: team/russell/dtls/UPGRADE.txt
URL: http://svnview.digium.com/svn/asterisk/team/russell/dtls/UPGRADE.txt?view=diff&rev=219814&r1=219813&r2=219814
==============================================================================
--- team/russell/dtls/UPGRADE.txt (original)
+++ team/russell/dtls/UPGRADE.txt Tue Sep 22 14:20:02 2009
@@ -19,6 +19,18 @@
 ===========================================================
 
 From 1.6.2 to 1.6.3:
+
+* The firmware for the IAXy has been removed from Asterisk.  It can be
+  downloaded from http://downloads.digium.com/pub/iaxy/.  To have Asterisk
+  install the firmware into its proper location, place the firmware in the
+  contrib/firmware/iax/ directory in the Asterisk source tree before running
+  "make install".
+
+* There have been some changes to the IAX2 protocol to address the security
+  concerns documented in the security advisory AST-2009-006.  Please see the
+  IAX2 security document, doc/IAX2-security.pdf, for information regarding
+  backwards compatibility with versions of Asterisk that do not contain these
+  changes to IAX2.
 
 * Asterisk-addons no longer exists as an independent package.  Those modules
   now live in the addons directory of the main Asterisk source tree.  They

Modified: team/russell/dtls/addons/format_mp3.c
URL: http://svnview.digium.com/svn/asterisk/team/russell/dtls/addons/format_mp3.c?view=diff&rev=219814&r1=219813&r2=219814
==============================================================================
--- team/russell/dtls/addons/format_mp3.c (original)
+++ team/russell/dtls/addons/format_mp3.c Tue Sep 22 14:20:02 2009
@@ -200,7 +200,7 @@
 
 	if(p->dbuflen) {
 		for(p->buflen=0; p->buflen < MP3_BUFLEN && p->buflen < p->dbuflen; p->buflen++) {
-			s->buf[p->buflen] = p->dbuf[p->buflen+p->dbufoffset];
+			s->buf[p->buflen + AST_FRIENDLY_OFFSET] = p->dbuf[p->buflen+p->dbufoffset];
 			p->sbufoffset++;
 		}
 		p->dbufoffset += p->buflen;
@@ -211,7 +211,7 @@
 				return NULL;
 
 			for(save = p->buflen; p->buflen < MP3_BUFLEN; p->buflen++) {
-				s->buf[p->buflen] = p->dbuf[(p->buflen-save)+p->dbufoffset];
+				s->buf[p->buflen + AST_FRIENDLY_OFFSET] = p->dbuf[(p->buflen-save)+p->dbufoffset];
 				p->sbufoffset++;
 			}
 			p->dbufoffset += (MP3_BUFLEN - save);

Modified: team/russell/dtls/apps/app_chanspy.c
URL: http://svnview.digium.com/svn/asterisk/team/russell/dtls/apps/app_chanspy.c?view=diff&rev=219814&r1=219813&r2=219814
==============================================================================
--- team/russell/dtls/apps/app_chanspy.c (original)
+++ team/russell/dtls/apps/app_chanspy.c Tue Sep 22 14:20:02 2009
@@ -71,6 +71,11 @@
 						<para>Instead of whispering on a single channel barge in on both
 						channels involved in the call.</para>
 					</option>
+					<option name="c">
+						<argument name="digit" required="true">
+							<para>Specify a DTMF digit that can be used to spy on the next available channel.</para>
+						</argument>
+					</option>
 					<option name="d">
 						<para>Override the typical numeric DTMF functionality and instead
 						use DTMF to switch between spy modes.</para>
@@ -86,6 +91,15 @@
 							</enum>
 						</enumlist>
 					</option>
+					<option name="e">
+						<argument name="ext" required="true" />
+						<para>Enable <emphasis>enforced</emphasis> mode, so the spying channel can
+						only monitor extensions whose name is in the <replaceable>ext</replaceable> : delimited 
+						list.</para>
+					</option>
+					<option name="E">
+						<para>Exit when the spied-on channel hangs up.</para>
+					</option>
 					<option name="g">
 						<argument name="grp" required="true">
 							<para>Only spy on channels in which one or more of the groups
@@ -106,6 +120,9 @@
 						<argument name="mailbox" />
 						<argument name="context" />
 					</option>
+					<option name="o">
+						<para>Only listen to audio coming from this channel.</para>
+					</option>
 					<option name="q">
 						<para>Don't play a beep when beginning to spy on a channel, or speak the
 						selected channel name.</para>
@@ -119,6 +136,9 @@
 						<para>Skip the playback of the channel type (i.e. SIP, IAX, etc) when
 						speaking the selected channel name.</para>
 					</option>
+					<option name="S">
+						<para>Stop when no more channels are left to spy on.</para>
+					</option>
 					<option name="v">
 						<argument name="value" />
 						<para>Adjust the initial volume in the range from <literal>-4</literal> 
@@ -132,11 +152,10 @@
 						<para>Enable <literal>private whisper</literal> mode, so the spying channel can
 						talk to the spied-on channel but cannot listen to that channel.</para>
 					</option>
-					<option name="o">
-						<para>Only listen to audio coming from this channel.</para>
-					</option>
-					<option name="s">
-						<para>Stop when no more channels are left to spy on.</para>
+					<option name="x">
+						<argument name="digit" required="true">
+							<para>Specify a DTMF digit that can be used to exit the application.</para>
+						</argument>
 					</option>
 					<option name="X">
 						<para>Allow the user to exit ChanSpy to a valid single digit
@@ -144,22 +163,6 @@
 						specified by the <variable>SPY_EXIT_CONTEXT</variable> channel variable. The
 						name of the last channel that was spied on will be stored
 						in the <variable>SPY_CHANNEL</variable> variable.</para>
-					</option>
-					<option name="x">
-						<argument name="digit" required="true">
-							<para>Specify a DTMF digit that can be used to exit the application.</para>
-						</argument>
-					</option>
-					<option name="c">
-						<argument name="digit" required="true">
-							<para>Specify a DTMF digit that can be used to spy on the next available channel.</para>
-						</argument>
-					</option>
-					<option name="e">
-						<argument name="ext" required="true" />
-						<para>Enable <emphasis>enforced</emphasis> mode, so the spying channel can
-						only monitor extensions whose name is in the <replaceable>ext</replaceable> : delimited 
-						list.</para>
 					</option>
 				</optionlist>		
 			</parameter>
@@ -205,6 +208,11 @@
 						<para>Instead of whispering on a single channel barge in on both
 						channels involved in the call.</para>
 					</option>
+					<option name="c">
+						<argument name="digit" required="true">
+							<para>Specify a DTMF digit that can be used to spy on the next available channel.</para>
+						</argument>
+					</option>
 					<option name="d">
 						<para>Override the typical numeric DTMF functionality and instead
 						use DTMF to switch between spy modes.</para>
@@ -220,6 +228,15 @@
 							</enum>
 						</enumlist>
 					</option>
+					<option name="e">
+						<argument name="ext" required="true" />
+						<para>Enable <emphasis>enforced</emphasis> mode, so the spying channel can
+						only monitor extensions whose name is in the <replaceable>ext</replaceable> : delimited 
+						list.</para>
+					</option>
+					<option name="E">
+						<para>Exit when the spied-on channel hangs up.</para>
+					</option>
 					<option name="g">
 						<argument name="grp" required="true">
 							<para>Only spy on channels in which one or more of the groups
@@ -240,6 +257,9 @@
 						<argument name="mailbox" />
 						<argument name="context" />
 					</option>
+					<option name="o">
+						<para>Only listen to audio coming from this channel.</para>
+					</option>
 					<option name="q">
 						<para>Don't play a beep when beginning to spy on a channel, or speak the
 						selected channel name.</para>
@@ -253,6 +273,9 @@
 						<para>Skip the playback of the channel type (i.e. SIP, IAX, etc) when
 						speaking the selected channel name.</para>
 					</option>
+					<option name="S">
+						<para>Stop when there are no more extensions left to spy on.</para>
+					</option>
 					<option name="v">
 						<argument name="value" />
 						<para>Adjust the initial volume in the range from <literal>-4</literal> 
@@ -266,11 +289,10 @@
 						<para>Enable <literal>private whisper</literal> mode, so the spying channel can
 						talk to the spied-on channel but cannot listen to that channel.</para>
 					</option>
-					<option name="o">
-						<para>Only listen to audio coming from this channel.</para>
-					</option>
-					<option name="s">
-						<para>Stop when there are no more extensions left to spy on.</para>
+					<option name="x">
+						<argument name="digit" required="true">
+							<para>Specify a DTMF digit that can be used to exit the application.</para>
+						</argument>
 					</option>
 					<option name="X">
 						<para>Allow the user to exit ChanSpy to a valid single digit
@@ -278,22 +300,6 @@
 						specified by the <variable>SPY_EXIT_CONTEXT</variable> channel variable. The
 						name of the last channel that was spied on will be stored
 						in the <variable>SPY_CHANNEL</variable> variable.</para>
-					</option>
-					<option name="x">
-						<argument name="digit" required="true">
-							<para>Specify a DTMF digit that can be used to exit the application.</para>
-						</argument>
-					</option>
-					<option name="c">
-						<argument name="digit" required="true">
-							<para>Specify a DTMF digit that can be used to spy on the next available channel.</para>
-						</argument>
-					</option>
-					<option name="e">
-						<argument name="ext" required="true" />
-						<para>Enable <emphasis>enforced</emphasis> mode, so the spying channel can
-						only monitor extensions whose name is in the <replaceable>ext</replaceable> : delimited 
-						list.</para>
 					</option>
 				</optionlist>	
 			</parameter>
@@ -356,6 +362,7 @@
 	OPTION_DTMF_CYCLE        = (1 << 15),	/* Custom DTMF for cycling next avaliable channel, (default is '*') */
 	OPTION_DAHDI_SCAN        = (1 << 16),	/* Scan groups in DAHDIScan mode */
 	OPTION_STOP              = (1 << 17),
+	OPTION_EXITONHANGUP      = (1 << 18),   /* Hang up when the spied-on channel hangs up. */
 };
 
 enum {
@@ -370,23 +377,24 @@
 };
 
 AST_APP_OPTIONS(spy_opts, {
-	AST_APP_OPTION('q', OPTION_QUIET),
 	AST_APP_OPTION('b', OPTION_BRIDGED),
 	AST_APP_OPTION('B', OPTION_BARGE),
+	AST_APP_OPTION_ARG('c', OPTION_DTMF_CYCLE, OPT_ARG_CYCLE),
+	AST_APP_OPTION('d', OPTION_DTMF_SWITCH_MODES),
+	AST_APP_OPTION_ARG('e', OPTION_ENFORCED, OPT_ARG_ENFORCED),
+	AST_APP_OPTION('E', OPTION_EXITONHANGUP),
+	AST_APP_OPTION_ARG('g', OPTION_GROUP, OPT_ARG_GROUP),
+	AST_APP_OPTION_ARG('n', OPTION_NAME, OPT_ARG_NAME),
+	AST_APP_OPTION('o', OPTION_READONLY),
+	AST_APP_OPTION('q', OPTION_QUIET),
+	AST_APP_OPTION_ARG('r', OPTION_RECORD, OPT_ARG_RECORD),
+	AST_APP_OPTION('s', OPTION_NOTECH),
+	AST_APP_OPTION('S', OPTION_STOP),
+	AST_APP_OPTION_ARG('v', OPTION_VOLUME, OPT_ARG_VOLUME),
 	AST_APP_OPTION('w', OPTION_WHISPER),
 	AST_APP_OPTION('W', OPTION_PRIVATE),
-	AST_APP_OPTION_ARG('v', OPTION_VOLUME, OPT_ARG_VOLUME),
-	AST_APP_OPTION_ARG('g', OPTION_GROUP, OPT_ARG_GROUP),
-	AST_APP_OPTION_ARG('r', OPTION_RECORD, OPT_ARG_RECORD),
-	AST_APP_OPTION_ARG('e', OPTION_ENFORCED, OPT_ARG_ENFORCED),
-	AST_APP_OPTION('o', OPTION_READONLY),
-	AST_APP_OPTION('s', OPTION_STOP),
+	AST_APP_OPTION_ARG('x', OPTION_DTMF_EXIT, OPT_ARG_EXIT),
 	AST_APP_OPTION('X', OPTION_EXIT),
-	AST_APP_OPTION('s', OPTION_NOTECH),
-	AST_APP_OPTION_ARG('n', OPTION_NAME, OPT_ARG_NAME),
-	AST_APP_OPTION('d', OPTION_DTMF_SWITCH_MODES),
-	AST_APP_OPTION_ARG('x', OPTION_DTMF_EXIT, OPT_ARG_EXIT),
-	AST_APP_OPTION_ARG('c', OPTION_DTMF_CYCLE, OPT_ARG_CYCLE),
 });
 
 struct chanspy_translation_helper {
@@ -957,6 +965,8 @@
 						next_autochan = NULL;
 					}
 				}
+			} else if (res == 0 && ast_test_flag(flags, OPTION_EXITONHANGUP)) {
+				goto exit;
 			}
 		}
 
@@ -1089,6 +1099,10 @@
 	if (oldwf && ast_set_write_format(chan, oldwf) < 0)
 		ast_log(LOG_ERROR, "Could Not Set Write Format.\n");
 
+	if (ast_test_flag(&flags, OPTION_EXITONHANGUP)) {
+		ast_verb(3, "Stopped spying due to the spied-on channel hanging up.\n");
+	}
+
 	return res;
 }
 

Modified: team/russell/dtls/apps/app_directed_pickup.c
URL: http://svnview.digium.com/svn/asterisk/team/russell/dtls/apps/app_directed_pickup.c?view=diff&rev=219814&r1=219813&r2=219814
==============================================================================
--- team/russell/dtls/apps/app_directed_pickup.c (original)
+++ team/russell/dtls/apps/app_directed_pickup.c Tue Sep 22 14:20:02 2009
@@ -216,7 +216,7 @@
 
 	while ((target = ast_channel_iterator_next(iter))) {
 		ast_channel_lock(target);
-		if (can_pickup(target)) {
+		if ((chan != target) && can_pickup(target)) {
 			break;
 		}
 		ast_channel_unlock(target);

Modified: team/russell/dtls/apps/app_disa.c
URL: http://svnview.digium.com/svn/asterisk/team/russell/dtls/apps/app_disa.c?view=diff&rev=219814&r1=219813&r2=219814
==============================================================================
--- team/russell/dtls/apps/app_disa.c (original)
+++ team/russell/dtls/apps/app_disa.c Tue Sep 22 14:20:02 2009
@@ -187,8 +187,12 @@
 			/* answer */
 			ast_answer(chan);
 		}
-	} else
+	} else {
 		special_noanswer = 1;
+		if (chan->_state != AST_STATE_UP) {
+			ast_indicate(chan, AST_CONTROL_PROGRESS);
+		}
+	}
 
 	ast_debug(1, "Context: %s\n",args.context);
 

Modified: team/russell/dtls/apps/app_followme.c
URL: http://svnview.digium.com/svn/asterisk/team/russell/dtls/apps/app_followme.c?view=diff&rev=219814&r1=219813&r2=219814
==============================================================================
--- team/russell/dtls/apps/app_followme.c (original)
+++ team/russell/dtls/apps/app_followme.c Tue Sep 22 14:20:02 2009
@@ -835,6 +835,10 @@
 			if (outbound) {
 				ast_set_callerid(outbound, caller->cid.cid_num, caller->cid.cid_name, caller->cid.cid_num);
 				ast_channel_inherit_variables(tpargs->chan, outbound);
+				ast_channel_datastore_inherit(tpargs->chan, outbound);
+				ast_string_field_set(outbound, language, tpargs->chan->language);
+				ast_string_field_set(outbound, accountcode, tpargs->chan->accountcode);
+				ast_string_field_set(outbound, musicclass, tpargs->chan->musicclass);
 				ast_verb(3, "calling %s\n", dialarg);
 				if (!ast_call(outbound,dialarg,0)) {
 					tmpuser->ochan = outbound;

Modified: team/russell/dtls/apps/app_meetme.c
URL: http://svnview.digium.com/svn/asterisk/team/russell/dtls/apps/app_meetme.c?view=diff&rev=219814&r1=219813&r2=219814
==============================================================================
--- team/russell/dtls/apps/app_meetme.c (original)
+++ team/russell/dtls/apps/app_meetme.c Tue Sep 22 14:20:02 2009
@@ -2055,7 +2055,7 @@
 	int res;
 	int retrydahdi;
 	int origfd;
-	int musiconhold = 0;
+	int musiconhold = 0, mohtempstopped = 0;
 	int firstpass = 0;
 	int lastmarked = 0;
 	int currentmarked = 0;
@@ -2095,6 +2095,7 @@
  	struct timeval nexteventts = { 0, };
  	int to;
 	int setusercount = 0;
+	int confsilence = 0, totalsilence = 0;
 
 	if (!(user = ast_calloc(1, sizeof(*user))))
 		return ret;
@@ -2525,6 +2526,11 @@
 
 	conf_flush(fd, chan);
 
+	if (!(dsp = ast_dsp_new())) {
+		ast_log(LOG_WARNING, "Unable to allocate DSP!\n");
+		res = -1;
+	}
+
 	if (confflags & CONFFLAG_AGI) {
 		/* Get name of AGI file to run from $(MEETME_AGI_BACKGROUND)
 		   or use default filename of conf-background.agi */
@@ -2561,10 +2567,6 @@
 			x = 1;
 			ast_channel_setoption(chan, AST_OPTION_TONE_VERIFY, &x, sizeof(char), 0);
 		}	
-		if (confflags & (CONFFLAG_OPTIMIZETALKER | CONFFLAG_MONITORTALKER) && !(dsp = ast_dsp_new())) {
-			ast_log(LOG_WARNING, "Unable to allocate DSP!\n");
-			res = -1;
-		}
 		for (;;) {
 			int menu_was_active = 0;
 
@@ -2933,8 +2935,6 @@
 					}
 
 					if (confflags & (CONFFLAG_OPTIMIZETALKER | CONFFLAG_MONITORTALKER)) {
-						int totalsilence;
-
 						if (user->talking == -1) {
 							user->talking = 0;
 						}
@@ -3275,7 +3275,11 @@
  							if ((conf->transframe[idx]->frametype != AST_FRAME_NULL) &&
 							    can_write(chan, confflags)) {
 								struct ast_frame *cur;
-								
+								if (musiconhold && !ast_dsp_silence(dsp, conf->transframe[idx], &confsilence) && confsilence < MEETME_DELAYDETECTTALK) {
+									ast_moh_stop(chan);
+									mohtempstopped = 1;
+								}
+
 								/* the translator may have returned a list of frames, so
 								   write each one onto the channel
 								*/
@@ -3285,6 +3289,10 @@
 										break;
 									}
 								}
+								if (musiconhold && mohtempstopped && confsilence > MEETME_DELAYDETECTENDTALK) {
+									mohtempstopped = 0;
+									ast_moh_start(chan, NULL, NULL);
+								}
 							}
 						} else {
 							ast_mutex_unlock(&conf->listenlock);
@@ -3292,12 +3300,20 @@
 						}
 						ast_mutex_unlock(&conf->listenlock);
 					} else {
-bailoutandtrynormal:					
+bailoutandtrynormal:
+						if (musiconhold && !ast_dsp_silence(dsp, &fr, &confsilence) && confsilence < MEETME_DELAYDETECTTALK) {
+							ast_moh_stop(chan);
+							mohtempstopped = 1;
+						}
 						if (user->listen.actual) {
 							ast_frame_adjust_volume(&fr, user->listen.actual);
 						}
 						if (can_write(chan, confflags) && ast_write(chan, &fr) < 0) {
 							ast_log(LOG_WARNING, "Unable to write frame to channel %s\n", chan->name);
+						}
+						if (musiconhold && mohtempstopped && confsilence > MEETME_DELAYDETECTENDTALK) {
+							mohtempstopped = 0;
+							ast_moh_start(chan, NULL, NULL);
 						}
 					}
 				} else {

Modified: team/russell/dtls/apps/app_playback.c
URL: http://svnview.digium.com/svn/asterisk/team/russell/dtls/apps/app_playback.c?view=diff&rev=219814&r1=219813&r2=219814
==============================================================================
--- team/russell/dtls/apps/app_playback.c (original)
+++ team/russell/dtls/apps/app_playback.c Tue Sep 22 14:20:02 2009
@@ -449,9 +449,13 @@
 		if (option_skip) {
 			/* At the user's option, skip if the line is not up */
 			goto done;
-		} else if (!option_noanswer)
+		} else if (!option_noanswer) {
 			/* Otherwise answer unless we're supposed to send this while on-hook */
 			res = ast_answer(chan);
+		} else {
+			ast_indicate(chan, AST_CONTROL_PROGRESS);
+		}
+
 	}
 	if (!res) {
 		char *back = args.filenames;

Modified: team/russell/dtls/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/russell/dtls/apps/app_queue.c?view=diff&rev=219814&r1=219813&r2=219814
==============================================================================
--- team/russell/dtls/apps/app_queue.c (original)
+++ team/russell/dtls/apps/app_queue.c Tue Sep 22 14:20:02 2009
@@ -2710,6 +2710,7 @@
 
 	/* Inherit specially named variables from parent channel */
 	ast_channel_inherit_variables(qe->chan, tmp->chan);
+	ast_channel_datastore_inherit(qe->chan, tmp->chan);
 
 	/* Presense of ADSI CPE on outgoing channel follows ours */
 	tmp->chan->adsicpe = qe->chan->adsicpe;
@@ -3082,7 +3083,11 @@
 			*to = 0;
 			return NULL;
 		}
+
+		/* Poll for events from both the incoming channel as well as any outgoing channels */
 		winner = ast_waitfor_n(watchers, pos, to);
+
+		/* Service all of the outgoing channels */
 		for (o = start; o; o = o->call_next) {
 			/* We go with a static buffer here instead of using ast_strdupa. Using
 			 * ast_strdupa in a loop like this one can cause a stack overflow
@@ -3231,7 +3236,11 @@
 							if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
 								if (qe->parent->timeoutrestart)
 									*to = orig;
-								ring_one(qe, outgoing, &numbusies);
+								/* Have enough time for a queue member to answer? */
+								if (*to > 500) {
+									ring_one(qe, outgoing, &numbusies);
+									starttime = (long) time(NULL);
+								}
 							}
 							numbusies++;
 							break;
@@ -3246,7 +3255,10 @@
 							if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
 								if (qe->parent->timeoutrestart)
 									*to = orig;
-								ring_one(qe, outgoing, &numbusies);
+								if (*to > 500) {
+									ring_one(qe, outgoing, &numbusies);
+									starttime = (long) time(NULL);
+								}
 							}
 							numbusies++;
 							break;
@@ -3286,18 +3298,23 @@
 						}
 					}
 					ast_frfree(f);
-				} else {
+				} else { /* ast_read() returned NULL */
 					endtime = (long) time(NULL) - starttime;
 					rna(endtime * 1000, qe, on, membername, 1);
 					do_hang(o);
 					if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
 						if (qe->parent->timeoutrestart)
 							*to = orig;
-						ring_one(qe, outgoing, &numbusies);
+						if (*to > 500) {
+							ring_one(qe, outgoing, &numbusies);
+							starttime = (long) time(NULL);
+						}
 					}
 				}
 			}
 		}
+
+		/* If we received an event from the caller, deal with it. */
 		if (winner == in) {
 			f = ast_read(in);
 			if (!f || ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP))) {

Modified: team/russell/dtls/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/team/russell/dtls/apps/app_voicemail.c?view=diff&rev=219814&r1=219813&r2=219814
==============================================================================
--- team/russell/dtls/apps/app_voicemail.c (original)
+++ team/russell/dtls/apps/app_voicemail.c Tue Sep 22 14:20:02 2009
@@ -783,6 +783,7 @@
 static char vm_reenterpassword[80] = "vm-reenterpassword";
 static char vm_mismatch[80] = "vm-mismatch";
 static char vm_invalid_password[80] = "vm-invalid-password";
+static char vm_pls_try_again[80] = "vm-pls-try-again";
 
 static struct ast_flags globalflags = {0};
 
@@ -942,6 +943,7 @@
 	} else if (!strcasecmp(var, "exitcontext")) {
 		ast_copy_string(vmu->exit, value, sizeof(vmu->exit));
 	} else if (!strcasecmp(var, "maxmessage") || !strcasecmp(var, "maxsecs")) {
+		vmu->maxsecs = atoi(value);
 		if (vmu->maxsecs <= 0) {
 			ast_log(AST_LOG_WARNING, "Invalid max message length of %s. Using global value %d\n", value, vmmaxsecs);
 			vmu->maxsecs = vmmaxsecs;
@@ -1067,28 +1069,27 @@
  * \param vmu The voicemail user to change the password for.
  * \param password The new value to be set to the password for this user.
  * 
- * This only works if the voicemail user has a unique id, and if there is a realtime engine configured.
+ * This only works if there is a realtime engine configured.
  * This is called from the (top level) vm_change_password.
  *
  * \return zero on success, -1 on error.
  */
 static int change_password_realtime(struct ast_vm_user *vmu, const char *password)
 {
-	int res;
-	if (!ast_strlen_zero(vmu->uniqueid)) {
-		if (strlen(password) > 10) {
-			ast_realtime_require_field("voicemail", "password", RQ_CHAR, strlen(password), SENTINEL);
-		}
-		res = ast_update2_realtime("voicemail", "context", vmu->context, "mailbox", vmu->mailbox, SENTINEL, "password", password, SENTINEL);
-		if (res > 0) {
-			ast_copy_string(vmu->password, password, sizeof(vmu->password));
-			res = 0;
-		} else if (!res) {
-			res = -1;
-		}
-		return res;
-	}
-	return -1;
+	int res = -1;
+	if (!strcmp(vmu->password, password)) {
+		/* No change (but an update would return 0 rows updated, so we opt out here) */
+		return 0;
+	}
+
+	if (strlen(password) > 10) {
+		ast_realtime_require_field("voicemail", "password", RQ_CHAR, strlen(password), SENTINEL);
+	}
+	if (ast_update2_realtime("voicemail", "context", vmu->context, "mailbox", vmu->mailbox, SENTINEL, "password", password, SENTINEL) > 0) {
+		ast_copy_string(vmu->password, password, sizeof(vmu->password));
+		res = 0;
+	}
+	return res;
 }
 
 /*!
@@ -2357,7 +2358,7 @@
 		ast_variables_destroy(var);
 		return vmu;
 	} else {
-		free(vmu);
+		ast_free(vmu);
 		return NULL;
 	}
 }
@@ -8431,6 +8432,9 @@
 		}
 		if (++tries == 3)
 			return -1;
+		if (cmd != 0) {
+			cmd = ast_play_and_wait(chan, vm_pls_try_again);
+		}
 	}
 	if (pwdchange & PWDCHANGE_INTERNAL)
 		vm_change_password(vmu, newpassword);
@@ -8528,6 +8532,9 @@
 			if (cmd != 0) {
 				ast_log(AST_LOG_NOTICE, "Invalid password for user %s (%s)\n", vms->username, newpassword);
 				cmd = ast_play_and_wait(chan, vm_invalid_password);
+				if (!cmd) {
+					cmd = ast_play_and_wait(chan, vm_pls_try_again);
+				}
 				break;
 			}
 			newpassword2[1] = '\0';
@@ -8545,6 +8552,9 @@
 			if (strcmp(newpassword, newpassword2)) {
 				ast_log(AST_LOG_NOTICE, "Password mismatch for user %s (%s != %s)\n", vms->username, newpassword, newpassword2);
 				cmd = ast_play_and_wait(chan, vm_mismatch);
+				if (!cmd) {
+					cmd = ast_play_and_wait(chan, vm_pls_try_again);
+				}
 				break;
 			}
 			if (pwdchange & PWDCHANGE_INTERNAL)
@@ -10965,6 +10975,9 @@
 			ast_copy_string(vm_reenterpassword, val, sizeof(vm_reenterpassword));
 		if ((val = ast_variable_retrieve(cfg, "general", "vm-mismatch")))
 			ast_copy_string(vm_mismatch, val, sizeof(vm_mismatch));
+		if ((val = ast_variable_retrieve(cfg, "general", "vm-pls-try-again"))) {
+			ast_copy_string(vm_pls_try_again, val, sizeof(vm_pls_try_again));
+		}
 		/* load configurable audio prompts */
 		if ((val = ast_variable_retrieve(cfg, "general", "listen-control-forward-key")) && is_valid_dtmf(val))
 			ast_copy_string(listen_control_forward_key, val, sizeof(listen_control_forward_key));

Modified: team/russell/dtls/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/russell/dtls/channels/chan_dahdi.c?view=diff&rev=219814&r1=219813&r2=219814
==============================================================================
--- team/russell/dtls/channels/chan_dahdi.c (original)
+++ team/russell/dtls/channels/chan_dahdi.c Tue Sep 22 14:20:02 2009
@@ -416,6 +416,7 @@
 static int numbufs = 4;
 
 static int mwilevel = 512;
+static int dtmfcid_level = 256;
 
 #ifdef HAVE_PRI
 #ifdef PRI_GETSET_TIMERS
@@ -564,10 +565,8 @@
 	struct dahdi_pvt *pvts[MAX_CHANNELS];     /*!< Member channel pvt structs */
 	int numchans;                          /*!< Number of channels in this R2 block */
 	int monitored_count;                   /*!< Number of channels being monitored */
-	ast_mutex_t monitored_count_lock;      /*!< lock access to the counter */
-	ast_cond_t do_monitor;                 /*!< Condition to wake up the monitor thread when there's work to do */
-
 };
+
 struct dahdi_mfcr2_conf {
 	openr2_variant_t variant;
 	int mfback_timeout;
@@ -682,7 +681,13 @@
 	mwisend_states 	mwisend_current;
 };
 
-static struct dahdi_pvt {
+/*! Specify the lists dahdi_pvt can be put in. */
+enum DAHDI_IFLIST {
+	DAHDI_IFLIST_NONE,	/*!< The dahdi_pvt is not in any list. */
+	DAHDI_IFLIST_MAIN,	/*!< The dahdi_pvt is in the main interface list */
+};
+
+struct dahdi_pvt {
 	ast_mutex_t lock;
 	struct callerid_state *cs;
 	struct ast_channel *owner;			/*!< Our current active owner (if applicable) */
@@ -717,6 +722,7 @@
 	/*! \brief Tx gain set by chan_dahdi.conf */
 	float txgain;
 	int tonezone;					/*!< tone zone for this chan, or -1 for default */
+	enum DAHDI_IFLIST which_iflist;	/*!< Which interface list is this structure listed? */
 	struct dahdi_pvt *next;				/*!< Next channel in list */
 	struct dahdi_pvt *prev;				/*!< Prev channel in list */
 
@@ -783,7 +789,7 @@
 	unsigned int dialing:1;
 	/*! \brief TRUE if the transfer capability of the call is digital. */
 	unsigned int digital:1;
-	/*! \brief TRUE if Do-Not-Disturb is enabled. */
+	/*! \brief TRUE if Do-Not-Disturb is enabled, present only for non sig_analog */
 	unsigned int dnd:1;
 	/*! \brief XXX BOOLEAN Purpose??? */
 	unsigned int echobreak:1;
@@ -945,12 +951,12 @@
 	unsigned int inservice:1;
 	/*!
 	 * \brief TRUE if the channel is locally blocked.
-	 * \note Applies to SS7 channels.
+	 * \note Applies to SS7 and MFCR2 channels.
 	 */
 	unsigned int locallyblocked:1;
 	/*!
 	 * \brief TRUE if the channel is remotely blocked.
-	 * \note Applies to SS7 channels.
+	 * \note Applies to SS7 and MFCR2 channels.
 	 */
 	unsigned int remotelyblocked:1;
 #if defined(HAVE_PRI)
@@ -1081,7 +1087,9 @@
 	int span;					/*!< Span number */
 	time_t guardtime;				/*!< Must wait this much time before using for new call */
 	int cid_signalling;				/*!< CID signalling type bell202 or v23 */
-	int cid_start;					/*!< CID start indicator, polarity or ring */
+	int cid_start;					/*!< CID start indicator, polarity or ring or DTMF without warning event */
+	int dtmfcid_holdoff_state;		/*!< State indicator that allows for line to settle before checking for dtmf energy */
+	struct timeval	dtmfcid_delay;  /*!< Time value used for allow line to settle */
 	int callingpres;				/*!< The value of calling presentation that we're going to use when placing a PRI call */
 	int callwaitingrepeat;				/*!< How many samples to wait before repeating call waiting */
 	int cidcwexpire;				/*!< When to expire our muting for CID/CW */
@@ -1245,7 +1253,10 @@
 	/*! \brief TRUE if confrence is muted. */
 	int muting;
 	void *sig_pvt;
-} *iflist = NULL, *ifend = NULL;
+};
+
+static struct dahdi_pvt *iflist = NULL;	/*!< Main interface list start */
+static struct dahdi_pvt *ifend = NULL;	/*!< Main interface list end */
 
 /*! \brief Channel configuration from chan_dahdi.conf .
  * This struct is used for parsing the [channels] section of chan_dahdi.conf.
@@ -1413,7 +1424,6 @@
 static int dahdi_setoption(struct ast_channel *chan, int option, void *data, int datalen);
 static int dahdi_queryoption(struct ast_channel *chan, int option, void *data, int *datalen);
 static int dahdi_func_read(struct ast_channel *chan, const char *function, char *data, char *buf, size_t len);
-static int handle_init_event(struct dahdi_pvt *i, int event);
 static int dahdi_func_write(struct ast_channel *chan, const char *function, char *data, const char *value);
 
 static const struct ast_channel_tech dahdi_tech = {
@@ -1804,7 +1814,7 @@
 	p->callwaitingrepeat = CALLWAITING_REPEAT_SAMPLES;
 	if (p->cidspill) {
 		ast_log(LOG_WARNING, "Spill already exists?!?\n");
-		free(p->cidspill);
+		ast_free(p->cidspill);
 	}
 	if (!(p->cidspill = ast_malloc(2400 /* SAS */ + 680 /* CAS */ + READ_SIZE * 4)))
 		return -1;
@@ -1834,7 +1844,7 @@
 
 	if (p->cidspill) {
 		ast_log(LOG_WARNING, "cidspill already exists??\n");
-		free(p->cidspill);
+		ast_free(p->cidspill);
 	}
 
 	if ((p->cidspill = ast_malloc(MAX_CALLERID_SIZE))) {
@@ -2099,6 +2109,15 @@
 	}
 
 	return 0;
+}
+
+static void my_cancel_cidspill(void *pvt)
+{
+	struct dahdi_pvt *p = pvt;
+	if (p->cidspill) {
+		ast_free(p->cidspill);
+		p->cidspill = NULL;
+	}
 }
 
 static void my_increase_ss_count(void)
@@ -2392,6 +2411,9 @@
 	case DAHDI_EVENT_PULSE_START:
 		res = ANALOG_EVENT_PULSE_START;
 	break;
+	case DAHDI_EVENT_REMOVED:
+		res = ANALOG_EVENT_REMOVED;
+	break;
 	case DAHDI_EVENT_NEONMWI_ACTIVE:
 		res = ANALOG_EVENT_NEONMWI_ACTIVE;
 		break;
@@ -2432,6 +2454,8 @@
 	int res;
 	struct dahdi_params par;
 
+	memset(&par, 0, sizeof(par));
+
 	if (p->subs[SUB_REAL].dfd > -1)
 		res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_GET_PARAMS, &par);
 	else {
@@ -2562,30 +2586,31 @@
 }
 
 #if defined(HAVE_PRI)
-static void my_pri_fixup_chans(void *old_chan, void *new_chan)
-{
-	struct dahdi_pvt *old = old_chan;
-	struct dahdi_pvt *new = new_chan;
-	struct sig_pri_chan *pchan = new->sig_pvt;
+static void my_pri_fixup_chans(void *chan_old, void *chan_new)
+{
+	struct dahdi_pvt *old_chan = chan_old;
+	struct dahdi_pvt *new_chan = chan_new;
+	struct sig_pri_chan *pchan = new_chan->sig_pvt;
 	struct sig_pri_pri *pri = pchan->pri;
 
-	new->owner = old->owner;
-	old->owner = NULL;
-	if (new->owner) {
+	new_chan->owner = old_chan->owner;
+	old_chan->owner = NULL;
+	if (new_chan->owner) {
 		char newname[AST_CHANNEL_NAME];
-		snprintf(newname, sizeof(newname), "DAHDI/%d:%d-%d", pri->trunkgroup, new->channel, 1);
-		ast_change_name(new->owner, newname);
-
-		new->owner->tech_pvt = new;
-		new->owner->fds[0] = new->subs[SUB_REAL].dfd;
-		new->subs[SUB_REAL].owner = old->subs[SUB_REAL].owner;
-		old->subs[SUB_REAL].owner = NULL;
+
+		snprintf(newname, sizeof(newname), "DAHDI/%d:%d-%d", pri->trunkgroup, new_chan->channel, 1);
+		ast_change_name(new_chan->owner, newname);
+
+		new_chan->owner->tech_pvt = new_chan;
+		new_chan->owner->fds[0] = new_chan->subs[SUB_REAL].dfd;
+		new_chan->subs[SUB_REAL].owner = old_chan->subs[SUB_REAL].owner;
+		old_chan->subs[SUB_REAL].owner = NULL;
 	}
 	/* Copy any DSP that may be present */
-	new->dsp = old->dsp;
-	new->dsp_features = old->dsp_features;
-	old->dsp = NULL;
-	old->dsp_features = 0;
+	new_chan->dsp = old_chan->dsp;
+	new_chan->dsp_features = old_chan->dsp_features;
+	old_chan->dsp = NULL;
+	old_chan->dsp_features = 0;
 }
 
 static int sig_pri_tone_to_dahditone(enum sig_pri_tone tone)
@@ -2829,6 +2854,7 @@
 	.check_waitingfordt = my_check_waitingfordt,
 	.set_confirmanswer = my_set_confirmanswer,
 	.check_confirmanswer = my_check_confirmanswer,
+	.cancel_cidspill = my_cancel_cidspill,
 };
 
 static struct dahdi_pvt *round_robin[32];
@@ -3005,7 +3031,7 @@
 	p->mfcr2_answer_pending = 0;
 	p->mfcr2_call_accepted = 0;
 	ast_mutex_unlock(&p->lock);
-	ast_log(LOG_NOTICE, "New MFC/R2 call detected on chan %d.\n", openr2_chan_get_number(r2chan));
+	ast_verbose("New MFC/R2 call detected on chan %d.\n", openr2_chan_get_number(r2chan));
 }
 
 static void dahdi_r2_on_hardware_alarm(openr2_chan_t *r2chan, int alarm)
@@ -3042,24 +3068,6 @@
 	ast_mutex_unlock(&p->lock);
 }
 
-static void dahdi_r2_update_monitor_count(struct dahdi_mfcr2 *mfcr2, int increment)
-{
-	ast_mutex_lock(&mfcr2->monitored_count_lock);
-	if (increment) {
-		mfcr2->monitored_count++;
-		if (mfcr2->monitored_count == 1) {
-			ast_log(LOG_DEBUG, "At least one device needs monitoring, let's wake up the monitor thread.\n");
-			ast_cond_signal(&mfcr2->do_monitor);
-		}
-	} else {
-		mfcr2->monitored_count--;
-		if (mfcr2->monitored_count < 0) {
-			ast_log(LOG_ERROR, "we have a bug here!.\n");
-		}
-	}
-	ast_mutex_unlock(&mfcr2->monitored_count_lock);
-}
-

[... 8365 lines stripped ...]



More information about the asterisk-commits mailing list