Most of the brains of this are in part of the MGetty port called VGetty. VGetty is a program designed to talk to voice modems to have them record and play back audio. The default mode is to pick up the phone after a few rings, play a message at the caller and record what they say in return - this is what is used here. It also supports running a script when the modem is picked up which could be used to implement a fully fledged voice mail box system.
midget# cu -l /dev/cuaa0 s 57600 Connected. ATZ OK AT#VBS=? 2,4,8 OKThe 'ATZ' command resets the modem, and the 'AT#VBS=?' command queries the modem about what ADPCM sample sizes it supports (in bits). If it is not a voice modem the second command will fail (printing ERROR).
midget# cp /tmp/voice.conf /usr/local/etc/mgetty+sendfax midget# cp /tmp/message.pl /usr/local/libexec/mgetty midget# cp /tmp/clearmsgs /tmp/msgtowav /tmp/playmsg /usr/local/bin midget# chmod 755 /usr/local/libexec/mgetty/message.pl midget# cd /usr/local/bin midget# chmod 755 clearmsgs playmsg msgtowav
cuaa0 "/usr/local/sbin/vgetty" unknown on insecure
/var/log/vgetty.cuaa0 644 7 100 * Z /var/log/vgetty_voice_shell.cuaa0 644 7 100 * Z
-- 12/17 11:50:54 aa0 vgetty: experimental test release 0.9.32 / 24Dec01 12/17 11:50:54 aa0 mgetty: experimental test release 1.1.28-Jan10 12/17 11:50:54 aa0 reading generic configuration from config file /usr/local/etc/mgetty+sendfax/voice.conf 12/17 11:50:54 aa0 reading program vgetty configuration from config file /usr/local/etc/mgetty+sendfax/voice.conf 12/17 11:50:54 aa0 reading port cuaa0 configuration from config file /usr/local/etc/mgetty+sendfax/voice.conf 12/17 11:50:54 aa0 check for lockfiles 12/17 11:50:54 aa0 locking the line 12/17 11:50:57 aa0 lowering DTR to reset Modem 12/17 11:50:57 aa0 send: ATS0=0Q0&D3&C1[0d] 12/17 11:50:57 aa0 waiting for ``OK'' ** found ** 12/17 11:50:57 aa0 mdm_send: 'ATI' 12/17 11:50:57 aa0 Generic Rockwell modem (56000) 12/17 11:50:57 aa0 mdm_send: 'ATI3' 12/17 11:50:57 aa0 mdm_send: 'ATI4' 12/17 11:50:57 aa0 additional info: '56000bps Voice Modem For Australia' 12/17 11:50:57 aa0 modem quirks: 0004 12/17 11:50:58 aa0 mdm_send: 'AT+FCLASS=2' -> ERROR 12/17 11:50:58 aa0 mdm_send: 'AT+FCLASS=2.0' -> ERROR 12/17 11:50:58 aa0 mdm_send: 'AT+FCLASS=2' -> ERROR 12/17 11:50:58 aa0 detecting voice modem type 12/17 11:50:59 aa0 Rockwell detected 12/17 11:51:02 aa0 initializing ROCKWELL voice modem 12/17 11:51:03 aa0 vgetty: Modem returned ERROR 12/17 11:51:03 aa0 can't set transmit gain 12/17 11:51:03 aa0 vgetty: Modem returned ERROR 12/17 11:51:03 aa0 can't set record gain 12/17 11:51:06 aa0 waiting...
vm record -v -d 3 test.rmdWill record from the external modem microphone. The vm command usage explains the other recording source possibilities. To record from your sound card you can use sox, eg
mixer mic 0 mixer rec 90 mixer =rec mic sox -t ossdsp -r 44100 -w -c 1 /dev/dsp message.wavThe following steps will convert it to a format suitable for modem playback.
sox message.wav -r 7200 -c 1 standard.wav resample
wavtopvf standard.wav standard.pvf pvftormd Rockwell 4 standard.pvf standard.rmd
12/17 11:56:00 aa0 wfr: waiting for ``RING'' 12/17 11:56:00 aa0 wfr: waiting for ``RING'' 12/17 11:56:03 aa0 wfr: waiting for ``RING'' 12/17 11:56:06 aa0 reading ring_type ring configuration from config file /usr/local/etc/mgetty+sendfax/voice.conf 12/17 11:56:11 aa0 playing voice file /var/spool/voice/messages/standard.rmd 12/17 11:56:16 aa0 recording voice file /var/spool/voice/incoming/v-56723-1071624370.rmd 12/17 11:56:25 aa0 vgetty: <DLE> <ETX> received 12/17 11:56:33 aa0 closing voice modem device 12/17 11:56:33 ##### message keep, length=00:00:09, name='', caller=none, dev=cuaa0, pid=56723 12/17 11:56:33 aa0 vgetty: Executing shell script /usr/local/libexec/mgetty/message.sh with shell /bin/sh
Started at Wed Dec 17 11:56:33 CST 2003 Temp dir is /tmp/message.sh.AD5QOi Writing Wave file: Microsoft PCM format, 1 channel, 7200 samp/sec 7200 byte/sec, 1 block align, 8 bits/samp sox: Length in output .wav header will be wrong since can't seek to fix it LAME version 3.91 MMX (http://www.mp3dev.org/) CPU features: i387, MMX (ASM used), 3DNow! Using polyphase highpass filter, transition band: 0 Hz - 97 Hz Using polyphase lowpass filter, transition band: 3387 Hz - 3484 Hz Encoding <stdin> to /tmp/message.sh.AD5QOi/Message.mp3 Encoding as 8 kHz 16 kbps single-ch MPEG-2.5 Layer III (8x) qval=5 sox: Finished at Wed Dec 17 11:56:35 CST 2003