Thread fixes, vm fix (bug #2665)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4030 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.2-netsec
Mark Spencer 21 years ago
parent 9f5f95fe87
commit 12e2fe4d94

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

@ -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 AST_MUTEX_INITIALIZER __use_AST_MUTEX_DEFINE_STATIC_rather_than_AST_MUTEX_INITIALIZER__
#define gethostbyname __gethostbyname__is__not__reentrant__use__ast_gethostbyname__instead__ #define gethostbyname __gethostbyname__is__not__reentrant__use__ast_gethostbyname__instead__
#ifndef __linux__
#define pthread_create __use_ast_pthread_create_instead__ #define pthread_create __use_ast_pthread_create_instead__
#endif
#endif #endif

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

@ -4818,7 +4818,7 @@ static int pbx_builtin_background(struct ast_channel *chan, void *data)
res = ast_waitstream(chan, AST_DIGIT_ANY); res = ast_waitstream(chan, AST_DIGIT_ANY);
ast_stopstream(chan); ast_stopstream(chan);
} else { } 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; res = 0;
} }
} }

@ -365,7 +365,7 @@ int ast_utils_init(void)
} }
#ifndef LINUX #ifndef __linux__
#undef pthread_create /* For ast_pthread_create function only */ #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) 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 */ #endif /* ! LINUX */
/* Case-insensitive substring matching */
#ifndef LINUX
static char *upper(const char *orig, char *buf, int bufsize) static char *upper(const char *orig, char *buf, int bufsize)
{ {
int i; int i;
@ -394,8 +396,6 @@ static char *upper(const char *orig, char *buf, int bufsize)
return buf; return buf;
} }
/* Case-insensitive substring matching */
#ifndef LINUX
char *ast_strcasestr(const char *haystack, const char *needle) char *ast_strcasestr(const char *haystack, const char *needle)
{ {
char *u1, *u2; char *u1, *u2;

Loading…
Cancel
Save