These mods are to solve the problem in bug 7506. It's a lot of rework to solve a fairly small problem... such is life.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@47303 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Steve Murphy
2006-11-07 23:46:41 +00:00
parent b3bf131dd8
commit 517978fd5f
23 changed files with 254 additions and 165 deletions

View File

@@ -549,7 +549,8 @@ static struct ast_channel *local_new(struct local_pvt *p, int state)
int randnum = ast_random() & 0xffff, fmt = 0;
/* Allocate two new Asterisk channels */
if (!(tmp = ast_channel_alloc(1)) || !(tmp2 = ast_channel_alloc(1))) {
if (!(tmp = ast_channel_alloc(1, state, 0, 0, "Local/%s@%s-%04x,1", p->exten, p->context, randnum))
|| !(tmp2 = ast_channel_alloc(1, AST_STATE_RING, 0, 0, "Local/%s@%s-%04x,2", p->exten, p->context, randnum))) {
if (tmp)
ast_channel_free(tmp);
if (tmp2)
@@ -563,12 +564,6 @@ static struct ast_channel *local_new(struct local_pvt *p, int state)
tmp->nativeformats = p->reqformat;
tmp2->nativeformats = p->reqformat;
ast_string_field_build(tmp, name, "Local/%s@%s-%04x,1", p->exten, p->context, randnum);
ast_string_field_build(tmp2, name, "Local/%s@%s-%04x,2", p->exten, p->context, randnum);
ast_setstate(tmp, state);
ast_setstate(tmp2, AST_STATE_RING);
/* Determine our read/write format and set it on each channel */
fmt = ast_best_codec(p->reqformat);
tmp->writeformat = fmt;