Correct PPTP server firewall rules chain.
[tomato/davidwu.git] / release / src / router / pppd / scripts / callback
blob1c3d3aac525c478a7c4d085762e4a217b9f0d624
1 #!/bin/sh
2 ###################################################################
4 # Script to dial the remote system, negotiate the connection, and send
5 # it the id. Then wait for the modem to disconnect. Reset the modem
6 # to answer mode and wait for the system to call back.
8 # The telephone number and modempass are used when establishing the
9 # connection to the modem.
11 PHONE=555-1212
12 MODEMPASS=modem_identifier
14 # Once the modem calls back, the account name and password are used for
15 # a UNIX style login operation.
17 ACCOUNT=my_account_name
18 PASSWORD=my_password
20 ###################################################################
22 # Step 1. Dial the modem and negotiate the initial dialog.
23 # note: the modem is configured to ignore loss of DCD at this point.
24 # it is important that this be performed because the loss of DCD
25 # will normally prevent system from working since 'modem' is used
26 # for pppd.
28 # The script is terminated normally when the carrier is lost.
30 chat -v \
31 TIMEOUT 3 \
32 ABORT '\nBUSY\r' \
33 ABORT '\nNO ANSWER\r' \
34 ABORT '\nRINGING\r\n\r\nRINGING\r' \
35 '' AT \
36 'OK-+++\c-OK' 'AT&C0&D2S0=0H0' \
37 TIMEOUT 30 \
38 OK ATDT$TELEPHONE \
39 CONNECT '' \
40 assword: $MODEMPASS \
41 "\nNO CARRIER\r"
43 if [ "$?" = "0" ]; then
45 ###################################################################
47 # Step 2. Wait for the call back from the remote. This will wait for at most
48 # 30 seconds for the call back should the first attempt fail or
49 # something happen with the callback logic at the remote.
51 # note: when the callback occurs, the DCD setting is re-enabled.
53 # If some voice call should happen during this period, the system will
54 # answer the telephone and then hang up on them. I realize that this is
55 # rude, but there is little that this script can do.
57 chat -v \
58 TIMEOUT 30 \
59 ABORT '\nVOICE\r' \
60 '\nRING\r' 'AT&C1A' \
61 CONNECT '' \
62 TIMEOUT 10 \
63 ogin:--ogin: $ACCOUNT \
64 TIMEOUT 45 \
65 assword: $PASSWORD
67 if [ "$?" = "0" ]; then
68 exit 0
72 ###################################################################
74 # The script has failed. Terminate the connection mode.
76 chat -v TIMEOUT 3 "" AT 'OK-+++\c-OK' 'AT&C1&D2S0=0H0' OK
77 exit 1