Merge tilghman's meetme fix for reentering pin (bug #2143)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3520 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2004-07-27 03:08:00 +00:00
parent e4d4c93bd8
commit 1394a78bd6

View File

@@ -1324,33 +1324,44 @@ static int conf_exec(struct ast_channel *chan, void *data)
confno[0] = '\0'; confno[0] = '\0';
} else { } else {
if (!ast_strlen_zero(cnf->pin)) { if (!ast_strlen_zero(cnf->pin)) {
char pin[AST_MAX_EXTENSION]; char pin[AST_MAX_EXTENSION]="";
int j;
if (*the_pin) { /* Allow the pin to be retried up to 3 times */
strncpy(pin, the_pin, sizeof(pin) - 1); for (j=0; j<3; j++) {
res = 0; if (*the_pin) {
} else { strncpy(pin, the_pin, sizeof(pin) - 1);
/* Prompt user for pin if pin is required */ res = 0;
res = ast_app_getdata(chan, "conf-getpin", pin, sizeof(pin) - 1, 0);
}
if (res >= 0) {
if (!strcasecmp(pin, cnf->pin)) {
/* Pin correct */
allowretry = 0;
/* Run the conference */
res = conf_run(chan, cnf, confflags);
} else { } else {
/* Pin invalid */ /* Prompt user for pin if pin is required */
res = ast_streamfile(chan, "conf-invalidpin", chan->language); res = ast_app_getdata(chan, "conf-getpin", pin, sizeof(pin) - 1, 0);
if (!res) }
ast_waitstream(chan, ""); if (res >= 0) {
res = -1; if (!strcasecmp(pin, cnf->pin)) {
if (allowretry) /* Pin correct */
confno[0] = '\0'; allowretry = 0;
/* Run the conference */
res = conf_run(chan, cnf, confflags);
break;
} else {
/* Pin invalid */
res = ast_streamfile(chan, "conf-invalidpin", chan->language);
if (!res)
ast_waitstream(chan, "");
res = -1;
if (allowretry)
confno[0] = '\0';
}
} else {
res = -1;
allowretry = 0;
break;
}
/* Don't retry pin with a static pin */
if (*the_pin) {
break;
} }
} else {
res = -1;
allowretry = 0;
} }
} else { } else {
/* No pin required */ /* No pin required */