Setting Up PCTTY bank (several PCTTY programs running on a windows pc that are scheduled by a perl script running along with an Apache web server. This is probably on a LINUX box). author: Paul Cheffers year: 2009 email: paul@securecottage.com IMPORTANT NOTE: Normally, PCTTY Bank is set up in conjunction with a VOIP phone interface. Several PCTTYs could have voice modems and phone lines, but normally a VOIP phone interface would be used. PCTTY needs to have a TSP (Tapi Service Provider) that can interface with a SIP phone server on the Internet. The only one that the author has found to work properly is the COMISDN SIP communication server available for a fee at http://www.comisdn.com/voip/communicationserver.htm see http://www.pctty.com/iptelephony.html for instructions on how to configure the COMISDN TSP. You can download a 30 trial version of this product and ensure it works with your VOIP SIP server. From there it will cost approximately 220 Euros for 2 channels (2 phone lines). A USB Dongle, available for around 60 euros, is recommended as with it the license for the program can be carried from PC to PC. You can buy more channels if you want them. The Activa TSP, an open source project available at sourceforge, looks promising, as it is free, but the author has not been able to make it work with his SIP server yet. Perhaps, someone can upgrade this product so that it works with TAPI 3 applications like PCTTY. STEPS TO INSTALL THE WEB INTERFACE 1)You need to install this directory along with the subdirectory 'web' directory on your webserver. 2)index.htm is the start of the system, but scheduler.cgi is called (twice, first time to see if any free PCTTY programs exist on the WINDOWS PCTTY PC, second time, to make the person provide a password so that bots don't make thousands of phone calls on you). schedulertest.cgi is a spare Perl script that you can use for test PCTTY banks. You need to change it just like you need to change scheduler.cgi 3)To run the passwordgenerator.cgi perl program you need to have installed the ImagePwd perl package (part of the webtools package) available at CPAN (http://www.cpan.org). You will need to edit the line use lib '/home/cheffers/pctty/webtools/modules'; in passwordgenerator.cgi so that it points to the actual webtools perl package on your system. The passwordgenerator.cgi uses the 'passwordimages' directory. Make sure you have one in the same directory as scheduler.cgi. 4) You need to have chatclient.html and query.html files in the web directory on your PCTTY computer program running on the Windows machine. You will need to put the '$locals' file in the actual install directory of each PCTTY instance (ie., c:\Program Files\Nantes Enterprises and c:\Program Files\Nantes Enterprises1 etc). You will need to configure this file with local values, mainly ip addresses (internal and external) and ports (internal and external) 5) You will have to add to the configuration file (httpd.conf) of the Apache webserver (see apachestuff/httpd.conf.webstuff.text for instructions) this will probably mean a recompile of Apache to include the mod_proxy module and then changes to the httpd.conf configuration file. 6) You will need to edit the scheduler.cgi perl script to take account of the individual PCTTY programs and their internal IP and port addresses, and the internal and external IP address of the apache web server. Look at the definitions of the variables at the top of the file and a) change the executive secret at the top of the file to something for you i) then bring up a PCTTY on the windows pc, go into Properties, then Internet Settings. From there a) click on "Make PCTTY an Internet..." b) click on "Check Secrets" c) enter the executive secret you put into scheduler.cgi d) click on "Make PCTTY a web server" e) unclick Disable PCTTY Internet Interface. b) change any references in the file (strings such as 'pctty/web') to whatever path you placed the pctty web directory on your apache server. It is recommended you simply replicate the web directory structure you find here) 7) edit the '$locals' file on each installation of PCTTY (look at C:\program files\nantes enterprises' and any other directories for the ancillary PCTTY installs) (Each PCTTY program must reside in its own directory, they share registry values, but NOT file space) A typical $locals file follows: MARRI VARIABLE: 0,7e82 $$ipaddress 192.168.1.38 $$internalipaddress 192.168.1.38 $$port 6667 $$executivesecret 888888888888 $$webserverport 81 $$externalipaddress calltty.com.au $$webserveripaddress 192.168.1.40 $$externalwebserveripaddress calltty.com.au $$defaulttapidevice IP Line 1 Channel 1 last last These addresses are mainly the ports the chat server within PCTTY is listening on, and the internal and external ip addresses of the PCTTY program. It is assumed that PCTTY bank is sitting behind a NAT firewall. Keep the file line in last last Carefully type in the default tapi device for the particular PCTTY instance being configure. It will be different for each PCTTY program. This has to be exact or PCTTY will not use the tapi device designated for your PCTTY instance. MOST IMPORTANT: the key '$$defaulttapidevice' is followed by a TAB key, not a space key. Use notepad to create and edit this file. A typical $locals files is provided in this directory. You should just be able to edit it and put it in the main PCTTY install directory (not the web directory underneath it). This file provides local variables for the particular PCTTY program that differentiates it from the other PCTTY programs on the same windows box. 8) install the secureco_publickeys MYSQL database by feeding the 'create_secureco_publickeys_mysql_db.txt' file into mysql after you have created the database through mysqladmin. 9) set the password for the secureco_publickeys db (and change the name of it if you are capable), and change the globallocals.pl file to reflect the mysql path string and the mysql username and mysql password for the database created. (HINT: myPhpAdmin is most helpful for dealing with MYSQL databases on LINUX) If you keep everything to minimun changes you will probably only need to change in the globallocals.pl file: $mainurl = "http://192.168.1.40/cottage/"; # probably your internal web address for the system $mainurlsecure = "http://192.168.1.40/cottage/"; # your secure web address, could be the same as here Set the database user name and the database password. $dbuser="secureco_publick"; $dbpw='password'; In order to install on LINUX you will probably need someone familar with LINUX system administration But this system runs on a 800mhz 384mb of memory old Dell box that I bought 5 years ago, so it does not need many resources. Essentially, scheduler.cgi queries each PCTTY instance by the web request: query.html. This webpage returns the current status of the PCTTY instance, whether it is in a call or not. You need to have the executive secret the same on both the PCTTY registry settings and the scheduler.cgi perl script. If it finds an open PCTTY, it creates a password and a png file showing that password, and enters this value into the mysql database. The customer then has to type in the password and then he proceeds to the actual PCTTY webpage: chatclient.html. He does not directly connect to PCTTY but to the apache web server which proxies his request to the PCTTY web server (each PCTTY can have a web server if this is turned on). The customer then gets the chatclient.html webpage which contains an applet that opens a socket to the apache web server on port 80. The applet then issues a CONNECT HTTP request (not a GET or POST as normal). The Apache web server, via configuration file changes mentioned above, then starts a socket connection between the customer's web browser and the PCTTY instance running on the Windows machine. This allows for continuous chat to happen. Sometimes firewall restrictions on corporate and/or government networks don't allow for 1) the applet to even load 2) the applet to open a socket connection to an outside ip address 3) use the CONNECT method within an open socket. So this method is not universal on all systems. However, it will work for just about anybody on the private ISP world. 10) It is recommended you simply copy this whole directory and its sub directories 'passwordimages' and 'web' to your web server directory. A path of http://yourwebdnsaddress/pctty is recommended as all the Perl scripts assume this. You may have to edit scheduler.cgi and schedulertest.cgi if you have a different web address for the system.