Modem-Vgetty

 view release on metacpan or  search on metacpan

Vgetty.pm  view on Meta::CPAN

for voice modems using the B<vgetty(8)> or B<vm(8)> package. The answering
machines and sofisticated voice applications can be written using this
module.

=head1 OVERVIEW

I<Voice modem> is a special kind of modem, which (besides the normal
data and/or fax mode) can communicate also in voice mode. It means
it can record sounds it hears from the phone line to the file,
Play-back recorded files, it can beep to the line, and it can detect
various standard sounds coming from the line (busy tone, silence,
dual tone modulation frequency (DTMF) keypad tones, etc).
An example of the voice modem can be the ZyXEL U1496, US Robotics
Sportster (not Courier), etc.

To use this software with the voice modem you need to have the
B<vgetty(8)> package installed. B<Vgetty> is distributed as a part of
B<mgetty> package. In fact, B<vgetty> is a B<mgetty(8)> with the voice
extensions. Vgetty has some support for scripting - when it receives
an incoming call, it runs a voice shell (it is program specified in
the B<voice.conf> file) as its child process, establishes the read

Vgetty.pm  view on Meta::CPAN

file. It changes the state to "PLAYING" and returns "READY" after
playing the whole file.

=item record($filename)

The B<vgetty> records the voice it can hear on the line to the given file.
It uses the raw modem data format (which can be re-played using the
B<play> subroutine). B<vgetty> changes its state to "RECORDING" and
you need to manually stop the recording using the B<stop> method
after some time (or, you can set B<autostop> and wait for any event
- silence, busy tone, etc).

=item wait($seconds)

The modem waits for a given number of seconds. Changes its state to
"WAITING" and returns "READY" after the wait is finished. Example:

	$v->wait(5);
	$v->waitfor('READY');

=item stop

Vgetty.pm  view on Meta::CPAN

documentation):

=over 4

=item BONG_TONE

The modem detected a bong tone on the line.

=item BUSY_TONE

The modem detected busy tone on the line (when dialing to the busy
number or when caller finished the call).

=item CALL_WAITING

Defined in IS-101 (I think it is when the line receives another call-in
when some call is already in progress. -Yenya).

=item DIAL_TONE

The modem detected dial tone on the line.

Vgetty.pm  view on Meta::CPAN

		$v->record("/path/$num.rmd");
		alarm $tmout;
		$v->waitfor('READY');
	}
	system "echo 'Play with rmdtopvf /path/$num.rmd|pvftoau >/dev/audio'" .
		 " | mail -s 'New voice message' $voicemaster";
        exit 0;

See the B<examples/answering_machine.pl> in the source distribution,
which contains a more configurable version of the above text.
It first sets the event handlers for the case of busy tone (the caller
hangs up) or silence (the caller doesn't speak at all). The handler
stops B<vgetty> from anything it is currently doing and sets the $finish
variable to 1. Then the reception of the events is enabled and 
the welcome message is played. Then the answering machine beeps
and starts to record the message. Note that we need to check the
$finish variable before we start recording to determine if user
hanged up the phone. Now we find the first filename <number>.rmd
such that this file does not exist and we start to record the message
to this file. We record until user hangs up the phone or until
the timeout occurs.



( run in 0.313 second using v1.01-cache-2.11-cpan-87723dcf8b7 )