#  Bayonne Curses Gui Version 0.15
#
#  Copyright (C) 2000, 2001, 2002 by
#
#  Damian Kohlfeld - <damian@kohlfeld.com>
#
#  This file is distributed for use with Bayonne, and may freely be distributed with Bayonne.
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.


What is it?

This program will graphically show all the channels on your Bayonne server and the states of the channels.
Of key importance is that the time in seconds a given channel has been in the state is provided as well, this
is of crucial importance to anyopne with a digital line who has experienced timing/hangup/accept issues with their
provider.

#
#REQUIREMENTS:
#


1) A Non-Threaded version of Perl, prefereably 5.8
2) The Perl Curses Library, IO::Socket, IO::Handle, IO::Select.



#
#INSTALL:
#

;;
::EDIT bayonne.conf::
;;

You'll need to edit Bayonne.conf, look in the [network] section and modify it to reflect your server's
IP address, and the address of the machine you want to run the Bayonne Curses GUI on.

i.e.  For a Bayonne server with IP address 10.1.1.20, and a Bayonne Curses GUI client with 10.1.1.150

********************************Begin Section of bayonne.conf
[network]
; broadcast address address to use with other nodes
broadcast = 10.1.1.150
;broadcast = 127.0.0.1

; refresh interval for nodes
refresh = 2
;refresh = 5

address = 10.1.1.20:7000
;address = 127.0.0.1:7000
********************************End Section of bayonne.conf

Note:
You'll notice I've also modified the refresh value to 2 seconds, I'm not sure if this works since I
statically modified it in Bayonne's source on my Bayonne server, feedback is appreciated.  The packet size is minimal, and
the quick updates are nice.  Otherwise 5 second intervals are used.

;;
::EDIT syslog.conf::
;;


If you want to use the scrolling log feature, add a line like the following in your syslog.conf file, try looking in /etc

# This assumes the client is at 10.1.1.150
*.crit        @10.1.1.150

Then simply use calls like the following in your scripts, or if a newbie add this to the beginning of playrec.scr 
after the line containing "answer":
       
********************************Begin Section of playrec.scr

answer

slog.crit "Script is beginning at %session.time"
slog.crit "Welcome to Bayonne"

********************************End Section of playrec.scr


This will cause the UDP packet to be forwarded and displayed via this program, through the multithreaded server.


;;
::EDIT GUIConfig.pm::
;;

Open GUIConfig.pm in the directory where you extracted the curses-gui package.

Edit the line containing $client_ip, so that the IP of the machine you'll be running the GUI on is
shown instead of the sample IP.  For example, if your workstation is 10.1.1.150, GUIConfig.pm should contain this:

********************************Begin Section of GUIConfig.pm

# Set the Client Workstation IP information
my $client_ip = '10.1.1.150';

********************************End Section of GUIConfig.pm

#
#RUNNING:
#


1) Open up two terminal windows, 
2) ./multi-thread-server.pl in one window
3) Maximize the other window and run ./curses-gui.pl
4) Hit 'q' to quit the gui, and ctrl-c to stop the server.

Thats it.


Notes:

I wanted to make this with a server component for a couple of reasons.  The main reason is because I invision Bayonne as being
a highly scalable entity someday with a totally distributed architecture.  The second reason is simplicity in development.  I wanted
to have my server component humming along and watching the messages while I was debugging the front end.


This application is a mechanism of providing a GUI for Bayonne.  I wrote it because, in development
there we're times when I needed a quick way of visually looking at the system's status.  Primarily this
is needed if a channel gets into a locked state and inbound calls to the channel are dropped, as may
happen with digital lines especially. 
