[asterisk-commits] russell: branch russell/chan_refcount r119293 - in /team/russell/chan_refcoun...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri May 30 10:00:37 CDT 2008
Author: russell
Date: Fri May 30 10:00:36 2008
New Revision: 119293
URL: http://svn.digium.com/view/asterisk?view=rev&rev=119293
Log:
resolve conflicts, reset automerge ... i'm sure i have broken app_chanspy by now
as it has had about 298347928347 conflicts over time
Added:
team/russell/chan_refcount/channels/chan_phone.h
- copied unchanged from r119239, trunk/channels/chan_phone.h
team/russell/chan_refcount/configs/pbx_realtime.conf
- copied unchanged from r119239, trunk/configs/pbx_realtime.conf
team/russell/chan_refcount/doc/api-1.6.0-changes.odt
- copied unchanged from r119239, trunk/doc/api-1.6.0-changes.odt
team/russell/chan_refcount/doc/cli.txt
- copied unchanged from r119239, trunk/doc/cli.txt
Removed:
team/russell/chan_refcount/channels/DialTone.h
Modified:
team/russell/chan_refcount/ (props changed)
team/russell/chan_refcount/CHANGES
team/russell/chan_refcount/CREDITS
team/russell/chan_refcount/UPGRADE.txt
team/russell/chan_refcount/apps/app_alarmreceiver.c
team/russell/chan_refcount/apps/app_chanisavail.c
team/russell/chan_refcount/apps/app_chanspy.c
team/russell/chan_refcount/apps/app_dial.c
team/russell/chan_refcount/apps/app_disa.c
team/russell/chan_refcount/apps/app_externalivr.c
team/russell/chan_refcount/apps/app_festival.c
team/russell/chan_refcount/apps/app_followme.c
team/russell/chan_refcount/apps/app_forkcdr.c
team/russell/chan_refcount/apps/app_ices.c
team/russell/chan_refcount/apps/app_jack.c
team/russell/chan_refcount/apps/app_meetme.c
team/russell/chan_refcount/apps/app_milliwatt.c
team/russell/chan_refcount/apps/app_mp3.c
team/russell/chan_refcount/apps/app_nbscat.c
team/russell/chan_refcount/apps/app_queue.c
team/russell/chan_refcount/apps/app_rpt.c
team/russell/chan_refcount/apps/app_sms.c
team/russell/chan_refcount/apps/app_speech_utils.c
team/russell/chan_refcount/apps/app_test.c
team/russell/chan_refcount/apps/app_voicemail.c
team/russell/chan_refcount/apps/app_waituntil.c
team/russell/chan_refcount/apps/app_zapbarge.c
team/russell/chan_refcount/apps/app_zapscan.c
team/russell/chan_refcount/build_tools/make_buildopts_h
team/russell/chan_refcount/cdr/cdr_csv.c
team/russell/chan_refcount/channels/Makefile
team/russell/chan_refcount/channels/chan_agent.c
team/russell/chan_refcount/channels/chan_alsa.c
team/russell/chan_refcount/channels/chan_console.c
team/russell/chan_refcount/channels/chan_gtalk.c
team/russell/chan_refcount/channels/chan_h323.c
team/russell/chan_refcount/channels/chan_iax2.c
team/russell/chan_refcount/channels/chan_jingle.c
team/russell/chan_refcount/channels/chan_local.c
team/russell/chan_refcount/channels/chan_mgcp.c
team/russell/chan_refcount/channels/chan_misdn.c
team/russell/chan_refcount/channels/chan_nbs.c
team/russell/chan_refcount/channels/chan_oss.c
team/russell/chan_refcount/channels/chan_phone.c
team/russell/chan_refcount/channels/chan_sip.c
team/russell/chan_refcount/channels/chan_skinny.c
team/russell/chan_refcount/channels/chan_unistim.c
team/russell/chan_refcount/channels/chan_usbradio.c
team/russell/chan_refcount/channels/chan_vpb.cc
team/russell/chan_refcount/channels/chan_zap.c
team/russell/chan_refcount/channels/console_gui.c
team/russell/chan_refcount/channels/console_video.c
team/russell/chan_refcount/channels/h323/ast_h323.cxx
team/russell/chan_refcount/channels/iax2-parser.c
team/russell/chan_refcount/channels/iax2-parser.h
team/russell/chan_refcount/channels/xpmr/sinetabx.h
team/russell/chan_refcount/channels/xpmr/xpmr.c
team/russell/chan_refcount/channels/xpmr/xpmr.h
team/russell/chan_refcount/channels/xpmr/xpmr_coef.h
team/russell/chan_refcount/codecs/codec_a_mu.c
team/russell/chan_refcount/codecs/codec_adpcm.c
team/russell/chan_refcount/codecs/codec_alaw.c
team/russell/chan_refcount/codecs/codec_g722.c
team/russell/chan_refcount/codecs/codec_g726.c
team/russell/chan_refcount/codecs/codec_gsm.c
team/russell/chan_refcount/codecs/codec_lpc10.c
team/russell/chan_refcount/codecs/codec_resample.c
team/russell/chan_refcount/codecs/codec_speex.c
team/russell/chan_refcount/codecs/codec_ulaw.c
team/russell/chan_refcount/codecs/codec_zap.c
team/russell/chan_refcount/configs/jabber.conf.sample
team/russell/chan_refcount/configs/oss.conf.sample
team/russell/chan_refcount/configs/queues.conf.sample
team/russell/chan_refcount/configs/sip.conf.sample
team/russell/chan_refcount/configs/voicemail.conf.sample
team/russell/chan_refcount/configs/zapata.conf.sample
team/russell/chan_refcount/doc/externalivr.txt
team/russell/chan_refcount/doc/manager_1_1.txt
team/russell/chan_refcount/formats/format_g723.c
team/russell/chan_refcount/formats/format_g726.c
team/russell/chan_refcount/formats/format_g729.c
team/russell/chan_refcount/formats/format_gsm.c
team/russell/chan_refcount/formats/format_h263.c
team/russell/chan_refcount/formats/format_h264.c
team/russell/chan_refcount/formats/format_ilbc.c
team/russell/chan_refcount/formats/format_jpeg.c
team/russell/chan_refcount/formats/format_ogg_vorbis.c
team/russell/chan_refcount/formats/format_pcm.c
team/russell/chan_refcount/formats/format_sln.c
team/russell/chan_refcount/formats/format_sln16.c
team/russell/chan_refcount/formats/format_vox.c
team/russell/chan_refcount/formats/format_wav.c
team/russell/chan_refcount/formats/format_wav_gsm.c
team/russell/chan_refcount/funcs/func_speex.c
team/russell/chan_refcount/funcs/func_timeout.c
team/russell/chan_refcount/include/asterisk/channel.h
team/russell/chan_refcount/include/asterisk/compat.h
team/russell/chan_refcount/include/asterisk/frame.h
team/russell/chan_refcount/include/asterisk/jingle.h
team/russell/chan_refcount/include/asterisk/lock.h
team/russell/chan_refcount/include/asterisk/logger.h
team/russell/chan_refcount/include/asterisk/manager.h
team/russell/chan_refcount/include/asterisk/rtp.h
team/russell/chan_refcount/include/asterisk/strings.h
team/russell/chan_refcount/include/asterisk/utils.h
team/russell/chan_refcount/main/Makefile
team/russell/chan_refcount/main/abstract_jb.c
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/autoservice.c
team/russell/chan_refcount/main/cdr.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/dsp.c
team/russell/chan_refcount/main/features.c
team/russell/chan_refcount/main/file.c
team/russell/chan_refcount/main/frame.c
team/russell/chan_refcount/main/http.c
team/russell/chan_refcount/main/indications.c
team/russell/chan_refcount/main/logger.c
team/russell/chan_refcount/main/manager.c
team/russell/chan_refcount/main/pbx.c
team/russell/chan_refcount/main/rtp.c
team/russell/chan_refcount/main/sched.c
team/russell/chan_refcount/main/slinfactory.c
team/russell/chan_refcount/main/taskprocessor.c
team/russell/chan_refcount/main/translate.c
team/russell/chan_refcount/main/udptl.c
team/russell/chan_refcount/main/utils.c
team/russell/chan_refcount/pbx/pbx_gtkconsole.c
team/russell/chan_refcount/pbx/pbx_realtime.c
team/russell/chan_refcount/pbx/pbx_spool.c
team/russell/chan_refcount/res/res_adsi.c
team/russell/chan_refcount/res/res_agi.c
team/russell/chan_refcount/res/res_config_ldap.c
team/russell/chan_refcount/res/res_jabber.c
team/russell/chan_refcount/res/res_musiconhold.c
team/russell/chan_refcount/res/res_odbc.c
team/russell/chan_refcount/res/res_smdi.c
team/russell/chan_refcount/sample.call
team/russell/chan_refcount/utils/ael_main.c
team/russell/chan_refcount/utils/astcanary.c
team/russell/chan_refcount/utils/check_expr.c
team/russell/chan_refcount/utils/conf2ael.c
team/russell/chan_refcount/utils/hashtest.c
team/russell/chan_refcount/utils/hashtest2.c
team/russell/chan_refcount/utils/refcounter.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 30 10:00:36 2008
@@ -1,1 +1,1 @@
-/trunk:1-104106,104108-116078
+/trunk:1-104106,104108-119292
Modified: team/russell/chan_refcount/CHANGES
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/CHANGES?view=diff&rev=119293&r1=119292&r2=119293
==============================================================================
--- team/russell/chan_refcount/CHANGES (original)
+++ team/russell/chan_refcount/CHANGES Fri May 30 10:00:36 2008
@@ -14,11 +14,19 @@
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.
+ * TIMEOUT() has been modified to be accurate down to the millisecond.
+ * ENUM*() functions now include the following new options:
+ - 'u' returns the full URI and does not strip off the URI-scheme.
+ - 's' triggers ISN specific rewriting
+ - 'i' looks for branches into an Infrastructure ENUM tree
+ - 'd' for a direct DNS lookup without any flipping of digits.
+ * TXCIDNAME() has a new zone-suffix parameter (which defaults to 'e164.arpa')
Zaptel channel driver (chan_zap) Changes
----------------------------------------
* Channels can now be configured using named sections in zapata.conf, just
like other channel drivers, including the use of templates.
+ * The default for pridialplan has changed from 'national' to 'unknown'.
PBX Changes
-----------
@@ -59,6 +67,16 @@
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.
+ * Chanspy has a new option, 'd', which allows the spy to use DTMF to swap between
+ spy modes. Use of this feature overrides the typical use of numeric DTMF. In other
+ words, if using the 'd' option, it is not possible to enter a number to append to
+ the first argument to Chanspy(). Pressing 4 will change to spy mode, pressing 5 will
+ change to whisper mode, and pressing 6 will change to barge mode.
+ * ExternalIVR now takes several options that affect the way it performs, as
+ well as having several new commands. Please see doc/externalivr.txt for the
+ complete documentation.
+ * ChanIsAvail has a new option, 'a', which will return all available channels instead
+ of just the first one if you give the function more then one channel to check.
SIP Changes
-----------
@@ -77,6 +95,9 @@
testing and problem reporting!
* Added ability to specify registration expiry time on a per registration basis in
the register line.
+ * Added support for T140 RED - redundancy in T.140 to prevent text loss due to
+ lost packets.
+ * Added t38pt_usertpsource option. See sip.conf.sample for details.
IAX Changes
-----------
@@ -98,20 +119,16 @@
* 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.
- * ENUM*() functions now include the following new options:
- - 'u' returns the full URI and does not strip off the URI-scheme.
- - 's' triggers ISN specific rewriting
- - 'i' looks for branches into an Infrastructure ENUM tree
- - 'd' for a direct DNS lookup without any flipping of digits.
- * TXCIDNAME() has a new zone-suffix parameter (which defaults to 'e164.arpa')
-
AMI - The manager (TCP/TLS/HTTP)
--------------------------------
* The Status command now takes an optional list of variables to display
along with channel status.
+
+ODBC Changes
+------------
+ * res_odbc no longer has a limit of 1023 total possible unshared connections,
+ as some people were running into this limit. This limit has been increased
+ to 4.2 billion.
------------------------------------------------------------------------------
--- Functionality changes from Asterisk 1.4.X to Asterisk 1.6.0 -------------
@@ -166,6 +183,7 @@
* Originate now requires the Originate privilege and, if you want to call out
to a subshell, it requires the System privilege, as well. This was done to
enhance manager security.
+ * Originate now accepts codec settings with "Codecs: alaw, ulaw, h264"
* New command: Atxfer. See doc/manager_1_1.txt for more details or
manager show command Atxfer from the CLI
@@ -727,3 +745,9 @@
turned on, via the CHANNEL(trace) dialplan function. Could be useful for
dialplan debugging.
* iLBC source code no longer included (see UPGRADE.txt for details)
+ * If compiled with DETECT_DEADLOCKS enabled and if you have glibc, then if
+ deadlock is detected, a backtrace of the stack which led to the lock calls
+ will be output to the CLI.
+ * If compiled with DEBUG_THREADS enabled and if you have glibc, then issuing
+ the "core show locks" CLI command will give lock information output as well
+ as a backtrace of the stack which led to the lock calls.
Modified: team/russell/chan_refcount/CREDITS
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/CREDITS?view=diff&rev=119293&r1=119292&r2=119293
==============================================================================
--- team/russell/chan_refcount/CREDITS (original)
+++ team/russell/chan_refcount/CREDITS Fri May 30 10:00:36 2008
@@ -19,6 +19,9 @@
John Todd, TalkPlus, Inc. and JR Richardson, Ntegrated Solutions. - for funding
the development of SIP Session Timers support.
+
+Omnitor AB, Gunnar Hellström, for funding work with videocaps, T.140 RED,
+originate with video/text and many more contributions.
=== WISHLIST CONTRIBUTERS ===
Jeremy McNamara - SpeeX support
Modified: team/russell/chan_refcount/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/UPGRADE.txt?view=diff&rev=119293&r1=119292&r2=119293
==============================================================================
--- team/russell/chan_refcount/UPGRADE.txt (original)
+++ team/russell/chan_refcount/UPGRADE.txt Fri May 30 10:00:36 2008
@@ -59,6 +59,12 @@
* The silencethreshold used for various applications is now settable via a
centralized config option in dsp.conf.
+* The logical value of spaces immediately preceding a standalone 0 previously
+ evaluated to true. It now evaluates to false. This has confused a good
+ many people in the past (typically because they failed to realize the space
+ had any significance). Since this violates the Principle of Least Surprise,
+ it has been changed.
+
Voicemail:
* The voicemail configuration values 'maxmessage' and 'minmessage' have
@@ -75,7 +81,7 @@
Examples of situations that would require this option are web interfaces to
voicemail or an email client in the case of using IMAP storage.
* The externnotify script should accept an additional (last) parameter
- containing the string "URGENT" if there are new urgent messages in the INBOX.
+ containing the number of urgent messages in the INBOX.
Applications:
Modified: team/russell/chan_refcount/apps/app_alarmreceiver.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/apps/app_alarmreceiver.c?view=diff&rev=119293&r1=119292&r2=119293
==============================================================================
--- team/russell/chan_refcount/apps/app_alarmreceiver.c (original)
+++ team/russell/chan_refcount/apps/app_alarmreceiver.c Fri May 30 10:00:36 2008
@@ -185,7 +185,7 @@
wf.subclass = AST_FORMAT_ULAW;
wf.offset = AST_FRIENDLY_OFFSET;
wf.mallocd = 0;
- wf.data = tone_block.buf;
+ wf.data.ptr = tone_block.buf;
wf.datalen = f->datalen;
wf.samples = wf.datalen;
@@ -252,8 +252,8 @@
/* If they hung up, leave */
if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP)) {
- if (f->seqno) {
- chan->hangupcause = f->seqno;
+ if (f->data.uint32) {
+ chan->hangupcause = f->data.uint32;
}
ast_frfree(f);
res = -1;
Modified: team/russell/chan_refcount/apps/app_chanisavail.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/apps/app_chanisavail.c?view=diff&rev=119293&r1=119292&r2=119293
==============================================================================
--- team/russell/chan_refcount/apps/app_chanisavail.c (original)
+++ team/russell/chan_refcount/apps/app_chanisavail.c Fri May 30 10:00:36 2008
@@ -50,6 +50,7 @@
"This application will check to see if any of the specified channels are\n"
"available.\n"
" Options:\n"
+" a - Check for all available channels, not only the first one.\n"
" s - Consider the channel unavailable if the channel is in use at all.\n"
" t - Simply checks if specified channels exist in the channel list\n"
" (implies option s).\n"
@@ -61,9 +62,12 @@
static int chanavail_exec(struct ast_channel *chan, void *data)
{
- int res=-1, inuse=-1, option_state=0, string_compare=0;
+ int inuse=-1, option_state=0, string_compare=0, option_all_avail=0;
int status;
char *info, tmp[512], trychan[512], *peers, *tech, *number, *rest, *cur;
+ struct ast_str *tmp_availchan = ast_str_alloca(2048);
+ struct ast_str *tmp_availorig = ast_str_alloca(2048);
+ struct ast_str *tmp_availstat = ast_str_alloca(2048);
struct ast_channel *tempchan;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(reqchans);
@@ -80,10 +84,15 @@
AST_STANDARD_APP_ARGS(args, info);
if (args.options) {
- if (strchr(args.options, 's'))
+ if (strchr(args.options, 'a')) {
+ option_all_avail = 1;
+ }
+ if (strchr(args.options, 's')) {
option_state = 1;
- if (strchr(args.options, 't'))
+ }
+ if (strchr(args.options, 't')) {
string_compare = 1;
+ }
}
peers = args.reqchans;
if (peers) {
@@ -119,27 +128,32 @@
status = inuse = ast_device_state(trychan);
}
if ((inuse <= 1) && (tempchan = ast_request(tech, chan->nativeformats, number, &status))) {
- pbx_builtin_setvar_helper(chan, "AVAILCHAN", tempchan->name);
- /* Store the originally used channel too */
+ ast_str_append(&tmp_availchan, 0, "%s%s", tmp_availchan->used ? "&" : "", tempchan->name);
+
snprintf(tmp, sizeof(tmp), "%s/%s", tech, number);
- pbx_builtin_setvar_helper(chan, "AVAILORIGCHAN", tmp);
+ ast_str_append(&tmp_availorig, 0, "%s%s", tmp_availorig->used ? "&" : "", tmp);
+
snprintf(tmp, sizeof(tmp), "%d", status);
- pbx_builtin_setvar_helper(chan, "AVAILSTATUS", tmp);
+ ast_str_append(&tmp_availstat, 0, "%s%s", tmp_availstat->used ? "&" : "", tmp);
+
ast_hangup(tempchan);
tempchan = NULL;
- res = 1;
- break;
+
+ if (!option_all_avail) {
+ break;
+ }
} else {
snprintf(tmp, sizeof(tmp), "%d", status);
- pbx_builtin_setvar_helper(chan, "AVAILSTATUS", tmp);
+ ast_str_append(&tmp_availstat, 0, "%s%s", tmp_availstat->used ? "&" : "", tmp);
}
cur = rest;
} while (cur);
}
- if (res < 1) {
- pbx_builtin_setvar_helper(chan, "AVAILCHAN", "");
- pbx_builtin_setvar_helper(chan, "AVAILORIGCHAN", "");
- }
+
+ pbx_builtin_setvar_helper(chan, "AVAILCHAN", tmp_availchan->str);
+ /* Store the originally used channel too */
+ pbx_builtin_setvar_helper(chan, "AVAILORIGCHAN", tmp_availorig->str);
+ pbx_builtin_setvar_helper(chan, "AVAILSTATUS", tmp_availstat->str);
return 0;
}
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=119293&r1=119292&r2=119293
==============================================================================
--- team/russell/chan_refcount/apps/app_chanspy.c (original)
+++ team/russell/chan_refcount/apps/app_chanspy.c Fri May 30 10:00:36 2008
@@ -64,7 +64,8 @@
" - Dialing a series of digits followed by # builds a channel name to append\n"
" to 'chanprefix'. For example, executing ChanSpy(Agent) and then dialing\n"
" the digits '1234#' while spying will begin spying on the channel\n"
-" 'Agent/1234'.\n"
+" 'Agent/1234'. Note that this feature will be overriden if the 'd' option\n"
+" is used\n"
" Note: The X option supersedes the three features above in that if a valid\n"
" single digit extension exists in the correct context ChanSpy will\n"
" exit to it. This also disables choosing a channel based on 'chanprefix'\n"
@@ -73,6 +74,11 @@
" 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"
+" d - Override the typical numeric DTMF functionality and instead\n"
+" use DTMF to switch between spy modes.\n"
+" 4 = spy mode\n"
+" 5 = whisper mode\n"
+" 6 = barge mode\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"
@@ -126,6 +132,13 @@
" exit to it.\n"
" Options:\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"
+" d - Override the typical numeric DTMF functionality and instead\n"
+" use DTMF to switch between spy modes.\n"
+" 4 = spy mode\n"
+" 5 = whisper mode\n"
+" 6 = barge mode\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"
@@ -162,19 +175,20 @@
;
enum {
- OPTION_QUIET = (1 << 0), /* Quiet, no announcement */
- OPTION_BRIDGED = (1 << 1), /* Only look at bridged calls */
- OPTION_VOLUME = (1 << 2), /* Specify initial volume */
- OPTION_GROUP = (1 << 3), /* Only look at channels in group */
- OPTION_RECORD = (1 << 4),
- OPTION_WHISPER = (1 << 5),
- OPTION_PRIVATE = (1 << 6), /* Private Whisper mode */
- 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 */
+ OPTION_QUIET = (1 << 0), /* Quiet, no announcement */
+ OPTION_BRIDGED = (1 << 1), /* Only look at bridged calls */
+ OPTION_VOLUME = (1 << 2), /* Specify initial volume */
+ OPTION_GROUP = (1 << 3), /* Only look at channels in group */
+ OPTION_RECORD = (1 << 4),
+ OPTION_WHISPER = (1 << 5),
+ OPTION_PRIVATE = (1 << 6), /* Private Whisper mode */
+ 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 */
+ OPTION_DTMF_SWITCH_MODES = (1 << 13), /*Allow numeric DTMF to switch between chanspy modes */
} chanspy_opt_flags;
enum {
@@ -200,8 +214,10 @@
AST_APP_OPTION('X', OPTION_EXIT),
AST_APP_OPTION('s', OPTION_NOTECH),
AST_APP_OPTION_ARG('n', OPTION_NAME, OPT_ARG_NAME),
+ AST_APP_OPTION('d', OPTION_DTMF_SWITCH_MODES),
});
+int next_unique_id_to_use = 0;
struct chanspy_translation_helper {
/* spy data */
@@ -248,7 +264,7 @@
}
if (csth->fd)
- write(csth->fd, f->data, f->datalen);
+ write(csth->fd, f->data.ptr, f->datalen);
ast_frfree(f);
@@ -277,8 +293,22 @@
return res;
}
+static void change_spy_mode(const char digit, struct ast_flags *flags)
+{
+ if (digit == '4') {
+ ast_clear_flag(flags, OPTION_WHISPER);
+ ast_clear_flag(flags, OPTION_BARGE);
+ } else if (digit == '5') {
+ ast_clear_flag(flags, OPTION_BARGE);
+ ast_set_flag(flags, OPTION_WHISPER);
+ } else if (digit == '6') {
+ ast_clear_flag(flags, OPTION_WHISPER);
+ ast_set_flag(flags, OPTION_BARGE);
+ }
+}
+
static int channel_spy(struct ast_channel *chan, struct ast_channel *spyee, int *volfactor, int fd,
- const struct ast_flags *flags, char *exitcontext)
+ struct ast_flags *flags, char *exitcontext)
{
struct chanspy_translation_helper csth;
int running = 0, res, x = 0;
@@ -286,6 +316,11 @@
char *name;
struct ast_frame *f;
struct ast_silence_generator *silgen = NULL;
+ const char *spyer_name;
+
+ ast_channel_lock(chan);
+ spyer_name = ast_strdupa(chan->name);
+ ast_channel_unlock(chan);
if (ast_check_hangup(chan) || ast_check_hangup(spyee)) {
ast_channel_unlock(spyee);
@@ -305,15 +340,14 @@
return 0;
}
- 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, chan, &csth.whisper_audiohook); /* Unlocks spyee */
- start_spying(ast_bridged_channel(spyee), chan, &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, chan, &csth.whisper_audiohook);
- }
+ ast_channel_lock(chan);
+ ast_set_flag(chan, AST_FLAG_END_DTMF_ONLY);
+ ast_channel_unlock(chan);
+
+ 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, chan, &csth.whisper_audiohook); /* Unlocks spyee */
+ start_spying(ast_bridged_channel(spyee), chan, &csth.bridge_whisper_audiohook);
ast_channel_unlock(spyee);
spyee = NULL;
@@ -395,7 +429,11 @@
ast_debug(2, "Exit by single digit did not work in chanspy. Extension %s does not exist in context %s\n", tmp, exitcontext);
}
} else if (res >= '0' && res <= '9') {
- inp[x++] = res;
+ if (ast_test_flag(flags, OPTION_DTMF_SWITCH_MODES)) {
+ change_spy_mode(res, flags);
+ } else {
+ inp[x++] = res;
+ }
}
if (res == '*') {
@@ -423,21 +461,18 @@
else
ast_deactivate_generator(chan);
- 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);
- ast_audiohook_destroy(&csth.whisper_audiohook);
- }
+ ast_channel_lock(chan);
+ ast_clear_flag(chan, AST_FLAG_END_DTMF_ONLY);
+ ast_channel_unlock(chan);
+
+ 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);
ast_audiohook_lock(&csth.spy_audiohook);
ast_audiohook_detach(&csth.spy_audiohook);
@@ -449,7 +484,7 @@
return running;
}
-static int common_exec(struct ast_channel *chan, const struct ast_flags *flags,
+static int common_exec(struct ast_channel *chan, 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 *mailbox,
const char *name_context)
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=119293&r1=119292&r2=119293
==============================================================================
--- team/russell/chan_refcount/apps/app_dial.c (original)
+++ team/russell/chan_refcount/apps/app_dial.c Fri May 30 10:00:36 2008
@@ -765,7 +765,7 @@
}
break;
case AST_FRAME_HTML:
- if (!ast_test_flag64(outgoing, DIAL_NOFORWARDHTML) && ast_channel_sendhtml(in, f->subclass, f->data, f->datalen) == -1) {
+ if (!ast_test_flag64(outgoing, DIAL_NOFORWARDHTML) && ast_channel_sendhtml(in, f->subclass, f->data.ptr, f->datalen) == -1) {
ast_log(LOG_WARNING, "Unable to send URL\n");
}
break;
@@ -789,8 +789,9 @@
strcpy(pa->status, "CANCEL");
ast_cdr_noanswer(in->cdr);
if (f) {
- if (f->seqno)
- in->hangupcause = f->seqno;
+ if (f->data.uint32) {
+ in->hangupcause = f->data.uint32;
+ }
ast_frfree(f);
}
return NULL;
@@ -824,7 +825,7 @@
/* Forward HTML stuff */
if (single && (f->frametype == AST_FRAME_HTML) && !ast_test_flag64(outgoing, DIAL_NOFORWARDHTML))
- if (ast_channel_sendhtml(outgoing->chan, f->subclass, f->data, f->datalen) == -1)
+ if (ast_channel_sendhtml(outgoing->chan, f->subclass, f->data.ptr, f->datalen) == -1)
ast_log(LOG_WARNING, "Unable to send URL\n");
if (single && ((f->frametype == AST_FRAME_VOICE) || (f->frametype == AST_FRAME_DTMF_BEGIN) || (f->frametype == AST_FRAME_DTMF_END))) {
@@ -837,7 +838,7 @@
(f->subclass == AST_CONTROL_VIDUPDATE) ||
(f->subclass == AST_CONTROL_SRCUPDATE))) {
ast_verb(3, "%s requested special control %d, passing it to %s\n", in->name, f->subclass, outgoing->chan->name);
- ast_indicate_data(outgoing->chan, f->subclass, f->data, f->datalen);
+ ast_indicate_data(outgoing->chan, f->subclass, f->data.ptr, f->datalen);
}
ast_frfree(f);
}
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=119293&r1=119292&r2=119293
==============================================================================
--- team/russell/chan_refcount/apps/app_disa.c (original)
+++ team/russell/chan_refcount/apps/app_disa.c Fri May 30 10:00:36 2008
@@ -195,8 +195,8 @@
}
if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP)) {
- if (f->seqno)
- chan->hangupcause = f->seqno;
+ if (f->data.uint32)
+ chan->hangupcause = f->data.uint32;
ast_frfree(f);
ast_clear_flag(chan, AST_FLAG_END_DTMF_ONLY);
return -1;
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=119293&r1=119292&r2=119293
==============================================================================
--- team/russell/chan_refcount/apps/app_externalivr.c (original)
+++ team/russell/chan_refcount/apps/app_externalivr.c Fri May 30 10:00:36 2008
@@ -50,19 +50,37 @@
static const char *app = "ExternalIVR";
static const char *synopsis = "Interfaces with an external IVR application";
-
static const char *descrip =
-" ExternalIVR(command|ivr://ivrhost[,arg[,arg...]]): Either forks a process\n"
+" ExternalIVR(command|ivr://ivrhosti([,arg[,arg...]])[,options]): Either forks a process\n"
"to run given command or makes a socket to connect to given host and starts\n"
"a generator on the channel. The generator's play list is controlled by the\n"
"external application, which can add and clear entries via simple commands\n"
"issued over its stdout. The external application will receive all DTMF events\n"
"received on the channel, and notification if the channel is hung up. The\n"
"application will not be forcibly terminated when the channel is hung up.\n"
-"See doc/externalivr.txt for a protocol specification.\n";
+"See doc/externalivr.txt for a protocol specification.\n"
+"The 'n' option tells ExternalIVR() not to answer the channel. \n"
+"The 'i' option tells ExternalIVR() not to send a hangup and exit when the\n"
+" channel receives a hangup, instead it sends an 'I' informative message\n"
+" meaning that the external application MUST hang up the call with an H command\n"
+"The 'd' option tells ExternalIVR() to run on a channel that has been hung up\n"
+" and will not look for hangups. The external application must exit with\n"
+" an 'E' command.\n";
/* XXX the parser in gcc 2.95 gets confused if you don't put a space between 'name' and the comma */
#define ast_chan_log(level, channel, format, ...) ast_log(level, "%s: " format, channel->name , ## __VA_ARGS__)
+
+enum {
+ noanswer = (1 << 0),
+ ignore_hangup = (1 << 1),
+ run_dead = (1 << 2),
+} options_flags;
+
+AST_APP_OPTIONS(app_opts, {
+ AST_APP_OPTION('n', noanswer),
+ AST_APP_OPTION('i', ignore_hangup),
+ AST_APP_OPTION('d', run_dead),
+});
struct playlist_entry {
AST_LIST_ENTRY(playlist_entry) list;
@@ -76,6 +94,7 @@
int abort_current_sound;
int playing_silence;
int option_autoclear;
+ int gen_active;
};
@@ -88,24 +107,22 @@
static int eivr_comm(struct ast_channel *chan, struct ivr_localuser *u,
int eivr_events_fd, int eivr_commands_fd, int eivr_errors_fd,
- const char *args);
+ const struct ast_str *args, const struct ast_flags flags);
int eivr_connect_socket(struct ast_channel *chan, const char *host, int port);
static void send_eivr_event(FILE *handle, const char event, const char *data,
const struct ast_channel *chan)
{
- char tmp[256];
-
- if (!data) {
- snprintf(tmp, sizeof(tmp), "%c,%10d", event, (int)time(NULL));
- } else {
- snprintf(tmp, sizeof(tmp), "%c,%10d,%s", event, (int)time(NULL), data);
- }
-
- fprintf(handle, "%s\n", tmp);
- if (option_debug)
- ast_chan_log(LOG_DEBUG, chan, "sent '%s'\n", tmp);
+ struct ast_str *tmp = ast_str_create(12);
+
+ ast_str_append(&tmp, 0, "%c,%10d", event, (int)time(NULL));
+ if (data) {
+ ast_str_append(&tmp, 0, "%s", data);
+ }
+
+ fprintf(handle, "%s\n", tmp->str);
+ ast_debug(1, "sent '%s'\n", tmp->str);
}
static void *gen_alloc(struct ast_channel *chan, void *params)
@@ -245,7 +262,7 @@
variable = strsep(&inbuf, ",");
if (variable == NULL) {
int outstrlen = strlen(outbuf);
- if(outstrlen && outbuf[outstrlen - 1] == ',') {
+ if (outstrlen && outbuf[outstrlen - 1] == ',') {
outbuf[outstrlen - 1] = 0;
}
break;
@@ -260,7 +277,7 @@
ast_channel_unlock(chan);
ast_copy_string(outbuf, newstring->str, outbuflen);
}
-};
+}
static void ast_eivr_setvariable(struct ast_channel *chan, char *data)
{
@@ -273,21 +290,22 @@
for (j = 1, inbuf = data; ; j++, inbuf = NULL) {
variable = strsep(&inbuf, ",");
- ast_chan_log(LOG_DEBUG, chan, "Setting up a variable: %s\n", variable);
- if(variable) {
+ ast_debug(1, "Setting up a variable: %s\n", variable);
+ if (variable) {
/* variable contains "varname=value" */
ast_copy_string(buf, variable, sizeof(buf));
value = strchr(buf, '=');
- if(!value)
- value="";
- else
+ if (!value) {
+ value = "";
+ } else {
*value++ = '\0';
+ }
pbx_builtin_setvar_helper(chan, buf, value);
- }
- else
+ } else {
break;
- }
-};
+ }
+ }
+}
static struct playlist_entry *make_entry(const char *filename)
{
@@ -303,14 +321,14 @@
static int app_exec(struct ast_channel *chan, void *data)
{
+ struct ast_flags flags;
+ char *opts[0];
struct playlist_entry *entry;
- int child_stdin[2] = { 0,0 };
- int child_stdout[2] = { 0,0 };
- int child_stderr[2] = { 0,0 };
+ int child_stdin[2] = { 0, 0 };
+ int child_stdout[2] = { 0, 0 };
+ int child_stderr[2] = { 0, 0 };
int res = -1;
- int gen_active = 0;
int pid;
- char *buf, *pipe_delim_argbuf, *pdargbuf_ptr;
char hostname[1024];
char *port_str = NULL;
@@ -320,29 +338,87 @@
struct ivr_localuser foo = {
.playlist = AST_LIST_HEAD_INIT_VALUE,
.finishlist = AST_LIST_HEAD_INIT_VALUE,
+ .gen_active = 0,
};
struct ivr_localuser *u = &foo;
- AST_DECLARE_APP_ARGS(args,
+
+ char *buf;
+ int j;
+ char *s, **app_args, *e;
+ struct ast_str *pipe_delim_args = ast_str_create(100);
+
+ AST_DECLARE_APP_ARGS(eivr_args,
AST_APP_ARG(cmd)[32];
);
+ AST_DECLARE_APP_ARGS(application_args,
+ AST_APP_ARG(cmd)[32];
+ );
u->abort_current_sound = 0;
u->chan = chan;
+ buf = ast_strdupa(data);
+ AST_STANDARD_APP_ARGS(eivr_args, buf);
+
+ if ((s = strchr(eivr_args.cmd[0], '('))) {
+ s[0] = ',';
+ if (( e = strrchr(s, ')')) ) {
+ *e = '\0';
+ } else {
+ ast_log(LOG_ERROR, "Parse error, no closing paren?\n");
+ }
+ AST_STANDARD_APP_ARGS(application_args, eivr_args.cmd[0]);
+ app_args = application_args.argv;
+
+ /* Put the application + the arguments in a | delimited list */
+ ast_str_reset(pipe_delim_args);
+ for (j = 0; application_args.cmd[j] != NULL; j++) {
+ ast_str_append(&pipe_delim_args, 0, "%s%s", j == 0 ? "" : "|", application_args.cmd[j]);
+ }
+
+ /* Parse the ExternalIVR() arguments */
+ if (option_debug)
+ ast_debug(1, "Parsing options from: [%s]\n", eivr_args.cmd[1]);
+ ast_app_parse_options(app_opts, &flags, opts, eivr_args.cmd[1]);
+ if (option_debug) {
+ if (ast_test_flag(&flags, noanswer))
+ ast_debug(1, "noanswer is set\n");
+ if (ast_test_flag(&flags, ignore_hangup))
+ ast_debug(1, "ignore_hangup is set\n");
+ if (ast_test_flag(&flags, run_dead))
+ ast_debug(1, "run_dead is set\n");
+ }
+
+ } else {
+ app_args = eivr_args.argv;
+ for (j = 0; eivr_args.cmd[j] != NULL; j++) {
+ ast_str_append(&pipe_delim_args, 0, "%s%s", j == 0 ? "" : "|", eivr_args.cmd[j]);
+ }
+ }
+
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "ExternalIVR requires a command to execute\n");
return -1;
}
- buf = ast_strdupa(data);
- AST_STANDARD_APP_ARGS(args, buf);
-
- /* copy args and replace commas with pipes */
- pipe_delim_argbuf = ast_strdupa(data);
[... 41368 lines stripped ...]
More information about the asterisk-commits
mailing list