aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-12-02 01:01:11 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-12-02 01:01:11 +0000
commit907b53f827a5202f4f0928ef98bedc6ff5958936 (patch)
tree975b2dabe30d1a8c86307711c15c13d63c258135 /apps
parent73f1a2863ebe21859bd73208fdd3ac3e4f124729 (diff)
Merged revisions 7265-7266,7268-7275 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r7265 | oej | 2005-12-01 17:18:14 -0600 (Thu, 01 Dec 2005) | 2 lines Changing bug report address to the Asterisk issue tracker ........ r7266 | kpfleming | 2005-12-01 17:18:29 -0600 (Thu, 01 Dec 2005) | 3 lines Makefile 'update' target now supports updating from Subversion repositories (issue #5875) remove support for 'patches' subdirectory, it's no longer useful ........ r7268 | kpfleming | 2005-12-01 17:34:58 -0600 (Thu, 01 Dec 2005) | 2 lines ensure channel's scheduling context is freed (issue #5788) ........ r7269 | kpfleming | 2005-12-01 17:49:44 -0600 (Thu, 01 Dec 2005) | 2 lines don't block waiting for the Festival server forever when it goes away (issue #5882) ........ r7270 | kpfleming | 2005-12-01 18:26:12 -0600 (Thu, 01 Dec 2005) | 2 lines allow variables to exist on both 'halves' of the Local channel (issue #5810) ........ r7271 | kpfleming | 2005-12-01 18:28:48 -0600 (Thu, 01 Dec 2005) | 2 lines protect agent_bridgedchannel() from segfaulting when there is no bridged channel (issue #5879) ........ r7272 | kpfleming | 2005-12-01 18:39:00 -0600 (Thu, 01 Dec 2005) | 3 lines properly handle password changes when mailbox is last line of config file and not followed by a newline (issue #5870) reformat password changing code to conform to coding guidelines (issue #5870) ........ r7273 | kpfleming | 2005-12-01 18:42:40 -0600 (Thu, 01 Dec 2005) | 2 lines allow previous context-searching behavior to be used if desired (issue #5899) ........ r7274 | kpfleming | 2005-12-01 18:51:15 -0600 (Thu, 01 Dec 2005) | 2 lines inherit channel variables into channels created by Page() application (issue #5888) ........ r7275 | oej | 2005-12-01 18:52:13 -0600 (Thu, 01 Dec 2005) | 2 lines Bug #5907. Improve SIP INFO DTMF debugging output. (1.2 & Trunk) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@7276 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_festival.c14
-rw-r--r--apps/app_page.c30
-rw-r--r--apps/app_voicemail.c164
3 files changed, 127 insertions, 81 deletions
diff --git a/apps/app_festival.c b/apps/app_festival.c
index 03753642c..186a50ae7 100644
--- a/apps/app_festival.c
+++ b/apps/app_festival.c
@@ -455,8 +455,20 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
/* This assumes only one waveform will come back, also LP is unlikely */
wave = 0;
do {
+ int read_data;
for (n=0; n < 3; )
- n += read(fd,ack+n,3-n);
+ {
+ read_data = read(fd,ack+n,3-n);
+ /* this avoids falling in infinite loop
+ * in case that festival server goes down
+ * */
+ if ( read_data == -1 )
+ {
+ ast_log(LOG_WARNING,"Unable to read from cache/festival fd");
+ return -1;
+ }
+ n += read_data;
+ }
ack[3] = '\0';
if (strcmp(ack,"WV\n") == 0) { /* receive a waveform */
ast_log(LOG_DEBUG,"Festival WV command\n");
diff --git a/apps/app_page.c b/apps/app_page.c
index 441208fd9..39a0eb4bc 100644
--- a/apps/app_page.c
+++ b/apps/app_page.c
@@ -40,6 +40,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/module.h"
#include "asterisk/file.h"
#include "asterisk/app.h"
+#include "asterisk/chanvars.h"
static const char *tdesc = "Page Multiple Phones";
@@ -77,13 +78,14 @@ struct calloutdata {
char tech[64];
char resource[256];
char meetmeopts[64];
+ struct ast_variable *variables;
};
static void *page_thread(void *data)
{
struct calloutdata *cd = data;
ast_pbx_outgoing_app(cd->tech, AST_FORMAT_SLINEAR, cd->resource, 30000,
- "MeetMe", cd->meetmeopts, NULL, 0, cd->cidnum, cd->cidname, NULL, NULL);
+ "MeetMe", cd->meetmeopts, NULL, 0, cd->cidnum, cd->cidname, cd->variables, NULL);
free(cd);
return NULL;
}
@@ -91,6 +93,9 @@ static void *page_thread(void *data)
static void launch_page(struct ast_channel *chan, const char *meetmeopts, const char *tech, const char *resource)
{
struct calloutdata *cd;
+ const char *varname;
+ struct ast_variable *lastvar = NULL;
+ struct ast_var_t *varptr;
pthread_t t;
pthread_attr_t attr;
cd = malloc(sizeof(struct calloutdata));
@@ -101,6 +106,29 @@ static void launch_page(struct ast_channel *chan, const char *meetmeopts, const
ast_copy_string(cd->tech, tech, sizeof(cd->tech));
ast_copy_string(cd->resource, resource, sizeof(cd->resource));
ast_copy_string(cd->meetmeopts, meetmeopts, sizeof(cd->meetmeopts));
+
+ AST_LIST_TRAVERSE(&chan->varshead, varptr, entries) {
+ if (!(varname = ast_var_full_name(varptr)))
+ continue;
+ if (varname[0] == '_') {
+ struct ast_variable *newvar = NULL;
+
+ if (varname[1] == '_') {
+ newvar = ast_variable_new(varname, ast_var_value(varptr));
+ } else {
+ newvar = ast_variable_new(&varname[1], ast_var_value(varptr));
+ }
+
+ if (newvar) {
+ if (lastvar)
+ lastvar->next = newvar;
+ else
+ cd->variables = newvar;
+ lastvar = newvar;
+ }
+ }
+ }
+
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
if (ast_pthread_create(&t, &attr, page_thread, cd)) {
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 2dab9fac0..1bc88ce2f 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -110,6 +110,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#define VM_ATTACH (1 << 11)
#define VM_DELETE (1 << 12)
#define VM_ALLOCED (1 << 13)
+#define VM_SEARCH (1 << 14)
#define ERROR_LOCK_PATH -100
@@ -534,12 +535,11 @@ static struct ast_vm_user *find_user_realtime(struct ast_vm_user *ivm, const cha
ast_set_flag(retval, VM_ALLOCED);
if (mailbox)
ast_copy_string(retval->mailbox, mailbox, sizeof(retval->mailbox));
- if (context)
- ast_copy_string(retval->context, context, sizeof(retval->context));
- else
- strcpy(retval->context, "default");
populate_defaults(retval);
- var = ast_load_realtime("voicemail", "mailbox", mailbox, "context", retval->context, NULL);
+ if (ast_test_flag((&globalflags), VM_SEARCH))
+ var = ast_load_realtime("voicemail", "mailbox", mailbox, NULL);
+ else
+ var = ast_load_realtime("voicemail", "mailbox", mailbox, "context", retval->context, NULL);
if (var) {
tmp = var;
while(tmp) {
@@ -554,6 +554,8 @@ static struct ast_vm_user *find_user_realtime(struct ast_vm_user *ivm, const cha
ast_copy_string(retval->email, tmp->value, sizeof(retval->email));
} else if (!strcasecmp(tmp->name, "fullname")) {
ast_copy_string(retval->fullname, tmp->value, sizeof(retval->fullname));
+ } else if (!strcasecmp(tmp->name, "context")) {
+ ast_copy_string(retval->context, tmp->value, sizeof(retval->context));
} else
apply_option(retval, tmp->name, tmp->value);
tmp = tmp->next;
@@ -574,13 +576,14 @@ static struct ast_vm_user *find_user(struct ast_vm_user *ivm, const char *contex
ast_mutex_lock(&vmlock);
cur = users;
- if (!context)
+ if (!context && !ast_test_flag((&globalflags), VM_SEARCH))
context = "default";
while (cur) {
- if ((!strcasecmp(context, cur->context)) &&
- (!strcasecmp(mailbox, cur->mailbox)))
- break;
+ if (ast_test_flag((&globalflags), VM_SEARCH) && !strcasecmp(mailbox, cur->mailbox))
+ break;
+ if ((!strcasecmp(context, cur->context)) && (!strcasecmp(mailbox, cur->mailbox)))
+ break;
cur=cur->next;
}
if (cur) {
@@ -660,91 +663,89 @@ static void vm_change_password(struct ast_vm_user *vmu, const char *newpassword)
}
while (!feof(configin)) {
+ char *user = NULL, *pass = NULL, *rest = NULL, *comment = NULL, *tmpctx = NULL, *tmpctxend = NULL;
+
/* Read in the line */
fgets(inbuf, sizeof(inbuf), configin);
linenum++;
- if (!feof(configin)) {
- char *user = NULL, *pass = NULL, *rest = NULL,
- *comment = NULL, *tmpctx = NULL, *tmpctxend = NULL;
-
- if (ast_strlen_zero(inbuf)) {
- fprintf(configout, "\n");
- continue;
- }
- /* Make a backup of it */
- ast_copy_string(orig, inbuf, sizeof(orig));
-
- /*
- Read the file line by line, split each line into a comment and command section
- only parse the command portion of the line
- */
- if (inbuf[strlen(inbuf) - 1] == '\n')
- inbuf[strlen(inbuf) - 1] = '\0';
+ if (ast_strlen_zero(inbuf)) {
+ fprintf(configout, "\n");
+ continue;
+ }
+
+ /* Make a backup of it */
+ ast_copy_string(orig, inbuf, sizeof(orig));
+
+ /*
+ Read the file line by line, split each line into a comment and command section
+ only parse the command portion of the line
+ */
+ if (inbuf[strlen(inbuf) - 1] == '\n')
+ inbuf[strlen(inbuf) - 1] = '\0';
- if ((comment = strchr(inbuf, ';')))
- *comment++ = '\0'; /* Now inbuf is terminated just before the comment */
+ if ((comment = strchr(inbuf, ';')))
+ *comment++ = '\0'; /* Now inbuf is terminated just before the comment */
- if (ast_strlen_zero(inbuf)) {
+ if (ast_strlen_zero(inbuf)) {
+ fprintf(configout, "%s", orig);
+ continue;
+ }
+
+ /* Check for a context, first '[' to first ']' */
+ if ((tmpctx = strchr(inbuf, '['))) {
+ tmpctxend = strchr(tmpctx, ']');
+ if (tmpctxend) {
+ /* Valid context */
+ ast_copy_string(currcontext, tmpctx + 1, tmpctxend - tmpctx);
fprintf(configout, "%s", orig);
continue;
}
-
- /* Check for a context, first '[' to first ']' */
- if ((tmpctx = strchr(inbuf, '['))) {
- tmpctxend = strchr(tmpctx, ']');
- if (tmpctxend) {
- /* Valid context */
- ast_copy_string(currcontext, tmpctx + 1, tmpctxend - tmpctx);
- fprintf(configout, "%s", orig);
- continue;
- }
- }
-
- /* This isn't a context line, check for MBX => PSWD... */
- user = inbuf;
- if ((pass = strchr(user, '='))) {
- /* We have a line in the form of aaaaa=aaaaaa */
+ }
+
+ /* This isn't a context line, check for MBX => PSWD... */
+ user = inbuf;
+ if ((pass = strchr(user, '='))) {
+ /* We have a line in the form of aaaaa=aaaaaa */
+ *pass++ = '\0';
+
+ user = ast_strip(user);
+
+ if (*pass == '>')
*pass++ = '\0';
-
- user = ast_strip(user);
- if (*pass == '>')
- *pass++ = '\0';
+ pass = ast_skip_blanks(pass);
- pass = ast_skip_blanks(pass);
-
- /*
- Since no whitespace allowed in fields, or more correctly white space
- inside the fields is there for a purpose, we can just terminate pass
- at the comma or EOL whichever comes first.
- */
- if ((rest = strchr(pass, ',')))
- *rest++ = '\0';
+ /*
+ Since no whitespace allowed in fields, or more correctly white space
+ inside the fields is there for a purpose, we can just terminate pass
+ at the comma or EOL whichever comes first.
+ */
+ if ((rest = strchr(pass, ',')))
+ *rest++ = '\0';
+ } else {
+ user = NULL;
+ }
+
+ /* Compare user, pass AND context */
+ if (!ast_strlen_zero(user) && !strcmp(user, vmu->mailbox) &&
+ !ast_strlen_zero(pass) && !strcmp(pass, vmu->password) &&
+ !strcasecmp(currcontext, vmu->context)) {
+ /* This is the line */
+ if (rest) {
+ fprintf(configout, "%s => %s,%s", user, newpassword, rest);
} else {
- user = NULL;
- }
-
- /* Compare user, pass AND context */
- if (!ast_strlen_zero(user) && !strcmp(user, vmu->mailbox) &&
- !ast_strlen_zero(pass) && !strcmp(pass, vmu->password) &&
- !strcasecmp(currcontext, vmu->context)) {
- /* This is the line */
- if (rest) {
- fprintf(configout, "%s => %s,%s", user, newpassword, rest);
- } else {
- fprintf(configout, "%s => %s", user, newpassword);
- }
- /* If there was a comment on the line print it out */
- if (comment) {
- fprintf(configout, ";%s\n", comment);
- } else {
- fprintf(configout, "\n");
- }
+ fprintf(configout, "%s => %s", user, newpassword);
+ }
+ /* If there was a comment on the line print it out */
+ if (comment) {
+ fprintf(configout, ";%s\n", comment);
} else {
- /* Put it back like it was */
- fprintf(configout, "%s", orig);
+ fprintf(configout, "\n");
}
+ } else {
+ /* Put it back like it was */
+ fprintf(configout, "%s", orig);
}
}
fclose(configin);
@@ -5812,6 +5813,7 @@ static int load_config(void)
struct ast_variable *var;
char *notifystr = NULL;
char *astattach;
+ char *astsearch;
char *astsaycid;
char *send_voicemail;
char *astcallop;
@@ -5865,6 +5867,10 @@ static int load_config(void)
astattach = "yes";
ast_set2_flag((&globalflags), ast_true(astattach), VM_ATTACH);
+ if (!(astsearch = ast_variable_retrieve(cfg, "general", "searchcontexts")))
+ astsearch = "no";
+ ast_set2_flag((&globalflags), ast_true(astsearch), VM_SEARCH);
+
#ifdef USE_ODBC_STORAGE
strcpy(odbc_database, "asterisk");
if ((thresholdstr = ast_variable_retrieve(cfg, "general", "odbcstorage"))) {