blob: 32eef82d347bf02975722bfb4d0559ce7677c4a9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
#!xchat
# @(#) dial.hayes V1.1 Tue Sep 1 13:59:58 1992 (Bob Denny)
#
# xchat script for dialing a vanilla Hayes modem
#
# Usage:
# xchat dial.hayes telno
#
# where telno is the telephone number, subject to pause and wait
# character modification.
#
# Uncomment the first two lines after "start:" to get debugging
# in file "Dial.Log"
#
# Flush input, zero counter, set telephone number if supplied,
# else fail if no telephone number given.
#
start:
### dbgfile Dial.Log
### dbgset 15
zero
flush
ifnstr notelno 0
telno 0
goto initmodem
#
# Missing telephone number.
#
notelno:
logerr No telephone number given
failed
#
# Reset the modem to nonvolatile profile.
# Allow 3 sec. for response, as some modems are slow to reset.
#
initmodem:
count
ifgtr cantinit 4
send ATZ\r
timeout initmodem 3000
expect setupmodem OK
#
# No response from modem
#
cantinit:
logerr Can't wake modem
failed
#
# Send the stuff needed to initialize the modem to the modes
# needed for the particular modem flavor. The string below
# is provided as a vanilla example. Allow 2 sec. for the
# modem to respond to this command.
#
setupmodem:
sleep 1000
send ATM0S7=90S11=120\r
timeout setupfail 2000
expect setupfail ERROR
expect dialnumber OK
#
# Modem barfed or died on setup command.
#
setupfail:
logerr Error in modem setup string
failed
#
# Dial the supplied number. Handle the various errors that
# can come back from the modem by logging the error.
#
dialnumber:
sleep 1000
send ATDT
dial
send \r
flush
timeout timeout 90000
expect connected CONNECT
expect busy BUSY
expect nocarrier NO CARRIER
expect noanswer NO ANSWER
expect nodialtone NO DIALTONE
#
# Success!
#
connected:
success
#
# Handle modem dial failures
#
timeout:
logerr Modem or carrier timeout.
failed
busy:
logerr BUSY
failed
nocarrier:
logerr NO CARRIER
failed
noanswer:
logerr NO ANSWER
failed
nodialtone:
logerr NO DIALTONE
failed
#
# end
#
|