[asterisk-commits] mvanbaak: branch mvanbaak/skinny-realtime r114878 - in /team/mvanbaak/skinny-...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Apr 30 07:24:50 CDT 2008
Author: mvanbaak
Date: Wed Apr 30 07:24:50 2008
New Revision: 114878
URL: http://svn.digium.com/view/asterisk?view=rev&rev=114878
Log:
Merged revisions 114813,114824,114830,114832,114834,114841,114845,114849,114852,114857,114866,114874,114876 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r114813 | mmichelson | 2008-04-29 00:38:07 +0200 (Tue, 29 Apr 2008) | 10 lines
Adding a new option 'n' to app_chanspy. This option allows for the name of the spied-on
party to be spoken instead of the channel name or number.
This was accomplished by adding a new function pointer to point to a function in app_voicemail
which retrieves the name file and plays it. This makes for an easy way that applications may play
a user's name should it be necessary. app_directory, in particular, can be simplified greatly by
this change.
This change comes as a suggestion from Switchvox, which already has this feature. AST-23
................
r114824 | kpfleming | 2008-04-29 14:54:31 +0200 (Tue, 29 Apr 2008) | 18 lines
Merged revisions 114823 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
................
r114823 | kpfleming | 2008-04-29 07:53:12 -0500 (Tue, 29 Apr 2008) | 10 lines
Merged revisions 114822 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r114822 | kpfleming | 2008-04-29 07:52:32 -0500 (Tue, 29 Apr 2008) | 2 lines
stop script from appending source code if run multiple times
........
................
................
r114830 | qwell | 2008-04-29 19:10:55 +0200 (Tue, 29 Apr 2008) | 9 lines
Merged revisions 114829 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r114829 | qwell | 2008-04-29 12:08:55 -0500 (Tue, 29 Apr 2008) | 1 line
Change warning message to debug, since there are cases where 0 results is perfectly fine.
........
................
r114832 | mmichelson | 2008-04-29 19:31:26 +0200 (Tue, 29 Apr 2008) | 3 lines
Fix a crash happening in app_directory. This crash would occur if a users.conf existed.
................
r114834 | mmichelson | 2008-04-29 19:56:13 +0200 (Tue, 29 Apr 2008) | 8 lines
Since there is now a globally available function for saying someone's name, a LOT of
functions in app_directory can be removed since the ODBC-specific lookups are accomplished
within app_voicemail. This change greatly reduces the amount of lines in app_directory that
were solely for the purpose of looking up a name when ODBC_STORAGE is specified for voicemail.
This commit also makes the name-saying interruptable via DTMF.
................
r114841 | mmichelson | 2008-04-29 20:48:26 +0200 (Tue, 29 Apr 2008) | 4 lines
Make app_directory dependent on app_voicemail. This is because the function
which says the person's name is handled inside app_voicemail now.
................
r114845 | kpfleming | 2008-04-29 20:58:48 +0200 (Tue, 29 Apr 2008) | 3 lines
fix this logic to actually be correct... the fd can't be *both* -1 and an array index to be checked in rfds/efds (bug found by gcc-4.3)
................
r114849 | mmichelson | 2008-04-29 21:42:04 +0200 (Tue, 29 Apr 2008) | 22 lines
Merged revisions 114848 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r114848 | mmichelson | 2008-04-29 14:40:06 -0500 (Tue, 29 Apr 2008) | 14 lines
Use the MACRO_CONTEXT and MACRO_EXTEN channel variables instead of the channel's macrocontext
and macroexten fields. This is needed because if macros are daisy-chained, the incorrect
context and extension are placed on the new channel. I also added locking to the channel prior
to accessing these variables as noted in trunk's janitor project file.
(closes issue #12549)
Reported by: darren1713
Patches:
app_queue.c.macroextenpatch uploaded by darren1713 (license 116)
(with modifications from me)
Tested by: putnopvut
........
................
r114852 | qwell | 2008-04-29 22:05:48 +0200 (Tue, 29 Apr 2008) | 1 line
Fix formatting
................
r114857 | mmichelson | 2008-04-29 23:07:36 +0200 (Tue, 29 Apr 2008) | 15 lines
Patching app_chanspy to jibe better with what is documented. This allows for
a colon-delimited list of spygroups to be specified when calling the ChanSpy application
with the 'g' option. Prior to this, you could only specify a single group when using the
'g' option.
I also have upped the maximum number of spygroups to 128 and added a #define so that this
can be easily increased or decreased later.
(closes issue #12497)
Reported by: jsmith
Patches:
app_chanspy_multiple_groups_v2.patch uploaded by jsmith (license 15)
Tested by: atis, jvandal
................
r114866 | jpeeler | 2008-04-30 00:54:14 +0200 (Wed, 30 Apr 2008) | 2 lines
Fixes a problem where all the templates were marked as dead no matter what. The templates should only be marked as dead if a configuration file has been successfully loaded and has changes. Bug found while making API documentation for 1.6.0.
................
r114874 | tilghman | 2008-04-30 07:05:25 +0200 (Wed, 30 Apr 2008) | 2 lines
Document the Incomplete application addition.
................
r114876 | kpfleming | 2008-04-30 14:15:43 +0200 (Wed, 30 Apr 2008) | 10 lines
Merged revisions 114875 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r114875 | kpfleming | 2008-04-30 07:14:07 -0500 (Wed, 30 Apr 2008) | 2 lines
pay attention to *all* header files for dependency tracking, not just the local ones (inspired by r578 of asterisk-addons by tilghman)
........
................
Modified:
team/mvanbaak/skinny-realtime/ (props changed)
team/mvanbaak/skinny-realtime/CHANGES
team/mvanbaak/skinny-realtime/Makefile.rules
team/mvanbaak/skinny-realtime/UPGRADE.txt
team/mvanbaak/skinny-realtime/apps/app_chanspy.c
team/mvanbaak/skinny-realtime/apps/app_directory.c
team/mvanbaak/skinny-realtime/apps/app_queue.c
team/mvanbaak/skinny-realtime/apps/app_voicemail.c
team/mvanbaak/skinny-realtime/channels/iax2-provision.c
team/mvanbaak/skinny-realtime/contrib/scripts/get_ilbc_source.sh
team/mvanbaak/skinny-realtime/include/asterisk/app.h
team/mvanbaak/skinny-realtime/main/app.c
team/mvanbaak/skinny-realtime/main/features.c
team/mvanbaak/skinny-realtime/phoneprov/polycom.xml
team/mvanbaak/skinny-realtime/res/res_config_pgsql.c
Propchange: team/mvanbaak/skinny-realtime/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Propchange: team/mvanbaak/skinny-realtime/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Apr 30 07:24:50 2008
@@ -1,1 +1,1 @@
-/trunk:1-114792
+/trunk:1-114877
Modified: team/mvanbaak/skinny-realtime/CHANGES
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/skinny-realtime/CHANGES?view=diff&rev=114878&r1=114877&r2=114878
==============================================================================
--- team/mvanbaak/skinny-realtime/CHANGES (original)
+++ team/mvanbaak/skinny-realtime/CHANGES Wed Apr 30 07:24:50 2008
@@ -18,6 +18,13 @@
* It is now possible to specify a pattern match as a hint. Once a phone subscribes
to something that matches the pattern a hint will be created using the contents
and variables evaluated.
+ * Dialplan matching has been extended to allow an extension to return to the
+ PBX core to wait for more digits. This is done by using the new dialplan
+ application called "Incomplete". This will permit a whole new level of
+ extension control, by giving the administrator more control over early
+ matches employing one of the short-circuit pattern match operators. Note
+ that custom applications can trigger this same behavior by returning the
+ special value AST_PBX_INCOMPLETE.
Application Changes
-------------------
@@ -36,6 +43,10 @@
* Chanspy has a new option, 'B', which can be used to "barge" on a call. This is
like the pre-existing whisper mode, except that the spy can also talk to the
participant on the bridged channel as well.
+ * Chanspy has a new option, 'n', which will allow for the spied-on party's name
+ to be spoken instead of the channel name or number. For more information on the
+ use of this option, issue the command "core show application ChanSpy" from the
+ Asterisk CLI.
SIP Changes
-----------
Modified: team/mvanbaak/skinny-realtime/Makefile.rules
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/skinny-realtime/Makefile.rules?view=diff&rev=114878&r1=114877&r2=114878
==============================================================================
--- team/mvanbaak/skinny-realtime/Makefile.rules (original)
+++ team/mvanbaak/skinny-realtime/Makefile.rules Wed Apr 30 07:24:50 2008
@@ -21,7 +21,7 @@
.PHONY: dist-clean
# extra cflags to build dependencies. Recursively expanded.
-MAKE_DEPS= -MMD -MT $@ -MF .$(subst /,_,$@).d -MP
+MAKE_DEPS= -MD -MT $@ -MF .$(subst /,_,$@).d -MP
ifeq ($(NOISY_BUILD),)
ECHO_PREFIX=@
Modified: team/mvanbaak/skinny-realtime/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/skinny-realtime/UPGRADE.txt?view=diff&rev=114878&r1=114877&r2=114878
==============================================================================
--- team/mvanbaak/skinny-realtime/UPGRADE.txt (original)
+++ team/mvanbaak/skinny-realtime/UPGRADE.txt Wed Apr 30 07:24:50 2008
@@ -103,6 +103,8 @@
* WaitMusicOnHold application is now deprecated in favor of extended MusicOnHold.
* SetMusicOnHold is now deprecated. You should use Set(CHANNEL(musicclass)=...)
instead.
+* While app_directory has always relied on having a voicemail.conf or users.conf file
+ correctly set up, it now is dependent on app_voicemail being compiled as well.
Dialplan Functions:
Modified: team/mvanbaak/skinny-realtime/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/skinny-realtime/apps/app_chanspy.c?view=diff&rev=114878&r1=114877&r2=114878
==============================================================================
--- team/mvanbaak/skinny-realtime/apps/app_chanspy.c (original)
+++ team/mvanbaak/skinny-realtime/apps/app_chanspy.c Wed Apr 30 07:24:50 2008
@@ -49,6 +49,7 @@
#include "asterisk/lock.h"
#define AST_NAME_STRLEN 256
+#define NUM_SPYGROUPS 128
static const char *tdesc = "Listen to a channel, and optionally whisper into it";
static const char *app_chan = "ChanSpy";
@@ -69,32 +70,43 @@
" exit to it. This also disables choosing a channel based on 'chanprefix'\n"
" and a digit sequence.\n"
" Options:\n"
-" b - Only spy on channels involved in a bridged call.\n"
-" g(grp) - Match only channels where their SPYGROUP variable is set to\n"
-" contain 'grp' in an optional : delimited list.\n"
-" q - Don't play a beep when beginning to spy on a channel, or speak the\n"
-" selected channel name.\n"
-" r[(basename)] - Record the session to the monitor spool directory. An\n"
-" optional base for the filename may be specified. The\n"
-" default is 'chanspy'.\n"
-" s - Skip the playback of the channel type (i.e. SIP, IAX, etc) when\n"
-" speaking the selected channel name.\n"
-" v([value]) - Adjust the initial volume in the range from -4 to 4. A\n"
-" negative value refers to a quieter setting.\n"
-" w - Enable 'whisper' mode, so the spying channel can talk to\n"
-" the spied-on channel.\n"
-" W - Enable 'private whisper' mode, so the spying channel can\n"
-" talk to the spied-on channel but cannot listen to that\n"
-" channel.\n"
-" o - Only listen to audio coming from this channel.\n"
-" X - Allow the user to exit ChanSpy to a valid single digit\n"
-" numeric extension in the current context or the context\n"
-" specified by the SPY_EXIT_CONTEXT channel variable. The\n"
-" name of the last channel that was spied on will be stored\n"
-" in the SPY_CHANNEL variable.\n"
-" e(ext) - Enable 'enforced' mode, so the spying channel can\n"
-" only monitor extensions whose name is in the 'ext' : \n"
-" delimited list.\n"
+" b - Only spy on channels involved in a bridged call.\n"
+" g(grp) - Only spy on channels in which one or more of the groups \n"
+" listed in 'grp' matches one or more groups from the\n"
+" SPYGROUP variable set on the channel to be spied upon.\n"
+" Note that both 'grp' and SPYGROUP can contain either a\n"
+" single group or a colon-delimited list of groups, such\n"
+" as 'sales:support:accounting'.\n"
+" n([mailbox][@context]) - Say the name of the person being spied on if that person has recorded\n"
+" his/her name. If a context is specified, then that voicemail context will\n"
+" be searched when retrieving the name, otherwise the \"default\" context\n"
+" will be searched. If no mailbox is specified, then the channel name will\n"
+" be used when searching for the name (i.e. if SIP/1000 is the channel being\n"
+" spied on and no mailbox is specified, then \"1000\" will be used when searching\n"
+" for the name).\n"
+" q - Don't play a beep when beginning to spy on a channel, or speak the\n"
+" selected channel name.\n"
+" r[(basename)] - Record the session to the monitor spool directory. An\n"
+" optional base for the filename may be specified. The\n"
+" default is 'chanspy'.\n"
+" s - Skip the playback of the channel type (i.e. SIP, IAX, etc) when\n"
+" speaking the selected channel name.\n"
+" v([value]) - Adjust the initial volume in the range from -4 to 4. A\n"
+" negative value refers to a quieter setting.\n"
+" w - Enable 'whisper' mode, so the spying channel can talk to\n"
+" the spied-on channel.\n"
+" W - Enable 'private whisper' mode, so the spying channel can\n"
+" talk to the spied-on channel but cannot listen to that\n"
+" channel.\n"
+" o - Only listen to audio coming from this channel.\n"
+" X - Allow the user to exit ChanSpy to a valid single digit\n"
+" numeric extension in the current context or the context\n"
+" specified by the SPY_EXIT_CONTEXT channel variable. The\n"
+" name of the last channel that was spied on will be stored\n"
+" in the SPY_CHANNEL variable.\n"
+" e(ext) - Enable 'enforced' mode, so the spying channel can\n"
+" only monitor extensions whose name is in the 'ext' : \n"
+" delimited list.\n"
;
static const char *app_ext = "ExtenSpy";
@@ -111,29 +123,40 @@
" single digit extension exists in the correct context it ChanSpy will\n"
" exit to it.\n"
" Options:\n"
-" b - Only spy on channels involved in a bridged call.\n"
-" g(grp) - Match only channels where their ${SPYGROUP} variable is set to\n"
-" contain 'grp' in an optional : delimited list.\n"
-" q - Don't play a beep when beginning to spy on a channel, or speak the\n"
-" selected channel name.\n"
-" r[(basename)] - Record the session to the monitor spool directory. An\n"
-" optional base for the filename may be specified. The\n"
-" default is 'chanspy'.\n"
-" s - Skip the playback of the channel type (i.e. SIP, IAX, etc) when\n"
-" speaking the selected channel name.\n"
-" v([value]) - Adjust the initial volume in the range from -4 to 4. A\n"
-" negative value refers to a quieter setting.\n"
-" w - Enable 'whisper' mode, so the spying channel can talk to\n"
-" the spied-on channel.\n"
-" W - Enable 'private whisper' mode, so the spying channel can\n"
-" talk to the spied-on channel but cannot listen to that\n"
-" channel.\n"
-" o - Only listen to audio coming from this channel.\n"
-" X - Allow the user to exit ChanSpy to a valid single digit\n"
-" numeric extension in the current context or the context\n"
-" specified by the SPY_EXIT_CONTEXT channel variable. The\n"
-" name of the last channel that was spied on will be stored\n"
-" in the SPY_CHANNEL variable.\n"
+" b - Only spy on channels involved in a bridged call.\n"
+" g(grp) - Only spy on channels in which one or more of the groups \n"
+" listed in 'grp' matches one or more groups from the\n"
+" SPYGROUP variable set on the channel to be spied upon.\n"
+" Note that both 'grp' and SPYGROUP can contain either a\n"
+" single group or a colon-delimited list of groups, such\n"
+" as 'sales:support:accounting'.\n"
+" n([mailbox][@context]) - Say the name of the person being spied on if that person has recorded\n"
+" his/her name. If a context is specified, then that voicemail context will\n"
+" be searched when retrieving the name, otherwise the \"default\" context\n"
+" will be searched. If no mailbox is specified, then the channel name will\n"
+" be used when searching for the name (i.e. if SIP/1000 is the channel being\n"
+" spied on and no mailbox is specified, then \"1000\" will be used when searching\n"
+" for the name).\n"
+" q - Don't play a beep when beginning to spy on a channel, or speak the\n"
+" selected channel name.\n"
+" r[(basename)] - Record the session to the monitor spool directory. An\n"
+" optional base for the filename may be specified. The\n"
+" default is 'chanspy'.\n"
+" s - Skip the playback of the channel type (i.e. SIP, IAX, etc) when\n"
+" speaking the selected channel name.\n"
+" v([value]) - Adjust the initial volume in the range from -4 to 4. A\n"
+" negative value refers to a quieter setting.\n"
+" w - Enable 'whisper' mode, so the spying channel can talk to\n"
+" the spied-on channel.\n"
+" W - Enable 'private whisper' mode, so the spying channel can\n"
+" talk to the spied-on channel but cannot listen to that\n"
+" channel.\n"
+" o - Only listen to audio coming from this channel.\n"
+" X - Allow the user to exit ChanSpy to a valid single digit\n"
+" numeric extension in the current context or the context\n"
+" specified by the SPY_EXIT_CONTEXT channel variable. The\n"
+" name of the last channel that was spied on will be stored\n"
+" in the SPY_CHANNEL variable.\n"
;
enum {
@@ -149,6 +172,7 @@
OPTION_ENFORCED = (1 << 9), /* Enforced mode */
OPTION_NOTECH = (1 << 10), /* Skip technology name playback */
OPTION_BARGE = (1 << 11), /* Barge mode (whisper to both channels) */
+ OPTION_NAME = (1 << 12), /* Say the name of the person on whom we will spy */
} chanspy_opt_flags;
enum {
@@ -156,6 +180,7 @@
OPT_ARG_GROUP,
OPT_ARG_RECORD,
OPT_ARG_ENFORCED,
+ OPT_ARG_NAME,
OPT_ARG_ARRAY_SIZE,
} chanspy_opt_args;
@@ -172,6 +197,7 @@
AST_APP_OPTION('o', OPTION_READONLY),
AST_APP_OPTION('X', OPTION_EXIT),
AST_APP_OPTION('s', OPTION_NOTECH),
+ AST_APP_OPTION_ARG('n', OPTION_NAME, OPT_ARG_NAME),
});
@@ -554,7 +580,8 @@
static int common_exec(struct ast_channel *chan, const struct ast_flags *flags,
int volfactor, const int fd, const char *mygroup, const char *myenforced,
- const char *spec, const char *exten, const char *context)
+ const char *spec, const char *exten, const char *context, const char *mailbox,
+ const char *name_context)
{
char nameprefix[AST_NAME_STRLEN];
char peer_name[AST_NAME_STRLEN + 5];
@@ -635,10 +662,14 @@
next_channel(chan, prev, spec, exten, context, &chanspy_ds), next_chanspy_ds = NULL) {
const char *group;
int igrp = !mygroup;
- char *groups[25];
+ char *groups[NUM_SPYGROUPS];
+ char *mygroups[NUM_SPYGROUPS];
int num_groups = 0;
char *dup_group;
+ int num_mygroups = 0;
+ char *dup_mygroup;
int x;
+ int y;
char *s;
char *buffer;
char *end;
@@ -673,16 +704,22 @@
}
if (mygroup) {
+ dup_mygroup = ast_strdupa(mygroup);
+ num_mygroups = ast_app_separate_args(dup_mygroup, ':', mygroups,
+ sizeof(mygroups) / sizeof(mygroups[0]));
+
if ((group = pbx_builtin_getvar_helper(peer, "SPYGROUP"))) {
dup_group = ast_strdupa(group);
num_groups = ast_app_separate_args(dup_group, ':', groups,
sizeof(groups) / sizeof(groups[0]));
}
- for (x = 0; x < num_groups; x++) {
- if (!strcmp(mygroup, groups[x])) {
- igrp = 1;
- break;
+ for (y = 0; y < num_mygroups; y++) {
+ for (x = 0; x < num_groups; x++) {
+ if (!strcmp(mygroups[y], groups[x])) {
+ igrp = 1;
+ break;
+ }
}
}
}
@@ -727,6 +764,7 @@
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);
@@ -737,22 +775,29 @@
ast_channel_unlock(peer);
if (!ast_test_flag(flags, OPTION_QUIET)) {
- if (!ast_test_flag(flags, OPTION_NOTECH)) {
- if (ast_fileexists(peer_name, NULL, NULL) != -1) {
- res = ast_streamfile(chan, peer_name, chan->language);
- if (!res) {
- res = ast_waitstream(chan, "");
+ if (ast_test_flag(flags, OPTION_NAME)) {
+ const char *local_context = S_OR(name_context, "default");
+ const char *local_mailbox = S_OR(mailbox, ptr);
+ res = ast_app_sayname(chan, local_mailbox, local_context);
+ }
+ if (!ast_test_flag(flags, OPTION_NAME) || res < 0) {
+ if (!ast_test_flag(flags, OPTION_NOTECH)) {
+ if (ast_fileexists(peer_name, NULL, NULL) != -1) {
+ res = ast_streamfile(chan, peer_name, chan->language);
+ if (!res) {
+ res = ast_waitstream(chan, "");
+ }
+ if (res) {
+ chanspy_ds_free(peer_chanspy_ds);
+ break;
+ }
+ } else {
+ res = ast_say_character_str(chan, peer_name, "", chan->language);
}
- if (res) {
- chanspy_ds_free(peer_chanspy_ds);
- break;
- }
- } else {
- res = ast_say_character_str(chan, peer_name, "", chan->language);
}
+ if ((num = atoi(ptr)))
+ ast_say_digits(chan, atoi(ptr), "", chan->language);
}
- if ((num = atoi(ptr)))
- ast_say_digits(chan, atoi(ptr), "", chan->language);
}
res = channel_spy(chan, peer_chanspy_ds, &volfactor, fd, flags, exitcontext);
@@ -815,6 +860,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);
@@ -850,6 +897,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);
@@ -870,7 +931,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);
@@ -891,6 +952,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);
@@ -930,6 +993,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);
@@ -950,7 +1028,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/mvanbaak/skinny-realtime/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/skinny-realtime/apps/app_directory.c?view=diff&rev=114878&r1=114877&r2=114878
==============================================================================
--- team/mvanbaak/skinny-realtime/apps/app_directory.c (original)
+++ team/mvanbaak/skinny-realtime/apps/app_directory.c Wed Apr 30 07:24:50 2008
@@ -25,6 +25,9 @@
* \ingroup applications
*/
+/*** MODULEINFO
+ <depend>app_voicemail</depend>
+ ***/
#include "asterisk.h"
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
@@ -38,15 +41,6 @@
#include "asterisk/say.h"
#include "asterisk/app.h"
#include "asterisk/utils.h"
-
-#ifdef ODBC_STORAGE
-#include <sys/mman.h>
-#include "asterisk/res_odbc.h"
-
-static char odbc_database[80] = "asterisk";
-static char odbc_table[80] = "voicemessages";
-static char vmfmts[80] = "wav";
-#endif
static char *app = "Directory";
@@ -133,121 +127,6 @@
AST_APP_OPTION('m', OPT_SELECTFROMMENU),
});
-#ifdef ODBC_STORAGE
-struct generic_prepare_struct {
- const char *sql;
- const char *param;
-};
-
-static SQLHSTMT generic_prepare(struct odbc_obj *obj, void *data)
-{
- struct generic_prepare_struct *gps = data;
- SQLHSTMT stmt;
- int res;
-
- res = SQLAllocHandle(SQL_HANDLE_STMT, obj->con, &stmt);
- if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
- ast_log(LOG_WARNING, "SQL Alloc Handle failed!\n");
- return NULL;
- }
-
- res = SQLPrepare(stmt, (unsigned char *)gps->sql, SQL_NTS);
- if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
- ast_log(LOG_WARNING, "SQL Prepare failed![%s]\n", (char *)gps->sql);
- SQLFreeHandle(SQL_HANDLE_STMT, stmt);
- return NULL;
- }
-
- if (!ast_strlen_zero(gps->param))
- SQLBindParameter(stmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(gps->param), 0, (void *)gps->param, 0, NULL);
-
- return stmt;
-}
-
-static void retrieve_file(char *dir)
-{
- int x = 0;
- int res;
- int fd=-1;
- size_t fdlen = 0;
- void *fdm = MAP_FAILED;
- SQLHSTMT stmt;
- char sql[256];
- char fmt[80]="", empty[10] = "";
- char *c;
- SQLLEN colsize;
- char full_fn[256];
- struct odbc_obj *obj;
- struct generic_prepare_struct gps = { .sql = sql, .param = dir };
-
- obj = ast_odbc_request_obj(odbc_database, 1);
- if (obj) {
- do {
- ast_copy_string(fmt, vmfmts, sizeof(fmt));
- c = strchr(fmt, '|');
- if (c)
- *c = '\0';
- if (!strcasecmp(fmt, "wav49"))
- strcpy(fmt, "WAV");
- snprintf(full_fn, sizeof(full_fn), "%s.%s", dir, fmt);
- snprintf(sql, sizeof(sql), "SELECT recording FROM %s WHERE dir=? AND msgnum=-1", odbc_table);
- stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, &gps);
-
- if (!stmt) {
- ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
- break;
- }
- res = SQLFetch(stmt);
- if (res == SQL_NO_DATA) {
- SQLFreeHandle(SQL_HANDLE_STMT, stmt);
- break;
- } else if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
- ast_log(LOG_WARNING, "SQL Fetch error!\n[%s]\n\n", sql);
- SQLFreeHandle(SQL_HANDLE_STMT, stmt);
- break;
- }
- fd = open(full_fn, O_RDWR | O_CREAT | O_TRUNC, AST_FILE_MODE);
- if (fd < 0) {
- ast_log(LOG_WARNING, "Failed to write '%s': %s\n", full_fn, strerror(errno));
- SQLFreeHandle(SQL_HANDLE_STMT, stmt);
- break;
- }
-
- res = SQLGetData(stmt, 1, SQL_BINARY, empty, 0, &colsize);
- fdlen = colsize;
- if (fd > -1) {
- char tmp[1]="";
- lseek(fd, fdlen - 1, SEEK_SET);
- if (write(fd, tmp, 1) != 1) {
- close(fd);
- fd = -1;
- break;
- }
- if (fd > -1)
- fdm = mmap(NULL, fdlen, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
- }
- if (fdm != MAP_FAILED) {
- memset(fdm, 0, fdlen);
- res = SQLGetData(stmt, x + 1, SQL_BINARY, fdm, fdlen, &colsize);
- if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
- ast_log(LOG_WARNING, "SQL Get Data error!\n[%s]\n\n", sql);
- SQLFreeHandle(SQL_HANDLE_STMT, stmt);
- break;
- }
- }
- SQLFreeHandle(SQL_HANDLE_STMT, stmt);
- } while (0);
- ast_odbc_release_obj(obj);
- } else
- ast_log(LOG_WARNING, "Failed to obtain database object for '%s'!\n", odbc_database);
- if (fdm != MAP_FAILED)
- munmap(fdm, fdlen);
- if (fd > -1)
- close(fd);
- return;
-}
-#endif
-
static int compare(const char *text, const char *template)
{
char digit;
@@ -333,26 +212,7 @@
const char *ext, const char *name, struct ast_flags *flags)
{
int res = 0;
- char fn[256];
-
- /* Check for the VoiceMail2 greeting first */
- snprintf(fn, sizeof(fn), "%s/voicemail/%s/%s/greet",
- ast_config_AST_SPOOL_DIR, context, ext);
-#ifdef ODBC_STORAGE
- retrieve_file(fn);
-#endif
-
- if (ast_fileexists(fn, NULL, chan->language) <= 0) {
- /* no file, check for an old-style Voicemail greeting */
- snprintf(fn, sizeof(fn), "%s/vm/%s/greet",
- ast_config_AST_SPOOL_DIR, ext);
- }
-#ifdef ODBC_STORAGE
- retrieve_file(fn);
-#endif
-
- if (ast_fileexists(fn, NULL, chan->language) > 0) {
- res = ast_stream_and_wait(chan, fn, AST_DIGIT_ANY);
+ if ((res = ast_app_sayname(chan, ext, context)) >= 0) {
ast_stopstream(chan);
/* If Option 'e' was specified, also read the extension number with the name */
if (ast_test_flag(flags, OPT_SAYEXTENSION)) {
@@ -366,9 +226,6 @@
res = ast_say_character_str(chan, ext, AST_DIGIT_ANY, chan->language);
}
}
-#ifdef ODBC_STORAGE
- ast_filedelete(fn, NULL);
-#endif
return res;
}
@@ -625,7 +482,6 @@
AST_LIST_INSERT_TAIL(alist, item, entry);
}
-
if (ucfg) {
for (cat = ast_category_browse(ucfg, NULL); cat ; cat = ast_category_browse(ucfg, cat)) {
const char *pos;
@@ -641,10 +497,10 @@
res = 0;
if (ast_test_flag(&flags, OPT_LISTBYLASTNAME)) {
- res = check_match(&item, pos, v->name, ext, 0 /* use_first_name */);
+ res = check_match(&item, pos, cat, ext, 0 /* use_first_name */);
}
if (!res && ast_test_flag(&flags, OPT_LISTBYFIRSTNAME)) {
- res = check_match(&item, pos, v->name, ext, 1 /* use_first_name */);
+ res = check_match(&item, pos, cat, ext, 1 /* use_first_name */);
}
if (!res)
@@ -655,7 +511,6 @@
AST_LIST_INSERT_TAIL(alist, item, entry);
}
}
-
return 0;
}
@@ -910,26 +765,6 @@
static int load_module(void)
{
-#ifdef ODBC_STORAGE
- struct ast_flags config_flags = { 0 };
- struct ast_config *cfg = ast_config_load(VOICEMAIL_CONFIG, config_flags);
- const char *tmp;
-
- if (cfg) {
- if ((tmp = ast_variable_retrieve(cfg, "general", "odbcstorage"))) {
- ast_copy_string(odbc_database, tmp, sizeof(odbc_database));
- }
- if ((tmp = ast_variable_retrieve(cfg, "general", "odbctable"))) {
- ast_copy_string(odbc_table, tmp, sizeof(odbc_table));
- }
- if ((tmp = ast_variable_retrieve(cfg, "general", "format"))) {
- ast_copy_string(vmfmts, tmp, sizeof(vmfmts));
- }
- ast_config_destroy(cfg);
- } else
- ast_log(LOG_WARNING, "Unable to load " VOICEMAIL_CONFIG " - ODBC defaults will be used\n");
-#endif
-
return ast_register_application(app, directory_exec, synopsis, descrip);
}
Modified: team/mvanbaak/skinny-realtime/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/skinny-realtime/apps/app_queue.c?view=diff&rev=114878&r1=114877&r2=114878
==============================================================================
--- team/mvanbaak/skinny-realtime/apps/app_queue.c (original)
+++ team/mvanbaak/skinny-realtime/apps/app_queue.c Wed Apr 30 07:24:50 2008
@@ -2110,6 +2110,7 @@
int status;
char tech[256];
char *location;
+ const char *macrocontext, *macroexten;
/* on entry here, we know that tmp->chan == NULL */
if ((tmp->lastqueue && tmp->lastqueue->wrapuptime && (time(NULL) - tmp->lastcall < tmp->lastqueue->wrapuptime)) ||
@@ -2192,14 +2193,18 @@
tmp->chan->adsicpe = qe->chan->adsicpe;
/* Inherit context and extension */
- if (!ast_strlen_zero(qe->chan->macrocontext))
- ast_copy_string(tmp->chan->dialcontext, qe->chan->macrocontext, sizeof(tmp->chan->dialcontext));
+ ast_channel_lock(qe->chan);
+ macrocontext = pbx_builtin_getvar_helper(qe->chan, "MACRO_CONTEXT");
+ if (!ast_strlen_zero(macrocontext))
+ ast_copy_string(tmp->chan->dialcontext, macrocontext, sizeof(tmp->chan->dialcontext));
else
ast_copy_string(tmp->chan->dialcontext, qe->chan->context, sizeof(tmp->chan->dialcontext));
- if (!ast_strlen_zero(qe->chan->macroexten))
- ast_copy_string(tmp->chan->exten, qe->chan->macroexten, sizeof(tmp->chan->exten));
+ macroexten = pbx_builtin_getvar_helper(qe->chan, "MACRO_EXTEN");
+ if (!ast_strlen_zero(macroexten))
+ ast_copy_string(tmp->chan->exten, macroexten, sizeof(tmp->chan->exten));
else
ast_copy_string(tmp->chan->exten, qe->chan->exten, sizeof(tmp->chan->exten));
+ ast_channel_unlock(qe->chan);
/* Place the call, but don't wait on the answer */
if ((res = ast_call(tmp->chan, location, 0))) {
Modified: team/mvanbaak/skinny-realtime/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/skinny-realtime/apps/app_voicemail.c?view=diff&rev=114878&r1=114877&r2=114878
==============================================================================
--- team/mvanbaak/skinny-realtime/apps/app_voicemail.c (original)
+++ team/mvanbaak/skinny-realtime/apps/app_voicemail.c Wed Apr 30 07:24:50 2008
@@ -9528,6 +9528,20 @@
}
}
+static int sayname(struct ast_channel *chan, const char *mailbox, const char *context)
+{
+ int res = -1;
+ char dir[PATH_MAX];
+ snprintf(dir, sizeof(dir), "%s%s/%s/greet", VM_SPOOL_DIR, context, mailbox);
+ ast_debug(2, "About to try retrieving name file %s\n", dir);
+ RETRIEVE(dir, -1, mailbox, context);
+ if (ast_fileexists(dir, NULL, NULL)) {
+ res = ast_stream_and_wait(chan, dir, AST_DIGIT_ANY);
+ }
+ DISPOSE(dir, -1);
+ return res;
+}
+
static int reload(void)
{
return load_config(1);
@@ -9575,7 +9589,7 @@
ast_cli_register_multiple(cli_voicemail, sizeof(cli_voicemail) / sizeof(struct ast_cli_entry));
- ast_install_vm_functions(has_voicemail, inboxcount, messagecount);
+ ast_install_vm_functions(has_voicemail, inboxcount, messagecount, sayname);
return res;
}
Modified: team/mvanbaak/skinny-realtime/channels/iax2-provision.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/skinny-realtime/channels/iax2-provision.c?view=diff&rev=114878&r1=114877&r2=114878
==============================================================================
--- team/mvanbaak/skinny-realtime/channels/iax2-provision.c (original)
+++ team/mvanbaak/skinny-realtime/channels/iax2-provision.c Wed Apr 30 07:24:50 2008
@@ -491,14 +491,16 @@
struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
if (!provinit)
iax_provision_init();
- /* Mark all as dead. No need for locking */
- cur = templates;
- while(cur) {
- cur->dead = 1;
- cur = cur->next;
- }
+
cfg = ast_config_load2("iaxprov.conf", "chan_iax2", config_flags);
if (cfg != NULL && cfg != CONFIG_STATUS_FILEUNCHANGED) {
+ /* Mark all as dead. No need for locking */
+ cur = templates;
+ while(cur) {
+ cur->dead = 1;
+ cur = cur->next;
+ }
+
/* Load as appropriate */
cat = ast_category_browse(cfg, NULL);
while(cat) {
Modified: team/mvanbaak/skinny-realtime/contrib/scripts/get_ilbc_source.sh
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/skinny-realtime/contrib/scripts/get_ilbc_source.sh?view=diff&rev=114878&r1=114877&r2=114878
==============================================================================
--- team/mvanbaak/skinny-realtime/contrib/scripts/get_ilbc_source.sh (original)
+++ team/mvanbaak/skinny-realtime/contrib/scripts/get_ilbc_source.sh Wed Apr 30 07:24:50 2008
@@ -1,4 +1,13 @@
#!/bin/sh -e
+
+if [ -f codecs/ilbc/iLBC_define.h ]; then
+ echo "***"
+ echo "The iLBC source code appears to already be present and does not"
+ echo "need to be downloaded."
+ echo "***"
+
+ exit 1
+fi
echo "***"
echo "This script will download the Global IP Solutions iLBC encoder/decoder"
@@ -20,3 +29,5 @@
echo "***"
echo "The iLBC source code download is complete."
echo "***"
+
+exit 0
Modified: team/mvanbaak/skinny-realtime/include/asterisk/app.h
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/skinny-realtime/include/asterisk/app.h?view=diff&rev=114878&r1=114877&r2=114878
==============================================================================
--- team/mvanbaak/skinny-realtime/include/asterisk/app.h (original)
+++ team/mvanbaak/skinny-realtime/include/asterisk/app.h Wed Apr 30 07:24:50 2008
@@ -105,7 +105,8 @@
void ast_install_vm_functions(int (*has_voicemail_func)(const char *mailbox, const char *folder),
int (*inboxcount_func)(const char *mailbox, int *newmsgs, int *oldmsgs),
- int (*messagecount_func)(const char *context, const char *mailbox, const char *folder));
+ int (*messagecount_func)(const char *context, const char *mailbox, const char *folder),
+ int (*sayname_func)(struct ast_channel *chan, const char *mailbox, const char *context));
void ast_uninstall_vm_functions(void);
@@ -114,6 +115,9 @@
/*! \brief Determine number of new/old messages in a mailbox */
int ast_app_inboxcount(const char *mailbox, int *newmsgs, int *oldmsgs);
+
+/*! Given a mailbox and context, play that mailbox owner's name to the channel specified */
+int ast_app_sayname(struct ast_channel *chan, const char *mailbox, const char *context);
/*! \brief Determine number of messages in a given mailbox and folder */
int ast_app_messagecount(const char *context, const char *mailbox, const char *folder);
Modified: team/mvanbaak/skinny-realtime/main/app.c
[... 92 lines stripped ...]
More information about the asterisk-commits
mailing list