Here is how I do it - I tweak chat and use its error codes for success reporting.
Please note that this is for a pap login.

#------------------------------------------------------------------------------------------------
#!/bin/sh
#
#       File - /etc/ppp/connect
#       Copyright (c) 1999, D.H.McKay
#

[ !FIFO ] && FIFO=/var/run/diald.ctl

ipchains=/sbin/ipchains
iptables=/usr/local/bin/iptables
ipnatctl=/usr/local/bin/ipnatctl

function logit()
{
  date +"message %a %b %d %T %Y %Z <${0//*\/}[$$]> $1" > $FIFO
  logger -p local2.info -t "${0//*\/}[$$]" "$1"
}

#
# Modem Init string     z   = reset
#                       e1  = modem echo
#                       v1  = long form result codes
#                       x4  = enable all return codes
#                       s25 = dial speed 
#                       s95 = connect reporting options (4 = CARRIER XXXX
#                                                       and CONNECT XXXX)
M_INIT="+++atze1v1x4s25=255s95=4"

#
#       Phone number of provider
#
P_NUMBER="my-ip-phone-number"

# exit code 0 = success, 1 = error
EXITMSG=0
# syslog report string
EXITSTRN=""

#
#       Write to system log and fifo
#
#logit "Modem Initialization"

#
#       The -S switch prevents chat from logging errors to the syslog
#       USE -S ONLY IF THE SCRIPT WORKS 
#
#
#       OK lets initialize the modem
#
chat -S \
        TIMEOUT 5 \
        "" $M_INIT \
        TIMEOUT 45 \
        OK ""

if [ $? != 0 ]; then
        logit "Error initializing modem"
        exit 1
fi

logit "Dialing $P_NUMBER"

#
#       The -S switch prevents chat from logging errors to the syslog
#       USE -S ONLY IF THE SCRIPT WORKS 
#
#       Now lets dial the system
#
#       I cheat here as I want a more complex result than chat normaly gives
#       ABORT is normally for errors - but it gives an individual return
#       code for each string.
#
chat -S \
        TIMEOUT 45 \
        ABORT "NO CARRIER" \
        ABORT BUSY \
        ABORT "NO DIALTONE" \
        ABORT ERROR \
        ABORT "CARRIER 300" \
        ABORT "CARRIER 1200/75" \
        ABORT "CARRIER 75/1200" \
        ABORT "CARRIER 1200" \
        ABORT "CARRIER 2400" \
        ABORT "CARRIER 4800" \
        ABORT "CARRIER 7200" \
        ABORT "CARRIER 9600" \
        ABORT "CARRIER 12000" \
        ABORT "CARRIER 14400" \
        ABORT "CARRIER 16800" \
        ABORT "CARRIER 19200" \
        ABORT "CARRIER 21600" \
        ABORT "CARRIER 24000" \
        ABORT "CARRIER 26400" \
        ABORT "CARRIER 28800" \
        ABORT "CARRIER 31200" \
        ABORT "CARRIER 33600" \
        "" ATDTW"$P_NUMBER" \
        CONNECT "" 

#
#       Lets test the return codes
#
case $? in
   0)   EXITSTRN="Connected Unknown speed";EXITMSG=0;;  #default connect
   1)   EXITSTRN="Chat Error";EXITMSG=1;;               #internal chat error
   2)   EXITSTRN="Chat Script Error";EXITMSG=1;;        #error in script
   3)   EXITSTRN="Chat Timeout";EXITMSG=1;;             #error timed out
   4)   EXITSTRN="No Carrier";EXITMSG=1;;               #no carrier
   5)   EXITSTRN="Busy";EXITMSG=1;;                     #phone number busy
   6)   EXITSTRN="No DialTone";EXITMSG=1;;              #nodialtone
   7)   EXITSTRN="Modem Error";EXITMSG=1;;              #general modem error
   8)   EXITSTRN="Error 300 bps GROAN";EXITMSG=1;;      #300 - 12000 bps
   9)   EXITSTRN="Error 1200tx 75rx bps GRR";EXITMSG=1;;#unacceptable
   10)  EXITSTRN="Error 75tx 1200rx bps SHEESH";EXITMSG=1;;
   11)  EXITSTRN="Error 1200 bps HMM";EXITMSG=1;;
   12)  EXITSTRN="Error 2400 bps HNGG";EXITMSG=1;;
   13)  EXITSTRN="Error 4800 bps BOY";EXITMSG=1;;
   14)  EXITSTRN="Error 7200 bps ALMOST";EXITMSG=1;;
   15)  EXITSTRN="Error 9600 bps NOT QUITE";EXITMSG=1;;
   16)  EXITSTRN="Error 12000 bps ALMOST BORDERLINE";EXITMSG=1;;
   17)  EXITSTRN="Connect 14400 bps VERRY SLOW";EXITMSG=0;; #minimum allowed
   18)  EXITSTRN="Connect 16800 bps BIT SLOW";EXITMSG=0;;
   19)  EXITSTRN="Connect 19200 bps SLOW";EXITMSG=0;;
   20)  EXITSTRN="Connect 21600 bps MEDIUM";EXITMSG=0;;
   21)  EXITSTRN="Connect 24000 bps PASSABLE";EXITMSG=0;;
   22)  EXITSTRN="Connect 26400 bps A-";EXITMSG=0;;
   23)  EXITSTRN="Connect 28800 bps A";EXITMSG=0;;
   24)  EXITSTRN="Connect 31200 bps A+";EXITMSG=0;;
   25)  EXITSTRN="Connect 33600 bps YAHOO A++";EXITMSG=0;; #best connect speed
   *)   EXITSTRN="UNKNOWN ERROR $?";EXITMSG=1;; #default unknown error
esac

logit "$EXITSTRN"

#
#       return result to calling program (diald)
#
exit $EXITMSG
#---------------------------------------------------------------------------------------------
On Mon, 15 May 2000, W. Scott Hayes wrote:
> >%_How do I determine the connection speed.  I would like to query the connection at 
>anytime to determine it.  But I would settle for logging it some where.
> 
> Also is there a web interface to diald.  I would like to beable to hit the machines 
>webpage that it is running on and check the status.
> 
> scott
> 
> 

----------------------------------------
Content-Type: text/html; name="unnamed"
Content-Transfer-Encoding: quoted-printable
Content-Description: 
----------------------------------------

--
Mr Cornish Rex
 [EMAIL PROTECTED]

   Ignore Microsoft
    Get a real OS 

-
To unsubscribe from this list: send the line "unsubscribe linux-diald" in
the body of a message to [EMAIL PROTECTED]

Reply via email to