; ;Wait for an incoming call, and answer it. ; &t= 0 ;disable trap throttle 20 message "Waiting for an incoming call" ; ;Wait for a RING result from the modem. ; wait-ans: sample ;poll the modem if "RING\r" answer jmp wait-ans ;keep waiting answer: trap timeout ;set a 90 sec. timeout trap &t= 90 output "ATA\r" ;issue ANSWER command message "RING: attempting connect" ; ;Got a RING, and ATA issued; wait for response. ; get-result: sample ;&S == result if "19200" connect if "9600" connect if "4800" connect if "2400" connect if "1200" connect if "300" connect if "ECT\r" old-connect ;Hayes 300 result code or X0 if "VOICE" unexpected if "BUSY" unexpected if "RING" unexpected if "NO" noanswer ;NO ANSWER or NO CARRIER jmp get-result timeout: message "No response from the modem?!" jmp reset unexpected: message "Unexpected result code" jmp reset noanswer: message "No connection!" reset: dtr ;reset the modem delay 1000 ;delay a bit output "\r" ;clear junk from modems cmd buffer quiet 100 ;flush all garbage jmp answer ; ;Connection made. &S is the baud rate. ; old-connect: &s= "300" connect: &t= 0 ;disable the trap now ;Set baud rate only for non-fixed-rate modems. ; &b= &s ;set baud rate message "Connected at &b baud" return