From: sysop                           
Subject: Re: PHONE port and parameters?
News-Software: VAX/VMS VNEWS 1.4-b1  
Organization: Department of Nuclear Engineering Sciences
Date: 27 Aug 1992 21:16 EST  

In article <1992Aug25.185621.5207@iitmax.iit.edu>, bruifal@elof.iit.edu (Falke Bruinsma) writes...
> 
>Hello
> 
>Can anyone tell me what the parameters are for PHONE? Last year I wrote a 
>program that could dump _any_ message on someone elses screen. What I did
>is I changed the fieldname that contains the username of who is calling you.
>So instead of: BRUIFAL is phoning you. It would say anything I wanted to say
>by using the backspace to go to the beginning of the line and using spaces
>to push the message 'is phoning you' of the screen on the right. Can anyone
>please tell me what the port is and what parameters in what order go? I lost
>the program over the summer when I was cleaning up.. you know how it goes.. oh
>this is old stuff: DEL *.*;*...
> 
> Thanx in advance
> 
>  Falke Bruinsma
> in%"bruifal@minna.iit.edu"
> in%"bruifal@elof.iit.edu"

Well, here are two utilities I use.  The first one is an example of how to
talk to the phone object on a remote node to get a listing of users.  The
second one is a "hack" that will let you insert text into the conversation of
some current PHONE users.  You can tell what the phone object is with NCP:
NCP> show known objects

WARNING: It is easy for the second program (TAP) to get hung during its' read
from the PHN$ mailbox while it waits for the Phone partner to enter something.
PHONE's read ASTs will inevitably strip characters from the mailbox before you
may read them, so trying to "listen in" on conversations becomes a mess of
sporadic (about every 3rd) character.  Therefore this is program doesn't try
to fool with listening.  I suppose if this were rewritten in a high level
language and you could post read ASTs at a higher mode than the PHONE users
you could get all the characters, and politely put them back into the stream.
I wrote this one day, and just outlined what I had figured out/guessed about
some of the phone codes.

-------- CUT HERE ---------

$ ver:='f$verify(0)
$ !
$ ! NETWHO.COM -- Shows the logged in users on a remote DECnet node
$ !               by asking the PHONE object for a list.
$ !
$ if p1.eqs."" then inquire p1 "_Node"
$ p1 = p1-":"-":"
$ say = "write sys$output"
$ num = 0
$ cmd[0,8] = 15
$ open/read/write/error=exit phn 'p1'::"29="	! Phone object is 29
$ say "Users on "+p1+" at "+f$time()+"."
$ say "Process Name    User Name       Terminal        Phone Status"
$ say ""
$lupe:
$ write phn cmd
$ read/error=close phn str
$ if f$length(str).eq.0 then goto close
$ say str
$ num = num+1
$ goto lupe
$close:
$ close phn
$ say ""
$ say f$fao("!SL person!%S listed.",num)
$exit:
$ if .not. $status then say f$message($status)
$ exit 1+0*f$verify(ver)

-------- CUT HERE ---------

$! Title:	TAP.COM
$! Author:	Shawn A. Clifford
$! Date:	31-JUL-1992
$! Purpose:	Places a tap on a user's phone mailbox.  The user
$!		may then insert a string of characters into the mailbox.
$! Modification History:
$! --------------------------------------------------------------------------
$!
$ set symbol/scope=(nolocal,noglobal)
$! 'f$verify(0)
$ set on
$ on error then goto exit
$ on warning then goto exit
$ on control_y then goto exit
$ w := write phn_mbx
$ say := write sys$output
$ nul[0,8]=0
$ lf[0,8]=10
$ cr[0,9]=13
$!
$!	The following are the PHONE codes I've figured out so far:
$!
$  scode[0,8]=2			! Switch cursor to tapped user's screen
$  echo$[0,8]=4			! Echo string to both users.  This is displayed
$!			in the window belonging to the TAPped user.
$  icode[0,8]=8			! IDentify a PHONE user
$  ecode[0,8]=9			! Exit - dead phone msg
$  acode[0,8]=11		! Answer acknowledge code  (w/ parter's ID)
$  rcode[0,8]=12		! Reject code (w/ rejectors ID)
$  pcode[0,8]=14		! Privately send msg. to just one screen
$!			(w/ conversation partner's ID).  This is displayed on
$!			the screen belonging to the parter IDd in the msg.
$  wcode[0,8]=15		! When send to the phone object (ie. "29=")
$!			before each read, a list of available user's is
$!			returned. (see NETWHO.COM )
$  ccode[0,8]=17		! Place a call (haven't figured out the syntax)
$  hcode[0,8]=18		! Place user on HOLD (w/ partner's ID)
$  ucode[0,8]=19		! UNHOLD user (w/ partner's ID)
$!
$!	Get the username who's phone is to be tapped.
$!
$ if (p1 .nes. "")
$ then
$	user=p1
$ else
$	read/prompt="User to TAP:  " sys$command user
$	if (user .eqs. "") then goto exit
$	user=f$edit(user,"collapse,upcase")
$ endif
$!
$!	Check if there is a phone mailbox to open.
$!
$ if (f$trnlnm("PHN$"+user,"LNM$SYSTEM_TABLE") .eqs. "") then goto nophone
$ say ""
$ say "Type EXIT at the '>' prompt to leave TAP."
$ call write "Waiting for input from ''user''s partner..."
$!
$!	Get the steering msg and the other user's name
$!
$ open/read/write phn_mbx phn$'user'
$ read/time=2 phn_mbx string
$ w string			! Put the stolen character back in the stream
$ steer_code=f$cvsi(0,8,string)
$ len=f$len(string)
$ offset=1
$ loop1:
$	if (f$cvsi(offset*8,8,string) .ne. nul .and. offset .lt. len)
$	then
$		offset=offset + 1
$		goto loop1
$	endif
$ other_user=f$extract(1,offset-1,string)
$! say "''other_user' sent a message with a steering code = ''steer_code'"
$ say ""
$ say "''user' is talking to  ''other_user'"
$ say ""
$!
$!	Get input to be inserted into mailbox
$!
$ loop2:
$   read/prompt="> " sys$command text
$   if (f$edit(text,"collapse,upcase").eqs."EXIT") then goto exit
$   msg=""
$   msg=echo$+text+cr+lf
$   w msg
$ goto loop2
$!
$ exit:
$	exit ($status)
$ close:
$    close/error=exit phn_mbx
$    exit ($status)
$!
$ nophone:
$	say ""
$	say "''user' does not have a PHONE mailbox in use."
$	say ""
$ exit ($status)
$!
$ Write: SUBROUTINE
$! Displays a line and pauses at the end of the line
$ READ/TIME_OUT=0/END=CCC/ERR=CCC/PROMPT="''P1'" SYS$COMMAND dummy_variable
$   CCC: EXIT
$        ENDSUBROUTINE