try this -

-----------------------------------------------

#
#       File - /etc/ppp/functions
#       Copyright (c) 1999, D.H.McKay
#
#
#       This file contains functions and variables used by all scripts
#

[ !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"
}

-----------------------------------------------

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

#
#       Include common functions and variables
#
.. /etc/ppp/functions  

#
# 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 Fri, 31 Dec 1999, [EMAIL PROTECTED] wrote:
> This maybe a really lame question, but I need the answer nonetheless!
> 
> I am trying to figure out what I need in my connect script in order to report
> the modem's connect speed back into the diald logged messages in
> /var/log/messages. Basically all I get right now is a 'Connection Established'
> message. I do not have the full text of my connect script to post at the moment,
> since I am at work. It is very simple however and just gives the errors to
> break/hangup on, modem init string, phone number to dial, and then a CONNECT
> statement.. It works perfectly fine, I just would like to be able to see what
> the connect speed is. And yes, I do have the AT command setting for returning
> result codes turned on, still nothing in the logs though.
> 
> I get the messages just fine when using wvdial, and I think even using pppd
> directly returns the right messages. Any help would be appreciated! Thanks!
> 
> - Jon
> 
> [EMAIL PROTECTED]
> 
> 
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-diald" in
> the body of a message to [EMAIL PROTECTED]

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

Reply via email to