[asterisk-commits] dhubbard: branch group/taskprocessors r114819 - in /team/group/taskprocessors...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Apr 28 21:25:30 CDT 2008
Author: dhubbard
Date: Mon Apr 28 21:25:29 2008
New Revision: 114819
URL: http://svn.digium.com/view/asterisk?view=rev&rev=114819
Log:
merged with butter
Added:
team/group/taskprocessors/doc/chan_sip-perf-testing.txt
- copied unchanged from r114813, trunk/doc/chan_sip-perf-testing.txt
team/group/taskprocessors/include/asterisk/dlinkedlists.h
- copied unchanged from r114813, trunk/include/asterisk/dlinkedlists.h
team/group/taskprocessors/pbx/ael/ael-test/ael-ntest24/
- copied from r114813, trunk/pbx/ael/ael-test/ael-ntest24/
team/group/taskprocessors/pbx/ael/ael-test/ael-ntest24/extensions.ael
- copied unchanged from r114813, trunk/pbx/ael/ael-test/ael-ntest24/extensions.ael
team/group/taskprocessors/pbx/ael/ael-test/ref.ael-ntest24
- copied unchanged from r114813, trunk/pbx/ael/ael-test/ref.ael-ntest24
team/group/taskprocessors/tests/test_dlinklists.c
- copied unchanged from r114813, trunk/tests/test_dlinklists.c
team/group/taskprocessors/utils/refcounter.c
- copied unchanged from r114813, trunk/utils/refcounter.c
Removed:
team/group/taskprocessors/apps/app_pickupchan.c
Modified:
team/group/taskprocessors/CHANGES
team/group/taskprocessors/Makefile
team/group/taskprocessors/apps/app_alarmreceiver.c
team/group/taskprocessors/apps/app_authenticate.c
team/group/taskprocessors/apps/app_chanspy.c
team/group/taskprocessors/apps/app_dial.c
team/group/taskprocessors/apps/app_directed_pickup.c
team/group/taskprocessors/apps/app_directory.c
team/group/taskprocessors/apps/app_disa.c
team/group/taskprocessors/apps/app_dumpchan.c
team/group/taskprocessors/apps/app_externalivr.c
team/group/taskprocessors/apps/app_festival.c
team/group/taskprocessors/apps/app_followme.c
team/group/taskprocessors/apps/app_ices.c
team/group/taskprocessors/apps/app_jack.c
team/group/taskprocessors/apps/app_meetme.c
team/group/taskprocessors/apps/app_minivm.c
team/group/taskprocessors/apps/app_mp3.c
team/group/taskprocessors/apps/app_nbscat.c
team/group/taskprocessors/apps/app_parkandannounce.c
team/group/taskprocessors/apps/app_playback.c
team/group/taskprocessors/apps/app_queue.c
team/group/taskprocessors/apps/app_rpt.c
team/group/taskprocessors/apps/app_setcallerid.c
team/group/taskprocessors/apps/app_sms.c
team/group/taskprocessors/apps/app_speech_utils.c
team/group/taskprocessors/apps/app_voicemail.c
team/group/taskprocessors/apps/app_waitforring.c
team/group/taskprocessors/apps/app_zapras.c
team/group/taskprocessors/apps/app_zapscan.c
team/group/taskprocessors/cdr/cdr_pgsql.c
team/group/taskprocessors/channels/chan_alsa.c
team/group/taskprocessors/channels/chan_console.c
team/group/taskprocessors/channels/chan_gtalk.c
team/group/taskprocessors/channels/chan_h323.c
team/group/taskprocessors/channels/chan_iax2.c
team/group/taskprocessors/channels/chan_jingle.c
team/group/taskprocessors/channels/chan_local.c
team/group/taskprocessors/channels/chan_mgcp.c
team/group/taskprocessors/channels/chan_misdn.c
team/group/taskprocessors/channels/chan_oss.c
team/group/taskprocessors/channels/chan_sip.c
team/group/taskprocessors/channels/chan_skinny.c
team/group/taskprocessors/channels/chan_unistim.c
team/group/taskprocessors/channels/chan_zap.c
team/group/taskprocessors/configs/features.conf.sample
team/group/taskprocessors/configs/iax.conf.sample
team/group/taskprocessors/configs/res_ldap.conf.sample
team/group/taskprocessors/configs/sip.conf.sample
team/group/taskprocessors/configs/sip_notify.conf.sample
team/group/taskprocessors/configure
team/group/taskprocessors/configure.ac
team/group/taskprocessors/contrib/scripts/astcli
team/group/taskprocessors/contrib/scripts/autosupport
team/group/taskprocessors/contrib/scripts/vmail.cgi
team/group/taskprocessors/doc/CODING-GUIDELINES
team/group/taskprocessors/doc/janitor-projects.txt
team/group/taskprocessors/doc/tex/ael.tex
team/group/taskprocessors/doc/tex/channelvariables.tex
team/group/taskprocessors/funcs/func_channel.c
team/group/taskprocessors/include/asterisk/app.h
team/group/taskprocessors/include/asterisk/astobj.h
team/group/taskprocessors/include/asterisk/astobj2.h
team/group/taskprocessors/include/asterisk/channel.h
team/group/taskprocessors/include/asterisk/dsp.h
team/group/taskprocessors/include/asterisk/frame.h
team/group/taskprocessors/include/asterisk/lock.h
team/group/taskprocessors/include/asterisk/logger.h
team/group/taskprocessors/include/asterisk/manager.h
team/group/taskprocessors/include/asterisk/pbx.h
team/group/taskprocessors/include/asterisk/sched.h
team/group/taskprocessors/main/app.c
team/group/taskprocessors/main/ast_expr2.c
team/group/taskprocessors/main/ast_expr2.fl
team/group/taskprocessors/main/ast_expr2.h
team/group/taskprocessors/main/ast_expr2.y
team/group/taskprocessors/main/ast_expr2f.c
team/group/taskprocessors/main/asterisk.c
team/group/taskprocessors/main/astobj2.c
team/group/taskprocessors/main/autoservice.c
team/group/taskprocessors/main/callerid.c
team/group/taskprocessors/main/channel.c
team/group/taskprocessors/main/dsp.c
team/group/taskprocessors/main/event.c
team/group/taskprocessors/main/features.c
team/group/taskprocessors/main/frame.c
team/group/taskprocessors/main/http.c
team/group/taskprocessors/main/logger.c
team/group/taskprocessors/main/manager.c
team/group/taskprocessors/main/pbx.c
team/group/taskprocessors/main/rtp.c
team/group/taskprocessors/main/sched.c
team/group/taskprocessors/main/utils.c
team/group/taskprocessors/pbx/ael/ael-test/ref.ael-ntest10
team/group/taskprocessors/pbx/ael/ael-test/ref.ael-test1
team/group/taskprocessors/pbx/ael/ael-test/ref.ael-test18
team/group/taskprocessors/pbx/ael/ael-test/ref.ael-test19
team/group/taskprocessors/pbx/ael/ael-test/ref.ael-test3
team/group/taskprocessors/pbx/ael/ael-test/ref.ael-test5
team/group/taskprocessors/pbx/ael/ael-test/ref.ael-test8
team/group/taskprocessors/pbx/ael/ael-test/ref.ael-vtest13
team/group/taskprocessors/pbx/ael/ael-test/ref.ael-vtest17
team/group/taskprocessors/pbx/pbx_lua.c
team/group/taskprocessors/phoneprov/polycom.xml
team/group/taskprocessors/phoneprov/polycom_line.xml
team/group/taskprocessors/res/res_agi.c
team/group/taskprocessors/res/res_config_ldap.c
team/group/taskprocessors/res/res_http_post.c
team/group/taskprocessors/res/res_jabber.c
team/group/taskprocessors/res/res_musiconhold.c
team/group/taskprocessors/res/res_phoneprov.c
team/group/taskprocessors/utils/ (props changed)
team/group/taskprocessors/utils/Makefile
Modified: team/group/taskprocessors/CHANGES
URL: http://svn.digium.com/view/asterisk/team/group/taskprocessors/CHANGES?view=diff&rev=114819&r1=114818&r2=114819
==============================================================================
--- team/group/taskprocessors/CHANGES (original)
+++ team/group/taskprocessors/CHANGES Mon Apr 28 21:25:29 2008
@@ -6,6 +6,7 @@
------------------
* 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.
Zaptel channel driver (chan_zap) Changes
----------------------------------------
@@ -29,12 +30,32 @@
messages, if the "messagewrap" option is set to a true value.
* Dial has a new option: F(context^extension^pri), which permits a callee to
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
-----------
* The ATTENDED_TRANSFER_COMPLETE_SOUND can now be set using setvar to cause a given
audio file to be played upon completion of an attended transfer.
* Added DNS manager support to registrations for peers referencing peer entries.
+ DNS manager runs in the background which allows DNS lookups to be run asynchronously
+ as well as periodically updating the IP address. These properties allow for
+ better performance as well as recovery in the event of an IP change.
+ * Performance improvements via using hash tables (astobj2) and doubly-linked lists to improve
+ load/reload of large numbers of peers/users by ~40x (for large lists of peers.
+ Initially, we saw 4x improvement in call setup/destruction, but at the time
+ of merging, this gain has disappeared; further research will be done to try
+ 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!
IAX Changes
-----------
@@ -155,6 +176,10 @@
* Added a CLI command, "devstate change", which allows you to set custom device
states from the func_devstate module that provides the DEVICE_STATE() function
and handling of the "Custom:" devices.
+ * New CLI command: "sip show sched" which shows all ast_sched entries for sip,
+ sorted into the different possible callbacks, with the number of entries
+ currently scheduled for each. Gives you a feel for how busy the sip channel
+ driver is.
SIP changes
-----------
@@ -414,6 +439,8 @@
for the "meetme" command.
* Added the ability to specify the music on hold class used to play into the
conference when there is only one member and the M option is used.
+ * Added MEETME_INFO dialplan function which provides a way to query
+ various properties of a Meetme conference.
Other Dialplan Application Changes
----------------------------------
@@ -486,6 +513,17 @@
first pass at conversion.
* aelparse will now read extensions.conf to see if a referenced
macro or context is there before issueing a warning.
+ * AEL parser sets a local channel variable ~~EXTEN~~, to
+ preserve the value of ${EXTEN} thru switch statements.
+ * New operator in $[...] expressions: the ~~ operator serves
+ as a concatenation operator. AT THE MOMENT, it is really only
+ necessary and useful in AEL, especially in if() expressions.
+ Operation: ${a} ~~ ${b| with force both a and b to strings, strip
+ any enclosing double-quotes, and evaluate to the value of a
+ concatenated with the value of b. For example if a is set to
+ "xyz" and b has the value "abc", then ${a} ~~ ${b| would
+ evaluate to xyzabc .
+
Call Features (res_features) Changes
------------------------------------
@@ -615,6 +653,18 @@
* A new option when starting a remote asterisk (rasterisk, asterisk -r) for
specifying which socket to use to connect to the running Asterisk daemon
(-s)
+ * Performance enhancements to the sched facility, which is used in
+ the channel drivers, etc. Added hashtabs and doubly-linked lists
+ to speed up deletion; start at the beginning or end of list to
+ speed up insertion.
+ * Added Doubly-linked lists after the fashion of linkedlists.h. They are in
+ dlinkedlists.h. Doubly-linked lists feature fast deletion times.
+ Added regression tests to the tests/ dir, also.
+ * Added a refcount trace feature to astobj2 for those trying to balance
+ object creation, deletion; work, play; space and time. See the
+ notes in astobj2.h. Also, see utils/refcounter as well, as a
+ quick way to find unbalanced refcounts in what could be a sea
+ of objects that were balanced.
* Added logging to 'make update' command. See update.log
* Added strictrtp option to rtp.conf. If enabled this will drop RTP packets that
do not come from the remote party.
Modified: team/group/taskprocessors/Makefile
URL: http://svn.digium.com/view/asterisk/team/group/taskprocessors/Makefile?view=diff&rev=114819&r1=114818&r2=114819
==============================================================================
--- team/group/taskprocessors/Makefile (original)
+++ team/group/taskprocessors/Makefile Mon Apr 28 21:25:29 2008
@@ -498,7 +498,7 @@
NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
-bininstall: _all
+installdirs:
mkdir -p $(DESTDIR)$(MODULES_DIR)
mkdir -p $(DESTDIR)$(ASTSBINDIR)
mkdir -p $(DESTDIR)$(ASTETCDIR)
@@ -510,6 +510,8 @@
mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
+
+bininstall: _all installdirs $(SUBDIRS_INSTALL)
$(INSTALL) -m 755 main/asterisk $(DESTDIR)$(ASTSBINDIR)/
$(LN) -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
$(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
@@ -571,7 +573,7 @@
@exit 1
endif
-install: badshell datafiles bininstall $(SUBDIRS_INSTALL)
+install: badshell datafiles bininstall
@if [ -x /usr/sbin/asterisk-post-install ]; then \
/usr/sbin/asterisk-post-install $(DESTDIR) . ; \
fi
@@ -867,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
+.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
Modified: team/group/taskprocessors/apps/app_alarmreceiver.c
URL: http://svn.digium.com/view/asterisk/team/group/taskprocessors/apps/app_alarmreceiver.c?view=diff&rev=114819&r1=114818&r2=114819
==============================================================================
--- team/group/taskprocessors/apps/app_alarmreceiver.c (original)
+++ team/group/taskprocessors/apps/app_alarmreceiver.c Mon Apr 28 21:25:29 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/taskprocessors/apps/app_authenticate.c
URL: http://svn.digium.com/view/asterisk/team/group/taskprocessors/apps/app_authenticate.c?view=diff&rev=114819&r1=114818&r2=114819
==============================================================================
--- team/group/taskprocessors/apps/app_authenticate.c (original)
+++ team/group/taskprocessors/apps/app_authenticate.c Mon Apr 28 21:25:29 2008
@@ -126,9 +126,7 @@
/* Compare against a fixed password */
if (!strcmp(passwd, arglist.password))
break;
- }
-
- if (ast_test_flag(&flags,OPT_DATABASE)) {
+ } else if (ast_test_flag(&flags,OPT_DATABASE)) {
char tmp[256];
/* Compare against a database key */
if (!ast_db_get(arglist.password + 1, passwd, tmp, sizeof(tmp))) {
Modified: team/group/taskprocessors/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/group/taskprocessors/apps/app_chanspy.c?view=diff&rev=114819&r1=114818&r2=114819
==============================================================================
--- team/group/taskprocessors/apps/app_chanspy.c (original)
+++ team/group/taskprocessors/apps/app_chanspy.c Mon Apr 28 21:25:29 2008
@@ -69,30 +69,39 @@
" 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"
-" 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) - Match only channels where their SPYGROUP variable is set to\n"
+" contain 'grp' in an optional : delimited list.\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";
@@ -109,27 +118,36 @@
" 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"
-" 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) - Match only channels where their ${SPYGROUP} variable is set to\n"
+" contain 'grp' in an optional : delimited list.\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 {
@@ -143,6 +161,9 @@
OPTION_READONLY = (1 << 7), /* Don't mix the two channels */
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 {
@@ -150,12 +171,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),
@@ -164,6 +187,8 @@
AST_APP_OPTION_ARG('e', OPTION_ENFORCED, OPT_ARG_ENFORCED),
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),
});
@@ -171,6 +196,7 @@
/* spy data */
struct ast_audiohook spy_audiohook;
struct ast_audiohook whisper_audiohook;
+ struct ast_audiohook bridge_whisper_audiohook;
int fd;
int volfactor;
};
@@ -224,7 +250,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;
@@ -233,12 +259,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;
}
@@ -287,16 +310,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;
@@ -333,7 +363,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);
@@ -395,7 +434,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);
@@ -496,35 +544,35 @@
const struct ast_channel *last, const char *spec,
const char *exten, const char *context, struct chanspy_ds *chanspy_ds)
{
- struct ast_channel *this;
+ struct ast_channel *next;
redo:
if (!ast_strlen_zero(spec))
- this = ast_walk_channel_by_name_prefix_locked(last, spec, strlen(spec));
-
+ next = ast_walk_channel_by_name_prefix_locked(last, spec, strlen(spec));
else if (!ast_strlen_zero(exten))
- this = ast_walk_channel_by_exten_locked(last, exten, context);
+ next = ast_walk_channel_by_exten_locked(last, exten, context);
else
- this = ast_channel_walk_locked(last);
-
- if (!this)
+ next = ast_channel_walk_locked(last);
+
+ if (!next)
return NULL;
- if (!strncmp(this->name, "Zap/pseudo", 10)) {
- ast_channel_unlock(this);
+ if (!strncmp(next->name, "Zap/pseudo", 10)) {
+ ast_channel_unlock(next);
goto redo;
- } else if (this == chan) {
- last = this;
- ast_channel_unlock(this);
+ } else if (next == chan) {
+ last = next;
+ ast_channel_unlock(next);
goto redo;
}
- return setup_chanspy_ds(this, chanspy_ds);
+ return setup_chanspy_ds(next, chanspy_ds);
}
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];
@@ -615,7 +663,6 @@
char *ext;
char *form_enforced;
int ienf = !myenforced;
- struct ast_channel *peer;
peer = peer_chanspy_ds->chan;
@@ -698,32 +745,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_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;
+ 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);
+ }
}
- } else
- res = ast_say_character_str(chan, peer_name, "", chan->language);
- if ((num = atoi(ptr)))
- ast_say_digits(chan, atoi(ptr), "", chan->language);
- }
-
- waitms = 5000;
+ if ((num = atoi(ptr)))
+ ast_say_digits(chan, atoi(ptr), "", chan->language);
+ }
+ }
+
res = channel_spy(chan, peer_chanspy_ds, &volfactor, fd, flags, exitcontext);
num_spyed_upon++;
@@ -784,6 +841,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);
@@ -819,6 +878,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);
@@ -830,7 +903,7 @@
}
if (recbase) {
- char filename[512];
+ char filename[PATH_MAX];
snprintf(filename, sizeof(filename), "%s/%s.%d.raw", ast_config_AST_MONITOR_DIR, recbase, (int) time(NULL));
if ((fd = open(filename, O_CREAT | O_WRONLY | O_TRUNC, AST_FILE_MODE)) <= 0) {
@@ -839,7 +912,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);
@@ -860,6 +933,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);
@@ -899,6 +974,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);
@@ -909,7 +999,7 @@
}
if (recbase) {
- char filename[512];
+ char filename[PATH_MAX];
snprintf(filename, sizeof(filename), "%s/%s.%d.raw", ast_config_AST_MONITOR_DIR, recbase, (int) time(NULL));
if ((fd = open(filename, O_CREAT | O_WRONLY | O_TRUNC, AST_FILE_MODE)) <= 0) {
@@ -919,7 +1009,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/group/taskprocessors/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/group/taskprocessors/apps/app_dial.c?view=diff&rev=114819&r1=114818&r2=114819
==============================================================================
--- team/group/taskprocessors/apps/app_dial.c (original)
+++ team/group/taskprocessors/apps/app_dial.c Mon Apr 28 21:25:29 2008
@@ -26,7 +26,7 @@
*/
/*** MODULEINFO
- <depend>chan_local</depend>
+ <depend>chan_local</depend>
***/
@@ -788,8 +788,11 @@
*to = -1;
strcpy(pa->status, "CANCEL");
ast_cdr_noanswer(in->cdr);
- if (f)
+ if (f) {
+ if (f->seqno)
+ in->hangupcause = f->seqno;
ast_frfree(f);
+ }
return NULL;
}
@@ -1600,8 +1603,14 @@
time(&start_time);
peer = wait_for_answer(chan, outgoing, &to, peerflags, &pa, &num, &result);
- ast_channel_datastore_remove(chan, datastore);
- ast_channel_datastore_free(datastore);
+ /* The ast_channel_datastore_remove() function could fail here if the
+ * datastore was moved to another channel during a masquerade. If this is
+ * the case, don't free the datastore here because later, when the channel
+ * to which the datastore was moved hangs up, it will attempt to free this
+ * datastore again, causing a crash
+ */
+ if (!ast_channel_datastore_remove(chan, datastore))
+ ast_channel_datastore_free(datastore);
if (!peer) {
if (result) {
res = result;
@@ -1610,6 +1619,13 @@
} else { /* Nobody answered, next please? */
res = 0;
}
+
+ /* SIP, in particular, sends back this error code to indicate an
+ * overlap dialled number needs more digits. */
+ if (chan->hangupcause == AST_CAUSE_INVALID_NUMBER_FORMAT) {
+ res = AST_PBX_INCOMPLETE;
+ }
+
/* almost done, although the 'else' block is 400 lines */
} else {
const char *number;
@@ -1925,9 +1941,9 @@
}
if (res != AST_PBX_NO_HANGUP_PEER) {
if (!ast_check_hangup(peer) && ast_test_flag64(&opts, OPT_CALLEE_GO_ON) && !ast_strlen_zero(opt_args[OPT_ARG_CALLEE_GO_ON])) {
- replace_macro_delimiter(opt_args[OPT_ARG_CALLEE_GO_ON]);
- ast_parseable_goto(peer, opt_args[OPT_ARG_CALLEE_GO_ON]);
- ast_pbx_start(peer);
+ replace_macro_delimiter(opt_args[OPT_ARG_CALLEE_GO_ON]);
+ ast_parseable_goto(peer, opt_args[OPT_ARG_CALLEE_GO_ON]);
+ ast_pbx_start(peer);
} else {
if (!ast_check_hangup(chan))
chan->hangupcause = peer->hangupcause;
@@ -1949,7 +1965,7 @@
senddialendevent(chan, pa.status);
ast_debug(1, "Exiting with DIALSTATUS=%s.\n", pa.status);
- if ((ast_test_flag64(peerflags, OPT_GO_ON)) && !ast_check_hangup(chan) && (res != AST_PBX_KEEPALIVE)) {
+ 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;
res = 0;
@@ -2050,9 +2066,9 @@
}
}
- if (res < 0)
+ if (res < 0 || res == AST_PBX_INCOMPLETE) {
break;
- else if (res > 0) { /* Trying to send the call elsewhere (1 digit ext) */
+ } else if (res > 0) { /* Trying to send the call elsewhere (1 digit ext) */
if (onedigit_goto(chan, context, (char) res, 1)) {
res = 0;
break;
Modified: team/group/taskprocessors/apps/app_directed_pickup.c
[... 24407 lines stripped ...]
More information about the asterisk-commits
mailing list