aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-09-20 23:01:50 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-09-20 23:01:50 +0000
commit69aae03f564bd37085da1f12d31c7a6d0e19ac93 (patch)
tree7677255d7b0e954ef54e63a19f83543825830494
parentb2013708826cdefda6473e78a2e9838ca408e426 (diff)
merge down mark's users.conf fixes
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@43392 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--channels/chan_agent.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index 148da4266..92027fb5e 100644
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -1006,9 +1006,13 @@ static struct ast_channel *agent_new(struct agent_pvt *p, int state)
static int read_agent_config(void)
{
struct ast_config *cfg;
+ struct ast_config *ucfg;
struct ast_variable *v;
struct agent_pvt *p;
const char *general_val;
+ const char *catname;
+ const char *hasagent;
+ int genhasagent;
group = 0;
autologoff = 0;
@@ -1104,6 +1108,28 @@ static int read_agent_config(void)
}
v = v->next;
}
+ if ((ucfg = ast_config_load("users.conf"))) {
+ genhasagent = ast_true(ast_variable_retrieve(ucfg, "general", "hasagent"));
+ catname = ast_category_browse(ucfg, NULL);
+ while(catname) {
+ if (strcasecmp(catname, "general")) {
+ hasagent = ast_variable_retrieve(ucfg, catname, "hasagent");
+ if (ast_true(hasagent) || (!hasagent && genhasagent)) {
+ char tmp[256];
+ const char *fullname = ast_variable_retrieve(ucfg, catname, "fullname");
+ const char *secret = ast_variable_retrieve(ucfg, catname, "secret");
+ if (!fullname)
+ fullname = "";
+ if (!secret)
+ secret = "";
+ snprintf(tmp, sizeof(tmp), "%s,%s,%s", catname, secret,fullname);
+ add_agent(tmp, 0);
+ }
+ }
+ catname = ast_category_browse(ucfg, catname);
+ }
+ ast_config_destroy(ucfg);
+ }
AST_LIST_TRAVERSE_SAFE_BEGIN(&agents, p, list) {
if (p->dead) {
AST_LIST_REMOVE_CURRENT(&agents, list);