[svn-commits] russell: branch russell/events r74124 - /team/russell/events/channels/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Mon Jul 9 13:48:27 CDT 2007
Author: russell
Date: Mon Jul 9 13:48:26 2007
New Revision: 74124
URL: http://svn.digium.com/view/asterisk?view=rev&rev=74124
Log:
make agent_set_state() so i can work on changing agent group state in one spot
Modified:
team/russell/events/channels/chan_agent.c
Modified: team/russell/events/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/channels/chan_agent.c?view=diff&rev=74124&r1=74123&r2=74124
==============================================================================
--- team/russell/events/channels/chan_agent.c (original)
+++ team/russell/events/channels/chan_agent.c Mon Jul 9 13:48:26 2007
@@ -692,6 +692,11 @@
snprintf(buf, sizeof(buf), "%s_%s", GETAGENTBYCALLERID, callerid);
pbx_builtin_setvar_helper(NULL, buf, agent);
+}
+
+static void agent_set_state(struct agent_pvt *pvt, enum ast_device_state state)
+{
+ ast_devstate_changed(state, "Agent/%s", pvt->agent);
}
static int agent_hangup(struct ast_channel *ast)
@@ -773,7 +778,7 @@
if (persistent_agents)
dump_agents();
} else {
- ast_devstate_changed(AST_DEVICE_NOT_INUSE, "Agent/%s", p->agent);
+ agent_set_state(p, AST_DEVICE_NOT_INUSE);
}
if (p->pending) {
@@ -970,7 +975,7 @@
CRASH;
}
}
- ast_devstate_changed(AST_DEVICE_BUSY, "Agent/%s", p->agent);
+ agent_set_state(p, AST_DEVICE_BUSY);
return tmp;
}
@@ -1448,7 +1453,7 @@
set_agentbycallerid(p->logincallerid, NULL);
p->loginchan[0] ='\0';
p->logincallerid[0] = '\0';
- ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "Agent/%s", p->agent);
+ agent_set_state(p, AST_DEVICE_UNAVAILABLE);
if (persistent_agents)
dump_agents();
@@ -1897,7 +1902,7 @@
check_availability(p, 0);
ast_mutex_unlock(&p->lock);
AST_LIST_UNLOCK(&agents);
- ast_devstate_changed(AST_DEVICE_NOT_INUSE, "Agent/%s", p->agent);
+ agent_set_state(p, AST_DEVICE_NOT_INUSE);
while (res >= 0) {
ast_mutex_lock(&p->lock);
if (p->chan != chan)
@@ -1960,8 +1965,8 @@
ast_queue_log("NONE", chan->uniqueid, agent, "AGENTLOGOFF", "%s|%ld", chan->name, logintime);
if (option_verbose > 1)
ast_verbose(VERBOSE_PREFIX_2 "Agent '%s' logged out\n", p->agent);
+ agent_set_state(p, AST_DEVICE_UNAVAILABLE);
/* If there is no owner, go ahead and kill it now */
- ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "Agent/%s", p->agent);
if (p->dead && !p->owner) {
ast_mutex_destroy(&p->lock);
ast_mutex_destroy(&p->app_lock);
@@ -2124,10 +2129,10 @@
if (cur_agent->loginstart == 0)
time(&cur_agent->loginstart);
- if(cur_agent->chan || !ast_strlen_zero(cur_agent->loginchan))
- ast_devstate_changed(AST_DEVICE_BUSY, "Agent/%s", cur_agent->agent);
+ if (cur_agent->chan || !ast_strlen_zero(cur_agent->loginchan))
+ agent_set_state(cur_agent, AST_DEVICE_BUSY);
else
- ast_devstate_changed(AST_DEVICE_NOT_INUSE, "Agent/%s", cur_agent->agent);
+ agent_set_state(cur_agent, AST_DEVICE_NOT_INUSE);
}
}
AST_LIST_UNLOCK(&agents);
More information about the svn-commits
mailing list