.. PCPCALL.MEX (04/16/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 run thru script .. Set up keys for manual connecting and dialing. Key C connects to the .. city, while key D dials the local RAS number (in Vadic mode). key c="C D//{D}//{B},PCP_USERID,PCP_PW/r" key d="D{E}/r" .. Let user know what we are up to. screen on cls %d=%c;GOSUB CITYNAME;. get name of requested city say "Placing call to:/n" say "/n System Name: ",F say "/n City: ",A if %c=%p say " (already connected)" else say " (new city)" endif say "/n PCP City Code: ",D if %c=%p say "/n Date Rate ",B,"00" else say "/n Data Rate: ",%b if %n>0 say " AUTO" endif say "/n Area Code: ",%a say "/n Phone Number: ",E .. 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 %c=%p GOTO LOCAL;. already connected to desired city .. ---------------------------------------------------------------------- .. .. Disconnect from wrong city .. .. ---------------------------------------------------------------------- .. disconnect from present city %d=%p;GOSUB CITYNAME;. get name of currently connected city say "/n/nDisconnecting from ",A," . . . " %z=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 %z=%z-1;. else drop count if %z<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 %v=0;. show not in Vadic mode screen on say "OK";. tell user that it worked .. ---------------------------------------------------------------------- .. .. Connect to new city .. .. ---------------------------------------------------------------------- LABEL NEWCITY screen on .. We do different things depending on whether or not we have exhausted .. the first set of attempts. if %u=0 say "/n";. end any line of screen output %u=1;. show no longer first time %e=%t;. number of tries into variable 'd' else A=" city code" gosub GETD;. gets number of times to try say "/nCalling ",F,"/n";. tell user whom we are trying to reach endif %d=%c;GOSUB CITYNAME say "/nDialing city code ",D," (",A,")";.report the city code we are dialing %z=1;. count of tries %o=1;. indicate no auto stepdown yet LABEL CITYCODE if %z>%d goto MORETRIES sleep 1 screen on;say "/n try #",%z," of ",%e," at ",B,"00 bps...";screen off %z=%z+1 sendout "C D//" sendout D;. city code sendout "//" sendout B;. baud code sendout "," sendout "PCP_USERID";. user id sendout "," sendout "PCP_PW";. user password sendout "/r" wait string 4 "CONNECTED" "BUSY" "FAIL" .. If we connected, set %p to show new city connected and %u to show .. that we are making our first pass at connecting to the specified RAS. if value=1 %u=0;%p=%c;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;. show now stepped down if %b=2400 B="12";%z=1;GOTO CITYCODE;. reset trial count %z LABEL MORETR1 A=" city code" GOSUB ASKMORE if value=1 GOTO NEWCITY;. try again to reach new city READ PCPMENU;. chain back to main menu .. ---------------------------------------------------------------------- .. .. In right city; try connecting to specified system .. .. ---------------------------------------------------------------------- LABEL LOCAL screen on %d=%p;GOSUB CITYNAME say "/n/nConnected to city code ",D," (",A,")" .. initialize destination modem to make sure it is still alive if %v=2;. if in Vadic mode, reinitialize modem sendout "I/r";. exit from it %v=0;. show initialized modem sleep 1 endif LABEL REINIT %z=3;. max attempts to initialize modem LABEL REINIT1 if %z<1 A="Remote modem failure";goto ABORT %z=%z-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 screen on .. if first time through, use default count in %s if %u=0 say "/n";. end any line of screen output %u=1;. show no longer first time %e=%s;. number of tries into variable 'e' else A=" local number" GOSUB GETD endif say "/nDialing ",F,"/n";screen off %z=1 if %v=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" %v=2;. show Vadic mode LABEL DIAL1 %r=0;. initialize ring count screen on;say "/n/nTry #",%z," of ",%e," (at ",B,"00 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 .. If ringing, count the rings and give up after 3. %r=%r+1 if %r<3 say "/n";goto DIAL2 say " No answer/n" sendout "I/r";. try to exit Vadic mode %v=0;. show no longer Vadic mode GOTO NOANSWER LABEL BADCODE say " Failed call/n" GOTO NOANSWER LABEL BUSY %z=%z+1 if %z>%e goto NOANSWER GOTO DIAL1 LABEL DIALTONE say " No dial tone/n" LABEL NOANSWER A=" local number" GOSUB ASKMORE if value=1 GOTO LOCALAGAIN READ PCPMENU;. back to main menu LABEL SUCCESS screen on say "^G/n/nCONNECTED TO HOST SYSTEM/n/n" READ PCPCONN;. chain to short script to free memory .. ---------- Subroutines .. Ask user for the number of times to connect and put answer is %e. If the .. answer is less than 1, then use a value of 1. PROC GETD say "/nTry how many times to connect to",A,"? " input %e=value if %e<1 %e=1 ENDP .. Ask if user wants to continue trying to connect. Return with the answer .. in VALUE, 1 if YES, 0 if NO. 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 %z=3 LABEL ABORT1 %z=%z-1 if %z<1 dsc;cpm sendout "/r@/r" wait string 1 "@" if value=1 sendout "hangup/r";cpm GOTO ABORT1 .. This subroutine is passed the city number in scratch variable %d and .. returns the name of the city in string variable A. PROC CITYNAME if %d=1 A="Atlanta, GA";ENDP if %d=2 A="Boston, MA";ENDP if %d=3 A="Chicago, IL";ENDP if %d=4 A="Cleveland, OH";ENDP if %d=5 A="Colton, CA";ENDP if %d=6 A="Dallas, TX";ENDP if %d=7 A="Denver, CO";ENDP if %d=8 A="Detroit, MI";ENDP if %d=9 A="Glendale, CA";ENDP if %d=10 A="Hartford, CT";ENDP if %d=11 A="Houston, TX";ENDP if %d=12 A="Kansas City, MO";ENDP if %d=13 A="Los Angeles, CA";ENDP if %d=14 A="Miami, FL";ENDP if %d=15 A="Milwaukee, WI";ENDP if %d=16 A="Minneapolis, MN";ENDP if %d=17 A="Newark, NJ";ENDP if %d=18 A="New York, NY";ENDP if %d=19 A="Oakland, CA";ENDP if %d=20 A="Palo Alto, CA";ENDP if %d=21 A="Philadelphia, PA";ENDP if %d=22 A="Phoenix, AZ";ENDP if %d=23 A="Portland, OR";ENDP if %d=24 A="Res Tri Park, NC";ENDP if %d=25 A="Sacramento, CA";ENDP if %d=26 A="Salt Lake City, UT";ENDP if %d=27 A="San Diego, CA";ENDP if %d=28 A="San Francisco, CA";ENDP if %d=29 A="San Jose, CA";ENDP if %d=30 A="Santa Ana, CA";ENDP if %d=31 A="Seattle, WA";ENDP if %d=32 A="St. Louis, MO";ENDP if %d=33 A="Tampa, FL";ENDP if %d=34 A="Washington, DC";ENDP A="Unknown City" ENDP