[asterisk-commits] mvanbaak: branch mvanbaak/privacymanager_check_context r120497 - /team/mvanba...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jun 4 16:21:21 CDT 2008
Author: mvanbaak
Date: Wed Jun 4 16:21:21 2008
New Revision: 120497
URL: http://svn.digium.com/view/asterisk?view=rev&rev=120497
Log:
came up with this while waiting for my microwave to nuke my second plate of dinner.
Lets commit it to test it on my testbox
Modified:
team/mvanbaak/privacymanager_check_context/apps/app_privacy.c
Modified: team/mvanbaak/privacymanager_check_context/apps/app_privacy.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/privacymanager_check_context/apps/app_privacy.c?view=diff&rev=120497&r1=120496&r2=120497
==============================================================================
--- team/mvanbaak/privacymanager_check_context/apps/app_privacy.c (original)
+++ team/mvanbaak/privacymanager_check_context/apps/app_privacy.c Wed Jun 4 16:21:21 2008
@@ -46,13 +46,14 @@
static char *synopsis = "Require phone number to be entered, if no CallerID sent";
static char *descrip =
- " PrivacyManager([maxretries][,minlength]): If no Caller*ID \n"
+ " PrivacyManager([maxretries][,minlength][,context]): If no Caller*ID \n"
"is sent, PrivacyManager answers the channel and asks the caller to\n"
"enter their phone number. The caller is given 'maxretries' attempts to do so.\n"
"The application does nothing if Caller*ID was received on the channel.\n"
" maxretries default 3 -maximum number of attempts the caller is allowed \n"
" to input a callerid.\n"
" minlength default 10 -minimum allowable digits in the input callerid number.\n"
+ " context context to check the given Caller*ID againts patterns.\n"
"The application sets the following channel variable upon completion: \n"
"PRIVACYMGRSTATUS The status of the privacy manager's attempt to collect \n"
" a phone number from the user. A text string that is either:\n"
@@ -66,12 +67,14 @@
int retries;
int maxretries = 3;
int minlength = 10;
+ char checkcontext[AST_MAX_CONTEXT];
int x = 0;
char phone[30];
char *parse = NULL;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(maxretries);
AST_APP_ARG(minlength);
+ AST_APP_ARG(checkcontext);
AST_APP_ARG(options);
);
@@ -101,6 +104,12 @@
else
ast_log(LOG_WARNING, "Invalid min length argument\n");
}
+ if (args.checkcontext) {
+ if (sscanf(args.checkcontext, "%s", &x) == 1)
+ checkcontext = x;
+ else
+ ast_log(LOG_WARNING, "Invalid check context argument\n");
+ }
}
@@ -126,7 +135,15 @@
/* Make sure we get at least digits */
if (strlen(phone) >= minlength )
- break;
+ if (checkcontext) {
+ res = ast_exists_extension(NULL, checkcontext, phone, 1);
+ if (!res)
+ res = ast_waitstream(chan, "");
+ else
+ break;
+ } else {
+ break;
+ }
else {
res = ast_streamfile(chan, "privacy-incorrect", chan->language);
if (!res)
More information about the asterisk-commits
mailing list