diff --git a/ChangeLog b/ChangeLog index 9b50a1aad911d9a93257bda0d9c4fe0af8b16162..061d07e79d7ef1af6e6bca3865e8c61fe744a859 100755 --- a/ChangeLog +++ b/ChangeLog @@ -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> diff --git a/apps/app_lookupblacklist.c b/apps/app_lookupblacklist.c index aafa81336f44628192af02771a05990ba5bd4d4f..fa5d48116a9a794d7d6f1870945047e51f59fdef 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; }