[asterisk-commits] russell: branch russell/chan_refcount r115265 - in /team/russell/chan_refcoun...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri May 2 21:44:44 CDT 2008


Author: russell
Date: Fri May  2 21:44:42 2008
New Revision: 115265

URL: http://svn.digium.com/view/asterisk?view=rev&rev=115265
Log:
sync with trunk, resolve, reset

Added:
    team/russell/chan_refcount/funcs/func_speex.c
      - copied unchanged from r115258, trunk/funcs/func_speex.c
Modified:
    team/russell/chan_refcount/   (props changed)
    team/russell/chan_refcount/CHANGES
    team/russell/chan_refcount/Makefile.rules
    team/russell/chan_refcount/UPGRADE.txt
    team/russell/chan_refcount/apps/app_chanspy.c
    team/russell/chan_refcount/apps/app_dial.c
    team/russell/chan_refcount/apps/app_directory.c
    team/russell/chan_refcount/apps/app_disa.c
    team/russell/chan_refcount/apps/app_dumpchan.c
    team/russell/chan_refcount/apps/app_externalivr.c
    team/russell/chan_refcount/apps/app_macro.c
    team/russell/chan_refcount/apps/app_meetme.c
    team/russell/chan_refcount/apps/app_minivm.c
    team/russell/chan_refcount/apps/app_morsecode.c
    team/russell/chan_refcount/apps/app_queue.c
    team/russell/chan_refcount/apps/app_read.c
    team/russell/chan_refcount/apps/app_readexten.c
    team/russell/chan_refcount/apps/app_rpt.c
    team/russell/chan_refcount/apps/app_speech_utils.c
    team/russell/chan_refcount/apps/app_stack.c
    team/russell/chan_refcount/apps/app_voicemail.c
    team/russell/chan_refcount/apps/app_while.c
    team/russell/chan_refcount/channels/chan_iax2.c
    team/russell/chan_refcount/channels/chan_sip.c
    team/russell/chan_refcount/channels/chan_zap.c
    team/russell/chan_refcount/channels/iax2-provision.c
    team/russell/chan_refcount/channels/iax2.h
    team/russell/chan_refcount/configs/queues.conf.sample
    team/russell/chan_refcount/configs/sip.conf.sample
    team/russell/chan_refcount/configure
    team/russell/chan_refcount/configure.ac
    team/russell/chan_refcount/contrib/scripts/get_ilbc_source.sh
    team/russell/chan_refcount/doc/smdi.txt
    team/russell/chan_refcount/funcs/func_timeout.c
    team/russell/chan_refcount/include/asterisk/app.h
    team/russell/chan_refcount/include/asterisk/audiohook.h
    team/russell/chan_refcount/include/asterisk/autoconfig.h.in
    team/russell/chan_refcount/include/asterisk/channel.h
    team/russell/chan_refcount/include/asterisk/compiler.h
    team/russell/chan_refcount/include/asterisk/config.h
    team/russell/chan_refcount/include/asterisk/logger.h
    team/russell/chan_refcount/include/asterisk/pbx.h
    team/russell/chan_refcount/include/asterisk/res_odbc.h
    team/russell/chan_refcount/include/asterisk/sched.h
    team/russell/chan_refcount/main/app.c
    team/russell/chan_refcount/main/asterisk.c
    team/russell/chan_refcount/main/audiohook.c
    team/russell/chan_refcount/main/channel.c
    team/russell/chan_refcount/main/cli.c
    team/russell/chan_refcount/main/config.c
    team/russell/chan_refcount/main/dial.c
    team/russell/chan_refcount/main/features.c
    team/russell/chan_refcount/main/manager.c
    team/russell/chan_refcount/main/pbx.c
    team/russell/chan_refcount/main/sched.c
    team/russell/chan_refcount/main/utils.c
    team/russell/chan_refcount/phoneprov/polycom.xml
    team/russell/chan_refcount/res/res_agi.c
    team/russell/chan_refcount/res/res_config_pgsql.c
    team/russell/chan_refcount/res/res_smdi.c
    team/russell/chan_refcount/res/snmp/agent.c

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

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

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

Propchange: team/russell/chan_refcount/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri May  2 21:44:42 2008
@@ -1,1 +1,1 @@
-/trunk:1-104106,104108-114799
+/trunk:1-104106,104108-115264

Modified: team/russell/chan_refcount/CHANGES
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/CHANGES?view=diff&rev=115265&r1=115264&r2=115265
==============================================================================
--- team/russell/chan_refcount/CHANGES (original)
+++ team/russell/chan_refcount/CHANGES Fri May  2 21:44:42 2008
@@ -7,6 +7,13 @@
  * Added a new dialplan function, AST_CONFIG(), which allows you to access
    variables from an Asterisk configuration file.
  * The JACK_HOOK function now has a c() option to supply a custom client name.
+ * Added two new dialplan functions from libspeex for audio gain control and 
+   denoise, AGC() and DENOISE(). Both functions can be applied to the tx and 
+   rx directions of a channel from the dialplan.
+ * The SMDI_MSG_RETRIEVE function now has the ability to search for SMDI messages
+   based on other parameters.  The default is still to search based on the
+   forwarding station ID.  However, there are new options that allow you to search
+   based on the message desk terminal ID, or the message desk number.
 
 Zaptel channel driver (chan_zap) Changes
 ----------------------------------------
@@ -18,6 +25,13 @@
  * It is now possible to specify a pattern match as a hint. Once a phone subscribes
    to something that matches the pattern a hint will be created using the contents
    and variables evaluated.
+ * Dialplan matching has been extended to allow an extension to return to the
+   PBX core to wait for more digits.  This is done by using the new dialplan
+   application called "Incomplete".  This will permit a whole new level of
+   extension control, by giving the administrator more control over early
+   matches employing one of the short-circuit pattern match operators.  Note
+   that custom applications can trigger this same behavior by returning the
+   special value AST_PBX_INCOMPLETE.
 
 Application Changes
 -------------------
@@ -36,6 +50,10 @@
  * Chanspy has a new option, 'B', which can be used to "barge" on a call. This is
    like the pre-existing whisper mode, except that the spy can also talk to the
    participant on the bridged channel as well.
+ * Chanspy has a new option, 'n', which will allow for the spied-on party's name
+   to be spoken instead of the channel name or number. For more information on the
+   use of this option, issue the command "core show application ChanSpy" from the 
+   Asterisk CLI.
 
 SIP Changes
 -----------
@@ -52,6 +70,8 @@
    and restore this performance improvement. Astobj2 refcounting is now used
    for users, peers, and dialogs.  Users are encouraged to assist in regression
    testing and problem reporting!
+ * Added ability to specify registration expiry time on a per registration basis in
+   the register line.
 
 IAX Changes
 -----------
@@ -62,11 +82,20 @@
   * New CLI command, "config reload <file.conf>" which reloads any module that
      references that particular configuration file.  Also added "config list"
      which shows which configuration files are in use.
+  * New CLI commands, "pri show version" and "ss7 show version" that will
+     display which version of libpri and libss7 are being used, respectively.
+	 A new API call was added so trunk will now have to be compiled against
+	 a versions of libpri and libss7 that have them or it will not know that
+	 these libraries exist.
 
 DNS manager changes
 -------------------
   * Addresses managed by DNS manager now can check to see if there is a DNS
     SRV record for a given domain and will use that hostname/port if present.
+
+Dialplan function changes
+-------------------------
+ * TIMEOUT() has been modified to be accurate down to the millisecond.
 
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 1.4.X to Asterisk 1.6.0  -------------
@@ -406,6 +435,12 @@
   * New configuration option: randomperiodicannounce. If a list of periodic announcements is
     specified by the periodic-announce option, then one will be chosen randomly when it is time
 	to play a periodic announcment
+  * New configuration options: announce-position now takes two more values in addition to "yes" and
+    "no." Two new options, "limit" and "more," are allowed. These are tied to another option,
+	announce-position-limit. By setting announce-position to "limit" callers will only have their
+	position announced if their position is less than what is specified by announce-position-limit.
+	If announce-position is set to "more" then callers beyond the position specified by announce-position-limit
+	will be told that their are more than announce-position-limit callers waiting.
 
 MeetMe Changes
 --------------

Modified: team/russell/chan_refcount/Makefile.rules
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/Makefile.rules?view=diff&rev=115265&r1=115264&r2=115265
==============================================================================
--- team/russell/chan_refcount/Makefile.rules (original)
+++ team/russell/chan_refcount/Makefile.rules Fri May  2 21:44:42 2008
@@ -21,7 +21,7 @@
 .PHONY: dist-clean
 
 # extra cflags to build dependencies. Recursively expanded.
-MAKE_DEPS= -MMD -MT $@ -MF .$(subst /,_,$@).d -MP
+MAKE_DEPS= -MD -MT $@ -MF .$(subst /,_,$@).d -MP
 
 ifeq ($(NOISY_BUILD),)
     ECHO_PREFIX=@

Modified: team/russell/chan_refcount/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/UPGRADE.txt?view=diff&rev=115265&r1=115264&r2=115265
==============================================================================
--- team/russell/chan_refcount/UPGRADE.txt (original)
+++ team/russell/chan_refcount/UPGRADE.txt Fri May  2 21:44:42 2008
@@ -92,7 +92,12 @@
   Gosub()/Return() applications.  To replace MacroExclusive(), we have
   introduced dialplan functions LOCK(), TRYLOCK(), and UNLOCK().  You may use
   these functions in any location where you desire to ensure that only one
-  channel is executing that path at any one time.
+  channel is executing that path at any one time.  The Macro() applications
+  are deprecated for performance reasons.  However, since Macro() has been
+  around for a long time and so many dialplans depend heavily on it, it will
+  not be removed for the sake of backwards compatibility.  It is also worth
+  noting that using both Macro() and GoSub() at the same time is _heavily_
+  discouraged.
 * Read() now sets a READSTATUS variable on exit.  It does NOT automatically
   return -1 (and hangup) anymore on error.  If you want to hangup on error,
   you need to do so explicitly in your dialplan.
@@ -103,6 +108,8 @@
 * WaitMusicOnHold application is now deprecated in favor of extended MusicOnHold.
 * SetMusicOnHold is now deprecated. You should use Set(CHANNEL(musicclass)=...)
   instead.
+* While app_directory has always relied on having a voicemail.conf or users.conf file
+  correctly set up, it now is dependent on app_voicemail being compiled as well.
 
 Dialplan Functions:
 

Modified: team/russell/chan_refcount/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/apps/app_chanspy.c?view=diff&rev=115265&r1=115264&r2=115265
==============================================================================
--- team/russell/chan_refcount/apps/app_chanspy.c (original)
+++ team/russell/chan_refcount/apps/app_chanspy.c Fri May  2 21:44:42 2008
@@ -49,6 +49,7 @@
 #include "asterisk/lock.h"
 
 #define AST_NAME_STRLEN 256
+#define NUM_SPYGROUPS 128
 
 static const char *tdesc = "Listen to a channel, and optionally whisper into it";
 static const char *app_chan = "ChanSpy";
@@ -69,32 +70,43 @@
 "        exit to it. This also disables choosing a channel based on 'chanprefix'\n"
 "        and a digit sequence.\n"
 "  Options:\n"
-"    b             - Only spy on channels involved in a bridged call.\n"
-"    g(grp)        - Match only channels where their SPYGROUP variable is set to\n"
-"                    contain 'grp' in an optional : delimited list.\n"
-"    q             - Don't play a beep when beginning to spy on a channel, or speak the\n"
-"                    selected channel name.\n"
-"    r[(basename)] - Record the session to the monitor spool directory. An\n"
-"                    optional base for the filename may be specified. The\n"
-"                    default is 'chanspy'.\n"
-"    s             - Skip the playback of the channel type (i.e. SIP, IAX, etc) when\n"
-"                    speaking the selected channel name.\n"
-"    v([value])    - Adjust the initial volume in the range from -4 to 4. A\n"
-"                    negative value refers to a quieter setting.\n"
-"    w             - Enable 'whisper' mode, so the spying channel can talk to\n"
-"                    the spied-on channel.\n"
-"    W             - Enable 'private whisper' mode, so the spying channel can\n"
-"                    talk to the spied-on channel but cannot listen to that\n"
-"                    channel.\n"
-"    o             - Only listen to audio coming from this channel.\n"
-"    X             - Allow the user to exit ChanSpy to a valid single digit\n"
-"                    numeric extension in the current context or the context\n"
-"                    specified by the SPY_EXIT_CONTEXT channel variable. The\n"
-"                    name of the last channel that was spied on will be stored\n"
-"                    in the SPY_CHANNEL variable.\n"
-"    e(ext)        - Enable 'enforced' mode, so the spying channel can\n"
-"                    only monitor extensions whose name is in the 'ext' : \n"
-"                    delimited list.\n"
+"    b                      - Only spy on channels involved in a bridged call.\n"
+"    g(grp)                 - Only spy on channels in which one or more of the groups \n"
+"                             listed in 'grp' matches one or more groups from the\n"
+"                             SPYGROUP variable set on the channel to be spied upon.\n"
+"                             Note that both 'grp' and SPYGROUP can contain either a\n"
+"                             single group or a colon-delimited list of groups, such\n"
+"                             as 'sales:support:accounting'.\n"
+"    n([mailbox][@context]) - Say the name of the person being spied on if that person has recorded\n"
+"                             his/her name. If a context is specified, then that voicemail context will\n"
+"                             be searched when retrieving the name, otherwise the \"default\" context\n"
+"                             will be searched. If no mailbox is specified, then the channel name will\n"
+"                             be used when searching for the name (i.e. if SIP/1000 is the channel being\n"
+"                             spied on and no mailbox is specified, then \"1000\" will be used when searching\n"
+"                             for the name).\n"
+"    q                      - Don't play a beep when beginning to spy on a channel, or speak the\n"
+"                             selected channel name.\n"
+"    r[(basename)]          - Record the session to the monitor spool directory. An\n"
+"                             optional base for the filename may be specified. The\n"
+"                             default is 'chanspy'.\n"
+"    s                      - Skip the playback of the channel type (i.e. SIP, IAX, etc) when\n"
+"                             speaking the selected channel name.\n"
+"    v([value])             - Adjust the initial volume in the range from -4 to 4. A\n"
+"                             negative value refers to a quieter setting.\n"
+"    w                      - Enable 'whisper' mode, so the spying channel can talk to\n"
+"                             the spied-on channel.\n"
+"    W                      - Enable 'private whisper' mode, so the spying channel can\n"
+"                             talk to the spied-on channel but cannot listen to that\n"
+"                             channel.\n"
+"    o                      - Only listen to audio coming from this channel.\n"
+"    X                      - Allow the user to exit ChanSpy to a valid single digit\n"
+"                             numeric extension in the current context or the context\n"
+"                             specified by the SPY_EXIT_CONTEXT channel variable. The\n"
+"                             name of the last channel that was spied on will be stored\n"
+"                             in the SPY_CHANNEL variable.\n"
+"    e(ext)                 - Enable 'enforced' mode, so the spying channel can\n"
+"                             only monitor extensions whose name is in the 'ext' : \n"
+"                             delimited list.\n"
 ;
 
 static const char *app_ext = "ExtenSpy";
@@ -111,29 +123,40 @@
 "        single digit extension exists in the correct context it ChanSpy will\n"
 "        exit to it.\n"
 "  Options:\n"
-"    b             - Only spy on channels involved in a bridged call.\n"
-"    g(grp)        - Match only channels where their ${SPYGROUP} variable is set to\n"
-"                    contain 'grp' in an optional : delimited list.\n"
-"    q             - Don't play a beep when beginning to spy on a channel, or speak the\n"
-"                    selected channel name.\n"
-"    r[(basename)] - Record the session to the monitor spool directory. An\n"
-"                    optional base for the filename may be specified. The\n"
-"                    default is 'chanspy'.\n"
-"    s             - Skip the playback of the channel type (i.e. SIP, IAX, etc) when\n"
-"                    speaking the selected channel name.\n"
-"    v([value])    - Adjust the initial volume in the range from -4 to 4. A\n"
-"                    negative value refers to a quieter setting.\n"
-"    w             - Enable 'whisper' mode, so the spying channel can talk to\n"
-"                    the spied-on channel.\n"
-"    W             - Enable 'private whisper' mode, so the spying channel can\n"
-"                    talk to the spied-on channel but cannot listen to that\n"
-"                    channel.\n"
-"    o             - Only listen to audio coming from this channel.\n"
-"    X             - Allow the user to exit ChanSpy to a valid single digit\n"
-"                    numeric extension in the current context or the context\n"
-"                    specified by the SPY_EXIT_CONTEXT channel variable. The\n"
-"                    name of the last channel that was spied on will be stored\n"
-"                    in the SPY_CHANNEL variable.\n"
+"    b                      - Only spy on channels involved in a bridged call.\n"
+"    g(grp)                 - Only spy on channels in which one or more of the groups \n"
+"                             listed in 'grp' matches one or more groups from the\n"
+"                             SPYGROUP variable set on the channel to be spied upon.\n"
+"                             Note that both 'grp' and SPYGROUP can contain either a\n"
+"                             single group or a colon-delimited list of groups, such\n"
+"                             as 'sales:support:accounting'.\n"
+"    n([mailbox][@context]) - Say the name of the person being spied on if that person has recorded\n"
+"                             his/her name. If a context is specified, then that voicemail context will\n"
+"                             be searched when retrieving the name, otherwise the \"default\" context\n"
+"                             will be searched. If no mailbox is specified, then the channel name will\n"
+"                             be used when searching for the name (i.e. if SIP/1000 is the channel being\n"
+"                             spied on and no mailbox is specified, then \"1000\" will be used when searching\n"
+"                             for the name).\n"
+"    q                      - Don't play a beep when beginning to spy on a channel, or speak the\n"
+"                             selected channel name.\n"
+"    r[(basename)]          - Record the session to the monitor spool directory. An\n"
+"                             optional base for the filename may be specified. The\n"
+"                             default is 'chanspy'.\n"
+"    s                      - Skip the playback of the channel type (i.e. SIP, IAX, etc) when\n"
+"                             speaking the selected channel name.\n"
+"    v([value])             - Adjust the initial volume in the range from -4 to 4. A\n"
+"                             negative value refers to a quieter setting.\n"
+"    w                      - Enable 'whisper' mode, so the spying channel can talk to\n"
+"                             the spied-on channel.\n"
+"    W                      - Enable 'private whisper' mode, so the spying channel can\n"
+"                             talk to the spied-on channel but cannot listen to that\n"
+"                             channel.\n"
+"    o                      - Only listen to audio coming from this channel.\n"
+"    X                      - Allow the user to exit ChanSpy to a valid single digit\n"
+"                             numeric extension in the current context or the context\n"
+"                             specified by the SPY_EXIT_CONTEXT channel variable. The\n"
+"                             name of the last channel that was spied on will be stored\n"
+"                             in the SPY_CHANNEL variable.\n"
 ;
 
 enum {
@@ -149,6 +172,7 @@
 	OPTION_ENFORCED  = (1 << 9),    /* Enforced mode */
 	OPTION_NOTECH    = (1 << 10),   /* Skip technology name playback */
 	OPTION_BARGE     = (1 << 11),   /* Barge mode (whisper to both channels) */
+	OPTION_NAME      = (1 << 12),   /* Say the name of the person on whom we will spy */
 } chanspy_opt_flags;
 
 enum {
@@ -156,6 +180,7 @@
 	OPT_ARG_GROUP,
 	OPT_ARG_RECORD,
 	OPT_ARG_ENFORCED,
+	OPT_ARG_NAME,
 	OPT_ARG_ARRAY_SIZE,
 } chanspy_opt_args;
 
@@ -172,6 +197,7 @@
 	AST_APP_OPTION('o', OPTION_READONLY),
 	AST_APP_OPTION('X', OPTION_EXIT),
 	AST_APP_OPTION('s', OPTION_NOTECH),
+	AST_APP_OPTION_ARG('n', OPTION_NAME, OPT_ARG_NAME),
 });
 
 
@@ -423,7 +449,8 @@
 
 static int common_exec(struct ast_channel *chan, const struct ast_flags *flags,
 	int volfactor, const int fd, const char *mygroup, const char *myenforced,
-	const char *spec, const char *exten, const char *context)
+	const char *spec, const char *exten, const char *context, const char *mailbox,
+	const char *name_context)
 {
 	struct ast_channel *peer, *prev, *next;
 	char nameprefix[AST_NAME_STRLEN];
@@ -439,12 +466,15 @@
 
 	if (ast_test_flag(flags, OPTION_EXIT)) {
 		const char *c;
-		if ((c = pbx_builtin_getvar_helper(chan, "SPY_EXIT_CONTEXT")))
+		ast_channel_lock(chan);
+		if ((c = pbx_builtin_getvar_helper(chan, "SPY_EXIT_CONTEXT"))) {
 			ast_copy_string(exitcontext, c, sizeof(exitcontext));
-		else if (!ast_strlen_zero(chan->macrocontext))
+		} else if (!ast_strlen_zero(chan->macrocontext)) {
 			ast_copy_string(exitcontext, chan->macrocontext, sizeof(exitcontext));
-		else
+		} else {
 			ast_copy_string(exitcontext, chan->context, sizeof(exitcontext));
+		}
+		ast_channel_unlock(chan);
 	}
 
 	if (chan->_state != AST_STATE_UP)
@@ -515,10 +545,14 @@
 
 			const char *group;
 			int igrp = !mygroup;
-			char *groups[25];
+			char *groups[NUM_SPYGROUPS];
+			char *mygroups[NUM_SPYGROUPS];
 			int num_groups = 0;
 			char *dup_group;
+			int num_mygroups = 0;
+			char *dup_mygroup;
 			int x;
+			int y;
 			char *s;
 			char *buffer;
 			char *end;
@@ -539,16 +573,22 @@
 				continue;
 
 			if (mygroup) {
+				dup_mygroup = ast_strdupa(mygroup);
+				num_mygroups = ast_app_separate_args(dup_mygroup, ':', mygroups,
+					sizeof(mygroups) / sizeof(mygroups[0]));
+
 				if ((group = pbx_builtin_getvar_helper(peer, "SPYGROUP"))) {
 					dup_group = ast_strdupa(group);
 					num_groups = ast_app_separate_args(dup_group, ':', groups,
 						sizeof(groups) / sizeof(groups[0]));
 				}
 
-				for (x = 0; x < num_groups; x++) {
-					if (!strcmp(mygroup, groups[x])) {
-						igrp = 1;
-						break;
+				for (y = 0; y < num_mygroups; y++) {
+					for (x = 0; x < num_groups; x++) {
+						if (!strcmp(mygroups[y], groups[x])) {
+							igrp = 1;
+							break;
+						}
 					}
 				}
 			}
@@ -591,26 +631,34 @@
 			strncat(peer_name, peer->name, AST_NAME_STRLEN - 4 - 1);
 			ptr = strchr(peer_name, '/');
 			*ptr++ = '\0';
+			ptr = strsep(&ptr, "-");
 
 			for (s = peer_name; s < ptr; s++)
 				*s = tolower(*s);
 
 			if (!ast_test_flag(flags, OPTION_QUIET)) {
-				if (!ast_test_flag(flags, OPTION_NOTECH)) {
-					if (ast_fileexists(peer_name, NULL, NULL) != -1) {
-						res = ast_streamfile(chan, peer_name, chan->language);
-						if (!res) {
-							res = ast_waitstream(chan, "");
+				if (ast_test_flag(flags, OPTION_NAME)) {
+					const char *local_context = S_OR(name_context, "default");
+					const char *local_mailbox = S_OR(mailbox, ptr);
+					res = ast_app_sayname(chan, local_mailbox, local_context);
+				}
+				if (!ast_test_flag(flags, OPTION_NAME) || res < 0) {
+					if (!ast_test_flag(flags, OPTION_NOTECH)) {
+						if (ast_fileexists(peer_name, NULL, NULL) != -1) {
+							res = ast_streamfile(chan, peer_name, chan->language);
+							if (!res) {
+								res = ast_waitstream(chan, "");
+							}
+							if (res) {
+								break;
+							}
+						} else {
+							res = ast_say_character_str(chan, peer_name, "", chan->language);
 						}
-						if (res) {
-							break;
-						}
-					} else {
-						res = ast_say_character_str(chan, peer_name, "", chan->language);
 					}
+					if ((num = atoi(ptr)))
+						ast_say_digits(chan, atoi(ptr), "", chan->language);
 				}
-				if ((num = atoi(ptr)))
-					ast_say_digits(chan, atoi(ptr), "", chan->language);
 			}
 
 			res = channel_spy(chan, peer, &volfactor, fd, flags, exitcontext);
@@ -652,6 +700,8 @@
 	int oldwf = 0;
 	int volfactor = 0;
 	int res;
+	char *mailbox = NULL;
+	char *name_context = NULL;
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(spec);
 		AST_APP_ARG(options);
@@ -687,6 +737,20 @@
 
 		if (ast_test_flag(&flags, OPTION_ENFORCED))
 			myenforced = opts[OPT_ARG_ENFORCED];
+		
+		if (ast_test_flag(&flags, OPTION_NAME)) {
+			if (!ast_strlen_zero(opts[OPT_ARG_NAME])) {
+				char *delimiter;
+				if ((delimiter = strchr(opts[OPT_ARG_NAME], '@'))) {
+					mailbox = opts[OPT_ARG_NAME];
+					*delimiter++ = '\0';
+					name_context = delimiter;
+				} else {
+					mailbox = opts[OPT_ARG_NAME];
+				}
+			}
+		}
+
 
 	} else
 		ast_clear_flag(&flags, AST_FLAGS_ALL);
@@ -707,7 +771,7 @@
 		}
 	}
 
-	res = common_exec(chan, &flags, volfactor, fd, mygroup, myenforced, args.spec, NULL, NULL);
+	res = common_exec(chan, &flags, volfactor, fd, mygroup, myenforced, args.spec, NULL, NULL, mailbox, name_context);
 
 	if (fd)
 		close(fd);
@@ -728,6 +792,8 @@
 	int oldwf = 0;
 	int volfactor = 0;
 	int res;
+	char *mailbox = NULL;
+	char *name_context = NULL;
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(context);
 		AST_APP_ARG(options);
@@ -767,6 +833,21 @@
 
 		if (ast_test_flag(&flags, OPTION_PRIVATE))
 			ast_set_flag(&flags, OPTION_WHISPER);
+
+		
+		if (ast_test_flag(&flags, OPTION_NAME)) {
+			if (!ast_strlen_zero(opts[OPT_ARG_NAME])) {
+				char *delimiter;
+				if ((delimiter = strchr(opts[OPT_ARG_NAME], '@'))) {
+					mailbox = opts[OPT_ARG_NAME];
+					*delimiter++ = '\0';
+					name_context = delimiter;
+				} else {
+					mailbox = opts[OPT_ARG_NAME];
+				}
+			}
+		}
+
 	} else
 		ast_clear_flag(&flags, AST_FLAGS_ALL);
 
@@ -787,7 +868,7 @@
 	}
 
 
-	res = common_exec(chan, &flags, volfactor, fd, mygroup, NULL, NULL, exten, args.context);
+	res = common_exec(chan, &flags, volfactor, fd, mygroup, NULL, NULL, exten, args.context, mailbox, name_context);
 
 	if (fd)
 		close(fd);

Modified: team/russell/chan_refcount/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/apps/app_dial.c?view=diff&rev=115265&r1=115264&r2=115265
==============================================================================
--- team/russell/chan_refcount/apps/app_dial.c (original)
+++ team/russell/chan_refcount/apps/app_dial.c Fri May  2 21:44:42 2008
@@ -1472,7 +1472,7 @@
 
 		tc->appl = "AppDial";
 		tc->data = "(Outgoing Line)";
-		tc->whentohangup = 0;
+		memset(&tc->whentohangup, 0, sizeof(tc->whentohangup));
 
 		S_REPLACE(tc->cid.cid_num, ast_strdup(chan->cid.cid_num));
 		S_REPLACE(tc->cid.cid_name, ast_strdup(chan->cid.cid_name));
@@ -1839,7 +1839,8 @@
 
 		if (!res) {
 			if (calldurationlimit > 0) {
-				peer->whentohangup = time(NULL) + calldurationlimit;
+				struct timeval whentohangup = { calldurationlimit, 0 };
+				peer->whentohangup = ast_tvadd(ast_tvnow(), whentohangup);
 			}
 			if (!ast_strlen_zero(dtmfcalled)) {
 				ast_verb(3, "Sending DTMF '%s' to the called party.\n", dtmfcalled);
@@ -1967,7 +1968,7 @@
 
 	if ((ast_test_flag64(peerflags, OPT_GO_ON)) && !ast_check_hangup(chan) && (res != AST_PBX_KEEPALIVE) && (res != AST_PBX_INCOMPLETE)) {
 		if (calldurationlimit)
-			chan->whentohangup = 0;
+			memset(&chan->whentohangup, 0, sizeof(chan->whentohangup));
 		res = 0;
 	}
 

Modified: team/russell/chan_refcount/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/apps/app_directory.c?view=diff&rev=115265&r1=115264&r2=115265
==============================================================================
--- team/russell/chan_refcount/apps/app_directory.c (original)
+++ team/russell/chan_refcount/apps/app_directory.c Fri May  2 21:44:42 2008
@@ -25,6 +25,9 @@
  * \ingroup applications
  */
 
+/*** MODULEINFO
+	<depend>app_voicemail</depend>
+ ***/
 #include "asterisk.h"
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
@@ -38,15 +41,6 @@
 #include "asterisk/say.h"
 #include "asterisk/app.h"
 #include "asterisk/utils.h"
-
-#ifdef ODBC_STORAGE
-#include <sys/mman.h>
-#include "asterisk/res_odbc.h"
-
-static char odbc_database[80] = "asterisk";
-static char odbc_table[80] = "voicemessages";
-static char vmfmts[80] = "wav";
-#endif
 
 static char *app = "Directory";
 
@@ -133,121 +127,6 @@
 	AST_APP_OPTION('m', OPT_SELECTFROMMENU),
 });
 
-#ifdef ODBC_STORAGE
-struct generic_prepare_struct {
-	const char *sql;
-	const char *param;
-};
-
-static SQLHSTMT generic_prepare(struct odbc_obj *obj, void *data)
-{
-	struct generic_prepare_struct *gps = data;
-	SQLHSTMT stmt;
-	int res;
-
-	res = SQLAllocHandle(SQL_HANDLE_STMT, obj->con, &stmt);
-	if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
-		ast_log(LOG_WARNING, "SQL Alloc Handle failed!\n");
-		return NULL;
-	}
-
-	res = SQLPrepare(stmt, (unsigned char *)gps->sql, SQL_NTS);
-	if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
-		ast_log(LOG_WARNING, "SQL Prepare failed![%s]\n", (char *)gps->sql);
-		SQLFreeHandle(SQL_HANDLE_STMT, stmt);
-		return NULL;
-	}
-
-	if (!ast_strlen_zero(gps->param))
-		SQLBindParameter(stmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(gps->param), 0, (void *)gps->param, 0, NULL);
-
-	return stmt;
-}
-
-static void retrieve_file(char *dir)
-{
-	int x = 0;
-	int res;
-	int fd=-1;
-	size_t fdlen = 0;
-	void *fdm = MAP_FAILED;
-	SQLHSTMT stmt;
-	char sql[256];
-	char fmt[80]="", empty[10] = "";
-	char *c;
-	SQLLEN colsize;
-	char full_fn[256];
-	struct odbc_obj *obj;
-	struct generic_prepare_struct gps = { .sql = sql, .param = dir };
-
-	obj = ast_odbc_request_obj(odbc_database, 1);
-	if (obj) {
-		do {
-			ast_copy_string(fmt, vmfmts, sizeof(fmt));
-			c = strchr(fmt, '|');
-			if (c)
-				*c = '\0';
-			if (!strcasecmp(fmt, "wav49"))
-				strcpy(fmt, "WAV");
-			snprintf(full_fn, sizeof(full_fn), "%s.%s", dir, fmt);
-			snprintf(sql, sizeof(sql), "SELECT recording FROM %s WHERE dir=? AND msgnum=-1", odbc_table);
-			stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, &gps);
-
-			if (!stmt) {
-				ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
-				break;
-			}
-			res = SQLFetch(stmt);
-			if (res == SQL_NO_DATA) {
-				SQLFreeHandle(SQL_HANDLE_STMT, stmt);
-				break;
-			} else if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
-				ast_log(LOG_WARNING, "SQL Fetch error!\n[%s]\n\n", sql);
-				SQLFreeHandle(SQL_HANDLE_STMT, stmt);
-				break;
-			}
-			fd = open(full_fn, O_RDWR | O_CREAT | O_TRUNC, AST_FILE_MODE);
-			if (fd < 0) {
-				ast_log(LOG_WARNING, "Failed to write '%s': %s\n", full_fn, strerror(errno));
-				SQLFreeHandle(SQL_HANDLE_STMT, stmt);
-				break;
-			}
-
-			res = SQLGetData(stmt, 1, SQL_BINARY, empty, 0, &colsize);
-			fdlen = colsize;
-			if (fd > -1) {
-				char tmp[1]="";
-				lseek(fd, fdlen - 1, SEEK_SET);
-				if (write(fd, tmp, 1) != 1) {
-					close(fd);
-					fd = -1;
-					break;
-				}
-				if (fd > -1)
-					fdm = mmap(NULL, fdlen, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
-			}
-			if (fdm != MAP_FAILED) {
-				memset(fdm, 0, fdlen);
-				res = SQLGetData(stmt, x + 1, SQL_BINARY, fdm, fdlen, &colsize);
-				if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
-					ast_log(LOG_WARNING, "SQL Get Data error!\n[%s]\n\n", sql);
-					SQLFreeHandle(SQL_HANDLE_STMT, stmt);
-					break;
-				}
-			}
-			SQLFreeHandle(SQL_HANDLE_STMT, stmt);
-		} while (0);
-		ast_odbc_release_obj(obj);
-	} else
-		ast_log(LOG_WARNING, "Failed to obtain database object for '%s'!\n", odbc_database);
-	if (fdm != MAP_FAILED)
-		munmap(fdm, fdlen);
-	if (fd > -1)
-		close(fd);
-	return;
-}
-#endif
-
 static int compare(const char *text, const char *template)
 {
 	char digit;
@@ -333,26 +212,7 @@
 	const char *ext, const char *name, struct ast_flags *flags)
 {
 	int res = 0;
-	char fn[256];
-
-	/* Check for the VoiceMail2 greeting first */
-	snprintf(fn, sizeof(fn), "%s/voicemail/%s/%s/greet",
-		ast_config_AST_SPOOL_DIR, context, ext);
-#ifdef ODBC_STORAGE
-	retrieve_file(fn);
-#endif
-
-	if (ast_fileexists(fn, NULL, chan->language) <= 0) {
-		/* no file, check for an old-style Voicemail greeting */
-		snprintf(fn, sizeof(fn), "%s/vm/%s/greet",
-			ast_config_AST_SPOOL_DIR, ext);
-	}
-#ifdef ODBC_STORAGE
-	retrieve_file(fn);
-#endif
-
-	if (ast_fileexists(fn, NULL, chan->language) > 0) {
-		res = ast_stream_and_wait(chan, fn, AST_DIGIT_ANY);
+	if ((res = ast_app_sayname(chan, ext, context)) >= 0) {
 		ast_stopstream(chan);
 		/* If Option 'e' was specified, also read the extension number with the name */
 		if (ast_test_flag(flags, OPT_SAYEXTENSION)) {
@@ -366,9 +226,6 @@
 			res = ast_say_character_str(chan, ext, AST_DIGIT_ANY, chan->language);
 		}
 	}
-#ifdef ODBC_STORAGE
-	ast_filedelete(fn, NULL);
-#endif
 
 	return res;
 }
@@ -625,7 +482,6 @@
 		AST_LIST_INSERT_TAIL(alist, item, entry);
 	}
 
-
 	if (ucfg) {
 		for (cat = ast_category_browse(ucfg, NULL); cat ; cat = ast_category_browse(ucfg, cat)) {
 			const char *pos;
@@ -641,10 +497,10 @@
 
 			res = 0;
 			if (ast_test_flag(&flags, OPT_LISTBYLASTNAME)) {
-				res = check_match(&item, pos, v->name, ext, 0 /* use_first_name */);
+				res = check_match(&item, pos, cat, ext, 0 /* use_first_name */);
 			}
 			if (!res && ast_test_flag(&flags, OPT_LISTBYFIRSTNAME)) {
-				res = check_match(&item, pos, v->name, ext, 1 /* use_first_name */);
+				res = check_match(&item, pos, cat, ext, 1 /* use_first_name */);
 			}
 
 			if (!res)
@@ -655,7 +511,6 @@
 			AST_LIST_INSERT_TAIL(alist, item, entry);
 		}
 	}
-
 	return 0;
 }
 
@@ -910,26 +765,6 @@
 
 static int load_module(void)
 {
-#ifdef ODBC_STORAGE
-	struct ast_flags config_flags = { 0 };
-	struct ast_config *cfg = ast_config_load(VOICEMAIL_CONFIG, config_flags);
-	const char *tmp;
-
-	if (cfg) {
-		if ((tmp = ast_variable_retrieve(cfg, "general", "odbcstorage"))) {
-			ast_copy_string(odbc_database, tmp, sizeof(odbc_database));
-		}
-		if ((tmp = ast_variable_retrieve(cfg, "general", "odbctable"))) {
-			ast_copy_string(odbc_table, tmp, sizeof(odbc_table));
-		}
-		if ((tmp = ast_variable_retrieve(cfg, "general", "format"))) {
-			ast_copy_string(vmfmts, tmp, sizeof(vmfmts));
-		}
-		ast_config_destroy(cfg);
-	} else
-		ast_log(LOG_WARNING, "Unable to load " VOICEMAIL_CONFIG " - ODBC defaults will be used\n");
-#endif
-
 	return ast_register_application(app, directory_exec, synopsis, descrip);
 }
 

Modified: team/russell/chan_refcount/apps/app_disa.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/apps/app_disa.c?view=diff&rev=115265&r1=115264&r2=115265
==============================================================================
--- team/russell/chan_refcount/apps/app_disa.c (original)
+++ team/russell/chan_refcount/apps/app_disa.c Fri May  2 21:44:42 2008
@@ -116,8 +116,8 @@
 static int disa_exec(struct ast_channel *chan, void *data)
 {
 	int i = 0, j, k = 0, did_ignore = 0, special_noanswer = 0;
-	int firstdigittimeout = (chan->pbx ? chan->pbx->rtimeout * 1000 : 20000);
-	int digittimeout = (chan->pbx ? chan->pbx->dtimeout * 1000 : 10000);
+	int firstdigittimeout = (chan->pbx ? chan->pbx->rtimeoutms : 20000);
+	int digittimeout = (chan->pbx ? chan->pbx->dtimeoutms : 10000);
 	struct ast_flags flags;
 	char *tmp, exten[AST_MAX_EXTENSION] = "", acctcode[20]="";
 	char pwline[256];

Modified: team/russell/chan_refcount/apps/app_dumpchan.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/apps/app_dumpchan.c?view=diff&rev=115265&r1=115264&r2=115265
==============================================================================
--- team/russell/chan_refcount/apps/app_dumpchan.c (original)
+++ team/russell/chan_refcount/apps/app_dumpchan.c Fri May  2 21:44:42 2008
@@ -115,7 +115,7 @@
 			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,
+			c->fout & ~DEBUGCHAN_FLAG, (c->fout & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "", (long)c->whentohangup.tv_sec,
 			hour,
 			min,
 			sec,

Modified: team/russell/chan_refcount/apps/app_externalivr.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/apps/app_externalivr.c?view=diff&rev=115265&r1=115264&r2=115265
==============================================================================
--- team/russell/chan_refcount/apps/app_externalivr.c (original)
+++ team/russell/chan_refcount/apps/app_externalivr.c Fri May  2 21:44:42 2008
@@ -251,10 +251,13 @@
 			break;
 		}
 		
-		value = pbx_builtin_getvar_helper(chan, variable);
-		if(!value)
+		ast_channel_lock(chan);
+		if (!(value = pbx_builtin_getvar_helper(chan, variable))) {
 			value = "";
+		}
+
 		ast_str_append(&newstring, 0, "%s=%s,", variable, value);
+		ast_channel_unlock(chan);
 		ast_copy_string(outbuf, newstring->str, outbuflen);
 	}
 };

Modified: team/russell/chan_refcount/apps/app_macro.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/apps/app_macro.c?view=diff&rev=115265&r1=115264&r2=115265
==============================================================================
--- team/russell/chan_refcount/apps/app_macro.c (original)
+++ team/russell/chan_refcount/apps/app_macro.c Fri May  2 21:44:42 2008
@@ -165,20 +165,24 @@
 	}
 
 	/* does the user want a deeper rabbit hole? */
-	s = pbx_builtin_getvar_helper(chan, "MACRO_RECURSION");
-	if (s)
+	ast_channel_lock(chan);
+	if ((s = pbx_builtin_getvar_helper(chan, "MACRO_RECURSION"))) {
 		sscanf(s, "%d", &maxdepth);
-
+	}
+	
 	/* Count how many levels deep the rabbit hole goes */
-	s = pbx_builtin_getvar_helper(chan, "MACRO_DEPTH");
-	if (s)
+	if ((s = pbx_builtin_getvar_helper(chan, "MACRO_DEPTH"))) {
 		sscanf(s, "%d", &depth);
+	}
+	

[... 3359 lines stripped ...]



More information about the asterisk-commits mailing list