	SUBROUTINE GET_MODEM_TYPE
C
C	This routine requests the type of autodial modem being used.
C
	INCLUDE 'COM.INC/NOLIST'

	CHARACTER*(*) TYPEQ

	PARAMETER (TYPEQ = 
	1 'Enter the type of autodial modem (RETURN if none): ')

	AUTODIAL_TYPE = 0		! No modem type yet.
	AUTODIAL = .FALSE.		! Presume no autodial modem.
	IF (STARTUP) THEN
		IF (GET_SYMBOL('MODEM_TYPE',MODEM_TYPE,LBYTE_COUNT)) THEN
			GO TO 130
		ENDIF
	ENDIF
100	CALL PROMPT_USER(TYPEQ,%REF(MODEM_TYPE),LEN(MODEM_TYPE))
	IF (BACKUP) RETURN
	IF (WANTS_HELP) THEN
125		CALL GET_HELP('MODEM_TYPE')
		GOTO 100
	ENDIF
130	IF (LBYTE_COUNT .EQ. 0) RETURN	! No autodial modem.
	MODEM_SIZE = LBYTE_COUNT	! Save the byte count.
C
C	See if we have a valid modem type.
C
	IF	(MODEM_TYPE(1:4) .EQ. 'DF03') THEN
		AUTODIAL_TYPE = DF03	! DEC DF03 modem.
	ELSEIF	(MODEM_TYPE(1:5) .EQ. 'RIXON') THEN
		AUTODIAL_TYPE = RIXON	! RIXON R212A modem.
	ELSE
		GO TO 125		! Invalid, give some help.
	ENDIF
	AUTODIAL = .TRUE.		! Show we have autodial modem.
	RETURN
	END

	SUBROUTINE GET_PHONE_NUMBER
C
C	This routine requests the phone number to be used with the
C	autodial modem.
C
	INCLUDE 'COM.INC/NOLIST'

	CHARACTER*(*) AUTOQ, ALREADY_ONLINE

	PARAMETER (AUTOQ =
	1 'Enter the phone number to dial: ')
	PARAMETER (ALREADY_ONLINE = SS//
	1 '*** The modem is already connected, bypassing autodial. ***'//SS)
C
C	Get the phone number.
C
C	If we're starting VAXNET with the modem already connected (REMOTE),
C	we don't want to autodial.  In this case, if they do want to dial
C	a number, they must use the HANGUP command to hangup the modem and
C	then use the DIAL command to enter this routine again.
C
C	The RIXON autodial modem always looks like it's ready (MR is on)
C	even when we've hung it up.  It does not pass the DSR or Carrier
C	signals to the terminal driver.
C
	IF (REMOTE .AND. (AUTODIAL_TYPE .NE. RIXON)) THEN
		CALL WRITE_USER (ALREADY_ONLINE)
		RETURN
	ENDIF
	IF (STARTUP) THEN
		IF (GET_SYMBOL('PHONE_NUMBER',PHONE_NUMBER,LBYTE_COUNT)) THEN
			GO TO 130
		ENDIF
	ENDIF
100	CALL PROMPT_USER(AUTOQ,%REF(PHONE_NUMBER),LEN(PHONE_NUMBER))
	IF (BACKUP) RETURN
	IF (WANTS_HELP) THEN
125		CALL GET_HELP('PHONE_NUMBER')
		GOTO 100
	ENDIF
130	IF (LBYTE_COUNT .EQ. 0) RETURN	! No phone number to dial.
	PHONE_SIZE = LBYTE_COUNT	! Save the byte count.
	RETURN
	END

	SUBROUTINE DIAL_MODEM
C
C	This routine is used to dispatch to the appropriate autodial
C	routine (RF03 or RIXON).
C
	INCLUDE 'COM.INC/NOLIST'
C
C	If we don't have a modem type, go get it.
C
	IF (.NOT. AUTODIAL) THEN
		CALL GET_MODEM_TYPE()	! Get the modem type.
		IF (BACKUP .OR. (.NOT. AUTODIAL)) RETURN
	ENDIF
C
C	If we don't have a phone number, prompt for it.
C
	IF (PHONE_SIZE .EQ. 0) THEN
		CALL GET_PHONE_NUMBER()	! Get the phone number.
		IF (BACKUP .OR. PHONE_SIZE .EQ. 0) RETURN
	ENDIF
	IF (AUTODIAL) THEN
		CALL HANGUP_MODEM()	! Hangup the modem first.
C
C	Now dispatch to approriate autodial routine.
C
		IF (AUTODIAL_TYPE .EQ. DF03) THEN
			CALL DIAL_DF03()	! DEC DF03 modem.
		ELSEIF (AUTODIAL_TYPE .EQ. RIXON) THEN
			CALL DIAL_RIXON()	! RIXON R212A modem.
		ENDIF
	ENDIF
	RETURN
	END
