mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-17 07:18:15 +00:00
issue #5627, with mods
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6986 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -5,12 +5,7 @@
|
||||
* sounds.txt: Add missing words from the description of the vm-opts prompt
|
||||
* apps/app_externalivr.c: Add a space that fixes building on older versions of gcc
|
||||
* many files: Add doxygen updates to categorize modules into groups. Convert a lot of comments over to doxygen style. Add some text giving a basic overview of channels.
|
||||
* apps/app_chanisavail.c: Make priority jumping optional
|
||||
* apps/app_db.c: Add an exit status variable, and make priority jumping optional
|
||||
* apps/app_enumlookup.c: Make priority jumping optional
|
||||
* apps/app_groupcount.c: Add an exit status variable, make priority jumping optional, and use new args parsing macros
|
||||
* apps/app_image.c: Add an exit status variable, make priority jumping optional, and use new args parsing macros
|
||||
* apps/app_hasnewvoicemail.c: Add an exit status variable, make priority jumping optional, and use new args parsing macros
|
||||
* many files: Update applications to add an exit status variable, make priority jumping optional, and use new args parsing macros
|
||||
|
||||
2005-11-05 Kevin P. Fleming <kpfleming@digium.com>
|
||||
|
||||
|
||||
@@ -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 (chan->cid.cid_num)
|
||||
{
|
||||
if (!ast_db_get ("blacklist", chan->cid.cid_num, blacklist, sizeof (blacklist)))
|
||||
{
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
if (!ast_strlen_zero(data)) {
|
||||
if (strchr(data, 'j'))
|
||||
priority_jump = 1;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user