dect
/
asterisk
Archived
13
0
Fork 0

Create/dial channel if availability is on callback channel

git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1379 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
markster 2003-08-19 21:14:16 +00:00
parent 19a20ea455
commit 2751b576c2
1 changed files with 15 additions and 1 deletions

View File

@ -707,7 +707,21 @@ static int check_availability(struct agent_pvt *newlyavailable, int needlock)
if (!p->abouttograb && p->pending && ((p->group && (newlyavailable->group & p->group)) || !strcmp(p->agent, newlyavailable->agent))) {
ast_log(LOG_DEBUG, "Call '%s' looks like a winner for agent '%s'\n", p->owner->name, newlyavailable->agent);
/* We found a pending call, time to merge */
chan = agent_new(newlyavailable, AST_STATE_DOWN);
if (strlen(newlyavailable->loginchan)) {
/* Adjustable agent */
newlyavailable->chan = ast_request("Local", AST_FORMAT_SLINEAR, newlyavailable->loginchan);
if (newlyavailable->chan) {
if (agent_call(newlyavailable->chan, newlyavailable->loginchan, 0))
ast_log(LOG_WARNING, "Call failed on channel '%s'\n", newlyavailable->chan->name);
chan = agent_new(p, AST_STATE_DOWN);
} else {
ast_log(LOG_WARNING, "I didn't expect to ever get here...\n");
ast_mutex_unlock(&p->lock);
p = p->next;
continue;
}
} else
chan = agent_new(newlyavailable, AST_STATE_DOWN);
parent = p->owner;
p->abouttograb = 1;
ast_mutex_unlock(&p->lock);