~ubuntu-branches/debian/jessie/ppp/jessie

« back to all changes in this revision

Viewing changes to debian/patches/011_scripts_redialer.diff

  • Committer: Bazaar Package Importer
  • Author(s): Michael Beattie
  • Date: 2001-12-11 00:24:05 UTC
  • Revision ID: james.westby@ubuntu.com-20011211002405-gcsjlgalwyjf99m2
Tags: 2.4.1.uus-4
Use MAKEDEV in postinst, not mknod. (Closes: #122574)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--- ppp-2.4.0b4.orig/scripts/redialer
 
2
+++ ppp-2.4.0b4/scripts/redialer
 
3
@@ -1,96 +1,69 @@
 
4
 #!/bin/sh
 
5
-###################################################################
 
6
 #
 
7
-# These parameters control the attack dialing sequence.
 
8
+# A chatscript that will attempt to dial multiple numbers in sequence, until
 
9
+# you get connected.
 
10
 #
 
11
-# Maximum number of attempts to reach the telephone number(s)
 
12
-MAX_ATTEMPTS=10
 
13
-
 
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.
 
16
-SLEEP_DELAY=15s
 
17
-
 
18
-###################################################################
 
19
+# To use: edit /etc/peers/provider, and change the connect line to read:
 
20
+# connect "/usr/local/bin/redialer"
 
21
 #
 
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.
 
24
-PHONE1=555-1212
 
25
-PHONE2=411
 
26
+# See below for configuration.
 
27
 
 
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.
 
31
 #
 
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.
 
35
-#
 
36
-ACCOUNT=my_account_name
 
37
-PASSWORD=my_password
 
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
 
41
+# chatscripts.
 
42
 
 
43
-###################################################################
 
44
-#
 
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.
 
47
-#
 
48
-function initialize
 
49
-{
 
50
-    chat -v TIMEOUT 3 '' AT 'OK-+++\c-OK'
 
51
-    return
 
52
-}
 
53
+PHONE1=123456789
 
54
+CHAT1=/etc/chatscripts/provider
 
55
 
 
56
-###################################################################
 
57
-#
 
58
-# Script to dial a telephone
 
59
-#
 
60
-function callnumber
 
61
-{
 
62
-chat -v                                                        \
 
63
-       ABORT           '\nBUSY\r'                      \
 
64
-       ABORT           '\nNO ANSWER\r'                 \
 
65
-       ABORT           '\nRINGING\r\n\r\nRINGING\r'    \
 
66
-       ''              ATDT$1                          \
 
67
-       CONNECT         ''                              \
 
68
-       ogin:--ogin:    $ACCOUNT                        \
 
69
-       assword:        $PASSWORD
 
70
-#
 
71
-# If the connection was successful then end the whole script with a
 
72
-# success.
 
73
-#
 
74
-    if [ "$?" = "0" ]; then
 
75
-       exit 0
 
76
-    fi
 
77
+PHONE2=912345678
 
78
+CHAT2=/etc/chatscripts/provider
 
79
 
 
80
-    return
 
81
-}
 
82
+PHONE3=891234567
 
83
+CHAT3=/etc/chatscripts/provider
 
84
 
 
85
-###################################################################
 
86
-#
 
87
-# Script to dial any telephone number
 
88
-#
 
89
-function callall
 
90
-{
 
91
-#   echo "dialing attempt number: $1" >/dev/console
 
92
-    callnumber $PHONE1
 
93
-#    callnumber $PHONE2
 
94
-}
 
95
+PHONE4=789123456
 
96
+CHAT4=/etc/chatscripts/provider
 
97
 
 
98
-###################################################################
 
99
-#
 
100
-# Initialize the modem to ensure that it is in the command state
 
101
-#
 
102
-initialize
 
103
-if [ ! "$?" = "0" ]; then
 
104
-   exit 1
 
105
-fi
 
106
+PHONE5=001234567
 
107
+CHAT5=/etc/chatscripts/provider
 
108
 
 
109
+# How long to sleep between retries:
 
110
 #
 
111
-# Dial telephone numbers until one answers
 
112
-#
 
113
+# Note that this is a parameter to sleep so use "15s" for 15 seconds,
 
114
+# "1m" for 1 minute, etc
 
115
+SLEEP_DELAY=1s
 
116
+
 
117
+# The code below does the dialing.
 
118
+
 
119
 attempt=0
 
120
 while : ; do
 
121
-    attempt=`expr $attempt + 1`
 
122
-    callall $attempt
 
123
-    if [ "$attempt" = "$MAX_ATTEMPTS" ]; then
 
124
-       exit 1
 
125
-    fi 
 
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
 
131
+                attempt=0
 
132
+        else
 
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
 
137
+                case $? in
 
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. ;;
 
148
+                esac
 
149
+                logger "Waiting $SLEEP_DELAY seconds before next try."
 
150
+                sleep $SLEEP_DELAY
 
151
+        fi
 
152
 done