SUBROUTINE DIAL_R212A C C This routine dials the phone number for the RIXON R212A Intelligent C modem. This routine was tested using revision 4.2 hardware. C INCLUDE 'COM.INC/NOLIST' CHARACTER*(*) NFG_MSG, BAD_MSG CHARACTER*(*) CONNECTION_NFG PARAMETER (NFG_MSG = SS// 1 '*** The modem is not responding, aborting... ***'//BELL//SS) PARAMETER (BAD_MSG = SS// 1 '*** Bad response from the modem, aborting... ***'//BELL//SS) PARAMETER (CONNECTION_NFG = SS// 1 '*** The connection was not established. ***'//BELL//SS) LOGICAL FSS, READ_DATA, WAIT_FOR_READ INTEGER POST_READ INTEGER AUTO_RETRY, DIAL_TMO, IDLE_TMO, PROMPT_TMO STATUS DATA DIAL_TMO, IDLE_TMO, PROMPT_TMO /60, 1, 5/ C C Setup the terminator table to terminate the read on the RIXON C prompt character (dollar sign "$" = 36 decimal). C CALL SET_TERMINATOR (TPTR, TTBL, %REF('$')) AUTO_RETRY = 0 ! Initialize the retry counter. C C Now post a read to get the modem response. C 100 IF (.NOT. POST_READ (RBUFFER, PROMPT_TMO, TPTR)) GO TO 9900 C C To put the RIXON in autodial (interactive) mode, we must send two C carriage returns and then wait for the read. Although we could bypass C the signon message by sending the commands immediatly between angle C brackets (< commands >), I'm using the signon message so I know the C the modem is responding. C XBUFFER(1) = CR ! Get ready to send return. CALL WRITE_REMOTE (XBUFFER(1), 1) ! Second gets appended later. IF (.NOT. WAIT_FOR_READ (RBUFFER, RDESC, .TRUE.)) THEN IF (CONTROLC_TYPED) GO TO 9900 ! CTRL/C typed to abort. AUTO_RETRY = AUTO_RETRY + 1 ! Adjust the retry count. IF (AUTO_RETRY .EQ. AUTODIAL_LIMIT) THEN CALL WRITE_USER (NFG_MSG) ! Modem is not responding. RETURN ELSE GO TO 100 ! Try to signon again. ENDIF ENDIF AUTO_RETRY = 0 ! Reinitialize retry counter. C C Now we'll build the computer batch command. The command built is: C C < Start of batch commands. C O Enter option setup. C 1N Disable programmed disconnect. C 4N Disable Data Set Ready (DSR) signal. C 5N Disable Clear To Send (CTS) signal. C 8T Enable tone dialing (instead of dial-auto). C 0 Exit option setup. C > End of batch commands. C -- C 12 characters C C Note: The dial type is changed to tone because we're using a Northern C Telecom SL-1 system. Using this system, the dial tone is not C broken when dialing thus preventing dial-auto from working. C C Also, the documentation I have started that option 9 was to setup C the type of dialing. On my modem, this is option 8. My modem C does not have the "Inhibit ENQ" option stated in the manual. C C The modem sends a dollar sign for each command completed. C XBUFFER(1) = '<' ! Start of batch commands. XBUFFER(2) = 'O' ! Enter option setup. XBUFFER(3) = '1' ! Disable XBUFFER(4) = 'N' ! programmed disconnect. XBUFFER(5) = '4' ! Disable XBUFFER(6) = 'N' ! Data Set Ready (DSR). XBUFFER(7) = '5' ! Disable XBUFFER(8) = 'N' ! Clear To Send (CTS). XBUFFER(9) = '8' ! Enable XBUFFER(10)= 'T' ! tone dialing. XBUFFER(11)= '0' ! Exit option setup. XBUFFER(12)= '>' ! End of batch commands. C C The computer batch commands are sent without a carriage return. C After sending the buffer, we wait for the "$" to show completion. C C We must send the options setup using the WRITE_RIXON routine so C a .25 seconds delay is inserted between each character. When I C tried to send the entire string, it was garbled at 300 baud. C CALL WRITE_RIXON (XBUFFER, 12) ! Send the options setup. IF (.NOT. POST_READ (RBUFFER, PROMPT_TMO, TPTR)) GO TO 9900 IF (.NOT. WAIT_FOR_READ (RBUFFER, RDESC, .FALSE.)) GO TO 9900 CALL READ_DATA (RBUFFER, .FALSE., RDESC, IDLE_TMO) C C Now do a keyboard dial command. I'm using the keyboard dial instead C of the computer batch mode so I don't have to generate my own ASCII C messages for dialing responses. In computer batch, the response is C returned as the digits 1 through 7. C C $ K C NUMBER: C CALL SET_TERMINATOR (TPTR, TTBL, %REF(':'))! Terminate read on colon. IF (.NOT. POST_READ (RBUFFER, PROMPT_TMO, TPTR)) THEN GO TO 9900 ! Tell user not connected. ENDIF CALL WRITE_RIXON (%REF('K'), 1) ! Doing a keyboard dial. IF (.NOT. WAIT_FOR_READ (RBUFFER, RDESC, .TRUE.)) THEN GO TO 9900 ! Tell user not connected. ENDIF C C Now send the phone number. C IF (.NOT. POST_READ (RBUFFER, PROMPT_TMO, TPTR)) THEN ! Read "DIALING:" GO TO 9900 ! Tell user not connected. ENDIF CALL WRITE_RIXON (%REF(PHONE_NUMBER),PHONE_SIZE) ! Send the number. CALL WRITE_RIXON (CR, 1) ! Finish with RETURN. 300 IF (.NOT. WAIT_FOR_READ (RBUFFER, RDESC, .TRUE.)) THEN GO TO 9800 ! Abort the phone call. ENDIF C C Now read the R212A response. Each response has a carriage return C line feed sequence appended to them. The R212A will display one C of the following messages after dialing: C C DIALING: phone_number ...ON LINE or ON-LINE C ...RINGING...NO ANSWER...ABORT C ...DEAD LINE....ABORT C ...BUSY....ABORT C C The documentation shows "ON LINE" should be returned. C CALL SET_TERMINATOR (TPTR, TTBL, %REF(LF)) IF (.NOT. POST_READ (RBUFFER, DIAL_TMO, TPTR)) THEN GO TO 9900 ! Tell user not connected. ENDIF IF (.NOT. WAIT_FOR_READ (RBUFFER, RDESC, .TRUE.)) THEN GO TO 9800 ! Abort the phone call. ENDIF C C If the response from the modem is "BUSY" or "NO ANSWER", try again. C If we need to redial, the response from the RIXON is: C C $ R C DIALING: phone_number ...(responses listed above) C IF ( (FSS ('BUSY', RDESC)) .OR. 1 (FSS ('NO ANSWER', RDESC)) ) THEN AUTO_RETRY = AUTO_RETRY + 1 ! Adjust the retry counter. IF (AUTO_RETRY .EQ. AUTODIAL_LIMIT) THEN GO TO 9900 ! Tell user not connected. ELSE CALL WRITE_RIXON (%REF('R'), 1) ! Tell the RIXON to redial. CALL SET_TERMINATOR (TPTR, TTBL, %REF(':')) IF (POST_READ (RBUFFER, PROMPT_TMO, TPTR)) THEN GO TO 300 ! Wait for redial. ELSE GO TO 9900 ! Tell user not connected. ENDIF ENDIF ENDIF C C If the modem is really online, set the flags to say so. C IF ( (FSS ('ON LINE', RDESC)) .OR. 1 (FSS ('ON-LINE', RDESC)) ) THEN MODEM_ONLINE = .TRUE. ! Show modem is online. REMOTE = .TRUE. ! Make VMS look online. C C Now make sure nothing is in the typeahead buffer to prevent C problems during auto login (if any). C CALL READ_DATA (RBUFFER, .TRUE., RDESC, IDLE_TMO) RETURN ! We're all finished. ENDIF GO TO 9900 ! Tell user not connected. C C We come here when our wait for read fails. C 9800 CALL WRITE_RIXON (CR, 1) ! Any character to abort. CALL SIGNOFF_RIXON() ! Signoff the RIXON modem. CALL WRITE_USER (BAD_MSG) ! Tell user bad response. RETURN C C We come here to let the user know we didn't get online. C 9900 CALL SIGNOFF_RIXON() ! Signoff the RIXON modem. CALL WRITE_USER (CONNECTION_NFG) ! Tell user not connected. END