[asterisk-commits] russell: branch russell/iax2_find_callno r114883 - in /team/russell/iax2_find...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Apr 30 09:49:47 CDT 2008
Author: russell
Date: Wed Apr 30 09:49:47 2008
New Revision: 114883
URL: http://svn.digium.com/view/asterisk?view=rev&rev=114883
Log:
sync with trunk
Modified:
team/russell/iax2_find_callno/ (props changed)
team/russell/iax2_find_callno/CHANGES
team/russell/iax2_find_callno/Makefile.rules
team/russell/iax2_find_callno/UPGRADE.txt
team/russell/iax2_find_callno/apps/app_chanspy.c
team/russell/iax2_find_callno/apps/app_directory.c
team/russell/iax2_find_callno/apps/app_queue.c
team/russell/iax2_find_callno/apps/app_voicemail.c
team/russell/iax2_find_callno/channels/iax2-provision.c
team/russell/iax2_find_callno/main/features.c
team/russell/iax2_find_callno/phoneprov/polycom.xml
team/russell/iax2_find_callno/res/res_config_pgsql.c
Propchange: team/russell/iax2_find_callno/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Propchange: team/russell/iax2_find_callno/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Apr 30 09:49:47 2008
@@ -1,1 +1,1 @@
-/trunk:1-114827
+/trunk:1-114882
Modified: team/russell/iax2_find_callno/CHANGES
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_find_callno/CHANGES?view=diff&rev=114883&r1=114882&r2=114883
==============================================================================
--- team/russell/iax2_find_callno/CHANGES (original)
+++ team/russell/iax2_find_callno/CHANGES Wed Apr 30 09:49:47 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
-------------------
Modified: team/russell/iax2_find_callno/Makefile.rules
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_find_callno/Makefile.rules?view=diff&rev=114883&r1=114882&r2=114883
==============================================================================
--- team/russell/iax2_find_callno/Makefile.rules (original)
+++ team/russell/iax2_find_callno/Makefile.rules Wed Apr 30 09:49:47 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/russell/iax2_find_callno/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_find_callno/UPGRADE.txt?view=diff&rev=114883&r1=114882&r2=114883
==============================================================================
--- team/russell/iax2_find_callno/UPGRADE.txt (original)
+++ team/russell/iax2_find_callno/UPGRADE.txt Wed Apr 30 09:49:47 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/russell/iax2_find_callno/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_find_callno/apps/app_chanspy.c?view=diff&rev=114883&r1=114882&r2=114883
==============================================================================
--- team/russell/iax2_find_callno/apps/app_chanspy.c (original)
+++ team/russell/iax2_find_callno/apps/app_chanspy.c Wed Apr 30 09:49:47 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";
@@ -70,8 +71,12 @@
" 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"
+" 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"
@@ -119,8 +124,12 @@
" 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"
+" 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"
@@ -653,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;
@@ -691,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;
+ }
}
}
}
Modified: team/russell/iax2_find_callno/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_find_callno/apps/app_directory.c?view=diff&rev=114883&r1=114882&r2=114883
==============================================================================
--- team/russell/iax2_find_callno/apps/app_directory.c (original)
+++ team/russell/iax2_find_callno/apps/app_directory.c Wed Apr 30 09:49:47 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/russell/iax2_find_callno/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_find_callno/apps/app_queue.c?view=diff&rev=114883&r1=114882&r2=114883
==============================================================================
--- team/russell/iax2_find_callno/apps/app_queue.c (original)
+++ team/russell/iax2_find_callno/apps/app_queue.c Wed Apr 30 09:49:47 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/russell/iax2_find_callno/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_find_callno/apps/app_voicemail.c?view=diff&rev=114883&r1=114882&r2=114883
==============================================================================
--- team/russell/iax2_find_callno/apps/app_voicemail.c (original)
+++ team/russell/iax2_find_callno/apps/app_voicemail.c Wed Apr 30 09:49:47 2008
@@ -9536,10 +9536,7 @@
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_streamfile(chan, dir, chan->language);
- if (!res) {
- res = ast_waitstream(chan, "");
- }
+ res = ast_stream_and_wait(chan, dir, AST_DIGIT_ANY);
}
DISPOSE(dir, -1);
return res;
Modified: team/russell/iax2_find_callno/channels/iax2-provision.c
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_find_callno/channels/iax2-provision.c?view=diff&rev=114883&r1=114882&r2=114883
==============================================================================
--- team/russell/iax2_find_callno/channels/iax2-provision.c (original)
+++ team/russell/iax2_find_callno/channels/iax2-provision.c Wed Apr 30 09:49:47 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/russell/iax2_find_callno/main/features.c
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_find_callno/main/features.c?view=diff&rev=114883&r1=114882&r2=114883
==============================================================================
--- team/russell/iax2_find_callno/main/features.c (original)
+++ team/russell/iax2_find_callno/main/features.c Wed Apr 30 09:49:47 2008
@@ -2421,7 +2421,7 @@
for (x = 0; x < AST_MAX_FDS; x++) {
struct ast_frame *f;
- if ((chan->fds[x] == -1) && (!FD_ISSET(chan->fds[x], rfds) && !FD_ISSET(pu->chan->fds[x], efds)))
+ if ((chan->fds[x] == -1) || (!FD_ISSET(chan->fds[x], rfds) && !FD_ISSET(pu->chan->fds[x], efds)))
continue;
if (FD_ISSET(chan->fds[x], efds))
Modified: team/russell/iax2_find_callno/phoneprov/polycom.xml
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_find_callno/phoneprov/polycom.xml?view=diff&rev=114883&r1=114882&r2=114883
==============================================================================
--- team/russell/iax2_find_callno/phoneprov/polycom.xml (original)
+++ team/russell/iax2_find_callno/phoneprov/polycom.xml Wed Apr 30 09:49:47 2008
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<phone1>
- <reg ${PP_EACH_EXTENSION(${MAC},polycom_line.xml)} />
+ <reg ${PP_EACH_EXTENSION(${MAC},polycom_line.xml)} />
<call>
<donotdisturb call.donotdisturb.perReg="1" />
<autoOffHook call.autoOffHook.1.enabled="0" call.autoOffHook.1.contact="" call.autoOffHook.2.enabled="0" call.autoOffHook.2.contact="" call.autoOffHook.3.enabled="0" call.autoOffHook.3.contact="" call.autoOffHook.4.enabled="0" call.autoOffHook.4.contact="" call.autoOffHook.5.enabled="0" call.autoOffHook.5.contact="" call.autoOffHook.6.enabled="0" call.autoOffHook.6.contact=""/>
Modified: team/russell/iax2_find_callno/res/res_config_pgsql.c
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_find_callno/res/res_config_pgsql.c?view=diff&rev=114883&r1=114882&r2=114883
==============================================================================
--- team/russell/iax2_find_callno/res/res_config_pgsql.c (original)
+++ team/russell/iax2_find_callno/res/res_config_pgsql.c Wed Apr 30 09:49:47 2008
@@ -192,8 +192,7 @@
}
ast_free(fieldnames);
} else {
- ast_log(LOG_WARNING,
- "PostgreSQL RealTime: Could not find any rows in table %s.\n", table);
+ ast_debug(1, "Postgresql RealTime: Could not find any rows in table %s.\n", table);
}
ast_mutex_unlock(&pgsql_lock);
More information about the asterisk-commits
mailing list