#!/bin/sh
# ~jhs/public_html/bin/.sh/telno_x
# Purpose: ISDN: xterm 99x3 monitors gate isdnd.log, Calls telno_2
# Hardware Bug:
#	 At 2018-05-06 host=mart is missing most, not all calls, &
#	 /var/log/messages showing errors, so I may need to try host=park, &/or
#	 re-seat isdn card in mart &/or try a new card:
#	   kernel: i4b-L1 isic_isac_irq: unit 0: CRC error
#	   kernel: i4b-L1 isic_isac_irq: unit 0: Receive Aborted error
#	 or maybe some other issue eg heat or power
# See Also:
#  ~/.procmailrc_private_router_logs
#  ~/public_html/src/bsd/jhs/bin/public/phone/index.lmth
#  vi -c/Purpose:		\
#   ~/bin/.csh/telno_dsl	\
#   ~/bin/.csh/telno_dslx	\
#   ~/bin/.sh/telno		\
#   ~/bin/.sh/telno_2		\
#   ~/bin/.sh/telno_expt	\
#   ~/bin/.sh/telno_router	\
#   ~/bin/.sh/telno_x

# Called within X windows on an internal host, not the gate.
# Calls telno on host=gate
case `hostname -s` in #{
	"park" )
		echo -n "$0 : Warning: Normaly run this on an internal host, "
		echo "not on a gate,"
		;;
	"mart" )
		echo -n "$0 : Warning: Normaly run this on an internal host, "
		echo "not on a gate,"
		;;
	*):
		# echo "OK, called from an internal non gate host, as expected."
		;;
	esac	#}

# display="`printenv DISPLAY`"	# Sometimes just :0 , so not used.
display="`hostname`:0"		# OK also wrong, but better than above.
#echo Debug display $display

screen=`xdpyinfo -d $display | grep dimensions | awk '{printf "%s\n",$2}'`
case $screen in #{
	"1024x768" )	#{
		geom="80x3-0-63"	# JJLATER consider change
		font="fixed"
		;;	#}
	"1280x960")	#{
		geom="99x3-0-104"	# OK @ 2015-06-19
		font="fixed"		# OK @ 2015-06-19
		;;	#}
	"1600x1200")	#{
		geom="80x3-0-90"	# JJLATER consider change
		font="fixed"		# JJLATER consider change eg 9x15bold
		;;	#}
	# For comparison: Samsung galaxy note 3 smart phone: 1920 x 1080
	*)		#{
		geom="99x3-0-90"	# JJLATER consider change
		font="fixed"
		;;	#}
	esac	#}
# .xsession-errors : /site/usr/local/bin/host2colour
# so full path name
rsh dsl "xterm -bg `/site/usr/local/bin/host2colour dsl`	\
	-display $display	\
	-g $geom	\
	-fn $font	\
	-n telno_x	\
	-T \"Phone Incoming (telno_x)\"	\
	-e ~/public_html/bin/.sh/telno_2" &
# Can break it with a ^C in the window
