;**************************************************************** ; * ; Hayes Modem Control File * ; * ; This is an example of a voice/data dial control file * ; for a Hayes compatible modem. * ; * ; Copyright (C) 1988 Apricot Computers plc. * ; Hacked by John K for use with V22 bis!!!! * ;**************************************************************** ; Default comms settings InitialSettings Begin $BaudRate = 2400 $WordLength = 8 $StopBits = one $Parity = none $Handshake = none End Event DialStatus Begin "OK^M^J" : $1 = 0, endevent "CONNECT^M^J" : $1 = 0, endevent "CONNECT 1200^M^J" : $1 = 0, endevent "CONNECT 2400^M^J" : $1 = 0, endevent "CONNECT 2400/REL^M^J" : $1 = 0, endevent "CONNECT 1200/ARQ^M^J" : $1 = 0, endevent "CONNECT 2400/ARQ^M^J" : $1 = 0, endevent "NO CARRIER^M^J" : $1 = -2, endevent "NO ANSWER^M^J" : $1 = -2, endevent "NO DIALTONE^M^J" : $1 = -3, endevent "BUSY^M^J" : $1 = -4, endevent "ERROR^M^J" : $1 = -5, endevent End Event Connect Begin "CONNECT^M^J" : endevent "CONNECT 1200^M^J" : endevent "CONNECT 2400^M^J" : endevent "CONNECT 2400/REL^M^J" : endevent "CONNECT 1200/ARQ^M^J" : endevent "CONNECT 2400/ARQ^M^J" : endevent End Event ModemTest Begin "OK^M^J" : endevent "0^M" : endevent End Control Begin $SendMode = 2 if $action = 1 call VoiceDial else if $action = 2 call DataDial else if $action = 3 call VoiceHangup else if $action = 4 call DataHangup else if $action = 5 call AutoanswerOn else if $action = 6 call AutoanswerOff End ;******************************** ; Make a voice call * ;******************************** Procedure VoiceDial Begin call CheckModemPresent DialState 1 ;Dialling send "ATD" nocr ;Dial command if $DialMode = tone send "T" nocr ;Tone dial else if $DialMode = pulse send "P" nocr ;Pulse dial send $Telephone nocr ;Telephone number send ";" ;Remain in command mode $1 = -5 ;Default - error waitevent DialStatus timeout 600 ;Wait for completion of dialling if $1 = 0 DialState 2 ;Dialled ok else begin DialState $1 ;Error in dialling exitcontrol end End ;******************************** ; Make a data call * ;******************************** Procedure DataDial Begin call CheckModemPresent DialState 1 ;Dialling send "ATD" nocr ;Dial command if $DialMode = tone send "T" nocr ;Tone dial else if $DialMode = pulse send "P" nocr ;Pulse dial send $telephone nocr ;Telephone number send "^M" nocr ;Carriage return $1 = -2 ;Default - no carrier waitevent DialStatus timeout 600 ;Wait for completion of dialling if $1 = 0 DialState 3 ;Connect else begin DialState $1 ;Error in dialling exitcontrol end End ;******************************** ; Hangup voice call * ;******************************** Procedure VoiceHangup Begin delay 10 ;Delay in case of any pending ;off-hook inquiry send "ATH0" ;Hangup call wait "OK^M^J" timeout 30 DialState 8 ;Hangup End ;******************************** ; Hangup data call * ;******************************** Procedure DataHangup Begin delay 10 send "+++" nocr ;Switch to command mode wait "OK^M^J" timeout 30 send "ATH0" ;Hangup call wait "OK^M^J" timeout 30 DialState 8 ;Hangup End ;************************************************ ; Enable autoanswer and wait for a connection * ;************************************************ Procedure AutoanswerOn Begin call CheckModemPresent send "ATS0=1" ;Switch autoanswer on after one ring wait "OK^M^J" timeout 30 DialState 6 ;Autoanswer on WaitConnect: waitevent Connect ;Wait for CONNECT delay 10 ;Ensure Xmodem caller starts first DialState 3 ;Connect goto WaitConnect End ;******************************** ; Disable autoanswer * ;******************************** Procedure AutoanswerOff Begin send "ATS0=0" ;Switch autoanswer off wait "OK^M^J" timeout 30 DialState 7 ;Autoanswer off End ;******************************************** ; Test for presence of a modem * ;******************************************** Procedure CheckModemPresent Begin send "ATZ" ;Reset modem waitevent ModemTest timeout 30 ;Test for presence of modem if $timeout begin DialState -1 ;No modem exitcontrol ;Exit control file end End