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

@@ -910,7 +910,10 @@ static struct ast_channel *agent_new(struct agent_pvt *p, int state)
return NULL;
}
#endif
tmp = ast_channel_alloc(0);
if (p->pending)
tmp = ast_channel_alloc(0, state, 0, 0, "Agent/P%s-%d", p->agent, ast_random() & 0xffff);
else
tmp = ast_channel_alloc(0, state, 0, 0, "Agent/%s", p->agent);
if (!tmp) {
ast_log(LOG_WARNING, "Unable to allocate agent channel structure\n");
return NULL;
@@ -934,12 +937,7 @@ static struct ast_channel *agent_new(struct agent_pvt *p, int state)
tmp->readformat = AST_FORMAT_SLINEAR;
tmp->rawreadformat = AST_FORMAT_SLINEAR;
}
if (p->pending)
ast_string_field_build(tmp, name, "Agent/P%s-%d", p->agent, ast_random() & 0xffff);
else
ast_string_field_build(tmp, name, "Agent/%s", p->agent);
/* Safe, agentlock already held */
ast_setstate(tmp, state);
tmp->tech_pvt = p;
p->owner = tmp;
/* XXX: this needs fixing */