Issue 8971 - Allow DISA input to be ended with a '#'.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@68854 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.6.0
Tilghman Lesher 19 years ago
parent bd3de6d0f1
commit f314fa039b

@ -47,6 +47,9 @@ Applications:
performs mostly a 'ChanExists' sort of function. performs mostly a 'ChanExists' sort of function.
* SetCallerPres() has been replaced with the CALLERPRES() dialplan function * SetCallerPres() has been replaced with the CALLERPRES() dialplan function
and is now deprecated. and is now deprecated.
* DISA()'s fifth argument is now an options argument. If you have previously
used 'NOANSWER' in this argument, you'll need to convert that to the new
option 'n'.
CDR: CDR:

@ -55,47 +55,55 @@ static char *app = "DISA";
static char *synopsis = "DISA (Direct Inward System Access)"; static char *synopsis = "DISA (Direct Inward System Access)";
static char *descrip = static char *descrip =
"DISA(<numeric passcode>[|<context>]) or DISA(<filename>)\n" "DISA(<numeric passcode>[|<context>[|<cid>[|mailbox[|options]]]]) or\n"
"The DISA, Direct Inward System Access, application allows someone from \n" "DISA(<filename>[||||options])\n"
"outside the telephone switch (PBX) to obtain an \"internal\" system \n" "The DISA, Direct Inward System Access, application allows someone from \n"
"dialtone and to place calls from it as if they were placing a call from \n" "outside the telephone switch (PBX) to obtain an \"internal\" system \n"
"within the switch.\n" "dialtone and to place calls from it as if they were placing a call from \n"
"DISA plays a dialtone. The user enters their numeric passcode, followed by\n" "within the switch.\n"
"the pound sign (#). If the passcode is correct, the user is then given\n" "DISA plays a dialtone. The user enters their numeric passcode, followed by\n"
"system dialtone on which a call may be placed. Obviously, this type\n" "the pound sign (#). If the passcode is correct, the user is then given\n"
"of access has SERIOUS security implications, and GREAT care must be\n" "system dialtone within <context> on which a call may be placed. If the user\n"
"taken NOT to compromise your security.\n\n" "enters an invalid extension and extension \"i\" exists in the specified\n"
"There is a possibility of accessing DISA without password. Simply\n" "context, it will be used.\n"
"exchange your password with \"no-password\".\n\n" "\n"
" Example: exten => s,1,DISA(no-password|local)\n\n" "If you need to present a DISA dialtone without entering a password, simply\n"
"Be aware that using this compromises the security of your PBX.\n\n" "set <passcode> to \"no-password\".\n"
"The arguments to this application (in extensions.conf) allow either\n" "\n"
"specification of a single global passcode (that everyone uses), or\n" "Be aware that using this may compromise the security of your PBX.\n"
"individual passcodes contained in a file. It also allows specification\n" "\n"
"of the context on which the user will be dialing. If no context is\n" "The arguments to this application (in extensions.conf) allow either\n"
"specified, the DISA application defaults the context to \"disa\".\n" "specification of a single global passcode (that everyone uses), or\n"
"Presumably a normal system will have a special context set up\n" "individual passcodes contained in a file.\n"
"for DISA use with some or a lot of restrictions. \n\n" "\n"
"The file that contains the passcodes (if used) allows specification\n" "The file that contains the passcodes (if used) allows a complete\n"
"of either just a passcode (defaulting to the \"disa\" context, or\n" "specification of all of the same arguments available on the command\n"
"passcode|context on each line of the file. The file may contain blank\n" "line, with the sole exception of the options. The file may contain blank\n"
"lines, or comments starting with \"#\" or \";\". In addition, the\n" "lines, or comments starting with \"#\" or \";\".\n"
"above arguments may have |new-callerid-string appended to them, to\n" "\n"
"specify a new (different) callerid to be used for this call, for\n" "<context> specifies the dialplan context in which the user-entered extension\n"
"example: numeric-passcode|context|\"My Phone\" <(234) 123-4567> or \n" "will be matched. If no context is specified, the DISA application defaults\n"
"full-pathname-of-passcode-file|\"My Phone\" <(234) 123-4567>. Last\n" "the context to \"disa\". Presumably a normal system will have a special\n"
"but not least, |mailbox[@context] may be appended, which will cause\n" "context set up for DISA use with some or a lot of restrictions.\n"
"a stutter-dialtone (indication \"dialrecall\") to be used, if the\n" "\n"
"specified mailbox contains any new messages, for example:\n" "<cid> specifies a new (different) callerid to be used for this call.\n"
"numeric-passcode|context||1234 (w/a changing callerid). Note that\n" "\n"
"in the case of specifying the numeric-passcode, the context must be\n" "<mailbox[@context]> will cause a stutter-dialtone (indication \"dialrecall\")\n"
"specified if the callerid is specified also.\n\n" "to be used, if the specified mailbox contains any new messages.\n"
"If login is successful, the application looks up the dialed number in\n" "\n"
"the specified (or default) context, and executes it if found.\n" "The following options are available:\n"
"If the user enters an invalid extension and extension \"i\" (invalid) \n" " n - the DISA application will not answer initially.\n"
"exists in the context, it will be used. Also, if you set the 5th argument\n" " p - the extension entered will be considered complete when a '#' is entered.\n";
"to 'NOANSWER', the DISA application will not answer initially.\n";
enum {
NOANSWER_FLAG = (1 << 0),
POUND_TO_END_FLAG = (1 << 1),
} option_flags;
AST_APP_OPTIONS(app_opts, {
AST_APP_OPTION('n', NOANSWER_FLAG),
AST_APP_OPTION('p', POUND_TO_END_FLAG),
});
static void play_dialtone(struct ast_channel *chan, char *mailbox) static void play_dialtone(struct ast_channel *chan, char *mailbox)
{ {
@ -116,6 +124,7 @@ static int disa_exec(struct ast_channel *chan, void *data)
int firstdigittimeout = 20000; int firstdigittimeout = 20000;
int digittimeout = 10000; int digittimeout = 10000;
struct ast_module_user *u; struct ast_module_user *u;
struct ast_flags flags;
char *tmp, exten[AST_MAX_EXTENSION],acctcode[20]=""; char *tmp, exten[AST_MAX_EXTENSION],acctcode[20]="";
char pwline[256]; char pwline[256];
char ourcidname[256],ourcidnum[256]; char ourcidname[256],ourcidnum[256];
@ -129,7 +138,7 @@ static int disa_exec(struct ast_channel *chan, void *data)
AST_APP_ARG(context); AST_APP_ARG(context);
AST_APP_ARG(cid); AST_APP_ARG(cid);
AST_APP_ARG(mailbox); AST_APP_ARG(mailbox);
AST_APP_ARG(noanswer); AST_APP_ARG(options);
); );
if (ast_strlen_zero(data)) { if (ast_strlen_zero(data)) {
@ -168,13 +177,14 @@ static int disa_exec(struct ast_channel *chan, void *data)
args.context = "disa"; args.context = "disa";
if (ast_strlen_zero(args.mailbox)) if (ast_strlen_zero(args.mailbox))
args.mailbox = ""; args.mailbox = "";
if (!ast_strlen_zero(args.options))
ast_app_parse_options(app_opts, &flags, NULL, args.options);
if (option_debug) if (option_debug)
ast_log(LOG_DEBUG, "Mailbox: %s\n",args.mailbox); ast_log(LOG_DEBUG, "Mailbox: %s\n",args.mailbox);
special_noanswer = 0; special_noanswer = 0;
if ((!args.noanswer) || strcmp(args.noanswer,"NOANSWER")) if (ast_test_flag(&flags, NOANSWER_FLAG)) {
{
if (chan->_state != AST_STATE_UP) { if (chan->_state != AST_STATE_UP) {
/* answer */ /* answer */
ast_answer(chan); ast_answer(chan);
@ -315,6 +325,12 @@ static int disa_exec(struct ast_channel *chan, void *data)
continue; /* if getting password, continue doing it */ continue; /* if getting password, continue doing it */
/* if this exists */ /* if this exists */
/* user wants end of number, remove # */
if (ast_test_flag(&flags, POUND_TO_END_FLAG) && j == '#') {
exten[--i] = 0;
break;
}
if (ast_ignore_pattern(args.context, exten)) { if (ast_ignore_pattern(args.context, exten)) {
play_dialtone(chan, ""); play_dialtone(chan, "");
did_ignore = 1; did_ignore = 1;

Loading…
Cancel
Save