Improve FollowMe accept/decline DTMF string matching.

If you hit the wrong DTMF digit trying to accept/decline a FollowMe call,
you had to wait for the prompt to repeat to try again.

* Make FollowMe compare the last DTMF digits received to the
accept/decline matching strings.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@365951 65c4cc65-6c06-0410-ace0-fbb531ad65f3
certified/11.2
Richard Mudgett 13 years ago
parent 6125190ca1
commit 108f5fafd7

@ -887,20 +887,31 @@ static struct ast_channel *wait_for_winner(struct findme_user_listptr *findme_us
}
}
if (tmpuser && tmpuser->state == 3 && f->frametype == AST_FRAME_DTMF) {
int cmp_len;
if (ast_channel_stream(winner))
ast_stopstream(winner);
tmpuser->digts = 0;
ast_debug(1, "DTMF received: %c\n", (char) f->subclass.integer);
if (tmpuser->ynidx < ARRAY_LEN(tmpuser->yn) - 1) {
tmpuser->yn[tmpuser->ynidx++] = (char) f->subclass.integer;
tmpuser->yn[tmpuser->ynidx++] = f->subclass.integer;
} else {
/* Discard oldest digit. */
memmove(tmpuser->yn, tmpuser->yn + 1,
sizeof(tmpuser->yn) - 2 * sizeof(tmpuser->yn[0]));
tmpuser->yn[ARRAY_LEN(tmpuser->yn) - 2] = f->subclass.integer;
}
ast_debug(1, "DTMF string: %s\n", tmpuser->yn);
if (!strcmp(tmpuser->yn, tpargs->takecall)) {
cmp_len = strlen(tpargs->takecall);
if (cmp_len <= tmpuser->ynidx
&& !strcmp(tmpuser->yn + (tmpuser->ynidx - cmp_len), tpargs->takecall)) {
ast_debug(1, "Match to take the call!\n");
ast_frfree(f);
return tmpuser->ochan;
}
if (!strcmp(tmpuser->yn, tpargs->nextindp)) {
cmp_len = strlen(tpargs->nextindp);
if (cmp_len <= tmpuser->ynidx
&& !strcmp(tmpuser->yn + (tmpuser->ynidx - cmp_len), tpargs->nextindp)) {
ast_debug(1, "Declined to take the call.\n");
clear_caller(tmpuser);
}

@ -8,10 +8,12 @@ featuredigittimeout=>5000
takecall=>1
; The global default keypress for the callee to take taking the current call. This can be
; a single digit or multiple digits. Default is "1".
; Note this string must not be a substring of declinecall.
;
declinecall=>2
; The global default keypress for the callee to decline taking the current call. This can
; be a single digit or multiple digits. Default is "2".
; Note this string must not be a substring of takecall.
;
call_from_prompt=>followme/call-from
; The global default for the 'Incoming call from' message.
@ -55,10 +57,12 @@ number=>01233456,25
takecall=>1
; The keypress for the callee to take taking the current call. This can be
; a single digit or multiple digits. Default is the global default.
; Note this string must not be a substring of declinecall.
;
declinecall=>2
; The keypress for the callee to decline taking the current call. This can
; be a single digit or multiple digits. Default is the global default.
; Note this string must not be a substring of takecall.
;
call_from_prompt=>followme/call-from
; The 'Incoming call from' message prompt. Default is the global default.

Loading…
Cancel
Save