1 | ; File CKEPAGE.SCR |
---|
2 | ; |
---|
3 | ; Authors: F. da Cruz and C. Gianone, Columbia University, September 1996. |
---|
4 | ; |
---|
5 | ; For use with C-Kermit 6.0.192 or later. |
---|
6 | ; |
---|
7 | ; TAPMSG, defined below, is an alphanumeric pager dialing script that |
---|
8 | ; implements the TAP protocol for sending one-line alphanumeric pages. |
---|
9 | ; To use the script, save it into a file, then tell C-Kermit to "take" |
---|
10 | ; the file. Now you have the TAPMSG macro defined. It assumes you have |
---|
11 | ; already made the phone connection. Then invoke it with two arguments: |
---|
12 | ; the pager ID and the message. |
---|
13 | ; |
---|
14 | ; Of course, it is also easy to define a macro for making the connection and |
---|
15 | ; then sending the page, for example (just a sample, change as required): |
---|
16 | |
---|
17 | define APAGE { |
---|
18 | set modem type usr ; I have a USR modem |
---|
19 | set port com1 ; on COM1 |
---|
20 | set speed 2400 ; Must use 2400 bps for paging |
---|
21 | set parity even ; and even parity |
---|
22 | set flow xon/xoff ; and Xon/Xoff flow control |
---|
23 | set modem flow none ; end-to-end, not local |
---|
24 | set dial retries 10 ; Allow 10 redials |
---|
25 | dial 5554321 ; Call the pager service |
---|
26 | if success - ; If the call is answered |
---|
27 | tapmsg \%1 {\%2} ; Send the page |
---|
28 | else end 1 Page failed. ; otherwise fail |
---|
29 | } |
---|
30 | |
---|
31 | ; To invoke the APAGE macro, put it in a file, edit it as necessary for your |
---|
32 | ; setup, tell C-Kermit to "take" the file, and then just type: |
---|
33 | ; |
---|
34 | ; apage number { this is a message } |
---|
35 | ; |
---|
36 | ; at the C-Kermit> prompt. Note: the phone number should not contain any |
---|
37 | ; spaces or else you have to enclose it in braces: |
---|
38 | ; |
---|
39 | ; apage { 1 212 555-1212 } { this is a message } |
---|
40 | ; |
---|
41 | ; Ditto for the message. |
---|
42 | |
---|
43 | COMMENT - TAPMSG - Send a one-line alpha page using TAP |
---|
44 | ; \%1 = Pager ID |
---|
45 | ; \%2 = Message |
---|
46 | ; |
---|
47 | def TAPMSG { |
---|
48 | local \%i \%m \%s block ; Local variables |
---|
49 | asg \%m \2\%1\13\%2\13\3 ; <STX>ID<CR>msg<CR><ETX> |
---|
50 | asg \%s \fchecksum(\%m) ; Get checksum and make block |
---|
51 | asg block \%m\fchar(\fmod(\%s/256,16)+48)- |
---|
52 | \fchar(\fmod(\%s/16,16)+48)- |
---|
53 | \fchar(\fmod(\%s,16)+48)\13 ; Checksummed TAP block |
---|
54 | |
---|
55 | for \%i 1 3 1 { ; Try 3 times to get prompt |
---|
56 | output \13 ; Send <CR> |
---|
57 | input 3 ID= ; Wait for "ID=" |
---|
58 | if success break |
---|
59 | } |
---|
60 | if > \%i 3 end 1 No prompt |
---|
61 | for \%i 1 3 1 { ; Send <ESC>PG1, get <ACK> |
---|
62 | msleep 500 |
---|
63 | output \{27}PG1\13 |
---|
64 | minput 3 {\6\13} {\21\13} {\27\4\13} |
---|
65 | switch \v(minput) { |
---|
66 | :0, continue ; Timeout |
---|
67 | :1, break ; <ACK> |
---|
68 | :2, continue ; <NAK> |
---|
69 | :3, end 1 Forced disconnect ; Fatal error |
---|
70 | } |
---|
71 | break |
---|
72 | } |
---|
73 | if > \%i 3 end 1 Timed out or unknown response |
---|
74 | input 5 \27[p\13 ; Wait for go-ahead |
---|
75 | if fail end 1 No go-ahead ; Didn't get it |
---|
76 | for \%i 1 3 1 { ; Try three times |
---|
77 | msleep 500 |
---|
78 | output \m(block) ; Send block |
---|
79 | minput 5 {\6\13} {\21\13} {\13\27\4\13} {\30\13} |
---|
80 | switch \v(minput) { ; Get response |
---|
81 | :0, continue ; Timeout |
---|
82 | :1, break ; <ACK> - success |
---|
83 | :2, continue ; <NAK> |
---|
84 | :3, end 1 Forced disconnect |
---|
85 | :4, end 1 Illegal message |
---|
86 | } |
---|
87 | output \4\13 ; Sign off with <EOT> |
---|
88 | input 5 \27\4\13 ; Get <ESC><EOT> back |
---|
89 | break ; But ignore timeout |
---|
90 | } |
---|
91 | if > \%i 3 end 1 Timed out or unknown response |
---|
92 | end 0 |
---|
93 | } |
---|
94 | ; (End) |
---|