Thread fixes, vm fix (bug #2665)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4030 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2004-10-17 22:13:05 +00:00
parent 9f5f95fe87
commit 12e2fe4d94
5 changed files with 30 additions and 25 deletions

View File

@@ -1332,16 +1332,22 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int
}
/* Check for a '0' here */
if (res == '0') {
transfer:
strncpy(chan->exten, "o", sizeof(chan->exten) - 1);
if (!ast_strlen_zero(vmu->exit)) {
strncpy(chan->context, vmu->exit, sizeof(chan->context) - 1);
} else if (ousemacro && !ast_strlen_zero(chan->macrocontext)) {
strncpy(chan->context, chan->macrocontext, sizeof(chan->context) - 1);
transfer:
if (vmu->operator) {
strncpy(chan->exten, "o", sizeof(chan->exten) - 1);
if (!ast_strlen_zero(vmu->exit)) {
strncpy(chan->context, vmu->exit, sizeof(chan->context) - 1);
} else if (ousemacro && !ast_strlen_zero(chan->macrocontext)) {
strncpy(chan->context, chan->macrocontext, sizeof(chan->context) - 1);
}
ast_play_and_wait(chan, "transfer");
chan->priority = 0;
free_user(vmu);
return 0;
} else {
ast_play_and_wait(chan, "vm-sorry");
return 0;
}
chan->priority = 0;
free_user(vmu);
return 0;
}
if (res < 0) {
free_user(vmu);
@@ -4605,9 +4611,7 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
/* User has hung up, no options to give */
return res;
if (cmd == '0') {
/* Erase the message if 0 pushed during playback */
ast_play_and_wait(chan, "vm-deleted");
vm_delete(recordfile);
break;
} else if (cmd == '*') {
break;
}
@@ -4660,13 +4664,11 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
return 1;
#endif
case '0':
if (outsidecaller && vmu->operator) {
if (message_exists)
ast_play_and_wait(chan, "vm-msgsaved");
return cmd;
} else
cmd = ast_play_and_wait(chan, "vm-sorry");
break;
if (message_exists || recorded) {
ast_play_and_wait(chan, "vm-deleted");
vm_delete(recordfile);
}
return cmd;
default:
/* If the caller is an ouside caller, and the review option is enabled,
allow them to review the message, but let the owner of the box review

View File

@@ -368,6 +368,8 @@ static inline int ast_mutex_trylock(ast_mutex_t *pmutex)
#define AST_MUTEX_INITIALIZER __use_AST_MUTEX_DEFINE_STATIC_rather_than_AST_MUTEX_INITIALIZER__
#define gethostbyname __gethostbyname__is__not__reentrant__use__ast_gethostbyname__instead__
#ifndef __linux__
#define pthread_create __use_ast_pthread_create_instead__
#endif
#endif

View File

@@ -15,6 +15,7 @@
#include <netinet/in.h>
#include <netdb.h>
#include <pthread.h>
#include <asterisk/lock.h>
static inline int ast_strlen_zero(const char *s)
{
@@ -41,7 +42,7 @@ extern int ast_utils_init(void);
#endif
#define inet_ntoa __dont__use__inet_ntoa__use__ast_inet_ntoa__instead__
#ifdef LINUX
#ifdef __linux__
#define ast_pthread_create pthread_create
#define ast_strcasestr strcasestr
#else
@@ -50,7 +51,7 @@ extern int ast_utils_init(void);
#define PTHREAD_ATTR_STACKSIZE 2097152
#endif /* PTHREAD_ATTR_STACKSIZE */
extern int ast_pthread_create(pthread_t *thread, pthread_attr_t *attr, void *(*start_routine)(void *), void *data);
#endif /* LINUX */
#endif /* __linux__ */
extern char *ast_strcasestr(const char *, const char *);

2
pbx.c
View File

@@ -4818,7 +4818,7 @@ static int pbx_builtin_background(struct ast_channel *chan, void *data)
res = ast_waitstream(chan, AST_DIGIT_ANY);
ast_stopstream(chan);
} else {
ast_log(LOG_WARNING, "ast_streamfile failed on %s fro %s\n", chan->name, (char*)data);
ast_log(LOG_WARNING, "ast_streamfile failed on %s for %s\n", chan->name, (char*)data);
res = 0;
}
}

View File

@@ -365,7 +365,7 @@ int ast_utils_init(void)
}
#ifndef LINUX
#ifndef __linux__
#undef pthread_create /* For ast_pthread_create function only */
int ast_pthread_create(pthread_t *thread, pthread_attr_t *attr, void *(*start_routine)(void *), void *data)
{
@@ -381,6 +381,8 @@ int ast_pthread_create(pthread_t *thread, pthread_attr_t *attr, void *(*start_ro
}
#endif /* ! LINUX */
/* Case-insensitive substring matching */
#ifndef LINUX
static char *upper(const char *orig, char *buf, int bufsize)
{
int i;
@@ -394,8 +396,6 @@ static char *upper(const char *orig, char *buf, int bufsize)
return buf;
}
/* Case-insensitive substring matching */
#ifndef LINUX
char *ast_strcasestr(const char *haystack, const char *needle)
{
char *u1, *u2;