diff --git a/channels/chan_agent.c b/channels/chan_agent.c index 8473b13378..481485c280 100755 --- a/channels/chan_agent.c +++ b/channels/chan_agent.c @@ -1422,55 +1422,6 @@ static int agents_show(int fd, int argc, char **argv) return RESULT_SUCCESS; } -static int agent_logoff(int fd, int argc, char **argv) -{ - struct agent_pvt *p = NULL; - char *line = NULL; - int res = 0; - - /* Check args */ - if (argc != 3) - return RESULT_SHOWUSAGE; - - line = argv[2]; - - ast_mutex_lock(&agentlock); - p = agents; - while (p) { - ast_mutex_lock(&p->lock); - res = strcmp(p->agent, line); - - if (!res) { - /* Found him! Now we're going to kill him. */ - - if (ast_strlen_zero(p->loginchan)) { - ast_cli(fd, "Agent %s already logged off the system.\n", line); - ast_mutex_unlock(&p->lock); - break; - } - - strcpy(p->loginchan, ""); /* Bang! Killed him */ - ast_cli(fd, "Agent %s successfully logged off.\n", line); - ast_mutex_unlock(&p->lock); - break; - } - - ast_mutex_unlock(&p->lock); - p = p->next; - } - ast_mutex_unlock(&agentlock); - if (res) ast_cli(fd, "Unable to find agent %s.\n", line); - return RESULT_SUCCESS; -} - -static char agent_logoff_usage[] = -"Usage: agent logoff \n" -" Log an agent off the system that maybe forgot to log off, etc....\n"; - -static struct ast_cli_entry cli_agent_logoff = { - { "agent", "logoff", NULL }, agent_logoff, - "Log an agent off of the system", agent_logoff_usage, NULL}; - static char show_agents_usage[] = "Usage: show agents\n" " Provides summary information on agents.\n"; diff --git a/pbx.c b/pbx.c index 7b876035da..77fdfc4614 100755 --- a/pbx.c +++ b/pbx.c @@ -182,6 +182,7 @@ static int pbx_builtin_setglobalvar(struct ast_channel *, void *); static int pbx_builtin_noop(struct ast_channel *, void *); static int pbx_builtin_gotoif(struct ast_channel *, void *); static int pbx_builtin_gotoiftime(struct ast_channel *, void *); +static int pbx_builtin_execiftime(struct ast_channel *, void *); static int pbx_builtin_saynumber(struct ast_channel *, void *); static int pbx_builtin_saydigits(struct ast_channel *, void *); static int pbx_builtin_saycharacters(struct ast_channel *, void *); @@ -289,6 +290,14 @@ static struct pbx_builtin { "extension. Each of the elements may be specified either as '*' (for always)\n" "or as a range. See the 'include' syntax for details." }, + + { "ExecIfTime", pbx_builtin_execiftime, + "Conditional application execution on current time", + " ExecIfTime(|||?[|]):\n" + "If the current time matches the specified time, then execute the specified\n" + "application. Each of the elements may be specified either as '*' (for always)\n" + "or as a range. See the 'include' syntax for details." + }, { "Hangup", pbx_builtin_hangup, "Unconditional hangup", @@ -5004,21 +5013,65 @@ static int pbx_builtin_gotoiftime(struct ast_channel *chan, void *data) char *s, *ts; struct ast_timing timing; - if (!data) { + if (!data || ast_strlen_zero(data)) { ast_log(LOG_WARNING, "GotoIfTime requires an argument:\n