[asterisk-commits] branch bweschke/findme_followme r31976 -
/team/bweschke/findme_followme/apps/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sun Jun 4 01:08:21 MST 2006
Author: bweschke
Date: Sun Jun 4 03:08:21 2006
New Revision: 31976
URL: http://svn.digium.com/view/asterisk?rev=31976&view=rev
Log:
All unit tests are now passing.
Modified:
team/bweschke/findme_followme/apps/app_followme.c
Modified: team/bweschke/findme_followme/apps/app_followme.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/findme_followme/apps/app_followme.c?rev=31976&r1=31975&r2=31976&view=diff
==============================================================================
--- team/bweschke/findme_followme/apps/app_followme.c (original)
+++ team/bweschke/findme_followme/apps/app_followme.c Sun Jun 4 03:08:21 2006
@@ -103,7 +103,8 @@
char dialarg[256];
char yn[10];
int ynidx;
- int digts;
+ long digts;
+ int cleared;
AST_LIST_ENTRY(findme_user) entry;
};
@@ -353,8 +354,10 @@
{
struct findme_user *tmpuser;
- AST_LIST_TRAVERSE(findme_user_list, tmpuser, entry)
+ AST_LIST_TRAVERSE(findme_user_list, tmpuser, entry) {
clear_caller(tmpuser);
+ tmpuser->cleared = 1;
+ }
}
@@ -372,7 +375,7 @@
int *to = ast_calloc(1, sizeof(*to));
int livechannels = 0;
int tmpto;
- long totalwait = 0;
+ long totalwait = 0, wtd, towas;
char *callfromname;
char *pressbuttonname;
@@ -392,6 +395,7 @@
}
ctstatus = 0;
totalwait = nm->timeout * 1000;
+ wtd = 0;
while (!ctstatus) {
*to = 1000;
pos = 1;
@@ -402,7 +406,10 @@
winner = NULL;
AST_LIST_TRAVERSE(findme_user_list, tmpuser, entry) {
if (tmpuser->state >= 0 && tmpuser->ochan) {
- if (tmpuser->digts && (tmpuser->digts - totalwait) > featuredigittimeout) {
+ if (tmpuser->state == 3) {
+ tmpuser->digts += (towas - wtd);
+ }
+ if (tmpuser->digts && (tmpuser->digts > featuredigittimeout)) {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "We've been waiting for digits longer than we should have.\n");
tmpuser->state = 1;
@@ -420,7 +427,7 @@
tmpto = ast_sched_wait(tmpuser->ochan->sched);
if (tmpto > 0 && tmpto < *to)
*to = tmpto;
- else if (tmpto < 0) {
+ else if (tmpto < 0 && !tmpuser->ochan->timingfunc) {
ast_stopstream(tmpuser->ochan);
if (tmpuser->state == 1) {
if (option_verbose > 2)
@@ -437,7 +444,6 @@
ast_verbose(VERBOSE_PREFIX_3 "Playback of name file appears to be done.\n");
memset(tmpuser->yn, 0, sizeof(tmpuser->yn));
tmpuser->ynidx = 0;
- tmpuser->digts = 0;
if (!ast_streamfile(tmpuser->ochan, pressbuttonname, tmpuser->ochan->language)) {
tmpuser->state = 3;
@@ -448,6 +454,7 @@
} else if (tmpuser->state == 3) {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Playback of the next step file appears to be done.\n");
+ tmpuser->digts = 0;
}
}
}
@@ -457,9 +464,15 @@
}
tmpto = *to;
+ if (*to < 0) {
+ *to = 1000;
+ tmpto = 1000;
+ }
+ towas = *to;
winner = ast_waitfor_n(watchers, pos, to);
tmpto -= *to;
totalwait -= tmpto;
+ wtd = *to;
if (totalwait <= 0) {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "We've hit our timeout for this step. Drop everyone and move on to the next one. %ld\n", totalwait);
@@ -558,8 +571,7 @@
if (tmpuser && tmpuser->state == 3 && f->frametype == AST_FRAME_DTMF) {
if (winner->stream)
ast_stopstream(winner);
- if (!tmpuser->digts)
- tmpuser->digts = totalwait;
+ tmpuser->digts = 0;
if (option_debug)
ast_log(LOG_DEBUG, "DTMF received: %c\n",(char) f->subclass);
tmpuser->yn[tmpuser->ynidx] = (char) f->subclass;
@@ -729,6 +741,7 @@
if (!ast_call(outbound,dialarg,0)) {
tmpuser->ochan = outbound;
tmpuser->state = 0;
+ tmpuser->cleared = 0;
ast_copy_string(tmpuser->dialarg, dialarg, sizeof(dialarg));
AST_LIST_INSERT_TAIL(findme_user_list, tmpuser, entry);
} else {
@@ -769,7 +782,7 @@
AST_LIST_TRAVERSE_SAFE_BEGIN(findme_user_list, fmuser, entry) {
- if (winner && fmuser->ochan != winner)
+ if (!fmuser->cleared && fmuser->ochan != winner)
clear_caller(fmuser);
AST_LIST_REMOVE_CURRENT(findme_user_list, entry);
free(fmuser);
@@ -780,6 +793,11 @@
headuser = NULL;
if (winner)
break;
+
+ if (!caller) {
+ tpargs->status = 1;
+ return;
+ }
idx++;
AST_LIST_TRAVERSE(&tpargs->cnumbers, nm, entry)
More information about the asterisk-commits
mailing list