dtmf tones and vgetty
Jan Kasprzak (kas@informatics.muni.cz)
Sun, 25 Oct 1998 01:30:06 +0200
Gert Doering wrote:
: hi,
:
: On Thu, Oct 22, 1998 at 09:59:12AM +0200, L. Whiteside wrote:
: > I am currently using vgetty with a call program to recognise dtmf
: > sequences and then perform various functions. The modem is a USR
: > sportster.
: >
: > Does anyone know if it is possible to recognise dtmf while an outgoing
: > message is playing, rather than just once it has finished.(although
: > still allow it to be entered once the message has fished)
:
: Should work. I think you just have to enable the "event handler" from the
: "voice shell code". Marc (one of you :) ), any more detailed instructions?
It works. In Perl (Modem::Vgetty) just register the appropriate
event handler for RECEIVED_DTMF event and $v->play_and_wait() the message.
The event handler can for example stop the playing ($v->stop()) and enter
the wait mode ($v->wait($seconds)).
The simple case of receiving a single DTMF key is the following
(in Perl, written without testing :-):
use Modem::Vgetty;
my $v = new Modem::Vgetty;
my $tone = undef;
sub handler {
my $self = shift;
my $event = shift;
$tone = shift;
$self->stop;
}
$v->add_handler('RECEIVED_DTMF', 'tone', \&handler);
$v->enable_events;
$v->play_and_wait($message);
if ($tone ne '') {
$v->wait($timeout);
$v->waitfor('READY');
}
-Yenya
--
\ Jan "Yenya" Kasprzak <kas at fi.muni.cz> http://www.fi.muni.cz/~kas/
\\ PGP: finger kas at aisa.fi.muni.cz 0D99A7FB206605D7 8B35FCDE05B18A5E //
\\\ Czech Linux Homepage: http://www.linux.cz/ ///
/// I think I'd rather be forced to learn perl than 68020 MMU. -Alan Cox \\\