diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-11-06 19:44:39 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-11-06 19:44:39 +0000 |
commit | 6ff992925a6efc38cd42bc2a61d63f0ef30d49b9 (patch) | |
tree | c298449e260dde9595e327b5ef13a287e88ce346 /apps | |
parent | 4eff003f9d9b1111a2109e213aed3fa613d8d428 (diff) |
issue #5627, with mods
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6986 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rwxr-xr-x | apps/app_lookupblacklist.c | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/apps/app_lookupblacklist.c b/apps/app_lookupblacklist.c index aafa81336..fa5d48116 100755 --- a/apps/app_lookupblacklist.c +++ b/apps/app_lookupblacklist.c @@ -42,6 +42,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/image.h" #include "asterisk/callerid.h" #include "asterisk/astdb.h" +#include "asterisk/options.h" static char *tdesc = "Look up Caller*ID name/number from blacklist database"; @@ -50,13 +51,15 @@ static char *app = "LookupBlacklist"; static char *synopsis = "Look up Caller*ID name/number from blacklist database"; static char *descrip = - " LookupBlacklist: Looks up the Caller*ID number on the active\n" - "channel in the Asterisk database (family 'blacklist'). If the\n" - "number is found, and if there exists a priority n + 101,\n" - "where 'n' is the priority of the current instance, then the\n" - "channel will be setup to continue at that priority level.\n" - "Otherwise, it returns 0. Does nothing if no Caller*ID was received on the\n" + " LookupBlacklist(options): Looks up the Caller*ID number on the active\n" + "channel in the Asterisk database (family 'blacklist'). \n" + "Returns 0. Does nothing if no Caller*ID was received on the\n" "channel.\n" + "The option string may contain zero or the following character:\n" + " 'j' -- jump to n+101 priority if the number/name is found in the blacklist\n" + "This application sets the following channel variable upon completion:\n" + " LOOKUPBLSTATUS The status of the Blacklist lookup as a text string, one of\n" + " FOUND | NOTFOUND\n" "Example: database put blacklist <name/number> 1\n"; STANDARD_LOCAL_USER; @@ -69,30 +72,39 @@ lookupblacklist_exec (struct ast_channel *chan, void *data) char blacklist[1]; struct localuser *u; int bl = 0; + int priority_jump = 0; + + LOCAL_USER_ADD(u); + + if (!ast_strlen_zero(data)) { + if (strchr(data, 'j')) + priority_jump = 1; + } - LOCAL_USER_ADD (u); - if (chan->cid.cid_num) - { - if (!ast_db_get ("blacklist", chan->cid.cid_num, blacklist, sizeof (blacklist))) - { + if (chan->cid.cid_num) { + if (!ast_db_get("blacklist", chan->cid.cid_num, blacklist, sizeof (blacklist))) { if (option_verbose > 2) ast_log(LOG_NOTICE, "Blacklisted number %s found\n",chan->cid.cid_num); bl = 1; } } if (chan->cid.cid_name) { - if (!ast_db_get ("blacklist", chan->cid.cid_name, blacklist, sizeof (blacklist))) - { + if (!ast_db_get("blacklist", chan->cid.cid_name, blacklist, sizeof (blacklist))) { if (option_verbose > 2) ast_log (LOG_NOTICE,"Blacklisted name \"%s\" found\n",chan->cid.cid_name); bl = 1; } } - - if (bl) - ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101); - LOCAL_USER_REMOVE (u); + if (bl) { + if (priority_jump || option_priority_jumping) + ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101); + pbx_builtin_setvar_helper(chan, "LOOKUPBLSTATUS", "FOUND"); + } else + pbx_builtin_setvar_helper(chan, "LOOKUPBLSTATUS", "NOTFOUND"); + + LOCAL_USER_REMOVE(u); + return 0; } |