[Asterisk-Users] app_festival not cleaning up properly?
John Laur
johnl at blurbco.com
Thu Jul 3 00:28:47 MST 2003
I am still poking at app_festival a little bit and have found a problem
I don't really understand, and therefore, I don't really know what to
try to do about fixing it. I have done a lot of things in the code, but
the best I can do is rewrite a bunch of stuff and still have the
problem. Perhaps someone more familiar with the * internals can lend
some in helping me to understand what might be going on so I can fix it
:)
The problem is that after the Festival application executes, it
sometimes leaves the channel in such a state that the next application
called will always fail (return -1) for reasons I have not been able to
determine. The biggest head scratcher is that this seems to be more
likely to occur the more extensions are making calls to app_festival at
the same time. This bug is unrelated to the app_festival.c patch I
submitted yesterday, though testing with FestivalBG seemed to cause the
problem to happen more often - but that is because since the stream is
interruptable, you can get a lot more calls to Festival going.
Here is a minimal AGI that you can use to duplicate the bug (I am using
asterisk-perl 0.06)
#!/usr/bin/perl
use Asterisk::AGI;
my $AGI = new Asterisk::AGI;
my %input = $AGI->ReadParse();
$AGI->answer();
while ($tries < 100) {
# Use FesivalBG instead of Festival to make the problem easier
to see
# if you have applied my Festival patch.
my $retval = chr($AGI->exec('Festival', '"i"'));
print STDERR "$$: Festival returned: ($retval)\n";
my $input = chr($AGI->wait_for_digit('5000'));
print STDERR "$$: Button pressed: ($input)\n";
$tries++;
}
$AGI->hangup();
Set up an extension to call this AGI and then call it from one or more
phones. (the more channels you get on it the easier it is to duplicate
the problem, though it will very rarely occur with only one active
channel in the system). Begin pressing a DTMF digit as rapidly as
possible on all phones, and eventually you will see that the agi call to
wait_for_digit will fail, return -1, and your channel will hang up. This
may happen on one or more of the phones at the same time.
I originally thought that perhaps connections to the festival server had
to be serialized, but this seems not to be needed as festival forks a
new child to handle each connection. Plus, the problem also happens when
reading festival speech from the cache that app_festival can create, and
that action most definitely does not need to be serialized.
Thanks anyone, for any insight you can offer... I am beginning to
understand the * internals a lot better after today, but still have a
long way to go obviously!
John Laur
More information about the asterisk-users
mailing list