q: vgetty detecting hangup?
Kurt Seel (kseel@utcorp.com)
Mon, 20 Sep 1999 16:30:10 -0400
I am running vgetty on freebsd 2.2.7. I am using the pc serial ports.
vgetty: experimental test release 0.9.4 / 20Jul99. I have a zyxel 1496,
rom level 6.16. I have put together a little TCL hack to drive the
modem, I include it here:
#!/usr/local/bin/tcl
#
# This script uses TclX for thr kill command.
#
#
------------------------------------------------------------------------------
#
#
proc vapi_init { } \
{
global env VI_FILE VO_FILE
set VI_FILE [open /dev/fd/$env(VOICE_INPUT) r]
set VO_FILE [open /dev/fd/$env(VOICE_OUTPUT) w]
puts [vapi_recv]
vapi_send "HELLO VOICE PROGRAM"
puts [vapi_recv]
}
#
------------------------------------------------------------------------------
#
#
proc vapi_send { MSG } \
{
global env VI_FILE VO_FILE
puts $VO_FILE $MSG
flush $VO_FILE
kill SIGPIPE $env(VOICE_PID)
}
#
------------------------------------------------------------------------------
#
#
proc vapi_recv { } \
{
global env VI_FILE VO_FILE
return [gets $VI_FILE]
}
#
------------------------------------------------------------------------------
#
#
vapi_init
vapi_send "DEVICE DIALUP_LINE"
puts "DEVICE DIALUP_LINE : [vapi_recv]"
vapi_send "ENABLE EVENTS"
puts "ENABLE EVENTS : [vapi_recv]"
while { 1 } \
{
vapi_send "PLAY /var/spool/voice/messages/standard.rmd"
puts "PLAY : [vapi_recv]"
switch [vapi_recv] \
{
RECEIVED_DTMF \
{
set DTMF [vapi_recv]
puts "RECEIVED_DTMF : $DTMF"
vapi_send "STOP"
puts "STOP : [vapi_recv]"
switch $DTMF \
{
1 { break }
default { puts "key : $DTMF" }
}
}
READY { }
}
}
vapi_send "DISABLE EVENTS"
puts "DISABLE EVENTS : [vapi_recv]"
vapi_send "GOODBYE"
puts "GOODBYE : [vapi_recv]"
I wrap it in this shell script to get it to run as the call_program:
#!/bin/bash
echo "before shell execs" > /tmp/out.txt
/usr/local/sbin/vgetty_test.tcl 2> /tmp/err.txt >> /tmp/out.txt
echo "after shell execs" >> /tmp/out.txt
My problen is this: if I wangup inside the while{ 1 }, it keeps playing
the message forever. Is there a way to get a 'hangup' event?
--
"The solution to a problem should be as simple as possible,
no simpler."
-Albert Einstein