[asterisk-commits] oej: branch oej/realtimetext-t140 r54822 - in
/team/oej/realtimetext-t140: ./...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Fri Feb 16 05:44:57 MST 2007
Author: oej
Date: Fri Feb 16 06:44:56 2007
New Revision: 54822
URL: http://svn.digium.com/view/asterisk?view=rev&rev=54822
Log:
Reset automerge
Added:
team/oej/realtimetext-t140/funcs/func_devstate.c
- copied unchanged from r54806, trunk/funcs/func_devstate.c
Modified:
team/oej/realtimetext-t140/ (props changed)
team/oej/realtimetext-t140/CHANGES
team/oej/realtimetext-t140/apps/app_chanspy.c
team/oej/realtimetext-t140/apps/app_dial.c
team/oej/realtimetext-t140/apps/app_exec.c
team/oej/realtimetext-t140/apps/app_flash.c
team/oej/realtimetext-t140/apps/app_image.c
team/oej/realtimetext-t140/apps/app_meetme.c
team/oej/realtimetext-t140/apps/app_milliwatt.c
team/oej/realtimetext-t140/apps/app_queue.c
team/oej/realtimetext-t140/apps/app_speech_utils.c
team/oej/realtimetext-t140/apps/app_voicemail.c
team/oej/realtimetext-t140/channels/chan_sip.c
team/oej/realtimetext-t140/channels/chan_zap.c
team/oej/realtimetext-t140/codecs/codec_g722.c
team/oej/realtimetext-t140/configs/extconfig.conf.sample
team/oej/realtimetext-t140/configs/sip.conf.sample
team/oej/realtimetext-t140/doc/realtime.txt
team/oej/realtimetext-t140/include/asterisk/cdr.h
team/oej/realtimetext-t140/include/asterisk/cli.h
team/oej/realtimetext-t140/include/asterisk/config.h
team/oej/realtimetext-t140/include/asterisk/devicestate.h
team/oej/realtimetext-t140/include/asterisk/dial.h
team/oej/realtimetext-t140/include/asterisk/manager.h
team/oej/realtimetext-t140/main/acl.c
team/oej/realtimetext-t140/main/asterisk.c
team/oej/realtimetext-t140/main/cdr.c
team/oej/realtimetext-t140/main/channel.c
team/oej/realtimetext-t140/main/cli.c
team/oej/realtimetext-t140/main/config.c
team/oej/realtimetext-t140/main/devicestate.c
team/oej/realtimetext-t140/main/dial.c
team/oej/realtimetext-t140/main/io.c
team/oej/realtimetext-t140/main/manager.c
team/oej/realtimetext-t140/res/res_agi.c
team/oej/realtimetext-t140/res/res_features.c
Propchange: team/oej/realtimetext-t140/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Propchange: team/oej/realtimetext-t140/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Feb 16 06:44:56 2007
@@ -1,1 +1,1 @@
-/trunk:1-54070
+/trunk:1-54821
Modified: team/oej/realtimetext-t140/CHANGES
URL: http://svn.digium.com/view/asterisk/team/oej/realtimetext-t140/CHANGES?view=diff&rev=54822&r1=54821&r2=54822
==============================================================================
--- team/oej/realtimetext-t140/CHANGES (original)
+++ team/oej/realtimetext-t140/CHANGES Fri Feb 16 06:44:56 2007
@@ -4,10 +4,7 @@
the DUNDi switch in the dialplan.
* Added the ability to customize which sound files are used for some of the
prompts within the Voicemail application by changing them in voicemail.conf
- * enable https support for builtin web server.
- See configs/http.conf.sample for details.
* Argument support for Gosub application
- * MailboxExists converted to dialplan function
* Ability to set process limits without restarting Asterisk
* SS7 support in chan_zap (via libss7 library)
* Proper codec support in chan_skinny.
@@ -27,8 +24,6 @@
statistics during a reload.
* Added rotatetimestamp option to logger.conf which will use
the time to name the logger files instead of sequence number.
- * The output of CallerID in Manager events is now more consistent.
- CallerIDNum is used for number and CallerIDName for name.
* setinterfacevar option in queues.conf also now sets a variable
called MEMBERNAME which contains the member's name.
* Added Masquerade manager event for when a masquerade happens between
@@ -43,9 +38,6 @@
Read() - timeout now can be floating pt.
WaitForRing() now takes floating pt timeout arg.
SpeechBackground() -- clarified in the docstrings that the timeout is an integer seconds.
- * Extend CALLERID() function with "pres" and "ton" parameters to
- fetch string representation of calling number presentation indicator
- and numeric representation of type of calling number value.
* Added 'C' option to Meetme which causes a caller to continue in the dialplan
when kicked out.
* Added option to run macro when a queue member is connected to a caller,
@@ -59,7 +51,6 @@
* Added maxfiles option to options section of asterisk.conf which allows you to specify
what Asterisk should set as the maximum number of open files when it loads.
* Added the jittertargetextra configuration option.
- * Added the URI redirect option for the built-in HTTP server
* Added the trunkmaxsize configuration option to chan_iax2.
* Added G729 passthrough support to chan_phone for Sigma Designs boards.
* Added the parkedcalltransfers option to features.conf
@@ -67,6 +58,29 @@
* Added the srvlookup option to iax.conf
* Added 'E' and 'V' commands to ExternalIVR.
* Added 'DBDel' and 'DBDelTree' manager commands.
+ * Added 'o' and 'X' options to Chanspy.
+
+AMI - The manager (TCP/TLS/HTTP)
+--------------------------------
+ * Added the URI redirect option for the built-in HTTP server
+ * The output of CallerID in Manager events is now more consistent.
+ CallerIDNum is used for number and CallerIDName for name.
+ * enable https support for builtin web server.
+ See configs/http.conf.sample for details.
+
+Dialplan functions
+------------------
+ * Added the DEVSTATE() dialplan function which allows retrieving any device
+ state in the dialplan, as well as creating custom device states that are
+ controllable from the dialplan.
+ * Extend CALLERID() function with "pres" and "ton" parameters to
+ fetch string representation of calling number presentation indicator
+ and numeric representation of type of calling number value.
+ * MailboxExists converted to dialplan function
+
+CLI Changes
+-----------
+ * New CLI command "core show settings"
* Added 'core show channels count' CLI command.
SIP changes
@@ -80,4 +94,11 @@
since they where replaced by "mohsuggest" and "mohinterpret" in version 1.4
* The "localmask" setting was removed in version 1.2 and the reminder about it
being removed is now also removed.
+ * A new option "busy-level" for setting a level of calls where asterisk reports
+ a device as busy, to separate it from call-limit
+ * A new realtime family called "sipregs" is now supported to store SIP registration
+ data. If this family is defined, "sippeers" will be used for configuration and
+ "sipregs" for registrations. If it's not defined, "sippeers" will be used for
+ registration data, as before.
+ * The SIPPEER function have new options for port address, call and pickup groups
* Added support for T.140 realtime text in SIP/RTP
Modified: team/oej/realtimetext-t140/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/oej/realtimetext-t140/apps/app_chanspy.c?view=diff&rev=54822&r1=54821&r2=54822
==============================================================================
--- team/oej/realtimetext-t140/apps/app_chanspy.c (original)
+++ team/oej/realtimetext-t140/apps/app_chanspy.c Fri Feb 16 06:44:56 2007
@@ -67,6 +67,10 @@
" 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"
+" 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"
+" 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"
@@ -83,6 +87,12 @@
" 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"
;
static const char *app_ext = "ExtenSpy";
@@ -95,6 +105,9 @@
" While spying, the following actions may be performed:\n"
" - Dialing # cycles the volume level.\n"
" - Dialing * will stop spying and look for another channel to spy on.\n"
+" Note: The X option superseeds the two features above in that if a valid\n"
+" 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"
@@ -111,6 +124,12 @@
" 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 {
@@ -121,6 +140,8 @@
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 */
} chanspy_opt_flags;
enum {
@@ -138,6 +159,8 @@
AST_APP_OPTION_ARG('v', OPTION_VOLUME, OPT_ARG_VOLUME),
AST_APP_OPTION_ARG('g', OPTION_GROUP, OPT_ARG_GROUP),
AST_APP_OPTION_ARG('r', OPTION_RECORD, OPT_ARG_RECORD),
+ AST_APP_OPTION('o', OPTION_READONLY),
+ AST_APP_OPTION('X', OPTION_EXIT),
});
@@ -241,7 +264,7 @@
}
static int channel_spy(struct ast_channel *chan, struct ast_channel *spyee, int *volfactor, int fd,
- const struct ast_flags *flags)
+ const struct ast_flags *flags, char *exitcontext)
{
struct chanspy_translation_helper csth;
int running = 0, res, x = 0;
@@ -260,7 +283,8 @@
memset(&csth, 0, sizeof(csth));
ast_set_flag(&csth.spy, CHANSPY_FORMAT_AUDIO);
ast_set_flag(&csth.spy, CHANSPY_TRIGGER_NONE);
- ast_set_flag(&csth.spy, CHANSPY_MIXAUDIO);
+ if (!ast_test_flag(flags, OPTION_READONLY))
+ ast_set_flag(&csth.spy, CHANSPY_MIXAUDIO);
csth.spy.type = "ChanSpy";
csth.spy.status = CHANSPY_RUNNING;
csth.spy.read_queue.format = AST_FORMAT_SLINEAR;
@@ -347,6 +371,22 @@
if (res < 0) {
running = -1;
break;
+ }
+
+ if (ast_test_flag(flags, OPTION_EXIT)) {
+ char tmp[2];
+ tmp[0] = res;
+ tmp[1] = '\0';
+ if (!ast_goto_if_exists(chan, exitcontext, tmp, 1)) {
+ ast_log(LOG_DEBUG, "Got DTMF %c, goto context %s\n", tmp[0], exitcontext);
+ pbx_builtin_setvar_helper(chan, "SPY_CHANNEL", name);
+ running = -2;
+ break;
+ } else if (option_debug > 1) {
+ ast_log(LOG_DEBUG, "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 (res == '*') {
@@ -374,8 +414,6 @@
ast_clear_flag(&csth.spy, CHANSPY_READ_VOLADJUST);
ast_clear_flag(&csth.spy, CHANSPY_WRITE_VOLADJUST);
}
- } else if (res >= '0' && res <= '9') {
- inp[x++] = res;
}
}
@@ -431,11 +469,22 @@
struct ast_channel *peer, *prev, *next;
char nameprefix[AST_NAME_STRLEN];
char peer_name[AST_NAME_STRLEN + 5];
+ char exitcontext[AST_MAX_CONTEXT] = "";
signed char zero_volume = 0;
int waitms;
int res;
char *ptr;
int num;
+
+ if (ast_test_flag(flags, OPTION_EXIT)) {
+ const char *c;
+ if ((c = pbx_builtin_getvar_helper(chan, "SPY_EXIT_CONTEXT")))
+ ast_copy_string(exitcontext, c, sizeof(exitcontext));
+ else if (!ast_strlen_zero(chan->macrocontext))
+ ast_copy_string(exitcontext, chan->macrocontext, sizeof(exitcontext));
+ else
+ ast_copy_string(exitcontext, chan->context, sizeof(exitcontext));
+ }
if (chan->_state != AST_STATE_UP)
ast_answer(chan);
@@ -453,12 +502,30 @@
ast_clear_flag(chan, AST_FLAG_SPYING);
break;
}
+ if (!ast_strlen_zero(exitcontext)) {
+ char tmp[2];
+ tmp[0] = res;
+ tmp[1] = '\0';
+ if (!ast_goto_if_exists(chan, exitcontext, tmp, 1))
+ goto exit;
+ else if (option_debug > 1)
+ ast_log(LOG_DEBUG, "Exit by single digit did not work in chanspy. Extension %s does not exist in context %s\n", tmp, exitcontext);
+ }
}
res = ast_waitfordigit(chan, waitms);
if (res < 0) {
ast_clear_flag(chan, AST_FLAG_SPYING);
break;
+ }
+ if (!ast_strlen_zero(exitcontext)) {
+ char tmp[2];
+ tmp[0] = res;
+ tmp[1] = '\0';
+ if (!ast_goto_if_exists(chan, exitcontext, tmp, 1))
+ goto exit;
+ else if (option_debug > 1)
+ ast_log(LOG_DEBUG, "Exit by single digit did not work in chanspy. Extension %s does not exist in context %s\n", tmp, exitcontext);
}
/* reset for the next loop around, unless overridden later */
@@ -528,10 +595,13 @@
}
waitms = 5000;
- res = channel_spy(chan, peer, &volfactor, fd, flags);
+ res = channel_spy(chan, peer, &volfactor, fd, flags, exitcontext);
if (res == -1) {
- break;
+ goto exit;
+ } else if (res == -2) {
+ res = 0;
+ goto exit;
} else if (res > 1 && spec) {
snprintf(nameprefix, AST_NAME_STRLEN, "%s/%d", spec, res);
if ((next = ast_get_channel_by_name_prefix_locked(nameprefix, strlen(nameprefix)))) {
@@ -543,10 +613,9 @@
peer = NULL;
}
}
- if (res == -1)
- break;
- }
-
+ }
+exit:
+
ast_clear_flag(chan, AST_FLAG_SPYING);
ast_channel_setoption(chan, AST_OPTION_TXGAIN, &zero_volume, sizeof(zero_volume), 0);
Modified: team/oej/realtimetext-t140/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/oej/realtimetext-t140/apps/app_dial.c?view=diff&rev=54822&r1=54821&r2=54822
==============================================================================
--- team/oej/realtimetext-t140/apps/app_dial.c (original)
+++ team/oej/realtimetext-t140/apps/app_dial.c Fri Feb 16 06:44:56 2007
@@ -782,9 +782,9 @@
ast_log(LOG_WARNING, "Unable to send URL\n");
- if (single && ((f->frametype == AST_FRAME_VOICE) || (f->frametype == AST_FRAME_DTMF))) {
+ if (single && ((f->frametype == AST_FRAME_VOICE) || (f->frametype == AST_FRAME_DTMF_BEGIN) || (f->frametype == AST_FRAME_DTMF_END))) {
if (ast_write(outgoing->chan, f))
- ast_log(LOG_WARNING, "Unable to forward voice\n");
+ ast_log(LOG_WARNING, "Unable to forward voice or dtmf\n");
}
if (single && (f->frametype == AST_FRAME_CONTROL) &&
((f->subclass == AST_CONTROL_HOLD) ||
@@ -1167,7 +1167,7 @@
return 1; /* success */
}
-static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags *peerflags)
+static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags *peerflags, int *continue_exec)
{
int res = -1; /* default: error */
struct ast_module_user *u;
@@ -1267,6 +1267,9 @@
goto out;
res = -1; /* reset default */
}
+
+ if (continue_exec)
+ *continue_exec = 0;
/* If a channel group has been specified, get it for use when we create peer channels */
outbound_group = pbx_builtin_getvar_helper(chan, "OUTBOUND_GROUP");
@@ -1533,7 +1536,9 @@
peer->priority++;
ast_pbx_start(peer);
hanguptree(outgoing, NULL);
- res = 1;
+ if (continue_exec)
+ *continue_exec = 1;
+ res = 0;
goto done;
}
@@ -1708,12 +1713,10 @@
static int dial_exec(struct ast_channel *chan, void *data)
{
struct ast_flags peerflags;
- int res = 0;
memset(&peerflags, 0, sizeof(peerflags));
- res = dial_exec_full(chan, data, &peerflags);
-
- return (res >= 0 ? 0 : -1);
+
+ return dial_exec_full(chan, data, &peerflags, NULL);
}
static int retrydial_exec(struct ast_channel *chan, void *data)
@@ -1769,14 +1772,16 @@
res = 0;
while (loops) {
+ int continue_exec;
+
chan->data = "Retrying";
if (ast_test_flag(chan, AST_FLAG_MOH))
ast_moh_stop(chan);
- res = dial_exec_full(chan, dialdata, &peerflags);
- if (res == 1) {
+ res = dial_exec_full(chan, dialdata, &peerflags, &continue_exec);
+ if (continue_exec)
break;
- } else if (res == 0) {
+ if (res == 0) {
if (ast_test_flag(&peerflags, OPT_DTMF_EXIT)) {
if (!(res = ast_streamfile(chan, announce, chan->language)))
res = ast_waitstream(chan, AST_DIGIT_ANY);
@@ -1814,7 +1819,6 @@
if (ast_test_flag(chan, AST_FLAG_MOH))
ast_moh_stop(chan);
-
done:
ast_module_user_remove(u);
return res;
Modified: team/oej/realtimetext-t140/apps/app_exec.c
URL: http://svn.digium.com/view/asterisk/team/oej/realtimetext-t140/apps/app_exec.c?view=diff&rev=54822&r1=54821&r2=54822
==============================================================================
--- team/oej/realtimetext-t140/apps/app_exec.c (original)
+++ team/oej/realtimetext-t140/apps/app_exec.c Fri Feb 16 06:44:56 2007
@@ -95,30 +95,31 @@
char *s, *appname, *endargs, args[MAXRESULT] = "";
struct ast_app *app;
+ if (ast_strlen_zero(data))
+ return 0;
+
u = ast_module_user_add(chan);
-
- /* Check and parse arguments */
- if (data) {
- s = ast_strdupa(data);
- appname = strsep(&s, "(");
- if (s) {
- endargs = strrchr(s, ')');
- if (endargs)
- *endargs = '\0';
- pbx_substitute_variables_helper(chan, s, args, MAXRESULT - 1);
+
+ s = ast_strdupa(data);
+ appname = strsep(&s, "(");
+ if (s) {
+ endargs = strrchr(s, ')');
+ if (endargs)
+ *endargs = '\0';
+ pbx_substitute_variables_helper(chan, s, args, MAXRESULT - 1);
+ }
+ if (appname) {
+ app = pbx_findapp(appname);
+ if (app) {
+ res = pbx_exec(chan, app, args);
+ } else {
+ ast_log(LOG_WARNING, "Could not find application (%s)\n", appname);
+ res = -1;
}
- if (appname) {
- app = pbx_findapp(appname);
- if (app) {
- res = pbx_exec(chan, app, args);
- } else {
- ast_log(LOG_WARNING, "Could not find application (%s)\n", appname);
- res = -1;
- }
- }
}
ast_module_user_remove(u);
+
return res;
}
@@ -129,31 +130,32 @@
char *s, *appname, *endargs, args[MAXRESULT] = "";
struct ast_app *app;
+ if (ast_strlen_zero(data))
+ return 0;
+
u = ast_module_user_add(chan);
- /* Check and parse arguments */
- if (data) {
- s = ast_strdupa(data);
- appname = strsep(&s, "(");
- if (s) {
- endargs = strrchr(s, ')');
- if (endargs)
- *endargs = '\0';
- pbx_substitute_variables_helper(chan, s, args, MAXRESULT - 1);
+ s = ast_strdupa(data);
+ appname = strsep(&s, "(");
+ if (s) {
+ endargs = strrchr(s, ')');
+ if (endargs)
+ *endargs = '\0';
+ pbx_substitute_variables_helper(chan, s, args, MAXRESULT - 1);
+ }
+ if (appname) {
+ app = pbx_findapp(appname);
+ if (app) {
+ res = pbx_exec(chan, app, args);
+ pbx_builtin_setvar_helper(chan, "TRYSTATUS", res ? "FAILED" : "SUCCESS");
+ } else {
+ ast_log(LOG_WARNING, "Could not find application (%s)\n", appname);
+ pbx_builtin_setvar_helper(chan, "TRYSTATUS", "NOAPP");
}
- if (appname) {
- app = pbx_findapp(appname);
- if (app) {
- res = pbx_exec(chan, app, args);
- pbx_builtin_setvar_helper(chan, "TRYSTATUS", res ? "FAILED" : "SUCCESS");
- } else {
- ast_log(LOG_WARNING, "Could not find application (%s)\n", appname);
- pbx_builtin_setvar_helper(chan, "TRYSTATUS", "NOAPP");
- }
- }
}
ast_module_user_remove(u);
+
return 0;
}
Modified: team/oej/realtimetext-t140/apps/app_flash.c
URL: http://svn.digium.com/view/asterisk/team/oej/realtimetext-t140/apps/app_flash.c?view=diff&rev=54822&r1=54821&r2=54822
==============================================================================
--- team/oej/realtimetext-t140/apps/app_flash.c (original)
+++ team/oej/realtimetext-t140/apps/app_flash.c Fri Feb 16 06:44:56 2007
@@ -75,31 +75,37 @@
int x;
struct ast_module_user *u;
struct zt_params ztp;
+
+ if (strcasecmp(chan->tech->type, "Zap")) {
+ ast_log(LOG_WARNING, "%s is not a Zap channel\n", chan->name);
+ return -1;
+ }
+
u = ast_module_user_add(chan);
- if (!strcasecmp(chan->tech->type, "Zap")) {
- memset(&ztp, 0, sizeof(ztp));
- res = ioctl(chan->fds[0], ZT_GET_PARAMS, &ztp);
- if (!res) {
- if (ztp.sigtype & __ZT_SIG_FXS) {
- x = ZT_FLASH;
- res = ioctl(chan->fds[0], ZT_HOOK, &x);
- if (!res || (errno == EINPROGRESS)) {
- if (res) {
- /* Wait for the event to finish */
- zt_wait_event(chan->fds[0]);
- }
- res = ast_safe_sleep(chan, 1000);
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "Flashed channel %s\n", chan->name);
- } else
- ast_log(LOG_WARNING, "Unable to flash channel %s: %s\n", chan->name, strerror(errno));
+
+ memset(&ztp, 0, sizeof(ztp));
+ res = ioctl(chan->fds[0], ZT_GET_PARAMS, &ztp);
+ if (!res) {
+ if (ztp.sigtype & __ZT_SIG_FXS) {
+ x = ZT_FLASH;
+ res = ioctl(chan->fds[0], ZT_HOOK, &x);
+ if (!res || (errno == EINPROGRESS)) {
+ if (res) {
+ /* Wait for the event to finish */
+ zt_wait_event(chan->fds[0]);
+ }
+ res = ast_safe_sleep(chan, 1000);
+ if (option_verbose > 2)
+ ast_verbose(VERBOSE_PREFIX_3 "Flashed channel %s\n", chan->name);
} else
- ast_log(LOG_WARNING, "%s is not an FXO Channel\n", chan->name);
+ ast_log(LOG_WARNING, "Unable to flash channel %s: %s\n", chan->name, strerror(errno));
} else
- ast_log(LOG_WARNING, "Unable to get parameters of %s: %s\n", chan->name, strerror(errno));
+ ast_log(LOG_WARNING, "%s is not an FXO Channel\n", chan->name);
} else
- ast_log(LOG_WARNING, "%s is not a Zap channel\n", chan->name);
+ ast_log(LOG_WARNING, "Unable to get parameters of %s: %s\n", chan->name, strerror(errno));
+
ast_module_user_remove(u);
+
return res;
}
Modified: team/oej/realtimetext-t140/apps/app_image.c
URL: http://svn.digium.com/view/asterisk/team/oej/realtimetext-t140/apps/app_image.c?view=diff&rev=54822&r1=54821&r2=54822
==============================================================================
--- team/oej/realtimetext-t140/apps/app_image.c (original)
+++ team/oej/realtimetext-t140/apps/app_image.c Fri Feb 16 06:44:56 2007
@@ -96,9 +96,7 @@
return 0;
}
- res = ast_send_image(chan, args.filename);
-
- if (!res)
+ if (!(res = ast_send_image(chan, args.filename)))
pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "OK");
ast_module_user_remove(u);
Modified: team/oej/realtimetext-t140/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/oej/realtimetext-t140/apps/app_meetme.c?view=diff&rev=54822&r1=54821&r2=54822
==============================================================================
--- team/oej/realtimetext-t140/apps/app_meetme.c (original)
+++ team/oej/realtimetext-t140/apps/app_meetme.c Fri Feb 16 06:44:56 2007
@@ -2867,7 +2867,7 @@
}
/*! \brief Callback for devicestate providers */
-static int meetmestate(const char *data)
+static enum ast_device_state meetmestate(const char *data)
{
struct ast_conference *conf;
@@ -3540,12 +3540,12 @@
return 0;
}
-static int sla_state(const char *data)
+static enum ast_device_state sla_state(const char *data)
{
char *buf, *station_name, *trunk_name;
struct sla_station *station;
struct sla_trunk_ref *trunk_ref;
- int res = AST_DEVICE_INVALID;
+ enum ast_device_state res = AST_DEVICE_INVALID;
trunk_name = buf = ast_strdupa(data);
station_name = strsep(&trunk_name, "_");
Modified: team/oej/realtimetext-t140/apps/app_milliwatt.c
URL: http://svn.digium.com/view/asterisk/team/oej/realtimetext-t140/apps/app_milliwatt.c?view=diff&rev=54822&r1=54821&r2=54822
==============================================================================
--- team/oej/realtimetext-t140/apps/app_milliwatt.c (original)
+++ team/oej/realtimetext-t140/apps/app_milliwatt.c Fri Feb 16 06:44:56 2007
@@ -50,7 +50,6 @@
static char *descrip =
"Milliwatt(): Generate a Constant 1000Hz tone at 0dbm (mu-law)\n";
-
static char digital_milliwatt[] = {0x1e,0x0b,0x0b,0x1e,0x9e,0x8b,0x8b,0x9e} ;
static void *milliwatt_alloc(struct ast_channel *chan, void *params)
@@ -82,7 +81,6 @@
* a multiple of samples, given by number of samples times bytes per
* sample. In the case of ulaw, len = samples. for signed linear
* len = 2 * samples */
-
if (samples > maxsamples) {
ast_log(LOG_WARNING, "Only doing %d samples (%d requested)\n", maxsamples, samples);
samples = maxsamples;
@@ -90,17 +88,18 @@
len = samples * sizeof (buf[0]);
wf.datalen = len;
wf.samples = samples;
+
/* create a buffer containing the digital milliwatt pattern */
- for(i = 0; i < len; i++)
- {
+ for (i = 0; i < len; i++) {
buf[AST_FRIENDLY_OFFSET + i] = digital_milliwatt[(*indexp)++];
*indexp &= 7;
}
- if (ast_write(chan,&wf) < 0)
- {
+
+ if (ast_write(chan,&wf) < 0) {
ast_log(LOG_WARNING,"Failed to write frame to '%s': %s\n",chan->name,strerror(errno));
return -1;
}
+
return 0;
}
@@ -109,28 +108,33 @@
alloc: milliwatt_alloc,
release: milliwatt_release,
generate: milliwatt_generate,
-} ;
+};
static int milliwatt_exec(struct ast_channel *chan, void *data)
{
struct ast_module_user *u;
u = ast_module_user_add(chan);
+
ast_set_write_format(chan, AST_FORMAT_ULAW);
ast_set_read_format(chan, AST_FORMAT_ULAW);
+
+
if (chan->_state != AST_STATE_UP)
- {
ast_answer(chan);
- }
- if (ast_activate_generator(chan,&milliwattgen,"milliwatt") < 0)
- {
+
+ if (ast_activate_generator(chan,&milliwattgen,"milliwatt") < 0) {
ast_log(LOG_WARNING,"Failed to activate generator on '%s'\n",chan->name);
ast_module_user_remove(u);
return -1;
}
+
while(!ast_safe_sleep(chan, 10000));
+
ast_deactivate_generator(chan);
+
ast_module_user_remove(u);
+
return -1;
}
Modified: team/oej/realtimetext-t140/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/oej/realtimetext-t140/apps/app_queue.c?view=diff&rev=54822&r1=54821&r2=54822
==============================================================================
--- team/oej/realtimetext-t140/apps/app_queue.c (original)
+++ team/oej/realtimetext-t140/apps/app_queue.c Fri Feb 16 06:44:56 2007
@@ -612,7 +612,7 @@
return NULL;
}
-static int statechange_queue(const char *dev, int state, void *ign)
+static int statechange_queue(const char *dev, enum ast_device_state state, void *ign)
{
/* Avoid potential for deadlocks by spawning a new thread to handle
the event */
Modified: team/oej/realtimetext-t140/apps/app_speech_utils.c
URL: http://svn.digium.com/view/asterisk/team/oej/realtimetext-t140/apps/app_speech_utils.c?view=diff&rev=54822&r1=54821&r2=54822
==============================================================================
--- team/oej/realtimetext-t140/apps/app_speech_utils.c (original)
+++ team/oej/realtimetext-t140/apps/app_speech_utils.c Fri Feb 16 06:44:56 2007
@@ -614,39 +614,43 @@
time(&start);
started = 1;
}
- /* Deal with audio frames if present */
- if (f != NULL && f->frametype == AST_FRAME_VOICE) {
+ /* Write audio frame out to speech engine if no DTMF has been received */
+ if (!strlen(dtmf) && f != NULL && f->frametype == AST_FRAME_VOICE) {
ast_speech_write(speech, f->data, f->datalen);
}
break;
case AST_SPEECH_STATE_WAIT:
/* Cue up waiting sound if not already playing */
- if (chan->stream == NULL) {
- if (speech->processing_sound != NULL) {
- if (strlen(speech->processing_sound) > 0 && strcasecmp(speech->processing_sound,"none")) {
- speech_streamfile(chan, speech->processing_sound, chan->language);
- }
- }
- } else if (chan->streamid == -1 && chan->timingfunc == NULL) {
- ast_stopstream(chan);
- if (speech->processing_sound != NULL) {
- if (strlen(speech->processing_sound) > 0 && strcasecmp(speech->processing_sound,"none")) {
- speech_streamfile(chan, speech->processing_sound, chan->language);
- }
- }
- }
+ if (!strlen(dtmf)) {
+ if (chan->stream == NULL) {
+ if (speech->processing_sound != NULL) {
+ if (strlen(speech->processing_sound) > 0 && strcasecmp(speech->processing_sound,"none")) {
+ speech_streamfile(chan, speech->processing_sound, chan->language);
+ }
+ }
+ } else if (chan->streamid == -1 && chan->timingfunc == NULL) {
+ ast_stopstream(chan);
+ if (speech->processing_sound != NULL) {
+ if (strlen(speech->processing_sound) > 0 && strcasecmp(speech->processing_sound,"none")) {
+ speech_streamfile(chan, speech->processing_sound, chan->language);
+ }
+ }
+ }
+ }
break;
case AST_SPEECH_STATE_DONE:
- /* Copy to speech structure the results, if available */
- speech->results = ast_speech_results_get(speech);
- /* Now that we are done... let's switch back to not ready state */
+ /* Now that we are done... let's switch back to not ready state */
ast_speech_change_state(speech, AST_SPEECH_STATE_NOT_READY);
- /* Break out of our background too */
- done = 1;
- /* Stop audio playback */
- if (chan->stream != NULL) {
- ast_stopstream(chan);
- }
+ if (!strlen(dtmf)) {
+ /* Copy to speech structure the results, if available */
+ speech->results = ast_speech_results_get(speech);
+ /* Break out of our background too */
+ done = 1;
+ /* Stop audio playback */
+ if (chan->stream != NULL) {
+ ast_stopstream(chan);
+ }
+ }
break;
default:
break;
@@ -688,7 +692,7 @@
}
}
- if (strlen(dtmf) > 0 && speech->results == NULL) {
+ if (strlen(dtmf)) {
/* We sort of make a results entry */
speech->results = ast_calloc(1, sizeof(*speech->results));
if (speech->results != NULL) {
Modified: team/oej/realtimetext-t140/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/realtimetext-t140/apps/app_voicemail.c?view=diff&rev=54822&r1=54821&r2=54822
==============================================================================
--- team/oej/realtimetext-t140/apps/app_voicemail.c (original)
+++ team/oej/realtimetext-t140/apps/app_voicemail.c Fri Feb 16 06:44:56 2007
@@ -24,8 +24,16 @@
*
* \par See also
* \arg \ref Config_vm
+ * \note For information about voicemail IMAP storage, read doc/imapstorage.txt
* \ingroup applications
- * \note This module requires res_adsi to load.
+ * \note This module requires res_adsi to load. This needs to be optional
+ * during compilation.
+ *
+ *
+ *
+ * \note This file is now almost impossible to work with, due to all #ifdefs.
+ * Feels like the database code before realtime. Someone - please come up
+ * with a plan to clean this up.
*/
/*** MODULEINFO
@@ -64,6 +72,7 @@
#include <sys/mman.h>
#include <time.h>
#include <dirent.h>
+
#ifdef IMAP_STORAGE
#include <ctype.h>
#include <signal.h>
@@ -72,6 +81,7 @@
#include "imap4r1.h"
#include "linkage.h"
#endif
+
#include "asterisk/lock.h"
#include "asterisk/file.h"
#include "asterisk/logger.h"
@@ -90,6 +100,7 @@
#include "asterisk/utils.h"
#include "asterisk/stringfields.h"
#include "asterisk/smdi.h"
+
#ifdef ODBC_STORAGE
#include "asterisk/res_odbc.h"
#endif
@@ -109,10 +120,10 @@
struct vm_state;
struct ast_vm_user;
-static int init_mailstream (struct vm_state *vms, int box);
-static void write_file (char *filename, char *buffer, unsigned long len);
-/*static void status (MAILSTREAM *stream); */ /* No need for this. */
-static void display_body (BODY *body, char *pfx, long i);
+/* Forward declarations for IMAP */
+static int init_mailstream(struct vm_state *vms, int box);
+static void write_file char *filename, char *buffer, unsigned long len);
+static void display_body(BODY *body, char *pfx, long i);
static char *get_header_by_tag(char *header, char *tag, char *buf, size_t len);
static void vm_imap_delete(int msgnum, struct vm_state *vms);
static char *get_user_by_mailbox(char *mailbox, char *buf, size_t len);
@@ -130,12 +141,16 @@
static void mm_parsequota (MAILSTREAM *stream, unsigned char *msg, QUOTALIST *pquota);
static void imap_mailbox_name(char *spec, struct vm_state *vms, int box, int target);
static int imap_store_file(char *dir, char *mailboxuser, char *mailboxcontext, int msgnum, struct ast_channel *chan, struct ast_vm_user *vmu, char *fmt, int duration, struct vm_state *vms);
-static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu,int box);
+
+
+
struct vmstate {
struct vm_state *vms;
AST_LIST_ENTRY(vmstate) list;
};
+
static AST_LIST_HEAD_STATIC(vmstates, vmstate);
+
#endif
#define SMDI_MWI_WAIT_TIMEOUT 1000 /* 1 second */
@@ -316,13 +331,14 @@
int maxmsg; /*!< Maximum number of msgs per folder for this mailbox */
int maxsecs; /*!< Maximum number of seconds per message for this mailbox */
#ifdef IMAP_STORAGE
- char imapuser[80]; /* IMAP server login */
- char imappassword[80]; /* IMAP server password if authpassword not defined */
+ char imapuser[80]; /*!< IMAP server login */
+ char imappassword[80]; /*!< IMAP server password if authpassword not defined */
#endif
- double volgain; /*!< Volume gain for voicemails sent via email */
+ double volgain; /*!< Volume gain for voicemails sent via email */
AST_LIST_ENTRY(ast_vm_user) list;
};
+/*! Voicemail time zones */
struct vm_zone {
AST_LIST_ENTRY(vm_zone) list;
char name[80];
@@ -330,6 +346,7 @@
char msg_format[512];
};
+/*! Voicemail mailbox state */
struct vm_state {
char curbox[80];
char username[80];
@@ -346,30 +363,18 @@
int starting;
int repeats;
#ifdef IMAP_STORAGE
- int updated; /* decremented on each mail check until 1 -allows delay */
+ int updated; /*!< decremented on each mail check until 1 -allows delay */
long msgArray[256];
MAILSTREAM *mailstream;
int vmArrayIndex;
- char imapuser[80]; /* IMAP server login */
+ char imapuser[80]; /*!< IMAP server login */
int interactive;
unsigned int quota_limit;
unsigned int quota_usage;
struct vm_state *persist_vms;
#endif
};
-static int advanced_options(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm_state *vms, int msg, int option, signed char record_gain);
-static int dialout(struct ast_channel *chan, struct ast_vm_user *vmu, char *num, char *outgoing_context);
-static int play_record_review(struct ast_channel *chan, char *playfile, char *recordfile, int maxtime,
- char *fmt, int outsidecaller, struct ast_vm_user *vmu, int *duration, const char *unlockdir,
- signed char record_gain, struct vm_state *vms);
-static int vm_tempgreeting(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm_state *vms, char *fmtc, signed char record_gain);
-static int vm_play_folder_name(struct ast_channel *chan, char *mbox);
-static int notify_new_message(struct ast_channel *chan, struct ast_vm_user *vmu, int msgnum, long duration, char *fmt, char *cidnum, char *cidname);
-static void make_email_file(FILE *p, char *srcemail, struct ast_vm_user *vmu, int msgnum, char *context, char *mailbox, char *cidnum, char *cidname, char *attach, char *format, int duration, int attach_user_voicemail, struct ast_channel *chan, const char *category, int imap);
-#if !(defined(ODBC_STORAGE) || defined(IMAP_STORAGE))
-static int __has_voicemail(const char *context, const char *mailbox, const char *folder, int shortcircuit);
-#endif
-static void apply_options(struct ast_vm_user *vmu, const char *options);
+
#ifdef ODBC_STORAGE
static char odbc_database[80];
@@ -422,77 +427,74 @@
static char *addesc = "Comedian Mail";
-static char *synopsis_vm =
-"Leave a Voicemail message";
+static char *synopsis_vm = "Leave a Voicemail message";
static char *descrip_vm =
-" VoiceMail(mailbox[@context][&mailbox[@context]][...][|options]): This\n"
-"application allows the calling party to leave a message for the specified\n"
-"list of mailboxes. When multiple mailboxes are specified, the greeting will\n"
-"be taken from the first mailbox specified. Dialplan execution will stop if the\n"
-"specified mailbox does not exist.\n"
-" The Voicemail application will exit if any of the following DTMF digits are\n"
-"received:\n"
-" 0 - Jump to the 'o' extension in the current dialplan context.\n"
-" * - Jump to the 'a' extension in the current dialplan context.\n"
-" This application will set the following channel variable upon completion:\n"
-" VMSTATUS - This indicates the status of the execution of the VoiceMail\n"
-" application. The possible values are:\n"
-" SUCCESS | USEREXIT | FAILED\n\n"
-" Options:\n"
-" b - Play the 'busy' greeting to the calling party.\n"
-" g(#) - Use the specified amount of gain when recording the voicemail\n"
-" message. The units are whole-number decibels (dB).\n"
-" s - Skip the playback of instructions for leaving a message to the\n"
-" calling party.\n"
-" u - Play the 'unavailble greeting.\n"
-" j - Jump to priority n+101 if the mailbox is not found or some other\n"
-" error occurs.\n";
-
-static char *synopsis_vmain =
-"Check Voicemail messages";
+ " VoiceMail(mailbox[@context][&mailbox[@context]][...][|options]): This\n"
+ "application allows the calling party to leave a message for the specified\n"
+ "list of mailboxes. When multiple mailboxes are specified, the greeting will\n"
+ "be taken from the first mailbox specified. Dialplan execution will stop if the\n"
+ "specified mailbox does not exist.\n"
+ " The Voicemail application will exit if any of the following DTMF digits are\n"
+ "received:\n"
+ " 0 - Jump to the 'o' extension in the current dialplan context.\n"
+ " * - Jump to the 'a' extension in the current dialplan context.\n"
+ " This application will set the following channel variable upon completion:\n"
+ " VMSTATUS - This indicates the status of the execution of the VoiceMail\n"
+ " application. The possible values are:\n"
+ " SUCCESS | USEREXIT | FAILED\n\n"
+ " Options:\n"
+ " b - Play the 'busy' greeting to the calling party.\n"
+ " g(#) - Use the specified amount of gain when recording the voicemail\n"
[... 1998 lines stripped ...]
More information about the asterisk-commits
mailing list