/* * GnuDialer - Complete, free predictive dialer * * Complete, free predictive dialer for contact centers. * * Copyright (C) 2003-2008, GnuDialer Project * * Heath Schultz * Richard Lyman * * This program is free software, distributed under the terms of * the GNU General Public License. */ #include #include #include #include #include #include #include #include "post.h" #include "queue.h" #include "agent.h" #include "adminwork.h" #include "settings.h" #include "itos.h" #include "stoi.h" #include "log.h" #include "dispo.h" #include "abnhelper.h" //#include "etcinfo.h" static char *dispo2short(int dispo); static char *dispo2long(int dispo); int special_reload = 1; int exportallbtn = 0; int useVirtAgents = 0; int collectdncbtn = 1; int processdncbtn = 1; int adddncbtn = 1; int testnewevents = 1; //std::string itos(int i){ //std::stringstream s; //s << i; //return s.str(); //} //long int stoi(const std::string & theString) { //return atoi(theString.c_str()); //} std::string stou(std::string & str1) { std::transform(str1.begin(), str1.end(), str1.begin(), ::toupper); return str1; } std::string stol(std::string & str1) { std::transform(str1.begin(), str1.end(), str1.begin(), ::tolower); return str1; } std::string rfill(std::string theString, int theLength) { std::string s; s += theString + std::string(" ").substr(0,theLength-theString.length()); return s.c_str(); } std::string lfill(std::string theString, int theLength) { std::string s; s += std::string(" ").substr(0,theLength-theString.length()) + theString; return s.c_str(); } void printDateFields(int occurence) { timeval tv; gettimeofday(&tv,NULL); time_t thetime; thetime = tv.tv_sec; tm * ptm = localtime(&thetime); int month = ptm->tm_mon + 1; int day = ptm->tm_mday; int year = ptm->tm_year + 1900; std::cout << "\n"; std::cout << " \n"; std::cout << " \n"; } bool loginError = false; std::string printAlert(std::string label, std::string text) { return "" + label + "\n"; } void startTable() { std::cout << "
\n"; std::cout << "\n"; } void endCell() { std::cout << "\n"; } void endRow() { std::cout << "
\n"; } void endTable() { std::cout << "
\n"; } std::string printSubmit(std::string value) { return ""; } std::string printSubmitConfirm(std::string value) { return ""; } std::string printSubmitSmallRedColored(std::string value) { return ""; } std::string printSubmitSmallGreenColored(std::string value) { return ""; } // return ""; void printHead(std::string text) { std::cout << ""; std::cout << text; std::cout << ""; } void printSubHead(std::string text) { std::cout << ""; std::cout << text; std::cout << ""; } void doAdd(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; printHead("Added Campaign Member"); std::cout << "

"; printSubHead("You have added

"); // start debug output std::cout << "\n"; // end debug output AgentList TheAgents; TheAgents.ParseAgentList(); std::string agent; for (int i = 0; i < TheFields.OccurencesOf("agentsnotinqueue"); i++) { agent = TheFields.GetField("agentsnotinqueue",i); printSubHead(agent); // printSubHead(agent + " - " + TheAgents.where(atoi(agent.c_str())).GetName()); if (!addQueueMember(atoi(agent.c_str()),queue)) std::cout << "Error adding campaign member!"; } TheAgents.ParseAgentList(); if (testnewevents) { sendUserEvent("ReloadCampaign","Campaign: " + queue); } printSubHead(" to "); printSubHead(queue); printSubHead("."); std::cout << "

\n"; } void doRemove(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; printHead("Removed Campaign Member"); std::cout << "

"; printSubHead("You removed

"); AgentList TheAgents; TheAgents.ParseAgentList(); for (int i = 0; i < TheFields.OccurencesOf("currentagents"); i++) { std::string agent = TheFields.GetField("currentagents",i); printSubHead(agent); if (!removeQueueMember(agent,queue)) std::cout << "Error removing campaign member!"; } TheAgents.ParseAgentList(); if (testnewevents) { sendUserEvent("ReloadCampaign","Campaign: " + queue); } printSubHead(" from "); printSubHead(queue); printSubHead("."); std::cout << "

\n"; } void showMenu(Post TheFields) { QueueList TheQueues; TheQueues.ParseQueues(); std::string queue = TheFields.GetField("queue"); std::cout << "GnuDialer Administration"; std::cout << "
\n"; startTable(); std::cout << "Campaigns:"; endRow(); std::cout << "\n"; std::cout << ""; //std::cout << "
* means started"; std::cout << "
* = started  "; std::cout << "
"; std::cout << printSubmitSmallGreenColored("Start"); std::cout << printSubmitSmallRedColored("Stop"); //std::cout << printAlert("[?]","These buttons simply allow for faster start/stop operation.\\n\\nSelect the campaign you wish to run the operation on,\\nand click the button you wish to run, Start or Stop.\\n\\n"); endCell(); // put queue buttons here //std::cout << "" << "
"; std::cout << printSubmit("Create Campaign") << "
"; std::cout << printSubmit("Import Data"); std::cout << printAlert("[?]","Added the ability to import data to a campaign with existing data.\\nThe field names and types used the second time must match the existing ones.\\nOr be a subset of the first data set.\\nFirst import: phone,name,address,city,state,zip,comments\\nSecond import: phone,name,comments"); std::cout << "

"; // std::cout << printSubmit("Callist Build") << "
"; std::cout << printSubmit("Edit Campaign Members") << "
"; std::cout << printSubmit("Manage Campaign") << "
"; //std::cout << printSubmit("Edit Filters") << "
"; std::cout << printSubmit("Edit Filters"); std::cout << printSubmit("Filter Cnts") << "
"; //std::cout << printSubmit("DB Today") << "
"; std::cout << printSubmit("Select Counts") << "
"; std::cout << "
"; std::cout << printSubmit("Campaign Stats"); std::cout << printAlert("[?]","Closer numbers provided for reference only,\\nthey are not included in Campaign totals!"); std::cout << "
"; //std::cout << printSubmit("System Stats"); //std::cout << printAlert("[?]","These are the Machine Stats. (what the dialer did)"); // std::cout << "
"; //std::cout << printSubmit("All Campaign Stats"); //std::cout << printAlert("[?]","Closer numbers provided for reference only, they are not included in Campaign totals!"); //std::cout << "
"; std::cout << printSubmit("Export Sales"); std::cout << printAlert("[?]","The output of this feature is currently hardcoded.\\nYou will need to modify the source code of dialeradmin.cpp\\nto suit your liking."); std::cout << "
"; endRow(); std::cout << "Agents:"; endRow(); AgentList TheAgents; TheAgents.ParseAgentList(); std::cout << "\n"; endCell(); // put agent buttons here std::cout << printSubmit("Create Agent"); std::cout << printSubmit("Alt Agent"); std::cout << "
"; std::cout << printSubmit("Day Agent"); std::cout << printSubmit("Create Closer") << "
"; std::cout << "
"; std::cout << printSubmitConfirm("Delete Agent/Closer") << "
"; std::cout << printSubmit("Edit Agent Info"); std::cout << printAlert("[?]","This feature only allows you to edit 1 agent/closer at a time.\\nOnly the first highlighted agent is editable.") << "
"; // std::cout << printSubmit("Message Agent") << "
"; std::cout << "
"; std::cout << printSubmit("Agent Stats") << "
"; std::cout << printSubmit("Agents Times") << "
"; endTable(); } void showEditQueueMembers(Post TheFields) { std::string queuename = TheFields.GetField("queue"); std::cout << ""; AgentList TheAgents; TheAgents.ParseAgentList(); Queue TheQueue; TheQueue.ParseQueue(queuename); std::cout << "\n"; std::cout << "
" + TheQueue.GetName() + "

\n"; std::cout << "
"; std::cout << "
\n"; std::cout << ""; std::cout << ""; std::cout << ""; std::cout << ""; std::cout << ""; std::cout << "\n \n \n \n\n"; } void doLogin(Post TheFields) { std::string actualPass = getGnuDialerPassword(); if (actualPass != TheFields.GetField("pass")) { std::cout << "Password Incorrect!\n"; loginError = true; } if (actualPass == TheFields.GetField("pass")) { showMenu(TheFields); } } void doLogout() { printSubHead("You have logged out."); std::cout << "

"; std::cout << "Click here to log back in."; } void doManageCampaign(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; addBasicSettings(queue); bool doStart = campaignIsRunning(queue); if (true) { printHead("Manage Campaign Options"); std::cout << "

"; printSubHead("Existing options for "); printSubHead(queue); printSubHead("."); std::cout << "

"; Queue TheQueue; TheQueue.ParseQueue(queue); std::cout << "
\n"; std::cout << "Current Members\n"; std::cout << "Not in Campaign
\n"; std::cout << "\n"; std::cout << "
\n"; std::cout << "\n

"; std::cout << "\n

"; std::cout << "
\n"; std::cout << "\n"; std::cout << "
" << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; if (useVirtAgents) { std::cout << "" << std::endl; } std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; std::string trunk = TheQueue.GetSetting("trunk").Get(); if (trunk.find("%3A",0) != std::string::npos) { int trunkPos = trunk.find("%3A",0); trunk.erase(trunkPos,3); trunk.insert(trunkPos,":"); } std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "
Dial Mode: " << TheQueue.GetSetting("function").Get() << "
Callback Today: " << TheQueue.GetSetting("calltoday").Get()<< "
DNC Scrub: " << TheQueue.GetSetting("usednc").Get()<< "
Virt Agents: " << TheQueue.GetSetting("virtagents").Get() << "
MaxRatio: " << TheQueue.GetSetting("maxratio").Get() << "
MaxAbandons: " << TheQueue.GetSetting("maxabandons").Get() << "
MaxLines: " << TheQueue.GetSetting("maxlines").Get() << "
SleepTime: " << TheQueue.GetSetting("sleeptime").Get() << "
LowestTime: " << TheQueue.GetSetting("tzearliest").Get() << "
HighestTime: " << TheQueue.GetSetting("tzlatest").Get() << "
Timeout: " << TheQueue.GetSetting("timeout").Get() << "
CallerID: " << TheQueue.GetSetting("callerid").Get() << "
DSP Mode: " << TheQueue.GetSetting("dspmode").Get() << "
Trunk: " << trunk << "
Dial Prefix: " << TheQueue.GetSetting("dialprefix").Get() << "
Use Closer: " << TheQueue.GetSetting("usecloser").Get() << "
Closer Cam: " << TheQueue.GetSetting("closercam").Get() << "
Debug: " << TheQueue.GetSetting("debug").Get() << "
VM Message: " << TheQueue.GetSetting("vm_message").Get() << "
SF Message: " << TheQueue.GetSetting("sf_message").Get() << "
3rdParty Ver: " << TheQueue.GetSetting("thirdparty").Get() << "
" << std::endl; std::cout << "
" << std::endl; if (doStart) { std::cout << printSubmit("Stop Campaign"); } else { std::cout << printSubmit("Start Campaign"); } std::cout << printSubmit("Edit Campaign"); //std::cout << printSubmit("Edit Filters"); std::cout << printSubmit("Edit Script"); // std::cout << printSubmit("Print Record"); std::cout << "
"; std::cout << printSubmit("Backup Data"); std::cout << printSubmit("Restore Data"); std::cout << printSubmit("Create Reload Data"); std::cout << printAlert("[?]","This feature allows you to create a reload text file.\\nThis file will contain dispositions -7 through 7 and 9 10 11.\\n\\n(see gnudialer/README or README.dispositions for info) \\n\\nIt will create this file as /tmp/reload-*campaign_name*.txt\\n\\nThat can then be re-imported into an existing campaign, or into\\na new campaign (to keep reports separate).\\n(remember table structures must be same/subset)\\n"); std::cout << "
"; //std::cout << printSubmit("Database Counts") << "
"; if (special_reload) { std::cout << printSubmit("Create Reload Campaign"); } std::cout << printSubmit("Edit Channel Vars")<< "
"; std::cout << "              "; std::cout << "              "; std::cout << "              "; std::cout << "       "; std::cout << printSubmitConfirm("Remove Campaign"); std::cout << "
"; } } void doShowCampaignSettings(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; QueueList TheQueues; TheQueues.ParseQueues(); printHead("Current Campaign Settings"); std::cout << "

"; std::string tempCampaign; std::cout << "" << std::endl; std::cout << " \ \ " << std::endl; for (int q = 0; q < TheQueues.size(); q++) { tempCampaign = TheQueues.at(q).GetName(); std::cout << "" << std::endl; } std::cout << "
CampaignModeCBTodayDNCScrubFudgeMaxRatioMaxAbnMaxLinesSleepLowTHighTTimeoutCallerID NumDSPModeTrunkPrefixUseCloserCloserCamDebug
" << tempCampaign << "" \ << TheQueues.at(q).GetSetting("function").Get() << "" \ << TheQueues.at(q).GetSetting("calltoday").Get() << "" \ << TheQueues.at(q).GetSetting("usednc").Get() << "" \ << TheQueues.at(q).GetSetting("virtagents").Get() << "" \ << TheQueues.at(q).GetSetting("maxratio").Get() << "" \ << TheQueues.at(q).GetSetting("maxabandons").Get() << "" \ << TheQueues.at(q).GetSetting("maxlines").Get() << "" \ << TheQueues.at(q).GetSetting("sleeptime").Get() << "" \ << TheQueues.at(q).GetSetting("tzearliest").Get() << "" \ << TheQueues.at(q).GetSetting("tzlatest").Get() << "" \ << TheQueues.at(q).GetSetting("timeout").Get() << "" \ << TheQueues.at(q).GetSetting("callerid").Get() << "" \ << TheQueues.at(q).GetSetting("dspmode").Get() << ""; std::string trunk = TheQueues.at(q).GetSetting("trunk").Get(); if (trunk.find("%3A",0) != std::string::npos) { int trunkPos = trunk.find("%3A",0); trunk.erase(trunkPos,3); trunk.insert(trunkPos,":"); } std::cout << trunk << "" \ << TheQueues.at(q).GetSetting("dialprefix").Get() << "" \ << TheQueues.at(q).GetSetting("usecloser").Get()<< "" \ << TheQueues.at(q).GetSetting("closercam").Get() << "" \ << TheQueues.at(q).GetSetting("debug").Get() << "" \ << TheQueues.at(q).GetSetting("vm_message").Get() << "" \ << TheQueues.at(q).GetSetting("sf_message").Get() << "" \ << TheQueues.at(q).GetSetting("thirdparty").Get() << "
" << std::endl; std::cout << "
" << std::endl; } void doPrintRecord(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; printSubHead("Enter the Record Number to Print"); std::cout << "

"; std::cout << "

\n"; std::cout << "

"; std::cout << printSubmit("Print Now"); std::cout << "

"; } void doPrintNow(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::string leadid = TheFields.GetField("leadid"); std::cout << ""; printHead("Print Record for"); std::cout << "

\n"; printSubHead(queue); std::cout << "

Leadid: "; printSubHead(leadid); std::cout << "

\n"; if (!leadid.empty()) { MYSQL *mysql = NULL; MYSQL_RES *result; MYSQL_ROW row; unsigned int counter = 0; mysql = mysql_init(NULL); if(mysql == NULL) { std::cerr << "MySql init failed!" << std::endl; } if(!mysql_real_connect(mysql, getMySqlHost().c_str(), \ getMySqlUser().c_str(), \ getMySqlPass().c_str(), \ getDbName().c_str(), \ 3306, NULL, 0)) \ { \ std::cerr << "MySql connection failed!" << std::endl; } std::string query = "SELECT * FROM `" + queue + "` WHERE id=" + leadid + ""; if(mysql_query(mysql, query.c_str()) != 0) { std::cout << "PrintNow: Error selecting record!" << std::endl; } else { result = mysql_use_result(mysql); for((counter = 0); (row = mysql_fetch_row(result)); counter++) { // for(counter = 0; row = mysql_fetch_row(result); counter++) { writeCampaignSale("Agent SALE",queue,std::string(row[0])); } mysql_free_result(result); } std::cout << "Complete\n"; std::cout << "

"; } else { std::cout << "Leadid was empty!\n"; std::cout << "

"; } } void doBackupData(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; printHead("Backup Data for"); std::cout << "

\n"; printSubHead(queue); std::cout << "

"; Queue TheQueue; TheQueue.ParseQueue(queue); if (TheQueue.GetSetting("active").Get() == "true") { std::cout << "You must stop the campaign first.

\n"; std::cout << printSubmit("Stop Campaign"); } else { std::cout << "This can take a few minutes!

\n"; std::cout << printSubmit("Backup Now"); } std::cout << "

"; } void doRestoreData(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; printHead("Restore Data for"); std::cout << "

\n"; printSubHead(queue); std::cout << "

"; Queue TheQueue; TheQueue.ParseQueue(queue); if (TheQueue.GetSetting("active").Get() == "true") { std::cout << "You must stop the campaign first.

\n"; std::cout << printSubmit("Stop Campaign"); } else { std::cout << "This can take a few minutes!

\n"; std::cout << printSubmit("Restore Now"); } std::cout << "

"; } void doBackupNow(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; printHead("Backup Data for"); std::cout << "

\n"; printSubHead(queue); MYSQL *mysql = NULL; // MYSQL_RES *result; // MYSQL_ROW row; // unsigned int counter = 0; std::string query; mysql = mysql_init(NULL); if (mysql == NULL) { std::cerr << "MySql init failed!" << std::endl; } if (!mysql_real_connect(mysql, getMySqlHost().c_str(), \ getMySqlUser().c_str(), \ getMySqlPass().c_str(), \ getDbName().c_str(), \ 3306, NULL, 0)) \ { \ std::cerr << "MySql connection failed!" << std::endl; } query = "BACKUP TABLE `" + queue + "` TO '/tmp'"; if(mysql_query(mysql, query.c_str()) != 0) { std::cout << "
Error backing up data!
" << std::endl; } std::cout << "

"; std::cout << "Complete\n"; std::cout << "

"; std::cout << printSubmit("Start Campaign"); std::cout << "

"; } void doRestoreNow(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; printHead("Restore Data for"); std::cout << "

\n"; printSubHead(queue); MYSQL *mysql = NULL; // MYSQL_RES *result; // MYSQL_ROW row; // unsigned int counter = 0; std::string query; mysql = mysql_init(NULL); if (mysql == NULL) { std::cerr << "MySql init failed!" << std::endl; } if (!mysql_real_connect(mysql, getMySqlHost().c_str(), \ getMySqlUser().c_str(), \ getMySqlPass().c_str(), \ getDbName().c_str(), \ 3306, NULL, 0)) \ { \ std::cerr << "MySql connection failed!" << std::endl; } query = "DROP TABLE `" + queue + "`"; if(mysql_query(mysql, query.c_str()) != 0) { std::cout << "
Error dropping table!
" << std::endl; } query = "RESTORE TABLE `" + queue + "` FROM '/tmp'"; if(mysql_query(mysql, query.c_str()) != 0) { std::cout << "
Error restoring data!
" << std::endl; } std::cout << "

"; std::cout << "Complete\n"; std::cout << "

"; std::cout << printSubmit("Start Campaign"); std::cout << "

"; } void doEditScript(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; //std::cout << "\n"; printHead("Edit Script"); std::cout << "

\n"; printSubHead(queue); std::cout << "

"; std::ifstream InFile; InFile.open((queue + ".script").c_str()); std::cout << ""; std::cout << "

"; std::cout << printSubmit("Save Script"); std::cout << "

"; InFile.close(); } void doSaveScript(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; printHead("Saving Script..."); std::cout << "

\n"; printSubHead(queue + " saved."); std::cout << "

\n"; std::cout << "
";
	std::cout << TheFields.GetField("thescript");
	std::cout << "
"; std::ofstream OutFile; OutFile.open((queue + ".script").c_str()); OutFile << TheFields.GetField("thescript"); OutFile.close(); } const std::string selectedIf(const std::string & lhs, const std::string & rhs) { if (lhs == rhs) return "SELECTED"; else return ""; } void doEditGlobals(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; Queue TheQueueGlobals; TheQueueGlobals.ParseQueue("general"); std::string debug= TheQueueGlobals.GetSetting("debug").Get(); std::string log= TheQueueGlobals.GetSetting("log").Get(); std::string gmaxlines= TheQueueGlobals.GetSetting("gmaxlines").Get(); std::string tzoffset= TheQueueGlobals.GetSetting("tzoffset").Get(); printHead("Edit Globals"); std::cout << "

"; printSubHead("Enter GnuDialer Global options"); std::cout << "

"; std::cout << "
" << std::endl; std::cout << ""; std::cout << ""; std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "gDebug: "; std::cout << printAlert("[?]","Send GnuDialer debug output to the console."); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "gLog: "; std::cout << printAlert("[?]","Send GnuDialer log output to gnudialer.log."); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "gMaxlines: "; std::cout << printAlert("[?]","Set Global Maxlines (useful when using multiple campaigns)."); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "gTZOffset: "; std::cout << printAlert("[?]","Set Global Timezone Offset (used for the new tzfiltering).\\nThis offset should be the GMT offset, not UTC.\\nThe calculations in realtime are based on the servers time.\\n\\nExamples: -8 (for PST) or -5 (for CST) -4 (for EST) .. etc\\n"); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "

"; std::cout << printSubmit("Save Global Settings"); std::cout << ""; std::cout << "
(changes take effect immediately)"; std::cout << "
"; std::cout << "

"; } void doFinishEditingGlobals(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; std::string debug= TheFields.GetField("debug"); std::string log= TheFields.GetField("log"); std::string gmaxlines= TheFields.GetField("gmaxlines"); std::string tzoffset= TheFields.GetField("tzoffset"); Queue TheQueueGlobals; TheQueueGlobals.ParseQueue("general"); TheQueueGlobals.SetSetting("debug",debug); TheQueueGlobals.SetSetting("log",log); TheQueueGlobals.SetSetting("gmaxlines",gmaxlines); TheQueueGlobals.SetSetting("tzoffset",tzoffset); TheQueueGlobals.Write(); if (testnewevents) { sendUserEvent("ReloadGlobals","gDebug: " + debug + "|gLog: " + log + "|gMaxlines: " + gmaxlines + "|gTZOffset: " + tzoffset + ""); } printHead("Save Globals"); std::cout << "

\n"; printSubHead("Global settings updated"); std::cout << "

"; } void doAddFilter(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; std::string filter = TheFields.GetField("filter"); if (!filter.empty()) { Queue TheQueue; TheQueue.ParseQueue(queue); int f = 0; for (int i = 0; i < TheQueue.OccurencesOf("filters"); i++) { f = i+1; } if (!TheQueue.SettingExists("filters","number",itos(f))) { TheQueue.AddSetting("filters","number:" + itos(f) + ":enable:false:string:" + filter); } TheQueue.Write(); if (testnewevents) { sendUserEvent("ReloadCampaign","Campaign: " + queue); } printHead("Save Filter"); std::cout << "

\n"; printSubHead("Filter added"); std::cout << "

filter" + itos(f) + ":" + filter; std::cout << "

"; } else { printHead("Save Filter"); std::cout << "

\n"; printSubHead("Filter was empty, try again."); std::cout << "

"; } } void doDelFilter(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; std::string fnum = TheFields.GetField("fnum"); std::string filter = TheFields.GetField("filter" + fnum); if (!fnum.empty()) { Queue TheQueue; TheQueue.ParseQueue(queue); for (int i = 0; i < TheQueue.OccurencesOf("filters"); i++) { if (TheQueue.SettingExists("filters","number",fnum)) { TheQueue.DelSetting("filters","number",fnum); } } TheQueue.Write(); if (testnewevents) { sendUserEvent("ReloadCampaign","Campaign: " + queue); } printHead("Deleted Filter"); std::cout << "

\n"; printSubHead("Filter deleted"); std::cout << "

filter" + fnum + ":" + filter; std::cout << "

"; } else { printHead("Deleted Filter"); std::cout << "

\n"; printSubHead("Filter not selected, nothing deleted!"); std::cout << "

"; } } void doAddChanvar(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; std::string chanvar = TheFields.GetField("chanvar"); std::string chanstr = TheFields.GetField("chanstr"); if (!chanvar.empty()) { Queue TheQueue; TheQueue.ParseQueue(queue); int f = 0; for (int i = 0; i < TheQueue.OccurencesOf("chanvars"); i++) { f = i+1; } if (!TheQueue.SettingExists("chanvars","number",itos(f))) { TheQueue.AddSetting("chanvars","number:" + itos(f) + ":enable:false:var:" + chanvar + ":string:" + chanstr); } TheQueue.Write(); if (testnewevents) { sendUserEvent("ReloadCampaign","Campaign: " + queue); } printHead("Save Chanvar"); std::cout << "

\n"; printSubHead("Chanvar added"); std::cout << "

chanvar" + itos(f) + ":" + chanvar; std::cout << "

"; } else { printHead("Save Chanvar"); std::cout << "

\n"; printSubHead("Chanvar was empty, try again."); std::cout << "

"; } } void doDelChanvar(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; std::string fnum = TheFields.GetField("fnum"); std::string chanvar = TheFields.GetField("chanvar" + fnum); if (!fnum.empty()) { Queue TheQueue; TheQueue.ParseQueue(queue); for (int i = 0; i < TheQueue.OccurencesOf("chanvars"); i++) { if (TheQueue.SettingExists("chanvars","number",fnum)) { TheQueue.DelSetting("chanvars","number",fnum); } } TheQueue.Write(); if (testnewevents) { sendUserEvent("ReloadCampaign","Campaign: " + queue); } printHead("Deleted Chanvar"); std::cout << "

\n"; printSubHead("Chanvar deleted"); std::cout << "

chanvar" + fnum + ":" + chanvar; std::cout << "

"; } else { printHead("Deleted Chanvar"); std::cout << "

\n"; printSubHead("Chanvar not selected, nothing deleted!"); std::cout << "

"; } } void doAreacodeFilter(std::string theCampaign, std::string theSettingName, std::string theSettingValue) { MYSQL *mysql = NULL; MYSQL_RES *result; MYSQL_ROW row; unsigned int counter = 0; mysql = mysql_init(NULL); if(mysql == NULL) { std::cerr << "MySql init failed!" << std::endl; } if(!mysql_real_connect(mysql, getMySqlHost().c_str(), \ getMySqlUser().c_str(), \ getMySqlPass().c_str(), \ getDbName().c_str(), \ 3306, NULL, 0)) \ { \ std::cerr << "MySql connection failed!" << std::endl; } std::string query = "SELECT DISTINCT SQL_CALC_FOUND_ROWS left( phone, 3 ) FROM `" + theCampaign + "`"; if(mysql_query(mysql, query.c_str()) != 0) { std::cout << "
Error selecting areacodes!
" << std::endl; } else { result = mysql_use_result(mysql); std::cout << "\n
"; mysql_free_result(result); } } void doAreacodePrefixFilter(std::string theCampaign, std::string theSettingName, std::string theSettingValue) { MYSQL *mysql = NULL; MYSQL_RES *result; MYSQL_ROW row; unsigned int counter = 0; mysql = mysql_init(NULL); if(mysql == NULL) { std::cerr << "MySql init failed!" << std::endl; } if(!mysql_real_connect(mysql, getMySqlHost().c_str(), \ getMySqlUser().c_str(), \ getMySqlPass().c_str(), \ getDbName().c_str(), \ 3306, NULL, 0)) \ { \ std::cerr << "MySql connection failed!" << std::endl; } std::string query = "SELECT DISTINCT SQL_CALC_FOUND_ROWS left( phone, 6 ) FROM `" + theCampaign + "`"; if(mysql_query(mysql, query.c_str()) != 0) { std::cout << "
Error selecting areacodes!
" << std::endl; } else { result = mysql_use_result(mysql); std::cout << "\n
"; mysql_free_result(result); } } void doZipcodeFilter(std::string theCampaign, std::string theSettingName, std::string theSettingValue) { MYSQL *mysql = NULL; MYSQL_RES *result; MYSQL_ROW row; unsigned int counter = 0; mysql = mysql_init(NULL); if(mysql == NULL) { std::cerr << "MySql init failed!" << std::endl; } if(!mysql_real_connect(mysql, getMySqlHost().c_str(), \ getMySqlUser().c_str(), \ getMySqlPass().c_str(), \ getDbName().c_str(), \ 3306, NULL, 0)) \ { \ std::cerr << "MySql connection failed!" << std::endl; } std::string query = "SELECT DISTINCT SQL_CALC_FOUND_ROWS left( zip, 5 ) FROM `" + theCampaign + "`"; if(mysql_query(mysql, query.c_str()) != 0) { std::cout << "
Error selecting zipcodes!
" << std::endl; } else { result = mysql_use_result(mysql); std::cout << "\n
"; mysql_free_result(result); } } void doEditFilters(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; Queue TheQueue; TheQueue.ParseQueue(queue); std::string filter = TheQueue.GetSetting("filter").Get(); std::string usetzfilter = TheQueue.GetSetting("usetzfilter").Get(); std::string skip = TheQueue.GetSetting("skip").Get(); std::string f_mode = TheQueue.GetSetting("f_mode").Get(); std::string f_areacode = TheQueue.GetSetting("f_areacode").Get(); std::string f_areacode_prefix = TheQueue.GetSetting("f_areacode_prefix").Get(); std::string f_zipcode = TheQueue.GetSetting("f_zipcode").Get(); std::string orderby = TheQueue.GetSetting("orderby").Get(); std::string allowedhours = TheQueue.GetSetting("allowedhours").Get(); if (f_mode == "0") f_mode = "none"; if (filter == "0") filter = ""; MYSQL *mysql = NULL; MYSQL_RES *result; MYSQL_ROW row; // unsigned int counter = 0; std::string query; mysql = mysql_init(NULL); if (mysql == NULL) { std::cerr << "MySql init failed!" << std::endl; } if (!mysql_real_connect(mysql, getMySqlHost().c_str(), \ getMySqlUser().c_str(), \ getMySqlPass().c_str(), \ getDbName().c_str(), \ 3306, NULL, 0)) \ { \ std::cerr << "MySql connection failed!" << std::endl; } printHead("Edit Filters"); std::cout << "

"; printSubHead("Enter filter options for "); printSubHead(queue); printSubHead("."); std::cout << "

"; std::cout << "
" << std::endl; std::cout << ""; if (f_mode == "areacode") { std::cout << ""; } if (f_mode == "acprefix") { std::cout << ""; } if (f_mode == "zipcode") { std::cout << ""; } std::cout << ""; std::cout << ""; std::cout << ""; std::cout << ""; std::cout << ""; std::cout << ""; std::cout << ""; std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "Filter Mode: "; std::cout << printAlert("[?]","Allow the ability to enable Areacode, Areacode/Prefix, Zipcode filtering.\\n(changing between types will zero-out previously selected types)\\n"); std::cout << ""; std::cout << ""; std::cout << "
Areacode Filter: "; std::cout << printAlert("[?]","Filter based on available areacodes in the campaign database.\\n(select None, if you do NOT want to filter by areacode)"); std::cout << ""; doAreacodeFilter(queue,"f_areacode",f_areacode); std::cout << "
Areacode/Prefix Filter: "; std::cout << printAlert("[?]","Filter based on available areacode/prefix conbinations in the campaign database.\\n(select None, if you do NOT want to filter by areacode/prefix)"); std::cout << ""; doAreacodePrefixFilter(queue,"f_areacode_prefix",f_areacode_prefix); std::cout << "
Zipcode Filter: "; std::cout << printAlert("[?]","Filter based on available zipcodes in the campaign database.\\n(select None, if you do NOT want to filter by areacode/prefix)"); std::cout << ""; doZipcodeFilter(queue,"f_zipcode",f_zipcode); std::cout << "
"; std::cout << "Extra Filter: "; std::cout << printAlert("[?]","These are AND separated MySQL conditionals to limit lead selection via specified criteria.\\n\\n\\n EXAMPLE: left(phone,3)=\\'408\\'\\nEXAMPLE: left(phone,3)=\\'408\\' AND MID(phone,4,3)=\\'376\\' \\nEXAMPLE: UCASE(city)=\\'SAN JOSE\\' AND UCASE(state)=\\'CA\\' \\nEXAMPLE: phone NOT LIKE \\'408\%\\' \\nThen click Save Campaign Settings. \\n(if you click Add Filter it will add it to primary filters)"); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << printSubmit("Add Filter"); std::cout << " (to primary filters) "; std::cout << printAlert("[?]","Fill in Extra Filter with the query string, then click Add Filter.\\n(this will add it to primary filters and not to the Extra Filter for the campaign)"); std::cout << "
"; std::string fnum,fstring,enabled; std::cout << "Primary Filters
 "; std::cout << printAlert("[?]","This check box allows you to enable a filter. \\nThen click Save Campaign Settings.\\nYou must check at least 1 box, or it will default to filter0."); std::cout << ""; std::cout << "Enable "; std::cout << printAlert("[?]","This check box allows you to delete a filter. \\nCheck a delete box, then click Del Filter.\\n\\nYou can NOT delete an Enabled filter, disable it first.\\n Then click Save Campaign Settings.\\nReturn to this menu, you will be able to check the Delete box for that filter. \\nThen click Del Filter."); std::cout << ""; std::cout << "Delete "; std::cout << printAlert("[?]","This is the realtime record count for this filter."); std::cout << ""; std::cout << "Counts "; std::cout << "
"; for (int i = 0; i < TheQueue.OccurencesOf("filters"); i++) { fnum = TheQueue.GetSetting(i,"filters").GetAttribute("number"); fstring = TheQueue.GetSetting(i,"filters").GetAttribute("string"); enabled = TheQueue.GetSetting(i,"filters").GetAttribute("enable"); //query = "SELECT COUNT(*) FROM " + queue + " WHERE left(lastupdated,10) <> left(now(),10) AND " + fstring + ""; if (TheQueue.GetSetting("calltoday").Get() == "true") { query = "SELECT COUNT(*) FROM `" + queue + "` WHERE " + fstring + ""; } else { query = "SELECT COUNT(*) FROM `" + queue + "` WHERE LEFT(lastupdated,10) <> LEFT(NOW(),10) AND " + fstring + ""; //query = "SELECT COUNT(*) FROM `" + queue + "` WHERE LEFT(lastupdated,10) = LEFT(NOW(),10) AND disposition = '1' OR (LEFT(lastupdated,10) <> LEFT(NOW(),10)) AND " + fstring + ""; } if (mysql_query(mysql, query.c_str()) != 0) { std::cout << "
Error selecting filter!
" << std::endl; } else { result = mysql_use_result(mysql); row = mysql_fetch_row(result); if (enabled == "true") { std::cout << " filter" + fnum + ": " + "[" + row[0] + "] " + fstring + "\n
"; } else { std::cout << " filter" + fnum + ": " + "[" + row[0] + "] " + fstring + "\n
"; } mysql_free_result(result); } } std::cout << "
"; std::cout << printSubmit("Del Filter"); std::cout << " (from primary filters) "; std::cout << printAlert("[?]","Must check 1 delete box, then click Del Filter."); std::cout << "
"; std::cout << "Use tzFilter: "; std::cout << printAlert("[?]","Allow the ability to disable tzfilter (Time Zone Filtering)."); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "Allowed Hours: "; std::cout << printAlert("[?]","Allowable call hours (Floating Time Zone Filtering).\\nStill requires usetzfilter true/yes to activate.\\nDefaults to 9,10,11,12,13,14,15,16,17,18,19,20\\nas allowedhours. (9am till 8pm are valid hours)\\n"); std::cout << "
"; std::cout << ""; std::cout << ""; std::cout << ""; for (int ah = 0; ah < 12; ah++) { if (allowedhours.find(((ah<10)?"0"+itos(ah):itos(ah)),0) != std::string::npos) { std::cout << ""; } else { std::cout << ""; } } std::cout << ""; std::cout << ""; for (int ah = 12; ah < 24; ah++) { if (allowedhours.find(((ah<10)?"0"+itos(ah):itos(ah)),0) != std::string::npos) { std::cout << ""; } else { std::cout << ""; } } std::cout << ""; std::cout << ""; std::cout << "
AM000102030405060708091011
PM121314151617181920212223
"; std::cout << "
"; std::cout << "Skip: "; std::cout << printAlert("[?]","This is the number of records that will be skipped over in the current query.\\nThis should be reset to 0 when you change filters."); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "Order By: "; //std::cout << printAlert("[?]","Allow the ability to order the calling data by, attempts plus pickups (default)\\nby phone and by id (record order)\\n"); std::cout << printAlert("[?]","Allow the ability to order the calling data by,\\n\\nattempts (default)\\nby phone \\nand by id (record order)\\n\\n"); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "
"; std::cout << printSubmit("Save Filter Settings"); std::cout << ""; std::cout << "
(changes take effect immediately)"; std::cout << "
"; std::cout << "
"; } void doFinishEditingFilterSettings(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; std::string filter = TheFields.GetField("filter"); std::string usetzfilter = TheFields.GetField("usetzfilter"); std::string skip = TheFields.GetField("skip"); std::string f_mode = TheFields.GetField("f_mode"); std::string f_areacode = TheFields.GetField("f_areacode"); std::string f_areacode_prefix = TheFields.GetField("f_areacode_prefix"); std::string f_zipcode = TheFields.GetField("f_zipcode"); std::string orderby = TheFields.GetField("orderby"); int hits = 0; std::string allowedhours; for (int ah = 0; ah < 24; ah++) { if (TheFields.HasField(((ah<10)?"0"+itos(ah):itos(ah)))) { if (TheFields.GetField(((ah<10)?"0"+itos(ah):itos(ah))) == "on") { if (hits != 0) { allowedhours += ","; } allowedhours += ((ah<10)?"0"+itos(ah):itos(ah)); hits++; } } } // if (TheFields.HasField("00")) { if (TheFields.GetField("00") == "on") { if (hits ; } // if (TheFields.HasField("01")) { std::string ah01 = TheFields.GetField("01"); } Queue TheQueue; TheQueue.ParseQueue(queue); int f = 0; for (int i = 0; i < TheQueue.OccurencesOf("filters"); i++) { TheQueue.GetSetting(i,"filters").SupAttribute("enable","false"); std::string filters = TheFields.GetField("filter" + itos(i)); if (!filters.empty()) { TheQueue.GetSetting(i,"filters").SupAttribute("enable","true"); f++; } } if (!f) TheQueue.GetSetting(0,"filters").SupAttribute("enable","true"); if (filter.empty()) filter = "0"; if (filter == "None") filter = "0"; if (filter == "none") filter = "0"; if (skip.empty()) skip = "0"; if (f_mode == "none") { f_mode = "0"; f_areacode = "0"; f_areacode_prefix = "0"; f_zipcode = "0"; } if (f_areacode.empty()) f_areacode = "0"; if (f_areacode_prefix.empty()) f_areacode_prefix = "0"; if (f_zipcode.empty()) f_zipcode = "0"; if (f_areacode == "selected") f_areacode = "0"; if (f_areacode_prefix == "selected") f_areacode_prefix = "0"; if (f_zipcode == "selected") f_zipcode = "0"; TheQueue.SetSetting("filter", filter); TheQueue.SetSetting("usetzfilter", usetzfilter); TheQueue.SetSetting("skip", skip); TheQueue.SetSetting("f_mode", f_mode); TheQueue.SetSetting("f_areacode", f_areacode); TheQueue.SetSetting("f_areacode_prefix", f_areacode_prefix); TheQueue.SetSetting("f_zipcode", f_zipcode); TheQueue.SetSetting("orderby", orderby); TheQueue.SetSetting("allowedhours", allowedhours); TheQueue.Write(); if (testnewevents) { sendUserEvent("ReloadCampaign","Campaign: " + queue); } printHead("Save Filter Settings"); std::cout << "

\n"; printSubHead("Filters updated for " + queue); std::cout << "

"; } //working here void doEditChannelVars(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; Queue TheQueue; TheQueue.ParseQueue(queue); std::string chanvar = TheQueue.GetSetting("chanvar").Get(); std::string chanstr = TheQueue.GetSetting("chanstr").Get(); if (chanvar == "0") chanvar = ""; if (chanstr == "0") chanstr = ""; printHead("Edit Channel Vars"); std::cout << "

"; printSubHead("Enter vars for "); printSubHead(queue); printSubHead("."); std::cout << "

"; std::cout << "
" << std::endl; std::cout << ""; std::cout << ""; std::cout << ""; std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "Chanvar: "; std::cout << printAlert("[?]","Chanvar is a Channel Variable.\\n"); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "Chanstr: "; std::cout << printAlert("[?]","Chanstr is a Channel Variable String.\\n"); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << printSubmit("Add Chanvar"); std::cout << " (to primary) "; std::cout << printAlert("[?]","Fill in Chanvar with the string, then click Add Chanvar.\\n(this will add it to primary chanvars and not to the Chanvar for the campaign)"); std::cout << "
"; std::string fnum,fvar,fstring,enabled; std::cout << "Primary Chanvars
 "; std::cout << printAlert("[?]","This check box allows you to enable a chanvar. \\nThen click Save Campaign Settings.\\n"); std::cout << ""; std::cout << "Enable "; std::cout << printAlert("[?]","This check box allows you to delete a chanvar. \\nCheck a delete box, then click Del Chanvar.\\n\\nYou can NOT delete an Enabled chanvar, disable it first.\\n Then click Save Campaign Settings.\\nReturn to this menu, you will be able to check the Delete box for that chanvar. \\nThen click Del Chanvar."); std::cout << ""; std::cout << "Delete "; std::cout << "
"; for (int i = 0; i < TheQueue.OccurencesOf("chanvars"); i++) { fnum = TheQueue.GetSetting(i,"chanvars").GetAttribute("number"); fvar = TheQueue.GetSetting(i,"chanvars").GetAttribute("var"); fstring = TheQueue.GetSetting(i,"chanvars").GetAttribute("string"); enabled = TheQueue.GetSetting(i,"chanvars").GetAttribute("enable"); if (enabled == "true") { std::cout << " chanvar" + fnum + ":var:" + fvar + ":string: " + fstring + "\n
"; } else { std::cout << " chanvar" + fnum + ": var:" + fvar + ":string:" + fstring + "\n
"; } } std::cout << "
"; std::cout << printSubmit("Del Chanvar"); std::cout << " (from primary) "; std::cout << printAlert("[?]","Must check 1 delete box, then click Del Chanvar."); std::cout << "
"; std::cout << "
"; std::cout << printSubmit("Save Channel Vars"); std::cout << ""; std::cout << "
(changes take effect immediately)"; std::cout << "
"; std::cout << "
"; } void doFinishEditingChannelVars(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; std::string chanvar = TheFields.GetField("chanvar"); std::string chanstr = TheFields.GetField("chanstr"); Queue TheQueue; TheQueue.ParseQueue(queue); int f = 0; for (int i = 0; i < TheQueue.OccurencesOf("chanvars"); i++) { TheQueue.GetSetting(i,"chanvars").SupAttribute("enable","false"); std::string chanvars = TheFields.GetField("chanvar" + itos(i)); if (!chanvars.empty()) { TheQueue.GetSetting(i,"chanvars").SupAttribute("enable","true"); f++; } } //if (!f) TheQueue.GetSetting(0,"chanvars").SupAttribute("enable","true"); if (chanvar.empty()) chanvar = "0"; if (chanvar == "None") chanvar = "0"; if (chanvar == "none") chanvar = "0"; if (chanstr.empty()) chanstr = "0"; if (chanstr == "None") chanstr = "0"; if (chanstr == "none") chanstr = "0"; TheQueue.SetSetting("chanvar", chanvar); TheQueue.SetSetting("chanstr", chanstr); TheQueue.Write(); if (testnewevents) { sendUserEvent("ReloadCampaign","Campaign: " + queue); } printHead("Save Channel Vars"); std::cout << "

\n"; printSubHead("Vars updated for " + queue); std::cout << "

"; } void doShowDBCounts(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; Queue TheQueue; TheQueue.ParseQueue(queue); std::string filter = TheQueue.GetSetting("filter").Get(); std::string usetzfilter = TheQueue.GetSetting("usetzfilter").Get(); std::string skip = TheQueue.GetSetting("skip").Get(); std::string f_mode = TheQueue.GetSetting("f_mode").Get(); std::string f_areacode = TheQueue.GetSetting("f_areacode").Get(); std::string f_areacode_prefix = TheQueue.GetSetting("f_areacode_prefix").Get(); std::string f_zipcode = TheQueue.GetSetting("f_zipcode").Get(); if (f_mode == "0") f_mode = "none"; if (filter == "0") filter = ""; MYSQL *mysql = NULL; MYSQL_RES *result; MYSQL_ROW row; // unsigned int counter = 0; std::string query; mysql = mysql_init(NULL); if (mysql == NULL) { std::cerr << "MySql init failed!" << std::endl; } if (!mysql_real_connect(mysql, getMySqlHost().c_str(), \ getMySqlUser().c_str(), \ getMySqlPass().c_str(), \ getDbName().c_str(), \ 3306, NULL, 0)) \ { \ std::cerr << "MySql connection failed!" << std::endl; } printHead("Campaign Counts"); std::cout << "

"; printSubHead("For Campaign: "); printSubHead(queue); std::cout << "

"; std::cout << "
" << std::endl; std::cout << "" << std::endl; int totaldispos = 0; for (int i = 0; i < 13; i++) { //if (i == 1) { //do nothing //} else { query = "SELECT COUNT(*) FROM `" + queue + "` WHERE disposition = '" + itos(i) + "' "; if (mysql_query(mysql, query.c_str()) != 0) { //std::cout << "
Error selecting filter!
" << std::endl; } else { result = mysql_use_result(mysql); row = mysql_fetch_row(result); totaldispos = totaldispos + stoi(row[0]); std::cout << ""; mysql_free_result(result); } //} } std::cout << "" << std::endl; std::cout << "
DispositionCounts
" + itos(i) + "[" + row[0] + "]
Total" + itos(totaldispos) + "
" << std::endl; std::cout << ""; std::cout << "
(these are dispositions 0-12 from the database table)"; std::cout << "
"; std::cout << "
"; } void doShowAllDBCounts(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; MYSQL *mysql = NULL; MYSQL_RES *result; MYSQL_ROW row; std::string query; mysql = mysql_init(NULL); if (mysql == NULL) { std::cerr << "MySql init failed!" << std::endl; } if (!mysql_real_connect(mysql, getMySqlHost().c_str(), \ getMySqlUser().c_str(), \ getMySqlPass().c_str(), \ getDbName().c_str(), \ 3306, NULL, 0)) \ { \ std::cerr << "MySql connection failed!" << std::endl; } printHead("All Campaign DB Counts"); std::cout << "

"; std::cout << "
" << std::endl; std::cout << ""; for (int d = -8; d < 13; d++) { //std::cout << ""; std::cout << ""; } std::cout << "" << std::endl; QueueList TheQueues; TheQueues.ParseQueues(); std::vector v; v.assign(24,0); int v1 = 0; std::string tempCampaign; for (int q = 0; q < TheQueues.size(); q++) { v1 = 0; tempCampaign = TheQueues.at(q).GetName(); if (tempCampaign.find("CLOSER",0) != std::string::npos || tempCampaign.find("closer",0) != std::string::npos || tempCampaign.find("DNC",0) != std::string::npos || tempCampaign.find("dnc",0) != std::string::npos) { //if (tempCampaign == "CLOSER") { //do nothing } else { std::cout << ""; std::cout << ""; int totaldispos = 0; for (int i = -8; i < 13; i++) { v1++; query = "SELECT COUNT(*) FROM `" + tempCampaign + "` WHERE disposition = '" + itos(i) + "' "; if (mysql_query(mysql, query.c_str()) != 0) { //std::cout << "
Error selecting filter!
" << std::endl; } else { result = mysql_use_result(mysql); row = mysql_fetch_row(result); totaldispos = totaldispos + stoi(row[0]); std::cout << ""; v[v1] = v[v1] + stoi(row[0]); mysql_free_result(result); } } std::cout << ""; } } //v[v1] = v[v1] + stoi(row[0]); std::cout << ""; std::cout << ""; std::cout << ""; for(int i=1; i<(v1+1); i++) { std::cout << ""; } std::cout << ""; std::cout << "
Campaign/Disposition" << itos(d) << "" << dispo2short(d) << "
" << tempCampaign << "" << row[0] << "

Totals" << v[i] << "
" << std::endl; std::cout << ""; std::cout << "
(these are dispositions -8 through 12 from the database table)"; std::cout << "
"; std::cout << "
"; } void doCollectAllDNC(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; MYSQL *mysql = NULL; MYSQL_RES *result; //MYSQL_ROW row; std::string query; mysql = mysql_init(NULL); if (mysql == NULL) { std::cerr << "MySql init failed!" << std::endl; } if (!mysql_real_connect(mysql, getMySqlHost().c_str(), \ getMySqlUser().c_str(), \ getMySqlPass().c_str(), \ getDbName().c_str(), \ 3306, NULL, 0)) \ { \ std::cerr << "MySql connection failed!" << std::endl; } printHead("Collecting -8 from Campaigns to DNC"); std::cout << "

"; std::cout << "
" << std::endl; std::cout << ""; std::cout << "" << std::endl; QueueList TheQueues; TheQueues.ParseQueues(); std::string tempCampaign; for (int q = 0; q < TheQueues.size(); q++) { tempCampaign = TheQueues.at(q).GetName(); if (tempCampaign.find("CLOSER",0) != std::string::npos || tempCampaign.find("closer",0) != std::string::npos || tempCampaign.find("DNC",0) != std::string::npos || tempCampaign.find("dnc",0) != std::string::npos) { //if (tempCampaign == "CLOSER") { //do nothing } else { std::cout << ""; std::cout << ""; query = "INSERT IGNORE INTO `DNC` (`phone`) SELECT `phone` FROM `" + tempCampaign + "` WHERE disposition = '8'"; if (mysql_query(mysql, query.c_str()) != 0) { //std::cout << "
Error selecting DNCs!
" << std::endl; } else { result = mysql_use_result(mysql); //row = mysql_fetch_row(result); //std::cout << ""; mysql_free_result(result); } std::cout << ""; } } std::cout << "
Campaign
" << tempCampaign << "" << row[0] << "
" << std::endl; std::cout << ""; std::cout << "
"; std::cout << "
"; std::cout << "
"; } void doProcessAllDNC(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; MYSQL *mysql = NULL; MYSQL_RES *result; //MYSQL_ROW row; std::string query; mysql = mysql_init(NULL); if (mysql == NULL) { std::cerr << "MySql init failed!" << std::endl; } if (!mysql_real_connect(mysql, getMySqlHost().c_str(), \ getMySqlUser().c_str(), \ getMySqlPass().c_str(), \ getDbName().c_str(), \ 3306, NULL, 0)) \ { \ std::cerr << "MySql connection failed!" << std::endl; } printHead("Processing DNC against Campaigns"); std::cout << "

"; std::cout << "
" << std::endl; std::cout << ""; std::cout << "" << std::endl; QueueList TheQueues; TheQueues.ParseQueues(); std::string tempCampaign; for (int q = 0; q < TheQueues.size(); q++) { tempCampaign = TheQueues.at(q).GetName(); if (tempCampaign.find("CLOSER",0) != std::string::npos || tempCampaign.find("closer",0) != std::string::npos || tempCampaign.find("DNC",0) != std::string::npos || tempCampaign.find("dnc",0) != std::string::npos) { //if (tempCampaign == "CLOSER") { //do nothing } else { std::cout << ""; std::cout << ""; query = "UPDATE `" + tempCampaign + "` SET `disposition` = '8' WHERE 1 AND `phone` IN (SELECT `phone` FROM `DNC`)"; if (mysql_query(mysql, query.c_str()) != 0) { //std::cout << "
Error selecting DNCs!
" << std::endl; } else { result = mysql_use_result(mysql); //row = mysql_fetch_row(result); //std::cout << ""; mysql_free_result(result); } std::cout << ""; } } std::cout << "
Campaign
" << tempCampaign << "" << row[0] << "
" << std::endl; std::cout << ""; std::cout << "
"; std::cout << "
"; std::cout << "
"; } void doShowAllFilterCounts(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; MYSQL *mysql = NULL; MYSQL_RES *result; MYSQL_ROW row; std::string query; mysql = mysql_init(NULL); if (mysql == NULL) { std::cerr << "MySql init failed!" << std::endl; } if (!mysql_real_connect(mysql, getMySqlHost().c_str(), \ getMySqlUser().c_str(), \ getMySqlPass().c_str(), \ getDbName().c_str(), \ 3306, NULL, 0)) \ { \ std::cerr << "MySql connection failed!" << std::endl; } printHead("All Campaign Filter Counts"); std::cout << "

"; QueueList TheQueues; TheQueues.ParseQueues(); std::cout << "
" << std::endl; std::cout << ""; for (int ft = 0; ft < TheQueues.at(0).OccurencesOf("filters"); ft++) { std::string fnum = TheQueues.at(0).GetSetting(ft,"filters").GetAttribute("number"); std::cout << ""; } std::cout << "" << std::endl; std::string tempCampaign,enabled; for (int q = 0; q < TheQueues.size(); q++) { tempCampaign = TheQueues.at(q).GetName(); if (tempCampaign.find("CLOSER",0) != std::string::npos || tempCampaign.find("closer",0) != std::string::npos || tempCampaign.find("DNC",0) != std::string::npos || tempCampaign.find("dnc",0) != std::string::npos) { //do nothing } else { std::cout << ""; std::cout << ""; //int totaldispos = 0; for (int f = 0; f < TheQueues.at(q).OccurencesOf("filters"); f++) { std::string fnum = TheQueues.at(q).GetSetting(f,"filters").GetAttribute("number"); std::string fstring = TheQueues.at(q).GetSetting(f,"filters").GetAttribute("string"); enabled = TheQueues.at(q).GetSetting(f,"filters").GetAttribute("enable"); //query = "SELECT COUNT(*) FROM " + tempCampaign + " WHERE left(lastupdated,10) <> left(now(),10) AND " + fstring + ""; if (TheQueues.at(q).GetSetting("calltoday").Get() == "true") { query = "SELECT COUNT(*) FROM `" + tempCampaign + "` WHERE " + fstring + ""; } else { query = "SELECT COUNT(*) FROM `" + tempCampaign + "` WHERE left(lastupdated,10) <> left(now(),10) AND " + fstring + ""; } if (mysql_query(mysql, query.c_str()) != 0) { //table doesn't exist, nor something else went wrong //std::cout << "
Error selecting filter! query: " << query << "
" << std::endl; } else { result = mysql_use_result(mysql); row = mysql_fetch_row(result); //totaldispos = totaldispos + stoi(row[0]); if (enabled == "true") { std::cout << ""; } else { std::cout << ""; } mysql_free_result(result); } } std::cout << ""; } } std::cout << "
Campaign/Filterfilter" << fnum << "
" << tempCampaign << "" << row[0] << "" << row[0] << "
" << std::endl; std::cout << ""; std::cout << "
(If it shows nothing, no data loaded yet. All zeros, mean not called yet.)"; std::cout << "
"; std::cout << "
GREEN"; std::cout << "
"; std::cout << " indicates those filters are currently enabled."; std::cout << "
"; } void doShowFilterCounts(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; MYSQL *mysql = NULL; MYSQL_RES *result; MYSQL_ROW row; std::string query; mysql = mysql_init(NULL); if (mysql == NULL) { std::cerr << "MySql init failed!" << std::endl; } if (!mysql_real_connect(mysql, getMySqlHost().c_str(), \ getMySqlUser().c_str(), \ getMySqlPass().c_str(), \ getDbName().c_str(), \ 3306, NULL, 0)) \ { \ std::cerr << "MySql connection failed!" << std::endl; } printHead("Campaign Filter Counts"); std::cout << "

"; QueueList TheQueues; TheQueues.ParseQueues(); std::cout << "
" << std::endl; std::cout << ""; for (int ft = 0; ft < TheQueues.at(0).OccurencesOf("filters"); ft++) { std::string fnum = TheQueues.at(0).GetSetting(ft,"filters").GetAttribute("number"); std::cout << ""; } std::cout << "" << std::endl; std::string tempCampaign, enabled; for (int q = 0; q < TheQueues.size(); q++) { tempCampaign = TheQueues.at(q).GetName(); // if (tempCampaign.find("CLOSER",0) != std::string::npos || tempCampaign.find("closer",0) != std::string::npos || tempCampaign.find("DNC",0) != std::string::npos || tempCampaign.find("dnc",0) != std::string::npos) { if (tempCampaign != queue) { //do nothing } else { std::cout << ""; std::cout << ""; //int totaldispos = 0; for (int f = 0; f < TheQueues.at(q).OccurencesOf("filters"); f++) { std::string fnum = TheQueues.at(q).GetSetting(f,"filters").GetAttribute("number"); std::string fstring = TheQueues.at(q).GetSetting(f,"filters").GetAttribute("string"); enabled = TheQueues.at(q).GetSetting(f,"filters").GetAttribute("enable"); //query = "SELECT COUNT(*) FROM " + tempCampaign + " WHERE left(lastupdated,10) <> left(now(),10) AND " + fstring + ""; if (TheQueues.at(q).GetSetting("calltoday").Get() == "true") { query = "SELECT COUNT(*) FROM `" + tempCampaign + "` WHERE " + fstring + ""; } else { query = "SELECT COUNT(*) FROM `" + tempCampaign + "` WHERE left(lastupdated,10) <> left(now(),10) AND " + fstring + ""; } if (mysql_query(mysql, query.c_str()) != 0) { //table doesn't exist, nor something else went wrong //std::cout << "
Error selecting filter! query: " << query << "
" << std::endl; } else { result = mysql_use_result(mysql); row = mysql_fetch_row(result); //totaldispos = totaldispos + stoi(row[0]); if (enabled == "true") { std::cout << ""; } else { std::cout << ""; } mysql_free_result(result); } } std::cout << ""; } } std::cout << "
Campaign/Filterfilter" << fnum << "
" << queue << "" << row[0] << "" << row[0] << "
" << std::endl; std::cout << ""; std::cout << "
(If it shows nothing, no data loaded yet. All zeros, mean not called yet.)"; std::cout << "
"; std::cout << "
GREEN"; std::cout << "
"; std::cout << " indicates those filters are currently enabled."; std::cout << "
"; } void doShowAllDBCountsForToday(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; MYSQL *mysql = NULL; MYSQL_RES *result; MYSQL_ROW row; std::string query; mysql = mysql_init(NULL); if (mysql == NULL) { std::cerr << "MySql init failed!" << std::endl; } if (!mysql_real_connect(mysql, getMySqlHost().c_str(), \ getMySqlUser().c_str(), \ getMySqlPass().c_str(), \ getDbName().c_str(), \ 3306, NULL, 0)) \ { \ std::cerr << "MySql connection failed!" << std::endl; } printHead("All Campaign Counts (affected today)"); std::cout << "

"; std::cout << "
" << std::endl; std::cout << ""; for (int d = -8; d < 13; d++) { //std::cout << ""; std::cout << ""; } std::cout << "" << std::endl; QueueList TheQueues; TheQueues.ParseQueues(); std::vector v; v.assign(24,0); int v1 = 0; std::string tempCampaign; for (int q = 0; q < TheQueues.size(); q++) { v1 = 0; tempCampaign = TheQueues.at(q).GetName(); if (tempCampaign.find("CLOSER",0) != std::string::npos || tempCampaign.find("closer",0) != std::string::npos || tempCampaign.find("DNC",0) != std::string::npos || tempCampaign.find("dnc",0) != std::string::npos) { //if (tempCampaign == "CLOSER" || tempCampaign == "closer" || tempCampaign == "DC_CLOSER") { //do nothing } else { std::cout << ""; std::cout << ""; int totaldispos = 0; for (int i = -8; i < 13; i++) { v1++; query = "SELECT COUNT(*) FROM `" + tempCampaign + "` WHERE disposition = '" + itos(i) + "' AND LEFT(lastupdated,10) = LEFT(NOW(),10) "; if (mysql_query(mysql, query.c_str()) != 0) { //std::cout << "
Error selecting filter!
" << std::endl; } else { result = mysql_use_result(mysql); row = mysql_fetch_row(result); totaldispos = totaldispos + stoi(row[0]); std::cout << ""; v[v1] = v[v1] + stoi(row[0]); mysql_free_result(result); } } std::cout << ""; } } //v[v1] = v[v1] + stoi(row[0]); std::cout << ""; std::cout << ""; std::cout << ""; for(int i=1; i<(v1+1); i++) { std::cout << ""; } std::cout << ""; std::cout << "
Campaign/Disposition" << itos(d) << "" << dispo2short(d) << "
" << tempCampaign << "" << row[0] << "

Totals" << v[i] << "
" << std::endl; std::cout << ""; std::cout << "
(these are dispositions -8 through 12 from the database table)"; std::cout << "
"; std::cout << "
"; } void doShowDBCountsForToday(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; MYSQL *mysql = NULL; MYSQL_RES *result; MYSQL_ROW row; std::string query; mysql = mysql_init(NULL); if (mysql == NULL) { std::cerr << "MySql init failed!" << std::endl; } if (!mysql_real_connect(mysql, getMySqlHost().c_str(), \ getMySqlUser().c_str(), \ getMySqlPass().c_str(), \ getDbName().c_str(), \ 3306, NULL, 0)) \ { \ std::cerr << "MySql connection failed!" << std::endl; } printHead("Campaign Counts (affected today)"); std::cout << "

"; std::cout << "
" << std::endl; std::cout << ""; for (int d = -8; d < 13; d++) { //std::cout << ""; std::cout << ""; } std::cout << ""; std::cout << "" << std::endl; QueueList TheQueues; TheQueues.ParseQueues(); std::string tempCampaign; for (int q = 0; q < TheQueues.size(); q++) { tempCampaign = TheQueues.at(q).GetName(); if (tempCampaign != queue) { //if (tempCampaign.find("CLOSER",0) != std::string::npos || tempCampaign.find("closer",0) != std::string::npos || tempCampaign.find("DNC",0) != std::string::npos || tempCampaign.find("dnc",0) != std::string::npos) { //if (tempCampaign == "CLOSER" || tempCampaign == "closer" || tempCampaign == "DC_CLOSER") { //do nothing } else { std::cout << ""; std::cout << ""; int totaldispos = 0; int totalused = 0; for (int i = -8; i < 13; i++) { query = "SELECT COUNT(*) FROM `" + tempCampaign + "` WHERE disposition = '" + itos(i) + "' AND LEFT(lastupdated,10) = LEFT(NOW(),10) "; if (mysql_query(mysql, query.c_str()) != 0) { //std::cout << "
Error selecting filter!
" << std::endl; } else { result = mysql_use_result(mysql); row = mysql_fetch_row(result); totaldispos = totaldispos + stoi(row[0]); std::cout << ""; if (i == -8 || i == -7 || i == -6 || i == 6 || i == 7 || i == 8 || i == 9 || i == 10 || i == 11 || i == 12) { totalused += stoi(row[0]); } mysql_free_result(result); } } std::cout << ""; std::cout << ""; } } std::cout << "
Campaign/Disposition" << itos(d) << "" << dispo2short(d) << "Used
" << tempCampaign << "" << row[0] << "" << totalused << "
" << std::endl; std::cout << ""; std::cout << "
(these are dispositions -8 through 12 from the database table)"; std::cout << "
"; std::cout << "
"; } void doSelectCounts(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; printHead("Campaign: " + queue); std::cout << "

" << std::endl; printSubHead("Date Range"); std::cout << "

" << std::endl; printDateFields(1); std::cout << "

To

\n"; printDateFields(2); std::cout << "

" << std::endl; std::cout << "Counts for: " << queue << "

"; std::cout << "  All Campaigns
" << std::endl; std::cout << "
" << std::endl; std::cout << "  Today Only
" << std::endl; std::cout << "  Yesterday Only
" << std::endl; std::cout << "  Last 5 Days
" << std::endl; std::cout << "  Last 7 Days
" << std::endl; std::cout << "  Previous 5 Days
" << std::endl; std::cout << "  Previous 7 Days
" << std::endl; //std::cout << "  Date Range ** DO NOT USE **
" << std::endl; std::cout << "  Date Range
" << std::endl; std::cout << "
" << std::endl; std::cout << "\n"; std::cout << printSubmit("DBCOUNTSFOR"); std::cout << "

"; } void doShowDBCountsFor(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; std::string when = TheFields.GetField("when"); std::string range_from = TheFields.GetField("from"); std::string range_to = TheFields.GetField("to"); std::string which = TheFields.GetField("for"); std::string querywhen; std::string mon1 = TheFields.GetField("mon1"); std::string day1 = TheFields.GetField("day1"); std::string year1 = TheFields.GetField("year1"); std::string date1 = "'" + year1 + "-" + mon1 + "-" + day1 + "'"; std::string mon2 = TheFields.GetField("mon2"); std::string day2 = TheFields.GetField("day2"); std::string year2 = TheFields.GetField("year2"); std::string date2 = "'" + year2 + "-" + mon2 + "-" + day2 + "'"; if (stou(when) == "TODAY") { querywhen = "LEFT(lastupdated,10) = DATE_ADD(CURDATE(), INTERVAL 0 DAY)"; } if (stou(when) == "YESTERDAY") { querywhen = "LEFT(lastupdated,10) = DATE_ADD(CURDATE(), INTERVAL -1 DAY)"; } if (stou(when) == "LAST5DAYS") { range_from = "-4"; range_to = "0"; querywhen = "(LEFT(lastupdated,10) >= DATE_ADD(CURDATE(), INTERVAL " + range_from + " DAY)) AND (LEFT(lastupdated,10) <= DATE_ADD(CURDATE(), INTERVAL " + range_to + " DAY))" ; } if (stou(when) == "LAST7DAYS") { range_from = "-6"; range_to = "0"; querywhen = "(LEFT(lastupdated,10) >= DATE_ADD(CURDATE(), INTERVAL " + range_from + " DAY)) AND (LEFT(lastupdated,10) <= DATE_ADD(CURDATE(), INTERVAL " + range_to + " DAY))" ; } if (stou(when) == "PREV5DAYS") { range_from = "-5"; range_to = "-1"; querywhen = "(LEFT(lastupdated,10) >= DATE_ADD(CURDATE(), INTERVAL " + range_from + " DAY)) AND (LEFT(lastupdated,10) <= DATE_ADD(CURDATE(), INTERVAL " + range_to + " DAY))" ; } if (stou(when) == "PREV7DAYS") { range_from = "-8"; range_to = "-1"; querywhen = "(LEFT(lastupdated,10) >= DATE_ADD(CURDATE(), INTERVAL " + range_from + " DAY)) AND (LEFT(lastupdated,10) <= DATE_ADD(CURDATE(), INTERVAL " + range_to + " DAY))" ; } if (stou(when) == "RANGE") { querywhen = "(LEFT(lastupdated,10) >= DATE_ADD(CURDATE(), INTERVAL " + range_from + " DAY)) AND (LEFT(lastupdated,10) <= DATE_ADD(CURDATE(), INTERVAL " + range_to + " DAY))" ; } if (stou(when) == "DATERANGE") { querywhen = "(LEFT(lastupdated,10) >= STR_TO_DATE(" + date1 + ", '%Y-%m-%d') AND LEFT(lastupdated,10) <= STR_TO_DATE(" + date2 + ", '%Y-%m-%d')) "; //querywhen = "(LEFT(lastupdated,10) >= DATE_ADD(CURDATE(), INTERVAL " + range_from + " DAY)) AND (LEFT(lastupdated,10) <= DATE_ADD(CURDATE(), INTERVAL " + range_to + " DAY))" ; } //std::cout << "
" << when << ":" << stou(when) << ":" << querywhen << "
"; MYSQL *mysql = NULL; MYSQL_RES *result; MYSQL_ROW row; std::string query; mysql = mysql_init(NULL); if (mysql == NULL) { std::cerr << "MySql init failed!" << std::endl; } if (!mysql_real_connect(mysql, getMySqlHost().c_str(), \ getMySqlUser().c_str(), \ getMySqlPass().c_str(), \ getDbName().c_str(), \ 3306, NULL, 0)) \ { \ std::cerr << "MySql connection failed!" << std::endl; } printHead("Campaign Counts for (" + when + ")"); if (stou(when) == "RANGE") { std::cout << " From: " << range_from << " To: " << range_to; } std::cout << "

"; std::cout << "
" << std::endl; std::cout << ""; for (int d = -8; d < 13; d++) { //std::cout << ""; std::cout << ""; } std::cout << ""; std::cout << "" << std::endl; QueueList TheQueues; TheQueues.ParseQueues(); std::vector v; v.assign(24,0); int v1 = 0; std::string tempCampaign; for (int q = 0; q < TheQueues.size(); q++) { v1 = 0; tempCampaign = TheQueues.at(q).GetName(); if (tempCampaign.find("CLOSER",0) != std::string::npos || tempCampaign.find("closer",0) != std::string::npos || tempCampaign.find("DNC",0) != std::string::npos || tempCampaign.find("dnc",0) != std::string::npos) { //if (tempCampaign == "CLOSER" || tempCampaign == "closer" || tempCampaign == "DC_CLOSER") { //do nothing } else if (tempCampaign == queue || stou(which) == "ALL" || stou(which) == "ON") { //if (tempCampaign != queue) { std::cout << ""; std::cout << ""; int totaldispos = 0; int totalused = 0; for (int i = -8; i < 13; i++) { v1++; query = "SELECT COUNT(*) FROM `" + tempCampaign + "` WHERE disposition = '" + itos(i) + "' AND " + querywhen + " "; if (mysql_query(mysql, query.c_str()) != 0) { //std::cout << "
Error selecting filter!
" << std::endl; } else { result = mysql_use_result(mysql); row = mysql_fetch_row(result); totaldispos = totaldispos + stoi(row[0]); std::cout << ""; if (i == -8 || i == -7 || i == -6 || i == 6 || i == 7 || i == 8 || i == 9 || i == 10 || i == 11 || i == 12) { totalused += stoi(row[0]); } v[v1] = v[v1] + stoi(row[0]); mysql_free_result(result); } } std::cout << ""; v1++; v[v1] = v[v1] + totalused; std::cout << ""; } } //v[v1] = v[v1] + stoi(row[0]); std::cout << ""; std::cout << ""; std::cout << ""; for(int i=1; i<(v1+1); i++) { std::cout << ""; } std::cout << ""; std::cout << "
Campaign/Disposition" << itos(d) << "" << dispo2short(d) << "Used
" << tempCampaign << "" << row[0] << "" << totalused << "

Totals" << v[i] << "
" << std::endl; std::cout << ""; std::cout << "
(these are dispositions -8 through 12 from the database table)"; std::cout << "
"; std::cout << "
"; } void doShowAllDBCountsForYesterday(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; MYSQL *mysql = NULL; MYSQL_RES *result; MYSQL_ROW row; std::string query; mysql = mysql_init(NULL); if (mysql == NULL) { std::cerr << "MySql init failed!" << std::endl; } if (!mysql_real_connect(mysql, getMySqlHost().c_str(), \ getMySqlUser().c_str(), \ getMySqlPass().c_str(), \ getDbName().c_str(), \ 3306, NULL, 0)) \ { \ std::cerr << "MySql connection failed!" << std::endl; } printHead("All Campaign Counts for Yesterday (affected calls)"); std::cout << "

"; std::cout << "
" << std::endl; std::cout << ""; for (int d = -8; d < 13; d++) { //std::cout << ""; std::cout << ""; } std::cout << "" << std::endl; QueueList TheQueues; TheQueues.ParseQueues(); std::string tempCampaign; for (int q = 0; q < TheQueues.size(); q++) { tempCampaign = TheQueues.at(q).GetName(); if (tempCampaign.find("CLOSER",0) != std::string::npos || tempCampaign.find("closer",0) != std::string::npos || tempCampaign.find("DNC",0) != std::string::npos || tempCampaign.find("dnc",0) != std::string::npos) { //if (tempCampaign == "CLOSER" || tempCampaign == "closer" || tempCampaign == "DC_CLOSER") { //do nothing } else { std::cout << ""; std::cout << ""; int totaldispos = 0; for (int i = -8; i < 13; i++) { query = "SELECT COUNT(*) FROM `" + tempCampaign + "` WHERE disposition = '" + itos(i) + "' AND LEFT(lastupdated,10) = DATE_ADD(CURDATE(), INTERVAL -1 DAY) "; if (mysql_query(mysql, query.c_str()) != 0) { //std::cout << "
Error selecting filter!
" << std::endl; } else { result = mysql_use_result(mysql); row = mysql_fetch_row(result); totaldispos = totaldispos + stoi(row[0]); std::cout << ""; mysql_free_result(result); } } std::cout << ""; } } std::cout << "
Campaign/Disposition" << itos(d) << "" << dispo2short(d) << "
" << tempCampaign << "" << row[0] << "
" << std::endl; std::cout << ""; std::cout << "
(these are dispositions -8 through 12 from the database table)"; std::cout << "
"; std::cout << "
"; } void doEditQueue(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; Queue TheQueue; TheQueue.ParseQueue(queue); std::string function = TheQueue.GetSetting("function").Get(); std::string calltoday = TheQueue.GetSetting("calltoday").Get(); std::string usednc = TheQueue.GetSetting("usednc").Get(); std::string virtagents = TheQueue.GetSetting("virtagents").Get(); std::string maxratio = TheQueue.GetSetting("maxratio").Get(); std::string maxabandons = TheQueue.GetSetting("maxabandons").Get(); std::string maxlines = TheQueue.GetSetting("maxlines").Get(); std::string sleeptime = TheQueue.GetSetting("sleeptime").Get(); std::string tzearliest = TheQueue.GetSetting("tzearliest").Get(); std::string tzlatest = TheQueue.GetSetting("tzlatest").Get(); std::string timeout = TheQueue.GetSetting("timeout").Get(); std::string dspmode = TheQueue.GetSetting("dspmode").Get(); std::string trunk = TheQueue.GetSetting("trunk").Get(); std::string dialprefix = TheQueue.GetSetting("dialprefix").Get(); std::string usecloser = TheQueue.GetSetting("usecloser").Get(); std::string callerid = TheQueue.GetSetting("callerid").Get(); std::string closercam = TheQueue.GetSetting("closercam").Get(); std::string usecallback = TheQueue.GetSetting("usecallback").Get(); std::string debug = TheQueue.GetSetting("debug").Get(); std::string printagentsales = TheQueue.GetSetting("prn_agent_sales").Get(); std::string printclosersales = TheQueue.GetSetting("prn_closer_sales").Get(); std::string printclosernosales = TheQueue.GetSetting("prn_closer_nosales").Get(); std::string vm_message = TheQueue.GetSetting("vm_message").Get(); std::string sf_message = TheQueue.GetSetting("sf_message").Get(); std::string thirdparty = TheQueue.GetSetting("thirdparty").Get(); if (trunk.find("%3A",0) != std::string::npos) { int trunkPos = trunk.find("%3A",0); trunk.erase(trunkPos,3); trunk.insert(trunkPos,":"); } printHead("Edit Campaign"); std::cout << "

"; printSubHead("Enter campaign options for "); printSubHead(queue); printSubHead("."); std::cout << "

"; std::cout << "
" << std::endl; std::cout << ""; std::cout << ""; std::cout << ""; if (useVirtAgents) { std::cout << ""; } std::cout << ""; std::cout << ""; std::cout << ""; std::cout << ""; std::cout << ""; std::cout << ""; std::cout << ""; std::cout << ""; std::cout << ""; std::cout << ""; std::cout << ""; std::cout << ""; std::cout << ""; std::cout << ""; QueueList TheQueues; TheQueues.ParseQueues(); std::cout << ""; std::cout << ""; std::cout << ""; std::cout << ""; std::cout << ""; std::cout << ""; std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << " Dialing Mode: "; std::cout << printAlert("[?]","This is where you define the method by which the dialer throttles the outgoing call volume.\\n\\nEach mode follows a different set of rules.\\nPredictive:\\nThe dialer will first check if it has reached maxlines. Then it will check if it has reached maxabandons. Finally it will check if it is over maxratio. If none of those checks returned false, the dialer will assume that it is okay to place a call.\\nPower:\\nThe dialer will check if it is over maxlines. Then it will check if it is over maxratio.\\nPreview:\\nIdentical to power, except that the maxratio is always 1."); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "Callback Today: "; std::cout << printAlert("[?]","If you want to call leads multiple times a day, set this to yes.\\n\\nOtherwise, Gnudialer will ONLY make one attempt a day per record."); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "DNC Scrub: "; std::cout << printAlert("[?]","Realtime check against your DNC table.\\n\\nOnly use this feature if you actually filled the DNC table!!!"); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "Virt Agents: "; std::cout << printAlert("[?]","This is the number of virtual agents applied to evaluation of dialing.\\nExample: 1\\n\\nThe Default is 1 which will times by maxratio.\\n\\nBe Careful you STOP your campaigns when not real agents available!!!"); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "Max Ratio: "; std::cout << printAlert("[?]","This is the maximum line to available agent ratio that the dialer will allow for your campaign.\\nFor example, if you set this to 2, and there are 15 agents ready to take a call,\\nthe dialer will place no more than 30 calls during that time. \\nKeep in mind that this number may also be limited by your maxabandon percentage."); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "Max Abandon \%: "; std::cout << printAlert("[?]","This is the maximum number of abandons divided by calls to allow \\nat any given point in time. \\n(Campaigns covered under the TSR should be set at 3.0 percent or lower)"); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "Max Outgoing Lines: "; std::cout << printAlert("[?]","This is the maximum number of outgoing lines to use for your campaign.\\nThe dialer will not call any leads when this threshhold has been reached."); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "Query Sleep Time: "; std::cout << printAlert("[?]","This is how often (in milliseconds) that the dialer should check to see if \\nit is appropriate to make another call. The lower the number, \\nthe higher the strain on your processor."); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "Call between: "; std::cout << printAlert("[?]","This is the time range to call the leads.\\nThe dialer will not call a lead earlier than the first time,\\nwill not call later than the last time."); std::cout << ""; std::cout << " - \n"; std::cout << ""; std::cout << "
"; std::cout << "Timeout: "; std::cout << printAlert("[?]","This is the number of rings (approximately), the outgoing call will wait for an answer.\\n(each ring is set at 5000 ms, so for every ring add 5000, so 4 Rings is 20000 ms)"); std::cout << ""; //std::cout << ""; // std::cout << "
"; std::cout << "CallerID: "; std::cout << printAlert("[?]","CallerID NUMBER (digits only) to use for dialing out.\\n0123456789 will send the callerid as the number you are calling.\\n0123459999 will send the areacode and prefix plus 9999 as the number you are calling."); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "DSP Mode: "; std::cout << printAlert("[?]","This is the method by which GnuDialer does voicemail/fax detection.\\nThere are 4 main methods\\n\\nWaitForSilence\\n WaitForSilence(x[|y]) Wait for Silence: Waits for up to \\'x\\' \\nmilliseconds of silence, \\'y\\' times or 1 if omitted\\n\\nBG Detect\\n BackgroundDetect(filename[|sil[|min|[max]]]): Plays back a given filename\\nchecking min/max silence times\\n\\nAMD \\nAMD([initialSilence][|greeting][|afterGreetingSilence][|totalAnalysisTime]\\n[|minimumWordLength][|betweenWordsSilence][|maximumNumberOfWords]\\n[|silenceThreshold])\\n\\nNV Fax (and VM) Detect\\n NVFaxDetect([waitdur[|options[|sildur[|mindur[|maxdur]]]]]): This application \\nlistens for fax tones (on IAX and SIP channels too) for waitdur seconds of time.\\n(this one requires contacting Newman Telecom at info@newmantelecom.com\\nto get the applications to add to asterisk)"); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "Trunk: "; std::cout << printAlert("[?]","This is the outgoing trunk to use for this campaigns dialing.\\n\\nExamples: \\nZap/g1\\nIAX2/username:password@provider\\n"); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "Dial Prefix: "; std::cout << printAlert("[?]","This is an optional dialing prefix that is dialed before\\nthe phone number from the database.\\n\\nExample: 9 OR 011 "); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "Use Callback: "; std::cout << printAlert("[?]","Allow the ability to set a callback."); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "Allow Closer: "; std::cout << printAlert("[?]","Allow agent to transfer to a closer."); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "Closer Campaign: "; std::cout << printAlert("[?]","This is the campaign to send transfers to."); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "Debug: "; std::cout << printAlert("[?]","Send Campaign debug output to the console."); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "VM Message: "; std::cout << printAlert("[?]","Voicemail message file to be played to answering machine."); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "SF Message: "; std::cout << printAlert("[?]","Safe Harbor message to be played to abandons."); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "3rdParty Ver: "; std::cout << printAlert("[?]","Phone string to use for 3rd party verification."); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "Print Agent Sales: "; std::cout << printAlert("[?]","(if cups/lpr configured) Print the record an Agent dispositions a 12 (sale)."); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "Print Closer Sales: "; std::cout << printAlert("[?]","(if cups/lpr configured) Print the record a Closer dispositions a 12 (sale)."); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "Print Closer NoSales: "; std::cout << printAlert("[?]","(if cups/lpr configured) Print the record a Closer dispositions an 11 (nosale)."); std::cout << ""; std::cout << ""; std::cout << "
"; std::cout << "
"; std::cout << printSubmit("Save Campaign Settings"); std::cout << ""; std::cout << "
(changes take effect immediately)"; std::cout << "
"; std::cout << "
"; } void doFinishEditingCampaignSettings(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; std::string function = TheFields.GetField("function"); std::string calltoday = TheFields.GetField("calltoday"); std::string usednc = TheFields.GetField("usednc"); std::string virtagents = TheFields.GetField("virtagents"); std::string maxratio = TheFields.GetField("maxratio"); std::string maxabandons = TheFields.GetField("maxabandons"); std::string maxlines = TheFields.GetField("maxlines"); std::string sleeptime = TheFields.GetField("sleeptime"); std::string tzearliest = TheFields.GetField("tzearliest"); std::string tzlatest = TheFields.GetField("tzlatest"); std::string timeout = TheFields.GetField("timeout"); std::string dspmode = TheFields.GetField("dspmode"); std::string trunk = TheFields.GetField("trunk"); std::string dialprefix = TheFields.GetField("dialprefix"); std::string usecloser = TheFields.GetField("usecloser"); std::string callerid = TheFields.GetField("callerid"); std::string closercam = TheFields.GetField("closercam"); std::string usecallback = TheFields.GetField("usecallback"); std::string debug = TheFields.GetField("debug"); std::string printagentsales = TheFields.GetField("printagentsales"); std::string printclosersales = TheFields.GetField("printclosersales"); std::string printclosernosales = TheFields.GetField("printclosernosales"); std::string vm_message = TheFields.GetField("vm_message"); std::string sf_message = TheFields.GetField("sf_message"); std::string thirdparty = TheFields.GetField("thirdparty"); trimStr(virtagents); if (virtagents.empty()) { virtagents = "0"; } trimStr(maxratio); if (maxratio.empty()) { maxratio = "2.0"; } trimStr(maxabandons); if (maxabandons.empty()) { maxabandons = "3.0"; } trimStr(maxlines); if (maxlines.empty()) { maxlines = "24"; } trimStr(sleeptime); if (sleeptime.empty()) { sleeptime = "1000"; } trimStr(callerid); if (callerid.empty()) { callerid = "9999999999"; } if (trunk.find(":",0) != std::string::npos) { int trunkPos = trunk.find(":",0); trunk.erase(trunkPos,1); trunk.insert(trunkPos,"%3A"); } trimStr(trunk); if (trunk.empty()) { trunk = "none"; } trimStr(dialprefix); if (dialprefix.empty()) { dialprefix = "none"; } trimStr(vm_message); if (vm_message.empty()) { vm_message = "none"; } trimStr(sf_message); if (sf_message.empty()) { sf_message = "none"; } trimStr(thirdparty); if (thirdparty.empty()) { thirdparty = "none"; } Queue TheQueue; TheQueue.ParseQueue(queue); TheQueue.SetSetting("function",function); TheQueue.SetSetting("calltoday", calltoday); TheQueue.SetSetting("usednc", usednc); TheQueue.SetSetting("virtagents",virtagents); TheQueue.SetSetting("maxratio",maxratio); TheQueue.SetSetting("maxabandons",maxabandons); TheQueue.SetSetting("maxlines",maxlines); TheQueue.SetSetting("sleeptime",sleeptime); TheQueue.SetSetting("tzearliest",tzearliest); TheQueue.SetSetting("tzlatest",tzlatest); TheQueue.SetSetting("timeout", timeout); TheQueue.SetSetting("dspmode", dspmode); TheQueue.SetSetting("trunk", trunk); TheQueue.SetSetting("dialprefix", dialprefix); TheQueue.SetSetting("usecloser", usecloser); TheQueue.SetSetting("closercam", closercam); TheQueue.SetSetting("callerid", callerid); TheQueue.SetSetting("usecallback", usecallback); TheQueue.SetSetting("debug", debug); TheQueue.SetSetting("prn_agent_sales", printagentsales); TheQueue.SetSetting("prn_closer_sales", printclosersales); TheQueue.SetSetting("prn_closer_nosales", printclosernosales); TheQueue.SetSetting("vm_message", vm_message); TheQueue.SetSetting("sf_message", sf_message); TheQueue.SetSetting("thirdparty", thirdparty); TheQueue.Write(); if (testnewevents) { sendUserEvent("ReloadCampaign","Campaign: " + queue); } printHead("Save Campaign Settings"); std::cout << "

\n"; printSubHead("Settings updated for " + queue); std::cout << "

"; } void doStartQueue(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; //Queue TheQueue; //TheQueue.ParseQueue(queue); startQueue(queue); //if (testnewevents) { // sendUserEvent("StartCampaign","Campaign: " + queue); //} printHead("Campaign Started"); std::cout << "

\n"; printSubHead("You have started campaign "); printSubHead(queue); printSubHead("."); std::cout << "

\n"; } void doStopQueue(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; //Queue TheQueue; //TheQueue.ParseQueue(queue); stopQueue(queue); //if (testnewevents) { // sendUserEvent("StopCampaign","Campaign: " + queue); //} printHead("Campaign Started"); std::cout << "

\n"; printSubHead("You have stopped campaign "); printSubHead(queue); printSubHead("."); std::cout << "

\n"; } void doStartQ(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; std::cout << ""; startQueue(queue); showMenu(TheFields); } void doStopQ(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; std::cout << ""; stopQueue(queue); showMenu(TheFields); } void doRemoveQueue(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; Queue TheQueue; TheQueue.ParseQueue(queue); if (TheQueue.GetSetting("active").Get() == "true") { std::cout << "You must stop the campaign first.

\n"; std::cout << printSubmit("Stop Campaign"); } else { removeQueue(queue); if (testnewevents) { sendUserEvent("RemoveCampaign","Campaign: " + queue); } printHead("Campaign Queue"); std::cout << "

\n"; printSubHead("You have removed campaign

"); printSubHead(queue); printSubHead(".

"); } } void doFinishCreatingQueue(Post TheFields) { std::string queue = TheFields.GetField("newqueuename"); std::cout << ""; if (!createQueue(queue)) std::cout << "Error creating campaign!"; else { addBasicSettings(queue); std::string filename = "/var/www/cgi-bin/" + queue + ".script"; std::system(("cp /var/www/cgi-bin/default.script " + filename).c_str()); if (testnewevents) { sendUserEvent("CreateCampaign","Campaign: " + queue); sendUserEvent("StopCampaign","Campaign: " + queue); } printHead("Created Campaign"); std::cout << "

\n"; printSubHead("You have created campaign "); printSubHead(queue); printSubHead(".

"); } } void doCreateQueue(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; printHead("Create Campaign"); std::cout << "

\n"; printSubHead("Enter the name of the campaign to create."); std::cout << "
NO dashes, spaces, etc (except '_' an underscore)"; std::cout << "
Must contain 'TAP' for tap campaigns."; std::cout << "
AND/OR Must contain 'DAY' for day campaigns.

"; std::cout << "

\n"; std::cout << printSubmit("Finish Creating Campaign"); std::cout << "

\n"; } void doReloadQueue(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; std::cout << ""; printHead("New Campaign Name"); std::cout << "

\n"; printSubHead("Enter the name of the campaign to CREATE."); std::cout << "
NO dashes, spaces, etc (except '_' an underscore)"; std::cout << "
Must contain 'TAP' for tap campaigns."; std::cout << "
AND/OR Must contain 'DAY' for day campaigns.

"; std::cout << "

\n"; std::cout << printSubmit("Finish Creating Reload Campaign"); std::cout << "

\n"; } void doFinishCreatingReloadQueue(Post TheFields) { std::string queue = TheFields.GetField("newqueuename"); std::string newqueue = TheFields.GetField("newqueuename"); std::string oldqueue = TheFields.GetField("oldqueuename"); std::cout << ""; if (!createQueue(queue)) std::cout << "Error creating campaign!"; else { addBasicSettings(queue); std::string filename = "/var/www/cgi-bin/" + queue + ".script"; std::system(("cp /var/www/cgi-bin/default.script " + filename).c_str()); MYSQL *mysql = NULL; //MYSQL_RES *result; //MYSQL_ROW row; //unsigned int counter = 0; mysql = mysql_init(NULL); if(mysql == NULL) { std::cerr << "MySql init failed!" << std::endl; } if(!mysql_real_connect(mysql, getMySqlHost().c_str(), \ getMySqlUser().c_str(), \ getMySqlPass().c_str(), \ getDbName().c_str(), \ 3306, NULL, 0)) \ { \ std::cerr << "MySql connection failed!" << std::endl; } //std::string query = "CREATE TABLE " + newqueue + " SELECT * FROM " + oldqueue + " WHERE (disposition = '-7' OR disposition = '0')"; std::string query = "CREATE TABLE `" + queue + "` SELECT * FROM `" + oldqueue + "` WHERE ((disposition > -8 AND disposition < 7) "; query += "OR disposition = 9 "; query += "OR disposition = 10 "; query += "OR disposition = 11) "; if(mysql_query(mysql, query.c_str()) != 0) { std::cout << "
Error copying table !
" << std::endl; } query = "UPDATE `" + queue + "` SET disposition='1',closerdispo='',agent='000',closer='000',attempts='0',pickups='0',abandons='0',subdispo=''"; if(mysql_query(mysql, query.c_str()) != 0) { std::cout << "
Error updating table !
" << std::endl; } query = "ALTER TABLE `" + queue + "` MODIFY COLUMN lastupdated timestamp NOT NULL default '0000-00-00 00:00:00' on update CURRENT_TIMESTAMP"; if(mysql_query(mysql, query.c_str()) != 0) { std::cout << "
Error updating table (modify column)
" << std::endl; } query = "ALTER TABLE `" + queue + "` ADD PRIMARY KEY (`id`), ADD INDEX (`attempts`), ADD INDEX (`pickups`), ADD INDEX (`disposition`), ADD INDEX (`phone`), ADD INDEX (`lastupdated`), ADD INDEX (`tzl`);"; if(mysql_query(mysql, query.c_str()) != 0) { std::cout << "
Error updating table (add indexes)
" << std::endl; } if (testnewevents) { sendUserEvent("CreateCampaign","Campaign: " + queue); sendUserEvent("StopCampaign","Campaign: " + queue); } printHead("Created Reload Campaign"); std::cout << "

\n"; printSubHead("You have created campaign "); printSubHead(queue); printSubHead(".

"); } } void doAddDNC(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; printHead("Add DNC Number"); std::cout << "

\n"; printSubHead("Enter the DNC Number you wish to add."); std::cout << "
Digits ONLY, nothing else

"; std::cout << "

\n"; std::cout << printSubmit("Finish Adding DNC"); std::cout << "

\n"; } void doFinishAddingDNC(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::string dnc = TheFields.GetField("dnc"); std::cout << ""; MYSQL *mysql = NULL; //MYSQL_RES *result; //MYSQL_ROW row; //unsigned int counter = 0; mysql = mysql_init(NULL); if(mysql == NULL) { std::cerr << "MySql init failed!" << std::endl; } if(!mysql_real_connect(mysql, getMySqlHost().c_str(), \ getMySqlUser().c_str(), \ getMySqlPass().c_str(), \ getDbName().c_str(), \ 3306, NULL, 0)) \ { \ std::cerr << "MySql connection failed!" << std::endl; } std::string query = "INSERT INTO DNC (id,phone) values (NULL,'" + dnc + "')"; if(mysql_query(mysql, query.c_str()) != 0) { std::cout << "
Error adding dnc number !
" << std::endl; } printHead("Added DNC Number"); std::cout << "

\n"; printSubHead("You have added "); printSubHead(dnc); printSubHead(" to DNC.

"); } void doFinishCreatingAgent(Post TheFields) { std::string agent = TheFields.GetField("newagentname"); std::string pass = TheFields.GetField("newagentpass"); if (!createNewAgent(299,499,agent,pass)) std::cout << "Error creating agent!"; else { reloadAgents(); printHead("Created Agent"); std::cout << "

\n"; printSubHead("You have created agent "); printSubHead(agent); printSubHead(".

"); } } void doFinishCreatingAltAgent(Post TheFields) { std::string agent = TheFields.GetField("newagentname"); std::string pass = TheFields.GetField("newagentpass"); if (!createNewAgent(499,599,agent,pass)) std::cout << "Error creating alt agent!"; else { reloadAgents(); printHead("Created Alt Agent"); std::cout << "

\n"; printSubHead("You have created alt agent "); printSubHead(agent); printSubHead(".

"); } } void doFinishCreatingDayAgent(Post TheFields) { std::string agent = TheFields.GetField("newagentname"); std::string pass = TheFields.GetField("newagentpass"); if (!createNewAgent(99,199,agent,pass)) std::cout << "Error creating day agent!"; else { reloadAgents(); printHead("Created Day Agent"); std::cout << "

\n"; printSubHead("You have created day agent "); printSubHead(agent); printSubHead(".

"); } } void doDeleteAgent(Post TheFields) { std::string queue = TheFields.GetField("queue"); printHead("Delete Agents"); std::cout << "

"; printSubHead("You deleted

"); for (int i = 0; i < TheFields.OccurencesOf("agents"); i++) { std::string agent = TheFields.GetField("agents",i); if (deleteAgent(agent)) { reloadAgents(); printSubHead(agent); printSubHead("
"); } } std::cout << "

\n"; } void doFinishCreatingCloser(Post TheFields) { std::string agent = TheFields.GetField("newagentname"); std::string pass = TheFields.GetField("newagentpass"); if (!createNewAgent(599,698,agent,pass)) std::cout << "Error creating agent!"; else { reloadAgents(); printHead("Created Closer"); std::cout << "

\n"; printSubHead("You have created closer "); printSubHead(agent); printSubHead(".

"); } } void doCreateCloser() { printHead("Create Closer"); std::cout << "

\n"; printSubHead("Enter the name of the closer to create."); std::cout << "

"; std::cout << "

\n"; printSubHead("Enter a password."); std::cout << "

"; std::cout << "

\n"; std::cout << printSubmit("Finish Creating Closer"); std::cout << "

\n"; } void doCreateAgent() { printHead("Create Agent"); std::cout << "

\n"; printSubHead("Enter the name of the agent to create."); std::cout << "

"; std::cout << "

\n"; printSubHead("Enter a password."); std::cout << "

"; std::cout << "

\n"; std::cout << printSubmit("Finish Creating Agent"); std::cout << "

\n"; } void doCreateAltAgent() { printHead("Create Alt Agent"); std::cout << "

\n"; printSubHead("Enter the name of the alt agent to create."); std::cout << "

"; std::cout << "

\n"; printSubHead("Enter a password."); std::cout << "

"; std::cout << "

\n"; std::cout << printSubmit("Finish Creating Alt Agent"); std::cout << "

\n"; } void doCreateDayAgent() { printHead("Create Day Agent"); std::cout << "

\n"; printSubHead("Enter the name of the day agent to create."); std::cout << "

"; std::cout << "

\n"; printSubHead("Enter a password."); std::cout << "

"; std::cout << "

\n"; std::cout << printSubmit("Finish Creating Day Agent"); std::cout << "

\n"; } void doEditAgentInfo(Post TheFields) { std::string agent = TheFields.GetField("agents"); AgentList TheAgents; TheAgents.ParseAgentList(); Agent TheAgent; for (int i = 0; i < TheAgents.size(); i++) { if (TheAgents.at(i).GetNumber() == atoi(agent.c_str())) { TheAgent = TheAgents.at(i); } } printHead("Edit Agent Info"); std::cout << "

\n"; printSubHead("Update the agent's information:"); std::cout << "

"; std::cout << "Agent Name:

\n"; std::cout << "\n"; std::cout << "

\n"; std::cout << "Agent Password:

\n"; std::cout << "

\n"; std::cout << printSubmit("Finish Editing Agent"); std::cout << "

\n"; } void doFinishEditingAgent(Post TheFields) { std::string agentnumber = TheFields.GetField("agentnumber"); std::string agentname = TheFields.GetField("editagentname"); std::string agentpass = TheFields.GetField("editagentpass"); if (editAgent(agentnumber,agentname,agentpass)) { reloadAgents(); printHead("Edit Agent Info"); std::cout << "

\n"; printSubHead("You have updated agent: " + agentnumber); } std::cout << "

"; } void doShowAgentStats(Post TheFields) { std::string agent = TheFields.GetField("agents"); printHead("Agent: " + agent); std::cout << "

" << std::endl; printSubHead("Date Range"); std::cout << "

" << std::endl; printDateFields(1); std::cout << "

To

\n"; printDateFields(2); std::cout << "

" << std::endl; std::cout << "Dispos to show:

"; std::cout << "   Callbacks
" << std::endl; std::cout << "   No Answers
" << std::endl; std::cout << "   Voicemails
" << std::endl; std::cout << "   Busies
" << std::endl; std::cout << "   Fast Busies
" << std::endl; std::cout << "   Fax Machines
" << std::endl; std::cout << "   Disconnects
" << std::endl; std::cout << "   Do Not Calls
" << std::endl; std::cout << "   Invalids
" << std::endl; std::cout << "   No Sales (No Contact)
" << std::endl; std::cout << "   No Sales (Contact)
" << std::endl; std::cout << "   Sales
" << std::endl; std::cout << "   Used
" << std::endl; std::cout << "
" << std::endl; std::cout << "\n"; std::cout << "\n"; std::cout << printSubmit("Show Stats"); std::cout << "

"; } void doShowAllCampaignStats(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; //printHead("Campaign: " + queue); std::cout << "All Campaign Stats

" << std::endl; printSubHead("Date Range"); std::cout << "

" << std::endl; printDateFields(1); std::cout << "

To

\n"; printDateFields(2); std::cout << "

" << std::endl; std::cout << "Dispos to show: " << std::endl; std::cout << "all" << std::endl; std::cout << "none" << std::endl; std::cout << "

"; std::cout << "   Callbacks
" << std::endl; std::cout << "   No Answers
" << std::endl; std::cout << "   Voicemails
" << std::endl; std::cout << "   Busies
" << std::endl; std::cout << "   Fast Busies
" << std::endl; std::cout << "   Fax Machines
" << std::endl; std::cout << "   Disconnects
" << std::endl; std::cout << "   Do Not Calls
" << std::endl; std::cout << "   Invalids
" << std::endl; std::cout << "   No Sales (No Contact)
" << std::endl; std::cout << "   No Sales (Contact)
" << std::endl; std::cout << "   Sales
" << std::endl; std::cout << "   Used
" << std::endl; std::cout << "
" << std::endl; std::cout << "\n"; std::cout << "\n"; std::cout << printSubmit("Show Stats"); std::cout << "

"; } void doShowSystemStats(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; printHead("Campaign: " + queue); std::cout << "

" << std::endl; printSubHead("Date Range"); std::cout << "

" << std::endl; printDateFields(1); std::cout << "

To

\n"; printDateFields(2); std::cout << "

" << std::endl; std::cout << "\n"; std::cout << "\n"; std::cout << printSubmit("Show System Stats"); std::cout << "

"; } void doShowCampaignStats(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; printHead("Campaign: " + queue); std::cout << "

" << std::endl; printSubHead("Date Range"); std::cout << "

" << std::endl; printDateFields(1); std::cout << "

To

\n"; printDateFields(2); std::cout << "

" << std::endl; std::cout << "Dispos to show: " << std::endl; std::cout << "all" << std::endl; std::cout << "none" << std::endl; std::cout << "

"; std::cout << "   Callbacks
" << std::endl; std::cout << "   No Answers
" << std::endl; std::cout << "   Voicemails
" << std::endl; std::cout << "   Busies
" << std::endl; std::cout << "   Fast Busies
" << std::endl; std::cout << "   Fax Machines
" << std::endl; std::cout << "   Disconnects
" << std::endl; std::cout << "   Do Not Calls
" << std::endl; std::cout << "   Invalids
" << std::endl; std::cout << "   No Sales (No Contact)
" << std::endl; std::cout << "   No Sales (Contact)
" << std::endl; std::cout << "   Sales
" << std::endl; std::cout << "   Used
" << std::endl; std::cout << "
" << std::endl; std::cout << "\n"; std::cout << "\n"; std::cout << printSubmit("Show Stats"); std::cout << "

"; } void doShowAgentTime() { printHead("Log Time for All Agents"); std::cout << "

" << std::endl; printSubHead("Date Range"); std::cout << "

" << std::endl; printDateFields(1); std::cout << "

To

\n"; printDateFields(2); std::cout << "

" << std::endl; std::cout << "\n"; std::cout << "\n"; std::cout << printSubmit("Show Stats"); std::cout << "

"; } void doShowSysStats(Post TheFields) { std::string thestatsurl; printSubHead("Generating report..."); thestatsurl = "/cgi-bin/sysstats.cgi?statsmode=" + TheFields.GetField("statmode") + "&selection=" + TheFields.GetField("selection"); std::cout << "

\n"; thestatsurl += "&mon1=" + TheFields.GetField("mon1"); thestatsurl += "&day1=" + TheFields.GetField("day1"); thestatsurl += "&year1=" + TheFields.GetField("year1"); thestatsurl += "&mon2=" + TheFields.GetField("mon2"); thestatsurl += "&day2=" + TheFields.GetField("day2"); thestatsurl += "&year2=" + TheFields.GetField("year2"); std::cout << "\n\n"; std::cout << "Click here if you are not redirected." << std::endl; std::cout << "

\n"; } void doShowStats(Post TheFields) { std::string thestatsurl; printSubHead("Generating report..."); if (TheFields.GetField("statmode") == "allagents") { thestatsurl = "/cgi-bin/agenthours.cgi?statsmode=" + TheFields.GetField("statmode") + "&selection=notapplicable"; } else { thestatsurl = "/cgi-bin/newstats.cgi?statsmode=" + TheFields.GetField("statmode") + "&selection=" + TheFields.GetField("selection"); } if (TheFields.HasField("callback")) thestatsurl += "&callback=on"; if (TheFields.HasField("noanswer")) thestatsurl += "&noanswer=on"; if (TheFields.HasField("voicemail")) thestatsurl += "&voicemail=on"; if (TheFields.HasField("busy")) thestatsurl += "&busy=on"; if (TheFields.HasField("fastbusy")) thestatsurl += "&fastbusy=on"; if (TheFields.HasField("fax")) thestatsurl += "&fax=on"; if (TheFields.HasField("disconnect")) thestatsurl += "&disconnect=on"; if (TheFields.HasField("donotcall")) thestatsurl += "&donotcall=on"; if (TheFields.HasField("invalid")) thestatsurl += "&invalid=on"; if (TheFields.HasField("nosalefalse")) thestatsurl += "&nosalefalse=on"; if (TheFields.HasField("nosaletrue")) thestatsurl += "&nosaletrue=on"; if (TheFields.HasField("sale")) thestatsurl += "&sale=on"; if (TheFields.HasField("used")) thestatsurl += "&used=on"; std::cout << "

\n"; thestatsurl += "&mon1=" + TheFields.GetField("mon1"); thestatsurl += "&day1=" + TheFields.GetField("day1"); thestatsurl += "&year1=" + TheFields.GetField("year1"); thestatsurl += "&mon2=" + TheFields.GetField("mon2"); thestatsurl += "&day2=" + TheFields.GetField("day2"); thestatsurl += "&year2=" + TheFields.GetField("year2"); std::cout << "\n\n"; std::cout << "Click here if you are not redirected." << std::endl; std::cout << "

\n"; } void doImportData(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; printHead("Import for: " + queue); // std::cout << "
" << std::endl; std::cout << "
Field List*: (separate with commas)" << std::endl; std::cout << "
" << std::endl; std::cout << "
* You MUST have a field named \"phone\"" << std::endl; std::cout << "
* \"phone\" field MUST be first" << std::endl; std::cout << "

" << std::endl; std::cout << "
Type List*: (separate with commas)" << std::endl; std::cout << "
" << std::endl; std::cout << "
* The phone field should be a varchar" << std::endl; std::cout << "

" << std::endl; std::cout << printAlert("[?]","See README.import for more information on file layout."); std::cout << "Csv File:" << std::endl; std::cout << "


" << std::endl; std::cout << ""; std::cout << "
Unless you know what you are doing do not change these."; std::cout << "
(make your data conform, because there are things in gnudialer"; std::cout << "
that are hardcoded with some of these fieldnames and placement)

"; std::cout << "
"; std::cout << ""; std::cout << ""; std::cout << printSubmitConfirm("Import Records"); std::cout << "


"; std::cout << "
\n"; std::cout << ""; } void doReloadData(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; printHead("Reload Data for:

" + queue); std::cout << "

" << std::endl; std::cout << printSubmitConfirm("Campaign Reload"); std::cout << "
"; } void doDataReload(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; Queue TheQueue; TheQueue.ParseQueue(queue); MYSQL *mysql = NULL; MYSQL_RES *result; MYSQL_ROW row; unsigned int counter = 0; mysql = mysql_init(NULL); if(mysql == NULL) { std::cerr << "MySql init failed!" << std::endl; } if(!mysql_real_connect(mysql, getMySqlHost().c_str(), \ getMySqlUser().c_str(), \ getMySqlPass().c_str(), \ getDbName().c_str(), \ 3306, NULL, 0)) \ { \ std::cerr << "MySql connection failed!" << std::endl; } std::string query = "SELECT SQL_CALC_FOUND_ROWS `phone`,`title`,`name`,`address`,`city`,`state`,`zip`,`oc`,`paidamt`,`paiddate`,`comments`,`countynum` "; query += "FROM `" + queue + "` WHERE ((disposition > -8 AND disposition < 7) "; query += "OR disposition = 9 "; query += "OR disposition = 10 "; query += "OR disposition = 11) "; query += "INTO OUTFILE '/tmp/reload-" + queue + ".txt' FIELDS TERMINATED BY ',' "; query += "OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\\r\\n'"; if(mysql_query(mysql, query.c_str()) != 0) { std::cout << "
Error selecting reload records !
" << std::endl; } query = "SELECT FOUND_ROWS()"; if(mysql_query(mysql, query.c_str()) != 0) { std::cout << "
Error selecting found records !
" << std::endl; } else { result = mysql_use_result(mysql); row = mysql_fetch_row(result); counter = stoi(row[0]); std::cout << ""; if(mysql_errno(mysql)) { std::cout << "
Error fetching Sales from mysql!
" << std::endl; } if (!counter) { std::cout << "
No Records Reloaded!
" << std::endl; } else { std::cout << "
Reloaded " << counter << " records to " << "/tmp/reload-" << queue << ".txt
"; //std::system(("cp /tmp/reload-" + queue + ".txt /var/www/html/gnudialer/reload-" + queue + ".txt").c_str()); } mysql_free_result(result); } } void doExportSales(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; printHead("Export Sales for: " + queue); std::cout << "

" << std::endl; printSubHead("Date Range"); std::cout << "

" << std::endl; printDateFields(1); std::cout << "

To

\n"; printDateFields(2); std::cout << "

" << std::endl; std::cout << printSubmit("Export Records"); std::cout << "

"; } void doExportRecords(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; std::string mon1 = TheFields.GetField("mon1"); std::string day1 = TheFields.GetField("day1"); std::string year1 = TheFields.GetField("year1"); std::string date1 = "'" + year1 + "-" + mon1 + "-" + day1 + "'"; std::string mon2 = TheFields.GetField("mon2"); std::string day2 = TheFields.GetField("day2"); std::string year2 = TheFields.GetField("year2"); std::string date2 = "'" + year2 + "-" + mon2 + "-" + day2 + "'"; Queue TheQueue; TheQueue.ParseQueue(queue); bool usecloser = TheQueue.GetSetting("usecloser").GetBool(); MYSQL *mysql = NULL; MYSQL_RES *result; MYSQL_ROW row; unsigned int counter = 0; int creation_inc = 0; std::cout << "
Campaign: " << queue << "
" << std::endl; mysql = mysql_init(NULL); if(mysql == NULL) { std::cerr << "MySql init failed!" << std::endl; } if(!mysql_real_connect(mysql, getMySqlHost().c_str(), \ getMySqlUser().c_str(), \ getMySqlPass().c_str(), \ getDbName().c_str(), \ 3306, NULL, 0)) \ { \ std::cerr << "MySql connection failed!" << std::endl; } std::string query = "SELECT * FROM `" + queue + "` WHERE "; query += "(left(lastupdated,10) >= STR_TO_DATE(" + date1 + ", '%Y-%m-%d') "; query += "AND left(lastupdated,10) <= STR_TO_DATE(" + date2 + ", '%Y-%m-%d')) "; if (usecloser) { query += "AND disposition='12' AND closerdispo='12' AND subdispo < 'H5'"; } else { query += "AND disposition='12'"; } if(mysql_query(mysql, query.c_str()) != 0) { std::cout << "
Error selecting sales from mysql!
" << std::endl; } else { result = mysql_use_result(mysql); if (!creation_inc) { createExportFile(queue); } creation_inc++; std::cout << "
";

		std::string theDB = "15";
		int isTap = 0;
		if (queue.find("TAP",0) != std::string::npos)
		{
			theDB = "95";
			isTap = 1;
		}

		int isDay = 0;
                if (queue.find("DAYT",0) != std::string::npos)
                {
                        isDay = 1;
			isTap = 1;
                }
		if (queue.find("DAY",0) != std::string::npos)
		{
			isDay = 1;
		}

		int special_export = 0;
		for((counter = 0); (row = mysql_fetch_row(result)); counter++)
		{
			//for(counter = 0; row = mysql_fetch_row(result); counter++) {
			std::string theDisplayRecord = "";
			std::string theExportRecord = "";

			if (special_export)
			{
				//on screen stuff
				theDisplayRecord = "";
				theDisplayRecord += std::string(row[10]);
				theDisplayRecord += " ";
				theDisplayRecord += std::string(row[9]);
				theDisplayRecord += " ";
				theDisplayRecord += std::string(row[1]);
				theDisplayRecord += " ";
				theDisplayRecord += std::string(row[26]);
				theDisplayRecord += " ";
				theDisplayRecord += std::string(row[28]);
				theDisplayRecord += " ";
				theDisplayRecord += std::string(row[25]);

				std::cout << "
" << theDisplayRecord; //in file stuff theExportRecord = "\""; theExportRecord += std::string(row[10]); theExportRecord += "\",\""; theExportRecord += std::string(row[9]); theExportRecord += "\",\""; theExportRecord += std::string(row[1]); theExportRecord += "\",\""; theExportRecord += std::string(row[26]); theExportRecord += "\",\""; theExportRecord += std::string(row[28]); theExportRecord += "\",\""; theExportRecord += std::string(row[25]); theExportRecord += "\""; theExportRecord += char(192); //theExportRecord += char(15); } else { if (isDay) { theDisplayRecord = "DB: "; theDisplayRecord += rfill(theDB,3); theDisplayRecord += rfill(std::string(row[0]),6); theDisplayRecord += " "; theDisplayRecord += rfill(std::string(row[1]),10); //theDisplayRecord += rfill(std::string(row[18]),3); theDisplayRecord += rfill(std::string(row[16]),3); theDisplayRecord += rfill(std::string(row[22]),3); std::cout << "
" << theDisplayRecord; // OutFile << " leadid : " << std::string(row[0]) << std::endl; // OutFile << " phone : " << std::string(row[1]) << std::endl; // OutFile << " title : " << std::string(row[2]) << std::endl; // OutFile << " name : " << std::string(row[3]) << std::endl; // OutFile << " address : " << std::string(row[4]) << std::endl; // OutFile << " city : " << std::string(row[5]) << std::endl; // OutFile << " state : " << std::string(row[6]) << std::endl; // OutFile << " zip : " << std::string(row[7]) << std::endl; // OutFile << " oc : " << std::string(row[8]) << std::endl; // OutFile << " paidamt : " << std::string(row[9]) << std::endl; // OutFile << "paiddate : " << std::string(row[10]) << std::endl; // OutFile << "comments : " << std::string(row[11]) << std::endl; // OutFile << " county : " << std::string(row[12]) << std::endl; // OutFile << " tzl : " << std::string(row[13]) << std::endl; // OutFile << " tzh : " << std::string(row[14]) << std::endl; // OutFile << "attempts : " << std::string(row[15]) << std::endl; // OutFile << " pickups : " << std::string(row[16]) << std::endl; // OutFile << "abandons : " << std::string(row[17]) << std::endl; // OutFile << " A dispo : " << std::string(row[18]) << std::endl; // OutFile << " agent : " << std::string(row[19]) << std::endl; // OutFile << " C dispo : " << std::string(row[20]) << std::endl; // OutFile << " closer : " << std::string(row[21]) << std::endl; // OutFile << "subdispo : " << std::string(row[22]) << std::endl; // OutFile << "datetime : " << std::string(row[23]) << std::endl; // OutFile << " cb_date : " << std::string(row[24]) << std::endl; //theExportRecord = "DB: "; //theExportRecord += rfill(theDB,2); theExportRecord += rfill(std::string(row[19]),3); //salenum (attempting storing recid instead //theExportRecord += " 1"; theExportRecord += lfill(std::string(row[0]),5); theExportRecord += rfill(std::string(row[1]),10); theExportRecord += rfill(std::string(row[3]),40); theExportRecord += rfill(std::string(row[4]),40); theExportRecord += rfill(std::string(row[5]),20); theExportRecord += rfill(std::string(row[6]),2); theExportRecord += rfill(std::string(row[7]),10); theExportRecord += rfill(std::string(row[8]),25); //this next is the dollar amount, how to fill //theExportRecord += " "; if (lfill(std::string(row[22]),2) == "H1") { theExportRecord += rfill("40",5); } if (lfill(std::string(row[22]),2) == "H2") { theExportRecord += rfill("80",5); } if (lfill(std::string(row[22]),2) == "H3") { theExportRecord += rfill("120",5); } if (lfill(std::string(row[22]),2) == "H4") { theExportRecord += rfill("160",5); } if (lfill(std::string(row[22]),2) == "H5") { theExportRecord += rfill("200",5); } if (isTap) { theExportRecord += "T"; } else { theExportRecord += "C"; } theExportRecord += " "; theExportRecord += "M"; //theExportRecord += " "; theExportRecord += rfill(std::string(row[21]),3); theExportRecord += char(192); //theExportRecord += char(15); } else { theDisplayRecord = "DB: "; theDisplayRecord += rfill(theDB,3); theDisplayRecord += rfill(std::string(row[0]),6); theDisplayRecord += " "; theDisplayRecord += rfill(std::string(row[1]),10); //theDisplayRecord += rfill(std::string(row[18]),3); theDisplayRecord += rfill(std::string(row[16]),3); theDisplayRecord += rfill(std::string(row[22]),3); std::cout << "
" << theDisplayRecord; theExportRecord = "DB: "; theExportRecord += rfill(theDB,2); theExportRecord += " "; theExportRecord += rfill(std::string(row[0]),6); theExportRecord += " "; theExportRecord += rfill(std::string(row[21]),3); theExportRecord += rfill(std::string(row[19]),3); theExportRecord += lfill(std::string(row[22]),2); theExportRecord += " "; theExportRecord += rfill(std::string(row[1]),10); theExportRecord += rfill(std::string(row[3]),40); theExportRecord += rfill(std::string(row[4]),40); theExportRecord += rfill(std::string(row[5]),20); theExportRecord += rfill(std::string(row[6]),2); theExportRecord += rfill(std::string(row[7]),10); theExportRecord += rfill(std::string(row[23]),25); theExportRecord += rfill(std::string(row[2]),4); theExportRecord += char(192); //theExportRecord += char(15); } } writeExportRecord(queue,theExportRecord); } std::cout << "
"; moveExportFile(queue); if(mysql_errno(mysql)) { std::cout << "
Error fetching Sales from mysql!
" << std::endl; } if (!counter) { std::cout << "
No Sales exported!
" << std::endl; } else { std::cout << "
Exported " << counter << " records to " << "/tmp/exports/" << queue << "-CCYYMMDD.txt
"; std::cout << "(CCYYMMDD means that todays date in that format is added)
"; //std::system(("cp /tmp/export-" + queue + ".txt /var/www/html/gnudialer/export-" + queue + ".txt").c_str()); } mysql_free_result(result); } if (usecloser) { std::cout << "
"; query = "SELECT * FROM `" + queue + "` WHERE "; //query += "(left(lastupdated,10) >= STR_TO_DATE(" + date1 + ", '%Y-%m-%d') "; //query += "AND left(lastupdated,10) <= STR_TO_DATE(" + date2 + ", '%Y-%m-%d')) "; query += "disposition = '12' AND closerdispo='0' "; if(mysql_query(mysql, query.c_str()) != 0) { std::cout << "
Error selecting non-verified sales from mysql!
" << std::endl; } else { result = mysql_use_result(mysql); for((counter = 0); (row = mysql_fetch_row(result)); counter++) { std::string theDisplayRecord = ""; theDisplayRecord += rfill(std::string(row[0]),6); theDisplayRecord += " "; theDisplayRecord += rfill(std::string(row[1]),10); theDisplayRecord += " "; theDisplayRecord += rfill(std::string(row[3]),30); theDisplayRecord += " "; theDisplayRecord += rfill(std::string(row[18]),3); theDisplayRecord += " "; theDisplayRecord += rfill(std::string(row[19]),3); theDisplayRecord += " "; theDisplayRecord += rfill(std::string(row[22]),3); theDisplayRecord += " "; theDisplayRecord += rfill(std::string(row[23]),10); std::cout << "
" << theDisplayRecord; if(mysql_errno(mysql)) { std::cout << "
Error fetching Sales from mysql!
" << std::endl; } writeEODNonSale("EOD Non-Verified Sale",queue,std::string(row[0])); } if (!counter) { std::cout << "
No Non-Verified Sales found!
" << std::endl; } else { std::cout << "
Printed " << counter << " non-verified records.
"; } mysql_free_result(result); std::cout << ""; } } } void doExportAllSales(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; printHead("Export All Campaign Sales "); std::cout << "

" << std::endl; printSubHead("Date Range"); std::cout << "

" << std::endl; printDateFields(1); std::cout << "

To

\n"; printDateFields(2); std::cout << "


" << std::endl; std::cout << "   Grouped


" << std::endl; std::cout << printSubmit("Export All Campaign Sales"); std::cout << "

"; } void doExportAllCampaignSales(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; std::string mon1 = TheFields.GetField("mon1"); std::string day1 = TheFields.GetField("day1"); std::string year1 = TheFields.GetField("year1"); std::string date1 = "'" + year1 + "-" + mon1 + "-" + day1 + "'"; std::string mon2 = TheFields.GetField("mon2"); std::string day2 = TheFields.GetField("day2"); std::string year2 = TheFields.GetField("year2"); std::string date2 = "'" + year2 + "-" + mon2 + "-" + day2 + "'"; std::string grouped = TheFields.GetField("grouped"); QueueList TheQueues; TheQueues.ParseQueues(); std::string tempCampaign; bool usecloser = false; MYSQL *mysql = NULL; MYSQL_RES *result; MYSQL_ROW row; unsigned int counter = 0, grouper = 0; std::string query = ""; mysql = mysql_init(NULL); if(mysql == NULL) { std::cerr << "MySql init failed!" << std::endl; } if(!mysql_real_connect(mysql, getMySqlHost().c_str(), \ getMySqlUser().c_str(), \ getMySqlPass().c_str(), \ getDbName().c_str(), \ 3306, NULL, 0)) \ { \ std::cerr << "MySql connection failed!" << std::endl; } std::string oldgrpname = "OLDBOGNAME"; for (int q = 0; q < TheQueues.size(); q++) { tempCampaign = TheQueues.at(q).GetName(); if ((stou(grouped) == "ALL" || stou(grouped) == "ON") && tempCampaign.substr(0,5) != oldgrpname.substr(0,5) && grouper != 0) { std::cout << "

Grouped " << grouper << " records to " << "/tmp/exports/" << oldgrpname << "-CCYYMMDD.txt

"; grouper = 0; } else if (stou(grouped) != "ALL" && stou(grouped) != "ON") { grouper = 0; } if (tempCampaign.find("CLOSER",0) != std::string::npos || tempCampaign.find("closer",0) != std::string::npos || tempCampaign.find("DNC",0) != std::string::npos || tempCampaign.find("dnc",0) != std::string::npos) { //do nothing } else { // uncomment to enable printing of non-verified sales //usecloser = TheQueue.GetSetting("usecloser").GetBool(); query = "SELECT * FROM `" + tempCampaign + "` WHERE "; query += "(left(lastupdated,10) >= STR_TO_DATE(" + date1 + ", '%Y-%m-%d') "; query += "AND left(lastupdated,10) <= STR_TO_DATE(" + date2 + ", '%Y-%m-%d')) "; if (usecloser) { query += "AND disposition='12' AND closerdispo='12' AND subdispo < 'H5'"; } else { query += "AND disposition='12'"; } if(mysql_query(mysql, query.c_str()) != 0) { std::cout << "
Error selecting sales from mysql!
" << std::endl; } else { result = mysql_use_result(mysql); std::string theDB = "15"; int isTap = 0; if (queue.find("TAP",0) != std::string::npos) { theDB = "95"; isTap = 1; } int isDay = 0; if (queue.find("DAY",0) != std::string::npos) { isDay = 1; } int special_export = 0; std::cout << "
";

				for((counter = 0); (row = mysql_fetch_row(result)); counter++)
				{

					if (counter == 0 && grouper == 0)
					{
						if ((stou(grouped) == "ALL" || stou(grouped) == "ON") && (tempCampaign.substr(0,5) != oldgrpname.substr(0,5)))
						{
							oldgrpname = tempCampaign.substr(0,5);
							createExportFile(oldgrpname);
							std::cout << "
Campaign Grouping: " << oldgrpname << "
" << std::endl; std::cout << "
Campaign: " << tempCampaign << "
" << std::endl; } else { createExportFile(tempCampaign); std::cout << "
Campaign: " << tempCampaign << "
" << std::endl; } } oldgrpname = tempCampaign.substr(0,5); std::string theDisplayRecord = ""; std::string theExportRecord = ""; if (special_export) { //on screen stuff theDisplayRecord = ""; theDisplayRecord += std::string(row[10]); theDisplayRecord += " "; theDisplayRecord += std::string(row[9]); theDisplayRecord += " "; theDisplayRecord += std::string(row[1]); theDisplayRecord += " "; theDisplayRecord += std::string(row[26]); theDisplayRecord += " "; theDisplayRecord += std::string(row[28]); theDisplayRecord += " "; theDisplayRecord += std::string(row[25]); std::cout << "
" << theDisplayRecord; //in file stuff theExportRecord = "\""; theExportRecord += std::string(row[10]); theExportRecord += "\",\""; theExportRecord += std::string(row[9]); theExportRecord += "\",\""; theExportRecord += std::string(row[1]); theExportRecord += "\",\""; theExportRecord += std::string(row[26]); theExportRecord += "\",\""; theExportRecord += std::string(row[28]); theExportRecord += "\",\""; theExportRecord += std::string(row[25]); theExportRecord += "\""; theExportRecord += char(192); //theExportRecord += char(15); } else { if (isDay) { theDisplayRecord = "DB: "; theDisplayRecord += rfill(theDB,3); theDisplayRecord += rfill(std::string(row[0]),6); theDisplayRecord += " "; theDisplayRecord += rfill(std::string(row[1]),10); theDisplayRecord += rfill(std::string(row[16]),3); theDisplayRecord += rfill(std::string(row[22]),3); std::cout << "
" << theDisplayRecord; theExportRecord += rfill(std::string(row[19]),3); theExportRecord += lfill(std::string(row[0]),5); theExportRecord += rfill(std::string(row[1]),10); theExportRecord += rfill(std::string(row[3]),40); theExportRecord += rfill(std::string(row[4]),40); theExportRecord += rfill(std::string(row[5]),20); theExportRecord += rfill(std::string(row[6]),2); theExportRecord += rfill(std::string(row[7]),10); theExportRecord += rfill(std::string(row[8]),25); if (lfill(std::string(row[22]),2) == "H1") { theExportRecord += rfill("40",5); } if (lfill(std::string(row[22]),2) == "H2") { theExportRecord += rfill("80",5); } if (lfill(std::string(row[22]),2) == "H3") { theExportRecord += rfill("120",5); } if (lfill(std::string(row[22]),2) == "H4") { theExportRecord += rfill("160",5); } if (lfill(std::string(row[22]),2) == "H5") { theExportRecord += rfill("200",5); } if (isTap) { theExportRecord += "T"; } else { theExportRecord += "C"; } theExportRecord += " "; theExportRecord += "M"; theExportRecord += rfill(std::string(row[21]),3); theExportRecord += char(192); } else { theDisplayRecord = "DB: "; theDisplayRecord += rfill(theDB,3); theDisplayRecord += rfill(std::string(row[0]),6); theDisplayRecord += " "; theDisplayRecord += rfill(std::string(row[1]),10); theDisplayRecord += rfill(std::string(row[16]),3); theDisplayRecord += rfill(std::string(row[22]),3); std::cout << "
" << theDisplayRecord; theExportRecord = "DB: "; theExportRecord += rfill(theDB,2); theExportRecord += " "; theExportRecord += rfill(std::string(row[0]),6); theExportRecord += " "; theExportRecord += rfill(std::string(row[21]),3); theExportRecord += rfill(std::string(row[19]),3); theExportRecord += lfill(std::string(row[22]),2); theExportRecord += " "; theExportRecord += rfill(std::string(row[1]),10); theExportRecord += rfill(std::string(row[3]),40); theExportRecord += rfill(std::string(row[4]),40); theExportRecord += rfill(std::string(row[5]),20); theExportRecord += rfill(std::string(row[6]),2); theExportRecord += rfill(std::string(row[7]),10); theExportRecord += rfill(std::string(row[23]),25); theExportRecord += rfill(std::string(row[2]),4); theExportRecord += char(192); } } if ((stou(grouped) == "ALL" || stou(grouped) == "ON")) { writeExportRecord(oldgrpname,theExportRecord); } else { writeExportRecord(tempCampaign,theExportRecord); } grouper++; } std::cout << "
"; if(mysql_errno(mysql)) { std::cout << "
Error fetching Sales from mysql!
" << std::endl; } if (!counter) { //uncomment to get a visual of campaigns not called that day //std::cout << "
Campaign: " << tempCampaign << " No Sales Exported!
" << std::endl; } else { std::cout << "
Exported " << counter << " records to " << "/tmp/exports/" << tempCampaign << "-CCYYMMDD.txt
"; //if ((stou(grouped) == "ALL" || stou(grouped) == "ON")) { //std::cout << "
Exported " << grouper << " records to " << "/tmp/exports/" << oldgrpname << "-CCYYMMDD.txt
"; //} std::cout << "(CCYYMMDD means that todays date in that format is added)
"; //std::system(("cp /tmp/export-" + queue + ".txt /var/www/html/gnudialer/export-" + queue + ".txt").c_str()); } mysql_free_result(result); } if (usecloser) { std::cout << "
"; query = "SELECT * FROM `" + tempCampaign + "` WHERE "; query += "disposition = '12' AND closerdispo='0' "; if(mysql_query(mysql, query.c_str()) != 0) { std::cout << "
Error selecting non-verified sales from mysql!
" << std::endl; } else { result = mysql_use_result(mysql); for((counter = 0); (row = mysql_fetch_row(result)); counter++) { std::string theDisplayRecord = ""; theDisplayRecord += rfill(std::string(row[0]),6); theDisplayRecord += " "; theDisplayRecord += rfill(std::string(row[1]),10); theDisplayRecord += " "; theDisplayRecord += rfill(std::string(row[3]),30); theDisplayRecord += " "; theDisplayRecord += rfill(std::string(row[18]),3); theDisplayRecord += " "; theDisplayRecord += rfill(std::string(row[19]),3); theDisplayRecord += " "; theDisplayRecord += rfill(std::string(row[22]),3); theDisplayRecord += " "; theDisplayRecord += rfill(std::string(row[23]),10); std::cout << "
" << theDisplayRecord; if(mysql_errno(mysql)) { std::cout << "
Error fetching Sales from mysql!
" << std::endl; } writeEODNonSale("EOD Non-Verified Sale",tempCampaign,std::string(row[0])); } if (!counter) { std::cout << "
No Non-Verified Sales found!
" << std::endl; } else { std::cout << "
Printed " << counter << " non-verified records.
"; } mysql_free_result(result); std::cout << "
"; } } } } } void doDNCExport(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; printHead("Build Export for: DNC Records"); std::cout << "

" << std::endl; std::cout << printSubmit("Export DNC"); std::cout << "

"; } void doExportDNC(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; MYSQL *mysql = NULL; MYSQL_RES *result; MYSQL_ROW row; mysql = mysql_init(NULL); if(mysql == NULL) { std::cerr << "MySql init failed!" << std::endl; } if(!mysql_real_connect(mysql, getMySqlHost().c_str(), \ getMySqlUser().c_str(), \ getMySqlPass().c_str(), \ getDbName().c_str(), \ 3306, NULL, 0)) \ { \ std::cerr << "MySql connection failed!" << std::endl; } std::string query = "SELECT * FROM `DNC` WHERE 1"; if(mysql_query(mysql, query.c_str()) != 0) { std::cout << "
Error selecting DNC records from mysql!
" << std::endl; } else { result = mysql_use_result(mysql); createExportFile("DNC"); std::cout << "
";

		std::string theExportRecord;
		unsigned int counter = 0;
		for((counter = 0); (row = mysql_fetch_row(result)); counter++)
		{
			//for(counter = 0; row = mysql_fetch_row(result); counter++) {
			char myrecord[50];
			std::string theCallistRecord;
			sprintf(myrecord, "%10s", row[1]);
			theExportRecord = std::string(myrecord);
			std::cout << "
" << theExportRecord; writeExportRecord("DNC",theExportRecord); } std::cout << "
"; if(mysql_errno(mysql)) { std::cout << "
Error fetching DNC records from mysql!
" << std::endl; } if (!counter) { std::cout << "
No DNC Records for Export!
" << std::endl; } else { std::cout << "
Exported " << counter << " records to " << "/tmp/exports/DNC-CCYYMMDD.txt
"; std::cout << "(CCYYMMDD means that todays date in that format is added)
"; } mysql_free_result(result); } } void doCallistBuild(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; printHead("Build Lists for: " + queue); std::cout << "

" << std::endl; std::cout << ""; std::cout << printSubmit("Build Callists"); std::cout << "

"; } void doBuildCallists(Post TheFields) { std::string queue = TheFields.GetField("queue"); std::cout << ""; MYSQL *mysql = NULL; MYSQL_RES *result; MYSQL_ROW row; mysql = mysql_init(NULL); if(mysql == NULL) { std::cerr << "MySql init failed!" << std::endl; } if(!mysql_real_connect(mysql, getMySqlHost().c_str(), \ getMySqlUser().c_str(), \ getMySqlPass().c_str(), \ getDbName().c_str(), \ 3306, NULL, 0)) \ { \ std::cerr << "MySql connection failed!" << std::endl; } std::string query = "SELECT * FROM `" + queue + "` WHERE "; query += "disposition >=-5 AND disposition <= 5 AND "; query += "attempts <= 6 LIMIT 10000"; if(mysql_query(mysql, query.c_str()) != 0) { std::cout << "
Error selecting sales from mysql!
" << std::endl; } else { result = mysql_use_result(mysql); createCallistFile(queue); std::cout << "
";

		unsigned int counter = 0;
		for((counter = 0); (row = mysql_fetch_row(result)); counter++)
		{
			//for(counter = 0; row = mysql_fetch_row(result); counter++) {
			char myrecord[50];
			std::string theCallistRecord;
			sprintf(myrecord, "%8s%10s%3s%3s%20s%2s", row[0],row[1],row[10],row[11],row[5],row[6]);
			theCallistRecord = std::string(myrecord);
			std::cout << "
" << theCallistRecord; writeCallistRecord(queue,theCallistRecord); } std::cout << "
"; if(mysql_errno(mysql)) { std::cout << "
Error fetching Sales from mysql!
" << std::endl; } if (!counter) { std::cout << "
No Records for Callist!
" << std::endl; } else { std::cout << "
Callist contains " << counter << " records.
"; } mysql_free_result(result); } } int main() { Post TheFields("text/html"); std::string mode = TheFields.GetField("mode"); std::cout << "Content-type: text/html\n" << std::endl; std::cout << "\n" << std::endl; std::cout << "\n" << std::endl; std::cout << " \ " << std::endl; std::cout << "\n"; if (mode == "Import Data") { std::cout << "\n"; } else { std::cout << "\n"; } std::cout << "\n"; std::cout << "
\n"; std::cout << "\n"; std::cout << "
\n"; std::cout << "
\n"; std::cout << "\n"; std::cout << "
\n"; TheFields.LogHiddenQueryString(); // Enter all the modes here so we can easily // deal with them in the "do" functions. if (dialerIsRunning()) { if (mode == "login") { doLogin(TheFields); mode = "Main Menu"; } else if (mode == "Edit Script") doEditScript(TheFields); else if (mode == "Save Script") doSaveScript(TheFields); else if (mode == "Export Sales") doExportSales(TheFields); else if (mode == "Export Records") doExportRecords(TheFields); else if (mode == "Export All Sales") doExportAllSales(TheFields); else if (mode == "Export All Campaign Sales") doExportAllCampaignSales(TheFields); else if (mode == "Manage Campaign") doManageCampaign(TheFields); else if (mode == "Show Campaign Settings") doShowCampaignSettings(TheFields); else if (mode == "Agents Times") doShowAgentTime(); else if (mode == "Show Stats") doShowStats(TheFields); else if (mode == "Show System Stats") doShowSysStats(TheFields); else if (mode == "Campaign Stats") doShowCampaignStats(TheFields); else if (mode == "System Stats") doShowSystemStats(TheFields); else if (mode == "All Campaign Stats") doShowAllCampaignStats(TheFields); else if (mode == "Agent Stats") doShowAgentStats(TheFields); else if (mode == "Logout") doLogout(); else if (mode == "Main Menu") showMenu(TheFields); else if (mode == "Edit Campaign Members") showEditQueueMembers(TheFields); else if (mode == "Remove Campaign") doRemoveQueue(TheFields); else if (mode == "Add") doAdd(TheFields); else if (mode == "Remove") doRemove(TheFields); else if (mode == "Create Campaign") doCreateQueue(TheFields); else if (mode == "Create Reload Campaign") doReloadQueue(TheFields); else if (mode == "Import Data") doImportData(TheFields); else if (mode == "Create Reload Data") doReloadData(TheFields); else if (mode == "Campaign Reload") doDataReload(TheFields); else if (mode == "Print Record") doPrintRecord(TheFields); else if (mode == "Print Now") doPrintNow(TheFields); else if (mode == "Backup Data") doBackupData(TheFields); else if (mode == "Restore Data") doRestoreData(TheFields); else if (mode == "Backup Now") doBackupNow(TheFields); else if (mode == "Restore Now") doRestoreNow(TheFields); else if (mode == "Export DNC") doExportDNC(TheFields); else if (mode == "DNC Export") doDNCExport(TheFields); else if (mode == "Collect DNC") doCollectAllDNC(TheFields); else if (mode == "Process DNC") doProcessAllDNC(TheFields); else if (mode == "Callist Build") doCallistBuild(TheFields); else if (mode == "Add DNC") doAddDNC(TheFields); else if (mode == "Finish Adding DNC") doFinishAddingDNC(TheFields); else if (mode == "Build Callists") doBuildCallists(TheFields); else if (mode == "Finish Creating Campaign") doFinishCreatingQueue(TheFields); else if (mode == "Finish Creating Reload Campaign") doFinishCreatingReloadQueue(TheFields); else if (mode == "Edit Campaign") doEditQueue(TheFields); else if (mode == "Edit Globals") doEditGlobals(TheFields); else if (mode == "Start Campaign") doStartQueue(TheFields); else if (mode == "Stop Campaign") doStopQueue(TheFields); else if (mode == "Start") doStartQueue(TheFields); else if (mode == "Stop") doStopQueue(TheFields); // else if (mode == "Start") doStartQ(TheFields); // else if (mode == "Stop") doStopQ(TheFields); else if (mode == "Create Agent") doCreateAgent(); else if (mode == "Alt Agent") doCreateAltAgent(); else if (mode == "Day Agent") doCreateDayAgent(); else if (mode == "Create Closer") doCreateCloser(); else if (mode == "Finish Creating Agent") doFinishCreatingAgent(TheFields); else if (mode == "Finish Creating Alt Agent") doFinishCreatingAltAgent(TheFields); else if (mode == "Finish Creating Day Agent") doFinishCreatingDayAgent(TheFields); else if (mode == "Finish Creating Closer") doFinishCreatingCloser(TheFields); else if (mode == "Delete Agent/Closer") doDeleteAgent(TheFields); else if (mode == "Edit Agent Info") doEditAgentInfo(TheFields); else if (mode == "Finish Editing Agent") doFinishEditingAgent(TheFields); else if (mode == "Save Campaign Settings") doFinishEditingCampaignSettings(TheFields); else if (mode == "Save Global Settings") doFinishEditingGlobals(TheFields); else if (mode == "Add Filter") doAddFilter(TheFields); else if (mode == "Del Filter") doDelFilter(TheFields); else if (mode == "Edit Filters") doEditFilters(TheFields); else if (mode == "Edit Channel Vars") doEditChannelVars(TheFields); else if (mode == "Save Channel Vars") doFinishEditingChannelVars(TheFields); else if (mode == "Add Chanvar") doAddChanvar(TheFields); else if (mode == "Del Chanvar") doDelChanvar(TheFields); else if (mode == "Database Counts") doShowDBCounts(TheFields); else if (mode == "All DB Counts") doShowAllDBCounts(TheFields); else if (mode == "All Filter Counts") doShowAllFilterCounts(TheFields); else if (mode == "Filter Cnts") doShowFilterCounts(TheFields); else if (mode == "DB Counts Today") doShowAllDBCountsForToday(TheFields); else if (mode == "DB Today") doShowDBCountsForToday(TheFields); else if (mode == "DB Counts Yesterday") doShowAllDBCountsForYesterday(TheFields); else if (mode == "DBCOUNTSFOR") doShowDBCountsFor(TheFields); else if (mode == "Select Counts") doSelectCounts(TheFields); else if (mode == "Save Filter Settings") doFinishEditingFilterSettings(TheFields); else if (mode.empty()) std::cout << "Invalid Login.

\n"; else std::cout << "Sorry! This option is not yet available.

" << mode << "

"; if (!loginError) { if (mode != "Logout") { std::cout << "
"; if (mode == "Main Menu") { std::cout << printSubmit("Edit Globals"); std::cout << printSubmit("DNC Export"); std::cout << printSubmit("All Campaign Stats"); std::cout << "
"; std::cout << printSubmit("All Filter Counts"); std::cout << printSubmit("All DB Counts"); std::cout << printSubmit("DB Counts Today"); std::cout << "   "; if (exportallbtn || collectdncbtn || processdncbtn) { std::cout << "
"; } if (exportallbtn) { std::cout << printSubmit("Export All Sales"); } if (collectdncbtn) { std::cout << printSubmitConfirm("Collect DNC"); } if (processdncbtn) { std::cout << printSubmitConfirm("Process DNC"); } if (adddncbtn) { std::cout << printSubmitConfirm("Add DNC"); } std::cout << "

"; } if (mode != "Main Menu") { if (!mode.empty()) { std::cout << printSubmit("Main Menu"); std::cout << "   "; } } if (!mode.empty()) { std::cout << printSubmit("Logout"); std::cout << "   "; if (mode == "Main Menu") { std::cout << "Help "; std::string theVersion = "Puff SVN r176"; std::cout << printAlert("[?]","Anytime you see this next to a Feature, \\njust click on it for general help information.\\n\\nIf you require install or custom programming\\n assistance, please goto any of the following\\n\\nhttp://gnudialer.org\\nhttp://dynx.net/gnudialer\\nhttp://dynx.net \\n\\nfor contact information and hourly rates.\\n(or if you just feel like making a donation)\\n\\nOtherwise, please visit the user forum at\\n\\n http://dynx.net/gnudialer \\nor, #gnudialer on irc.freenode.net\\n\\nfor free assistance. (as time permits)\\n\\n\\nCopyright (c) 2003-2008, GnuDialer Project\\n\\nHeath Schultz - heath1444(at)yahoo.com \\nJamerson Medley - nixtux2003(at)yahoo.com\\nRichard Lyman - richard(at)dynx.net\\n\\nThis program is free software, distributed under\\nthe terms ofthe GNU General Public License.\\n\\nVersion: " + theVersion + "\\n"); std::cout << "      (Version: " << theVersion << ")"; } } } } std::cout << ""; } else { std::cout << "

GnuDialer not running!"; } std::cout << "
\n"; std::cout << "
\n"; TheFields.PrintHiddenQueryString(); std::cout << "
\n" << std::endl; return 0; }