From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 26-JUL-1990 07:08:59.51
To:	MRGATE::"ARISIA::EVERHART"
CC:	
Subj:	Re: Help needed w/ modem <-> VMS

Received:  by crdgw1.ge.com (5.57/GE 1.70)
	 id AA16970; Sat, 21 Jul 90 15:07:30 EDT
Received: From UCBVAX.BERKELEY.EDU by CRVAX.SRI.COM with TCP; Sat, 21 JUL 90 11:43:51 PDT
Received: by ucbvax.Berkeley.EDU (5.63/1.41)
	id AA24936; Sat, 21 Jul 90 11:28:09 -0700
Received: from USENET by ucbvax.Berkeley.EDU with netnews
	for info-vax@kl.sri.com (info-vax@kl.sri.com)
	(contact usenet@ucbvax.Berkeley.EDU if you have questions)
Date: 21 Jul 90 18:25:02 GMT
From: rogue.llnl.gov!oberman@lll-winken.llnl.gov
Organization: Lawrence Livermore National Laboratory
Subject: Re: Help needed w/ modem <-> VMS
Message-Id: <1990Jul21.112502.1@rogue.llnl.gov>
References: <58324@bbn.BBN.COM>, <00939ED6.539C2B40@uclapp.physics.ucla.edu>, <2017@bnlux0.bnl.gov>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com

In article <2017@bnlux0.bnl.gov>, kushmer@bnlux0.bnl.gov (christopher kushmerick) writes:
> How can I implement a simple call-back scheme. I want my Hayes compatible
> modem to call my modem at home, and then conect me (at home) to a login
> prompt (ie I want to log in from home but have work pay the phone bill).
 
I have a rather tacky callback I wrote for use on my system. It is designed for
use with a stat mux that CLAIMS to emulate a Hayes and does 2 stage dialing to
get through our 5ESS (First number to connect to an analog modem, second to
dial the outside line.

It could be easily modified for more standard systems or you could use it for
ideas on writing your own. It is important to know EXACTLY how your modem
responds to various situations if it's going to work.

The program consists of 2 parts, a diriving procedure which submits the
callback to a batch queue and the actual dialer.

It has a couple of hard <CR>s in text strings, so it may get a bit garbled by
gateways.

					R. Kevin Oberman
					Lawrence Livermore National Laboratory
					Internet: oberman@icdc.llnl.gov
   					(415) 422-6955

Disclaimer: Don't take this too seriously. I just like to improve my typing
and probably don't really know anything useful about anything.

============================ CALL.COM ==========================================
$ On Error Then Exit
$ After = ""
$ If "''P2'" .nes. "" Then after = "/After=''P2'"
$ Submit/NoPrint/Parameter=("''P1'")/Queue=DIAL'After' -
 SYS$system:DIAL
$ LogOut

============================ DIAL.COM ==========================================
$!	A command file designed to have the computer
$!	call out to a number (P1).
$!
$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$
$	Set NoOn
$                                                 
$ If "''P1'" .EQS. "" Then Read/Prompt="Number? " SYS$COMMAND P1
$! Make sure we're on the system with the lines
$ If F$GetSYI("NODENAME") .NES. "MYNODE" Then Exit
$! Logical "MODEM" is defined as a search list of possible dialer lines
$ Max_Index = F$TRNLNM("MODEM",,,,,"MAX_INDEX")
$Get_Port:
$ Reset_Count = 0
$ Index = 0
$ PID = F$GetJPI("","PID")
$Loop:
$ Port = F$TRNLN("MODEM",,Index)
$ Index = Index + 1
$ If Index .GT. Max_Index
$ Then
$    Write Sys$Output "All modems in use. Please try later."
$    Exit
$ EndIf
$! This SHOULD work! But it doesn't.
$! If F$GetDVI(Port,"AVL") Then GoTo Loop
$! So, we will do ti the hard way
$ Define/User SYS$OUTPUT Temp_'PID'.DAT
$ Show Device 'Port'
$ Open/Read Data Temp_'PID'
$ Read Data String
$ Read Data String
$ Read Data String
$ Read Data String
$ Close Data
$ Delete/Log Temp_'PID'.DAT;
$ String = F$Edit(String,"COMPRESS")
$ Sho SYm String
$ If F$Element(1, " ",String) .EQS. "Unavailable" Then GoTo Loop
$ If F$Element(2, " ",String) .EQS. "Alloc" Then GoTo Loop
$ Dialer = Port - ":" + ":"
$ ! There is a hard <CR> (%O13) at the end of the next string!
$ Number=="''P1'
$ ! Clear out any junk from the line
$ Allocate 'Dialer'
$ Set Terminal/NoTypeahead /NoModem 'Dialer'
$ Wait 0:0:2
$ Set Terminal/Typeahead/Modem 'Dialer'
$ Deallocate 'Dialer'
$ Wait 0:0:8
$ Open/Write DD 'Dialer'
$ Set Terminal/Modem/Typeahead/NoEcho/NoHangup 'Dialer'
$! First, call the real modem in the central modem pool
$Stage_1:
$! The next line contains a hard <CR> after the phone number
$ Read/Prompt="ATD1112400
$ Show Symbol Response
$! Pause long enough for the remote line to have hung up (for callback)
$ Wait 0:0:10
$! Now call the real number
$ Read/Time=2/Error=Reset_Mux/Prompt="ATDT''Number'" DD Response
$ Show Symbol Response
$ Read/Time=70/Error=Reset_Mux/Prompt="" DD Response
$ Show Symbol Response
$ Read/Time=2/Error=Reset_Mux/Prompt="" DD Response
$ Show Symbol Response
$ If F$Locate("CONNECT", Response) .LT. F$Length(Response) Then GoTo Got_It
$! Something happened. time to give up gracefully
$error_vector:
$ Show Symbol Response
$ Set Terminal/Hangup 'Dialer'
$ Close DD
$ Deallocate 'Dialer'
$ Exit
$! Connection is established! Get out and let the user log in.
$Got_It:
$ Close DD
$Return_Vector:
$ Exit
$! This is a routine to reset the stat mux as it often hangs or is left
$! off-hook.
$Reset_Mux:
$ Reset_Count = Reset_Count + 1
$ If Reset_Count .EQ. 3 Then GoTo Get_Port
$ Wait 0:0:1
$ Read/Prompt="+++"/Time=2 DD Response
$ Wait 0:0:1
$ Read/Prompt="ATH
$ GoTo Stage_1

