[asterisk-commits] mmichelson: branch group/manager2 r115503 - in /team/group/manager2: ./ apps/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue May 6 16:07:27 CDT 2008


Author: mmichelson
Date: Tue May  6 16:07:26 2008
New Revision: 115503

URL: http://svn.digium.com/view/asterisk?view=rev&rev=115503
Log:
resolve and reset. I love steak


Added:
    team/group/manager2/funcs/func_speex.c
      - copied unchanged from r115473, trunk/funcs/func_speex.c
    team/group/manager2/include/asterisk/taskprocessor.h
      - copied unchanged from r115473, trunk/include/asterisk/taskprocessor.h
    team/group/manager2/main/taskprocessor.c
      - copied unchanged from r115473, trunk/main/taskprocessor.c
Removed:
    team/group/manager2/apps/app_pickupchan.c
Modified:
    team/group/manager2/   (props changed)
    team/group/manager2/CHANGES
    team/group/manager2/Makefile
    team/group/manager2/Makefile.rules
    team/group/manager2/UPGRADE.txt
    team/group/manager2/acinclude.m4
    team/group/manager2/apps/app_alarmreceiver.c
    team/group/manager2/apps/app_chanspy.c
    team/group/manager2/apps/app_dial.c
    team/group/manager2/apps/app_directed_pickup.c
    team/group/manager2/apps/app_directory.c
    team/group/manager2/apps/app_disa.c
    team/group/manager2/apps/app_dumpchan.c
    team/group/manager2/apps/app_externalivr.c
    team/group/manager2/apps/app_followme.c
    team/group/manager2/apps/app_jack.c
    team/group/manager2/apps/app_macro.c
    team/group/manager2/apps/app_meetme.c
    team/group/manager2/apps/app_minivm.c
    team/group/manager2/apps/app_morsecode.c
    team/group/manager2/apps/app_parkandannounce.c
    team/group/manager2/apps/app_playback.c
    team/group/manager2/apps/app_queue.c
    team/group/manager2/apps/app_read.c
    team/group/manager2/apps/app_readexten.c
    team/group/manager2/apps/app_rpt.c
    team/group/manager2/apps/app_sms.c
    team/group/manager2/apps/app_speech_utils.c
    team/group/manager2/apps/app_stack.c
    team/group/manager2/apps/app_voicemail.c
    team/group/manager2/apps/app_waitforring.c
    team/group/manager2/apps/app_while.c
    team/group/manager2/apps/app_zapscan.c
    team/group/manager2/build_tools/menuselect-deps.in
    team/group/manager2/channels/chan_alsa.c
    team/group/manager2/channels/chan_console.c
    team/group/manager2/channels/chan_gtalk.c
    team/group/manager2/channels/chan_h323.c
    team/group/manager2/channels/chan_iax2.c
    team/group/manager2/channels/chan_jingle.c
    team/group/manager2/channels/chan_local.c
    team/group/manager2/channels/chan_mgcp.c
    team/group/manager2/channels/chan_misdn.c
    team/group/manager2/channels/chan_oss.c
    team/group/manager2/channels/chan_sip.c
    team/group/manager2/channels/chan_skinny.c
    team/group/manager2/channels/chan_unistim.c
    team/group/manager2/channels/chan_zap.c
    team/group/manager2/channels/iax2-provision.c
    team/group/manager2/channels/iax2.h
    team/group/manager2/codecs/codec_speex.c
    team/group/manager2/configs/queues.conf.sample
    team/group/manager2/configs/sip.conf.sample
    team/group/manager2/configs/sip_notify.conf.sample
    team/group/manager2/configure
    team/group/manager2/configure.ac
    team/group/manager2/contrib/init.d/rc.debian.asterisk
    team/group/manager2/contrib/init.d/rc.gentoo.asterisk
    team/group/manager2/contrib/init.d/rc.mandrake.asterisk
    team/group/manager2/contrib/init.d/rc.redhat.asterisk
    team/group/manager2/contrib/init.d/rc.slackware.asterisk
    team/group/manager2/contrib/init.d/rc.suse.asterisk
    team/group/manager2/contrib/scripts/safe_asterisk
    team/group/manager2/contrib/scripts/vmail.cgi
    team/group/manager2/doc/smdi.txt
    team/group/manager2/funcs/func_timeout.c
    team/group/manager2/include/asterisk/_private.h
    team/group/manager2/include/asterisk/app.h
    team/group/manager2/include/asterisk/astobj.h
    team/group/manager2/include/asterisk/audiohook.h
    team/group/manager2/include/asterisk/autoconfig.h.in
    team/group/manager2/include/asterisk/channel.h
    team/group/manager2/include/asterisk/compiler.h
    team/group/manager2/include/asterisk/config.h
    team/group/manager2/include/asterisk/logger.h
    team/group/manager2/include/asterisk/manager.h
    team/group/manager2/include/asterisk/pbx.h
    team/group/manager2/include/asterisk/res_odbc.h
    team/group/manager2/include/asterisk/sched.h
    team/group/manager2/main/Makefile
    team/group/manager2/main/app.c
    team/group/manager2/main/asterisk.c
    team/group/manager2/main/audiohook.c
    team/group/manager2/main/channel.c
    team/group/manager2/main/cli.c
    team/group/manager2/main/config.c
    team/group/manager2/main/dial.c
    team/group/manager2/main/event.c
    team/group/manager2/main/features.c
    team/group/manager2/main/http.c
    team/group/manager2/main/logger.c
    team/group/manager2/main/manager.c
    team/group/manager2/main/pbx.c
    team/group/manager2/main/sched.c
    team/group/manager2/main/utils.c
    team/group/manager2/pbx/pbx_lua.c
    team/group/manager2/phoneprov/polycom.xml
    team/group/manager2/res/res_agi.c
    team/group/manager2/res/res_config_pgsql.c
    team/group/manager2/res/res_musiconhold.c
    team/group/manager2/res/res_odbc.c
    team/group/manager2/res/res_smdi.c
    team/group/manager2/res/snmp/agent.c
    team/group/manager2/utils/refcounter.c

Propchange: team/group/manager2/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.

Propchange: team/group/manager2/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/group/manager2/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue May  6 16:07:26 2008
@@ -1,1 +1,1 @@
-/trunk:1-114493
+/trunk:1-115477

Modified: team/group/manager2/CHANGES
URL: http://svn.digium.com/view/asterisk/team/group/manager2/CHANGES?view=diff&rev=115503&r1=115502&r2=115503
==============================================================================
--- team/group/manager2/CHANGES (original)
+++ team/group/manager2/CHANGES Tue May  6 16:07:26 2008
@@ -6,6 +6,14 @@
 ------------------
  * 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
 ----------------------------------------
@@ -17,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
 -------------------
@@ -31,6 +46,14 @@
    continue in the dialplan, at the specified label, if the caller hangs up.
  * ChanSpy and ExtenSpy have a new option, 's' which suppresses speaking the
    technology name (e.g. SIP, IAX, etc) of the channel being spied on.
+ * The Jack application now has a c() option to supply a custom client name.
+ * 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
 -----------
@@ -47,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
 -----------
@@ -57,11 +82,25 @@
   * 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.
+
+AMI - The manager (TCP/TLS/HTTP)
+--------------------------------
+  * The Status command now takes an optional list of variables to display
+    along with channel status.
 
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 1.4.X to Asterisk 1.6.0  -------------
@@ -401,6 +440,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/group/manager2/Makefile
URL: http://svn.digium.com/view/asterisk/team/group/manager2/Makefile?view=diff&rev=115503&r1=115502&r2=115503
==============================================================================
--- team/group/manager2/Makefile (original)
+++ team/group/manager2/Makefile Tue May  6 16:07:26 2008
@@ -351,7 +351,7 @@
 	@exit 1
 
 menuselect.makeopts: menuselect/menuselect menuselect-tree makeopts
-	menuselect/menuselect --check-deps $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts
+	menuselect/menuselect --check-deps menuselect.makeopts $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS)
 
 $(MOD_SUBDIRS_EMBED_LDSCRIPT):
 	@echo "EMBED_LDSCRIPTS+="`$(SILENTMAKE) -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
@@ -821,16 +821,16 @@
 nmenuconfig: nmenuselect
 
 menuselect: menuselect/menuselect menuselect-tree
-	- at menuselect/menuselect $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
+	- at menuselect/menuselect menuselect.makeopts $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
 
 cmenuselect: menuselect/cmenuselect menuselect-tree
-	- at menuselect/cmenuselect $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
+	- at menuselect/cmenuselect menuselect.makeopts $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
 
 gmenuselect: menuselect/gmenuselect menuselect-tree
-	- at menuselect/gmenuselect $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
+	- at menuselect/gmenuselect menuselect.makeopts $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
 
 nmenuselect: menuselect/nmenuselect menuselect-tree
-	- at menuselect/nmenuselect $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
+	- at menuselect/nmenuselect menuselect.makeopts $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
 
 # options for make in menuselect/
 MAKE_MENUSELECT=CC="$(HOST_CC)" CXX="$(CXX)" LD="" AR="" RANLIB="" CFLAGS="" $(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
@@ -869,4 +869,4 @@
 asterisk.pdf:
 	$(MAKE) -C doc/tex asterisk.pdf
 
-.PHONY: menuselect main sounds clean dist-clean distclean all prereqs cleantest uninstall _uninstall uninstall-all pdf dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_DIST_CLEAN) $(SUBDIRS_CLEAN) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS) badshell main/version.c include/asterisk/version.h installdirs
+.PHONY: menuselect menuselect.makeopts main sounds clean dist-clean distclean all prereqs cleantest uninstall _uninstall uninstall-all pdf dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_DIST_CLEAN) $(SUBDIRS_CLEAN) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS) badshell main/version.c include/asterisk/version.h installdirs

Modified: team/group/manager2/Makefile.rules
URL: http://svn.digium.com/view/asterisk/team/group/manager2/Makefile.rules?view=diff&rev=115503&r1=115502&r2=115503
==============================================================================
--- team/group/manager2/Makefile.rules (original)
+++ team/group/manager2/Makefile.rules Tue May  6 16:07:26 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/group/manager2/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/group/manager2/UPGRADE.txt?view=diff&rev=115503&r1=115502&r2=115503
==============================================================================
--- team/group/manager2/UPGRADE.txt (original)
+++ team/group/manager2/UPGRADE.txt Tue May  6 16:07:26 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, for the
+  sake of backwards compatibility it will not be removed .  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,10 @@
 * 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.
+* The arguments in ExecIf changed a bit, to be more like other applications.
+  The syntax is now ExecIf(<cond>?appiftrue(args):appiffalse(args)).
 
 Dialplan Functions:
 

Modified: team/group/manager2/acinclude.m4
URL: http://svn.digium.com/view/asterisk/team/group/manager2/acinclude.m4?view=diff&rev=115503&r1=115502&r2=115503
==============================================================================
--- team/group/manager2/acinclude.m4 (original)
+++ team/group/manager2/acinclude.m4 Tue May  6 16:07:26 2008
@@ -7,13 +7,17 @@
 AC_DEFUN([AST_GCC_ATTRIBUTE],
 [
 AC_MSG_CHECKING(for compiler 'attribute $1' support)
+saved_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Werror"
 AC_COMPILE_IFELSE(
-	AC_LANG_PROGRAM([static int __attribute__(($1)) test(void) {}],
+	AC_LANG_PROGRAM([static void __attribute__(($1)) *test(void *muffin, ...) {}],
 			[]),
 	AC_MSG_RESULT(yes)
 	AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]),
 	AC_MSG_RESULT(no))
-])
+]
+CFLAGS="$saved_CFLAGS"
+)
 
 # Helper function to setup variables for a package.
 # $1 -> the package name. Used in configure.ac and also as a prefix

Modified: team/group/manager2/apps/app_alarmreceiver.c
URL: http://svn.digium.com/view/asterisk/team/group/manager2/apps/app_alarmreceiver.c?view=diff&rev=115503&r1=115502&r2=115503
==============================================================================
--- team/group/manager2/apps/app_alarmreceiver.c (original)
+++ team/group/manager2/apps/app_alarmreceiver.c Tue May  6 16:07:26 2008
@@ -252,6 +252,9 @@
 
 		/* If they hung up, leave */
 		if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP)) {
+			if (f->seqno) {
+				chan->hangupcause = f->seqno;
+			}
 			ast_frfree(f);
 			res = -1;
 			break;

Modified: team/group/manager2/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/group/manager2/apps/app_chanspy.c?view=diff&rev=115503&r1=115502&r2=115503
==============================================================================
--- team/group/manager2/apps/app_chanspy.c (original)
+++ team/group/manager2/apps/app_chanspy.c Tue May  6 16:07:26 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,45 @@
 "        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"
+"    B                      - Instead of whispering on a single channel barge in on both\n"
+"                             channels involved in the 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 +125,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 {
@@ -148,6 +173,8 @@
 	OPTION_EXIT      = (1 << 8),    /* Exit to a valid single digit extension */
 	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 {
@@ -155,12 +182,14 @@
 	OPT_ARG_GROUP,
 	OPT_ARG_RECORD,
 	OPT_ARG_ENFORCED,
+	OPT_ARG_NAME,
 	OPT_ARG_ARRAY_SIZE,
 } chanspy_opt_args;
 
 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('w', OPTION_WHISPER),
 	AST_APP_OPTION('W', OPTION_PRIVATE),
 	AST_APP_OPTION_ARG('v', OPTION_VOLUME, OPT_ARG_VOLUME),
@@ -170,6 +199,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),
 });
 
 
@@ -177,6 +207,7 @@
 	/* spy data */
 	struct ast_audiohook spy_audiohook;
 	struct ast_audiohook whisper_audiohook;
+	struct ast_audiohook bridge_whisper_audiohook;
 	int fd;
 	int volfactor;
 };
@@ -230,7 +261,7 @@
 	.generate = spy_generate,
 };
 
-static int start_spying(struct ast_channel *chan, const char *spychan_name, struct ast_audiohook *audiohook) 
+static int start_spying(struct ast_channel *chan, const char *spychan_name, struct ast_audiohook *audiohook)
 {
 	int res = 0;
 	struct ast_channel *peer = NULL;
@@ -239,12 +270,9 @@
 
 	res = ast_audiohook_attach(chan, audiohook);
 
-	if (!res && ast_test_flag(chan, AST_FLAG_NBRIDGE) && (peer = ast_bridged_channel(chan))) {
-		ast_channel_unlock(chan);
+	if (!res && ast_test_flag(chan, AST_FLAG_NBRIDGE) && (peer = ast_bridged_channel(chan))) { 
 		ast_softhangup(peer, AST_SOFTHANGUP_UNBRIDGE);
-	} else
-		ast_channel_unlock(chan);
-
+	}
 	return res;
 }
 
@@ -293,16 +321,23 @@
 
 	ast_audiohook_init(&csth.spy_audiohook, AST_AUDIOHOOK_TYPE_SPY, "ChanSpy");
 
-	if (start_spying(spyee, spyer_name, &csth.spy_audiohook)) { /* Unlocks spyee */
+	if (start_spying(spyee, spyer_name, &csth.spy_audiohook)) {
 		ast_audiohook_destroy(&csth.spy_audiohook);
+		ast_channel_unlock(spyee);
 		return 0;
 	}
 
-	if (ast_test_flag(flags, OPTION_WHISPER)) {
+	if (ast_test_flag(flags, OPTION_BARGE)) {
+  		ast_audiohook_init(&csth.whisper_audiohook, AST_AUDIOHOOK_TYPE_WHISPER, "ChanSpy");
+		ast_audiohook_init(&csth.bridge_whisper_audiohook, AST_AUDIOHOOK_TYPE_WHISPER, "Chanspy");
+  		start_spying(spyee, spyer_name, &csth.whisper_audiohook); /* Unlocks spyee */
+		start_spying(ast_bridged_channel(spyee), spyer_name, &csth.bridge_whisper_audiohook);
+	} else if (ast_test_flag(flags, OPTION_WHISPER)) {
 		ast_audiohook_init(&csth.whisper_audiohook, AST_AUDIOHOOK_TYPE_WHISPER, "ChanSpy");
 		start_spying(spyee, spyer_name, &csth.whisper_audiohook); /* Unlocks spyee */
-	}
-
+  	}
+
+	ast_channel_unlock(spyee);
 	spyee = NULL;
 
 	csth.volfactor = *volfactor;
@@ -339,7 +374,16 @@
 			break;
 		}
 
-		if (ast_test_flag(flags, OPTION_WHISPER) && f->frametype == AST_FRAME_VOICE) {
+		if (ast_test_flag(flags, OPTION_BARGE) && f->frametype == AST_FRAME_VOICE) {
+			ast_audiohook_lock(&csth.whisper_audiohook);
+			ast_audiohook_lock(&csth.bridge_whisper_audiohook);
+			ast_audiohook_write_frame(&csth.whisper_audiohook, AST_AUDIOHOOK_DIRECTION_WRITE, f);
+			ast_audiohook_write_frame(&csth.bridge_whisper_audiohook, AST_AUDIOHOOK_DIRECTION_WRITE, f);
+			ast_audiohook_unlock(&csth.whisper_audiohook);
+			ast_audiohook_unlock(&csth.bridge_whisper_audiohook);
+			ast_frfree(f);
+			continue;
+		} else if (ast_test_flag(flags, OPTION_WHISPER) && f->frametype == AST_FRAME_VOICE) {
 			ast_audiohook_lock(&csth.whisper_audiohook);
 			ast_audiohook_write_frame(&csth.whisper_audiohook, AST_AUDIOHOOK_DIRECTION_WRITE, f);
 			ast_audiohook_unlock(&csth.whisper_audiohook);
@@ -401,7 +445,16 @@
 	else
 		ast_deactivate_generator(chan);
 
-	if (ast_test_flag(flags, OPTION_WHISPER)) {
+	if (ast_test_flag(flags, OPTION_BARGE)) {
+		ast_audiohook_lock(&csth.whisper_audiohook);
+		ast_audiohook_detach(&csth.whisper_audiohook);
+		ast_audiohook_unlock(&csth.whisper_audiohook);
+		ast_audiohook_destroy(&csth.whisper_audiohook);
+		ast_audiohook_lock(&csth.bridge_whisper_audiohook);
+		ast_audiohook_detach(&csth.bridge_whisper_audiohook);
+		ast_audiohook_unlock(&csth.bridge_whisper_audiohook);
+		ast_audiohook_destroy(&csth.bridge_whisper_audiohook);
+	} else if (ast_test_flag(flags, OPTION_WHISPER)) {
 		ast_audiohook_lock(&csth.whisper_audiohook);
 		ast_audiohook_detach(&csth.whisper_audiohook);
 		ast_audiohook_unlock(&csth.whisper_audiohook);
@@ -529,7 +582,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)
 {
 	char nameprefix[AST_NAME_STRLEN];
 	char peer_name[AST_NAME_STRLEN + 5];
@@ -544,12 +598,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);
 	}
 
 	ast_mutex_init(&chanspy_ds.lock);
@@ -610,10 +667,14 @@
 			 	next_channel(chan, prev, spec, exten, context, &chanspy_ds), next_chanspy_ds = NULL) {
 			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;
@@ -648,16 +709,22 @@
 			}
 
 			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;
+						}
 					}
 				}
 			}
@@ -702,36 +769,42 @@
 			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);
-		
 			/* We have to unlock the peer channel here to avoid a deadlock.
-			 * So, when we need it again, we have to lock the datastore and get
-			 * the pointer from there to see if the channel is still valid. */
+			 * So, when we need to dereference it again, we have to lock the 
+			 * datastore and get the pointer from there to see if the channel 
+			 * is still valid. */
 			ast_channel_unlock(peer);
-			peer = NULL;
 
 			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) {
+								chanspy_ds_free(peer_chanspy_ds);
+								break;
+							}
+						} else {
+							res = ast_say_character_str(chan, peer_name, "", chan->language);
 						}
-						if (res) {
-							chanspy_ds_free(peer_chanspy_ds);
-							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);
-			}
-
-			waitms = 5000;
+			}
+
 			res = channel_spy(chan, peer_chanspy_ds, &volfactor, fd, flags, exitcontext);
 			num_spyed_upon++;	
 
@@ -792,6 +865,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);
@@ -827,6 +902,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);
@@ -847,7 +936,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);
@@ -868,6 +957,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);
@@ -907,6 +998,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], '@'))) {

[... 12344 lines stripped ...]



More information about the asterisk-commits mailing list