mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 20:04:50 +00:00
Properly fix double locking issue, fix wav49 issue
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1855 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1928,6 +1928,9 @@ forward_message(struct ast_channel *chan, char *context, char *dir, int curmsg,
|
||||
strncpy(tmp, fmt, sizeof(tmp));
|
||||
stringp = tmp;
|
||||
while((s = strsep(&stringp, "|"))) {
|
||||
/* XXX This is a hack -- we should use build_filename or similar XXX */
|
||||
if (!strcasecmp(s, "wav49"))
|
||||
s = "WAV";
|
||||
snprintf(sys, sizeof(sys), "cp %s/msg%04d.%s %s/msg%04d.%s\n", dir, curmsg, s, todir, todircount, s);
|
||||
ast_log(LOG_DEBUG, sys);
|
||||
system(sys);
|
||||
|
@@ -3182,7 +3182,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
|
||||
|
||||
|
||||
|
||||
static struct ast_frame *zt_exception(struct ast_channel *ast)
|
||||
static struct ast_frame *__zt_exception(struct ast_channel *ast)
|
||||
{
|
||||
struct zt_pvt *p = ast->pvt->pvt;
|
||||
int res;
|
||||
@@ -3190,7 +3190,6 @@ static struct ast_frame *zt_exception(struct ast_channel *ast)
|
||||
int index;
|
||||
struct ast_frame *f;
|
||||
|
||||
ast_mutex_lock(&p->lock);
|
||||
|
||||
index = zt_get_index(ast, p, 1);
|
||||
|
||||
@@ -3272,7 +3271,6 @@ static struct ast_frame *zt_exception(struct ast_channel *ast)
|
||||
ast_log(LOG_WARNING, "Don't know how to absorb event %s\n", event2str(res));
|
||||
}
|
||||
f = &p->subs[index].f;
|
||||
ast_mutex_unlock(&p->lock);
|
||||
return f;
|
||||
}
|
||||
if (!p->radio) ast_log(LOG_DEBUG, "Exception on %d, channel %d\n", ast->fds[0],p->channel);
|
||||
@@ -3280,10 +3278,18 @@ static struct ast_frame *zt_exception(struct ast_channel *ast)
|
||||
if (ast != p->owner) {
|
||||
ast_log(LOG_WARNING, "We're %s, not %s\n", ast->name, p->owner->name);
|
||||
f = &p->subs[index].f;
|
||||
ast_mutex_unlock(&p->lock);
|
||||
return f;
|
||||
}
|
||||
f = zt_handle_event(ast);
|
||||
return f;
|
||||
}
|
||||
|
||||
struct ast_frame *zt_exception(struct ast_channel *ast)
|
||||
{
|
||||
struct zt_pvt *p = ast->pvt->pvt;
|
||||
struct ast_frame *f;
|
||||
ast_mutex_lock(&p->lock);
|
||||
f = __zt_exception(ast);
|
||||
ast_mutex_unlock(&p->lock);
|
||||
return f;
|
||||
}
|
||||
@@ -3403,7 +3409,7 @@ struct ast_frame *zt_read(struct ast_channel *ast)
|
||||
ast_mutex_unlock(&p->lock);
|
||||
return &p->subs[index].f;
|
||||
} else if (errno == ELAST) {
|
||||
f = zt_exception(ast);
|
||||
f = __zt_exception(ast);
|
||||
} else
|
||||
ast_log(LOG_WARNING, "zt_rec: %s\n", strerror(errno));
|
||||
}
|
||||
@@ -3412,7 +3418,7 @@ struct ast_frame *zt_read(struct ast_channel *ast)
|
||||
}
|
||||
if (res != (p->subs[index].linear ? READ_SIZE * 2 : READ_SIZE)) {
|
||||
ast_log(LOG_DEBUG, "Short read (%d/%d), must be an event...\n", res, p->subs[index].linear ? READ_SIZE * 2 : READ_SIZE);
|
||||
f = zt_exception(ast);
|
||||
f = __zt_exception(ast);
|
||||
ast_mutex_unlock(&p->lock);
|
||||
return f;
|
||||
}
|
||||
|
Reference in New Issue
Block a user