# # GnuDialer - Complete, free predictive dialer # # Complete, free predictive dialer for contact centers. # # Copyright (C) 2005, GnuDialer Project # # Heath Schultz # Richard Lyman # # This program is free software, distributed under the terms of # the GNU General Public License. # SHELL=/bin/sh # Feel free to comment out the "guessed values" and enter the paths explicitly # if you have troubles getting them from ./mkhelper or mysql_config. RUNAS := `ps wwwaux | grep asterisk | sed -e 's/ /\n/' | sed -e 's/ /\n/' | head -n 1` DIST := `./detect` MYSQLVER := `mysql -V | cut -c25-27` SVNREV := `svn info |grep Revision:` #ifeq ($(shell `detect`),RedHat) ifeq ($(DIST),RedHat) CGIBIN := `./mkhelper CGIBIN` DOCROOT := `./mkhelper DOCROOT` #MYSQLLIBLOC := `mysql_config --libs | sed -e 's/ /\n/' | sed -e 's/ /\n/' | head -n 1` #MYSQLLIBLOC= LMYSQLCLIENT := `mysql_config --libs | sed -e 's/ /\n/' | sed -e 's/ /\n/' | head -n 2 | tail -n 1` else CGIBIN=/var/www/cgi-bin/ DOCROOT=/var/www/html/ # CGIBIN=/home/pchammer/www/dynx.net/cgi-bin/ # DOCROOT=/home/pchammer/www/dynx.net/ #MYSQLLIBLOC=/usr/lib/mysql #MYSQLLIBLOC= LMYSQLCLIENT=-lmysqlclient endif #sometimes you need to comment out all but UB=/usr/bin (if you are going to run as root #ifeq (${RUNAS},root) UB=/usr/bin #else # UB=/usr/bin/${RUNAS} #endif CC = g++ CFLAGS = -g -Wall #CFLAGS+= -ansi #CFLAGS+= -pedantic #CFLAGS+= -O3 -mtune=pentium4 #CFLAGS+= -O3 -mtune=i686 #CFLAGS+= -fexceptions CFLAGS+= #-Wshadow CFLAGS+= #-Weffc++ #CFLAGS+= -Wunreachable-code #CFLAGS+= -O2 -mtune=i686 -pipe -fomit-frame-pointer -Wundef -Woverloaded-virtual -fsigned-char -fno-inline all: printdistinfo printrunasinfo printcgibin printdocroot printasteriskv printmysqlver printmysqlinc thegnudialer dialeradmin agenthours newstats allstats printrec disporec dnidlookup test up @echo @echo "Done! Now type \"make install\" to install." @echo printdistinfo: @echo @echo "Checking Linux Dist Info..." @echo @echo "DISTRIBUTION: " ${DIST} @echo printrunasinfo: @echo @echo "Asterisk being RUN..." @echo @echo "AS: " ${RUNAS} @echo printcgibin: @echo @echo "WE GUESSED THAT THE PATH TO cgi-bin IS: " ${CGIBIN} @echo "I WILL TRY TO USE THIS PATH" @echo "IF THIS IS INCORRECT, PLEASE EDIT THE PATH MANUALLY IN Makefile" @echo printdocroot: @echo @echo "Checking for Apache (httpd.conf)..." @echo @locate httpd.conf @echo @echo "OK." @echo @echo "WE GUESSED THAT THE PATH TO DocumentRoot IS: " ${DOCROOT} @echo "I WILL TRY TO USE THIS PATH" @echo "IF THIS IS INCORRECT, PLEASE EDIT THE PATH MANUALLY IN Makefile" @echo printmysqlver: @echo @echo "Checking MySQL Version..." @echo @echo "MYSQL VERSION: " ${MYSQLVER} @echo @echo "THIS MUST SAY 4.1 OR HIGHER!!!!!!" @echo "CURRENTLY THERE ARE NO CHECKS TO STOP COMPILING IF TOO OLD!" @echo printmysqlinc: @echo @echo "Checking for mysql_config..." @echo @locate mysql_config @echo @echo "OK." @echo printasteriskv: @echo @echo "Checking for asterisk..." @echo @/usr/sbin/asterisk -V @echo @echo "OK." @echo thegnudialer: @echo "SVN" ${SVNREV} $(CC) $(CFLAGS) gnudialer.cpp -g -o gnudialer `mysql_config --include` `mysql_config --libs` #dialeradmin: # $(CC) $(CFLAGS) ${MYSQLINC} ${MYSQLLIBLOC} ${LMYSQLCLIENT} dialeradmin.cpp -o dialeradmin.cgi dialeradmin: $(CC) $(CFLAGS) dialeradmin.cpp -o dialeradmin.cgi `mysql_config --include` `mysql_config --libs` agenthours: $(CC) $(CFLAGS) agenthours.cpp -o agenthours.cgi stats: $(CC) $(CFLAGS) stats.cpp -o stats.cgi newstats: $(CC) $(CFLAGS) newstats.cpp -o newstats.cgi allstats: $(CC) $(CFLAGS) allstats.cpp -o allstats.cgi printrec: $(CC) $(CFLAGS) printrec.cpp -g -o printrec.agi `mysql_config --include` `mysql_config --libs` disporec: $(CC) $(CFLAGS) disporec.cpp -g -o disporec.agi `mysql_config --include` `mysql_config --libs` dnidlookup: $(CC) $(CFLAGS) dnidlookup.cpp -g -o dnidlookup.agi `mysql_config --include` `mysql_config --libs` test: $(CC) $(CFLAGS) test.cpp -g -o test.agi `mysql_config --include` `mysql_config --libs` up: $(CC) $(CFLAGS) up.cpp -o up.cgi `mysql_config --include` `mysql_config --libs` clean: rm gnudialer dialeradmin.cgi agenthours.cgi newstats.cgi allstats.cgi printrec.agi disporec.agi dnidlookup.agi up.cgi install: printdistinfo printrunasinfo printmysqlver printmysqlinc printcgibin printdocroot theinstall reload: thereload thereload: asterisk -rx "extensions reload" asterisk -rx "ael reload" theinstall: cp gnudialer ${UB} cp *.cgi ${CGIBIN} mkdir -p ${DOCROOT}gnudialer mkdir -p /usr/lib/gnudialer chmod a+rw /usr/lib/gnudialer mkdir -p /usr/lib/gnudialer/timezones chmod a+rw /usr/lib/gnudialer/timezones cp ./timezones/* /usr/lib/gnudialer/timezones/ mkdir -p /var/log/asterisk/gnudialer chmod a+rw /var/log/asterisk/gnudialer chmod a+rw /etc/asterisk/queues.conf chmod a+rw /etc/asterisk/agents.conf chmod a+rw ${CGIBIN} cp *.html ${DOCROOT}gnudialer/ cp *.gif ${DOCROOT}gnudialer/ cp *.script ${CGIBIN} cp *.agi /var/lib/asterisk/agi-bin/ chmod 755 /var/lib/asterisk/agi-bin/*.agi cp -R /etc/asterisk /etc/asterisk-config-bak if [ `grep -c '#include "dialer.conf"' /etc/asterisk/extensions.conf` -lt 1 ]; then \ sed -i -e "s/\(.*writeprotect.*\)/\1\n#include \"dialer.conf\"/" /etc/asterisk/extensions.conf ;\ fi sed -i -e "s/enabled = no/enabled = yes/" /etc/asterisk/manager.conf ; if [ `grep -c '\[dialer]' /etc/asterisk/manager.conf` -lt 1 ]; then \ cat manager.conf.EXAMPLE >> /etc/asterisk/manager.conf ;\ fi cp dialer.conf /etc/asterisk/dialer.conf cp dialer.ael /etc/asterisk/dialer.ael if [ ! -f /etc/asterisk/extensions.ael ]; then \ cat dialer.ael > /etc/asterisk/extensions.ael ;\ fi if [ ! -f /etc/gnudialer.conf ]; then \ cat gnudialer.conf.EXAMPLE > /etc/gnudialer.conf ;\ fi if [ ! -f /etc/gdhosts.conf ]; then \ cat gdhosts.conf.EXAMPLE > /etc/gdhosts.conf ;\ fi chmod 666 /etc/gnudialer.conf chmod 666 /etc/gdhosts.conf cp -R sounds /var/lib/asterisk/ mkdir -p /tmp/exports mkdir -p /tmp/sales chmod 755 /tmp/exports chmod 755 /tmp/sales touch /tmp/bogus.helper.1-1-1980 chmod 666 /tmp/*.helper.* @echo @echo "***************************************************************************************" @echo "* ** NEW REQUIREMENT ** *" @echo "* make sure you read the INSTALL doc and apply the one of the following patches *" @echo "* channel.c.hangup_callerid_ast12.diff *" @echo "* channel.c.hangup_callerid_ast14.diff *" @echo "* depending on which asterisk version you use. (the old patch(es) are still needed) *" @echo "* *" @echo "* This version changes the way dialing is done so watch your maxlines, maxratio, etc..*" @echo "* ** watch your abandons ** as this does NOT current throttle down automatically yet! *" @echo "* (after i have fleshed out the calcs i will add it back in) *" @echo "* *" @echo "* make sure your *existing* /etc/gnudialer.conf has a 9th line *" @echo "* 5038 (the asterisk manager.conf port number you have configured) *" @echo "* *" @echo "* Done! Now type \"make reload\" to reload asterisk extensions/ael. *" @echo "***************************************************************************************" @echo uninstall: printdocroot printcgibin rm ${UB}gnudialer rm ${CGIBIN}dialeradmin.cgi rm ${CGIBIN}newstats.cgi rm ${CGIBIN}agenthours.cgi rm ${CGIBIN}*.script rm ${DOCROOT}gnudialer/dialerlogin.html rm ${DOCROOT}gnudialer/checkered.gif rm -rf /usr/lib/gnudialer/timezones/ rm -rf /tmp/exports rm -rf /tmp/sales