home *** CD-ROM | disk | FTP | other *** search
-
- .. PCPCALL.MEX (02/08/90)
- ..
- .. This script performs the steps necessary to connect to the designated city
- .. and remote system.
-
- .. initialization
-
- %m=100;. clear menu selection
- %u=0;. flag to show initial attempt
-
- .. let user know what we are up to
-
- screen on
- cls
- say "/nCalling ",F,": city code ",D," at ",B,"00 bps . . . "
-
-
- .. Branch depending on whether we are presently connected to no city, the
- .. requested city, or a different city.
-
- if %p=0 GOTO NEWCITY;. no city connected presently
- if %a=%p GOTO LOCAL;. already connected to desired city
-
- .. ----------------------------------------------------------------------
- ..
- .. Disconnect from wrong city
- ..
- .. ----------------------------------------------------------------------
-
- .. disconnect from present city
-
- say "/n/nDisconnecting from outdial code ",A," . . . "
- %x=3;. max number of tries
-
- LABEL DROPCITY
- screen off
- sendout "/r@/r";. try to return to PCP command mode
- wait string 2 "@";. we should get '@' prompt
- if value>0 GOTO DROP1;. if we do, continue below
- %x=%x-1;. else drop count
- if %x<1 A="Cannot quit current city";GOTO ABORT;. abort if count expired
- GOTO DROPCITY;. try again
-
- LABEL DROP1
- screen off
- sendout "D/r";. tell PCP to disconnect from city
- %p=0;. show no city connected
- screen on
- say "OK";. tell user that it worked
-
- .. ----------------------------------------------------------------------
- ..
- .. Connect to new city
- ..
- .. ----------------------------------------------------------------------
-
- LABEL NEWCITY
- A=" city code"
- screen on
- if %u=0;. initial attempt to connect to city
- say "/n";. end any line of screen output
- %u=1;. show no longer first time
- %d=%t;. number of tries into variable 'd'
- else;. else trying AGAIN to connect
- gosub GETD;. gets number of times to try
- say "/nCalling ",F,"/n";. tell user whom we are trying to reach
- endif
- say "/nDialing",A," ",D;. report the city code we are dialing
-
- %c=1;. count of tries
- %o=1;. indicate first time through
- LABEL CITYCODE
- if %c>%d goto MORETRIES
- sleep 1
- screen on;say "/n try #",%c," of ",%d," at ",%b," bps...";screen off
- %c=%c+1
- sendout "C D//"
- sendout D;. city code
- sendout "//"
- sendout B;. baud code
- sendout ","
- sendout "userid";. user id
- sendout ","
- sendout "password";. user password
- sendout "/r"
-
- wait string 4 "CONNECTED" "BUSY" "FAIL"
- if value=1 goto LOCAL
-
- screen on
- if value=3 say "Failed Call";goto MORETR1
- if value=2 say "Busy"
- if value=0 say "No Response"
- goto CITYCODE
-
- LABEL MORETRIES
- if %n=0 goto MORETR1;. no auto step down
- if %o=0 goto MORETR1;. already stepped down
- %o=0
- if %b=2400 %b=1200;B=12;%c=1;GOTO CITYCODE
-
- LABEL MORETR1
- gosub ASKMORE
- if value=1 goto NEWCITY
-
- %a=0
- D=" "
- read PCPMENU;. chain back to main menu
-
- .. ----------------------------------------------------------------------
- ..
- .. In right city; try connecting to specified system
- ..
- .. ----------------------------------------------------------------------
-
- LABEL LOCAL
- screen on
- say "/n/nCONNECTED to city code ",D
-
- .. initialize destination modem
-
- if %z=2;. if in Vadic mode
- sendout "I/r";. exit from it
- %z=0;. show initialized modem
- sleep 1
- endif
-
- LABEL REINIT
- %x=3;. max attempts to initialize modem
- LABEL REINIT1
- if %x<1 A="Remote modem failure";goto ABORT
- %x=%x-1
- screen on;say "/n initialize remote modem... ";screen off
- sleep 1
- sendout "ATZ/r"
- wait string 3 "OK"
- if value=0 goto REINIT1
-
- ;.. Call destination system
-
- LABEL LOCALAGAIN
- A=" local number"
- screen on
- if %z=0
- say "/n"
- %z=1
- %d=%s
- else
- GOSUB GETD
- endif
-
- say "/nDialing ",F,"/n";screen off
- %c=1
-
- if %z=2 goto DIAL1;. already in Vadic mode
-
- LABEL DIAL
-
- sendout "^E/r";. enter Vadic mode
- wait string 3 "*"
- screen on
- if value=0 say "/nVadic Mode Failed/n";goto REINIT
-
- say "/nRemote modem now in Vadic Mode"
- %z=2;. show Vadic mode
-
- LABEL DIAL1
-
- %r=0
- screen on;say "/n/nTry #",%c," of ",%d," (at ",%b," bps)/n"
- sendout "D";sendout E;sendout "/r"
-
- LABEL DIAL2
- screen on
- wait string 25 "ANSWER" "BUSY" "DIAL TONE" "RINGING..."
- if value=1 goto SUCCESS
- if value=2 goto BUSY
- if value=3 goto DIALTONE
- if value<>4 goto BADCODE
-
- %r=%r+1;. count of rings
- if %r<3 say "/n";goto DIAL2
- say " No answer/n"
- sendout "I/r"
- goto NOANSWER
-
- LABEL BADCODE
- say " Failed call/n"
- goto NOANSWER
-
- LABEL BUSY
- %c=%c+1
- if %c>%d goto NOANSWER
- goto DIAL1
-
- LABEL DIALTONE
- say " No dial tone/n"
-
- LABEL NOANSWER
- gosub ASKMORE
- if value=1 goto LOCALAGAIN
-
- read PCPMENU
-
- LABEL SUCCESS
- screen on
- say "^G/n/nCONNECTED TO HOST SYSTEM/n/n"
- read PCPCONN
-
-
- .. ---------- Subroutines
-
- PROC GETD
- say "/nTry how many times to connect to",A,"? "
- input
- %d=value
- if %d<1 %d=1
- ENDP
-
- PROC ASKMORE
- LABEL ASKAGAIN
- screen on
- say "/n/nTry",A," some more (Y//N)? "
- bell 1
- accept C,1
- screen off
- comp C "Y"
- if value=1 ENDP
- comp C "N"
- if value=1 value=0;ENDP
- bell 1
- goto ASKAGAIN
-
- LABEL ABORT
- screen on
- cls
- @ 5 0 say A,"; session ended."
- @ 10 0 say "Will disconnect in 5 seconds . . . "
- bell 5
- %x=3
- LABEL ABORT1
- %x=%x-1
- if %x<1 dsc;cpm
- sendout "/r@/r"
- wait string 1 "@"
- if value=1 sendout "hangup/r";cpm
- goto ABORT1
-