1 --- ppp-2.4.0b4.orig/scripts/redialer
2 +++ ppp-2.4.0b4/scripts/redialer
5 -###################################################################
7 -# These parameters control the attack dialing sequence.
8 +# A chatscript that will attempt to dial multiple numbers in sequence, until
11 -# Maximum number of attempts to reach the telephone number(s)
14 -# Delay between each of the attempts. This is a parameter to sleep
15 -# so use "15s" for 15 seconds, "1m" for 1 minute, etc.
18 -###################################################################
19 +# To use: edit /etc/peers/provider, and change the connect line to read:
20 +# connect "/usr/local/bin/redialer"
22 -# This is a list of telephone numbers. Add new numbers if you wish
23 -# and see the function 'callall' below for the dial process.
26 +# See below for configuration.
28 -###################################################################
29 +# This is a list of chatscripts to use to get connected, and (optional)
30 +# telephone numbers to call for each of those chatscripts.
32 -# If you use the ppp-on script, then these are passed to this routine
33 -# automatically. There is no need to define them here. If not, then
34 -# you will need to set the values.
36 -ACCOUNT=my_account_name
38 +# Note that in the chatscripts, you may use #NUMBER#, this will be replaced
39 +# with the number it is calling. You might want to use this to only have one
40 +# chatscript that is used for all numbers, or you might need multiple
43 -###################################################################
45 -# Function to initialize the modem and ensure that it is in command
46 -# state. This may not be needed, but it doesn't hurt.
50 - chat -v TIMEOUT 3 '' AT 'OK-+++\c-OK'
54 +CHAT1=/etc/chatscripts/provider
56 -###################################################################
58 -# Script to dial a telephone
64 - ABORT '\nNO ANSWER\r' \
65 - ABORT '\nRINGING\r\n\r\nRINGING\r' \
68 - ogin:--ogin: $ACCOUNT \
71 -# If the connection was successful then end the whole script with a
74 - if [ "$?" = "0" ]; then
78 +CHAT2=/etc/chatscripts/provider
83 +CHAT3=/etc/chatscripts/provider
85 -###################################################################
87 -# Script to dial any telephone number
91 -# echo "dialing attempt number: $1" >/dev/console
96 +CHAT4=/etc/chatscripts/provider
98 -###################################################################
100 -# Initialize the modem to ensure that it is in the command state
103 -if [ ! "$?" = "0" ]; then
107 +CHAT5=/etc/chatscripts/provider
109 +# How long to sleep between retries:
111 -# Dial telephone numbers until one answers
113 +# Note that this is a parameter to sleep so use "15s" for 15 seconds,
114 +# "1m" for 1 minute, etc
117 +# The code below does the dialing.
121 - attempt=`expr $attempt + 1`
123 - if [ "$attempt" = "$MAX_ATTEMPTS" ]; then
126 - sleep "$SLEEP_DELAY"
127 + attempt=`expr $attempt + 1`
128 + NUMBER=`eval echo '$PHONE'$attempt`
129 + CHAT=`eval echo '$CHAT'$attempt`
130 + if [ ! "$CHAT" ]; then
133 + logger "Dialing attempt number: $attempt"
134 + sed s/#NUMBER#/$NUMBER/ $CHAT >/etc/chatscripts/tmpchat
135 + /usr/sbin/chat -v -f /etc/chatscripts/tmpchat
136 + rm -f /etc/chatscripts/tmpchat
138 + 0) logger Connection established ; exit 0;;
139 + 1) logger chat: exit 1, see manpage for details. ; exit 1;;
140 + 2) logger chat: exit 2, see manpage for details. ; exit 2;;
141 + 3) logger chat: exit 3, see manpage for details. ;;
142 + 4) logger Line busy. ;;
143 + 5) logger No Carrier. ;;
144 + 6) logger A call is coming. Exiting! ; exit 1;;
145 + 7) logger No dialtone. ;;
146 + 8) logger An error occured. Exiting! ; exit 1;;
147 + *) logger chat: exit $?, see manpage for details. ;;
149 + logger "Waiting $SLEEP_DELAY seconds before next try."