├── LICENSE ├── README.md ├── goAPI.php ├── goAdminLogs ├── goAPI.php ├── goGetAdminLogsList.php ├── goLogActions.php └── includes │ └── XMLParser.php ├── goAgent ├── goAPI.php ├── goAgentLog.php ├── goAgentStats.php ├── goAutodialResumePause.php ├── goCallbackResched.php ├── goCallbackSkip.php ├── goCheckConference.php ├── goCheckIfLoggedIn.php ├── goClearAPIField.php ├── goGetAgentSalesCount.php ├── goGetAgentsLoggedIn.php ├── goGetAllowedCampaigns.php ├── goGetCallLogs.php ├── goGetCallbackCount.php ├── goGetCallsInQueue.php ├── goGetContactList.php ├── goGetCustomerInfo.php ├── goGetInboundGroups.php ├── goGetLabels.php ├── goGetLoginInfo.php ├── goGetScriptContents.php ├── goHangupCall.php ├── goLoginUser.php ├── goLogoutUser.php ├── goManualDialLogCall.php ├── goManualDialLookCall.php ├── goManualDialNext.php ├── goManualDialOnly.php ├── goManualDialSkip.php ├── goMonitorCall.php ├── goOriginate.php ├── goPauseCodeSubmit.php ├── goReLoginUser.php ├── goUpdateCustomer.php ├── goUpdateDispo.php ├── goUpdateFields.php ├── goUpdateLead.php ├── goVDADCheckIncoming.php ├── goVolumeControl.php ├── goXFERSendRedirect.php ├── includes │ ├── MySQLiDB.php │ ├── XMLParser.php │ ├── bp.pl │ ├── check_exten.pl │ └── index.php └── index.php ├── goAreacodes ├── goAPI.php ├── goAddAreacode.php ├── goDeleteAreacode.php ├── goEditAreacode.php ├── goGetAllAreacodes.php └── goGetAreacodeInfo.php ├── goBarging ├── goAPI.php ├── goBarge.php ├── goGetAgentsOnCall.php ├── goMonitorAgent.php ├── includes │ ├── MySQLiDB.php │ ├── XMLParser.php │ ├── bp.pl │ ├── check_exten.pl │ └── index.php └── index.php ├── goCallRecordings ├── goAPI.php ├── goGetCallRecordingInfo.php └── goGetCallRecordingList.php ├── goCalltimes ├── goAPI.php ├── goAddCalltime.php ├── goCheckCalltimes.php ├── goDeleteCalltime.php ├── goEditCalltime.php ├── goGetAllCalltimes.php └── goGetCalltimeInfo.php ├── goCampaigns ├── getAllAudioFiles.php ├── goAPI.php ├── goAddCampaign.php ├── goCheckCampaign.php ├── goDeleteCampaign.php ├── goEditCampaign.php ├── goGetAllCampaigns.php ├── goGetCampaignDispositions.php ├── goGetCampaignInfo.php ├── goGetCampaignLeadRecycling.php ├── goGetDIDSettings.php ├── goGetSuggestedDIDs.php ├── goUpdateCampaignDialStatus.php └── goUpdateCampaignGoogleSheet.php ├── goCarriers ├── goAPI.php ├── goAddCarrier.php ├── goCheckCarriers.php ├── goDeleteCarrier.php ├── goEditCarrier.php ├── goGetAllCarriers.php └── goGetCarrierInfo.php ├── goChat ├── goAPI.php ├── goAjaxManagerChat.php ├── goChatHistory.php ├── goChatSave.php └── includes │ └── XMLParser.php ├── goCountryCode ├── getAllCountryCodes.php └── goAPI.php ├── goCustomFields ├── goAPI.php ├── goAddCustomFields.php ├── goCopyCustomFields.php ├── goDeleteAllCustomFields.php ├── goDeleteCustomField.php ├── goGetAllCustomFields.php └── goModifyCustomField.php ├── goDBasterisk.php ├── goDBgoautodial.php ├── goDBkamailio.php ├── goDBosticket.php ├── goDashboard ├── goAPI.php ├── goEmergencyLogout.php ├── goGetActiveCampaignsToday.php ├── goGetAgentsPerformanceForMD.php ├── goGetAllSales.php ├── goGetCallsPerHour.php ├── goGetCampaignsResources.php ├── goGetClusterStatus.php ├── goGetDashboardCounters.php ├── goGetDroppedPercentage.php ├── goGetIncomingQueue.php ├── goGetLeadsinHopper.php ├── goGetLiveInbound.php ├── goGetLiveOutbound.php ├── goGetMainTableData.php ├── goGetOfflineActiveAgents.php ├── goGetOnlineAgents.php ├── goGetOpenTickets.php ├── goGetOverdueTickets.php ├── goGetRealtimeAgentsMonitoring.php ├── goGetRealtimeCallsMonitoring.php ├── goGetRealtimeInboundMonitoring.php ├── goGetRingingCalls.php ├── goGetSLAPercentage.php ├── goGetSalesAgent.php ├── goGetSalesPerHour.php ├── goGetTicketsPerHour.php ├── goGetTotalActiveAgents.php ├── goGetTotalActiveLeads.php ├── goGetTotalAgentsCall.php ├── goGetTotalAgentsOnline.php ├── goGetTotalAgentsPaused.php ├── goGetTotalAgentsWaitCalls.php ├── goGetTotalAnsweredCalls.php ├── goGetTotalCalls.php ├── goGetTotalCallsAgent.php ├── goGetTotalDialableLeads.php ├── goGetTotalDroppedCalls.php ├── goGetTotalNumberOfAgents.php ├── goGetTotalSales.php └── goGetURLResources.php ├── goDialStatus ├── goAPI.php ├── goGetAllCampaignDialStatuses.php └── goGetAllDialStatuses.php ├── goDispositions ├── goAPI.php ├── goAddDisposition.php ├── goDeleteDisposition.php ├── goEditDisposition.php ├── goGetAllCampaignDispositions.php ├── goGetAllDispositions.php └── goGetDispositionInfo.php ├── goFilters ├── goAPI.php ├── goAddFilter.php ├── goDeleteFilter.php ├── goEditFilter.php ├── goGetAllFilters.php └── goGetFilterInfo.php ├── goFunctions.php ├── goGetLeads ├── goAPI.php ├── goDeleteLead.php ├── goEditLeads.php ├── goGetLeads.php └── goGetLeadsInfo.php ├── goHotkeys ├── goAPI.php ├── goAddHotkey.php ├── goDeleteHotkey.php ├── goEditHotkey.php └── goGetAllHotkeys.php ├── goInbound ├── goAPI.php ├── goAddDID.php ├── goAddIVR.php ├── goAddIngroup.php ├── goCheckDID.php ├── goCheckIVR.php ├── goCheckIngroup.php ├── goDeleteDID.php ├── goDeleteIVR.php ├── goDeleteInbound.php ├── goDeleteIngroup.php ├── goEditAgentRank.php ├── goEditDID.php ├── goEditIVR.php ├── goEditIngroup.php ├── goGetAllAgentRank.php ├── goGetAllDID.php ├── goGetAllIVR.php ├── goGetAllIngroup.php ├── goGetCampaignDID.php ├── goGetDIDInfo.php ├── goGetIVRInfo.php ├── goGetIVROptions.php ├── goGetIngroupInfo.php └── index.php ├── goLeadFilters ├── goAPI.php ├── goAddLeadFilter.php ├── goDeleteLeadFilter.php ├── goEditLeadFilter.php ├── goGetAllLeadFilters.php └── goGetLeadFilterInfo.php ├── goLeadRecycling ├── goAPI.php ├── goAddLeadRecycling.php ├── goAddPauseCode.php ├── goDeleteLeadRecycling.php ├── goEdit.php ├── goEditLeadRec.php ├── goEditLeadRecycling.php ├── goEditPauseCode.php ├── goGetAllLeadRecycling.php └── goGetLeadRecycleInfo.php ├── goLists ├── goAPI.php ├── goActionDNC.php ├── goAddDeleteDNC.php ├── goAddList.php ├── goDeleteList.php ├── goEditList.php ├── goGetAllDNC.php ├── goGetAllLeadsOnHopper.php ├── goGetAllLists.php ├── goGetAllListsCampaign.php ├── goGetListInfo.php ├── goGetStatusesWithCountCalledNCalled.php ├── goGetTZonesWithCountCalledNCalled.php ├── goListExport.php └── goListExportCountRows.php ├── goLoadLeads ├── goAPI.php ├── goAddLeads.php ├── goAddList.php ├── goDeleteList.php ├── goEditList.php ├── goGetAllLists.php └── goGetListInfo.php ├── goLocations ├── goAPI.php ├── goAddLocation.php ├── goAssignAgents.php ├── goDeleteLocation.php ├── goEditLocation.php ├── goGetAssignedAgents.php ├── goGetLocationInfo.php ├── goGetLocationsList.php ├── goGetUnassignedAgents.php └── goUnassignAgents.php ├── goMultiTenant ├── goAPI.php ├── goAddMultiTenant.php ├── goDeleteMultiTenant.php ├── goEditMultiTenant.php ├── goGetMultiTenantInfo.php └── goGetMultiTenantList.php ├── goMusicOnHold ├── goAPI.php ├── goAddMOH.php ├── goCheckMOH.php ├── goDeleteMOH.php ├── goEditMOH.php ├── goGetAllMusicOnHold.php └── goGetMOHInfo.php ├── goOSTicket ├── goAPI.php ├── goDeleteTicket.php ├── goEditTicket.php ├── goGetAnsweredTicketLists.php ├── goGetCannedResponseLists.php ├── goGetClosedTicketLists.php ├── goGetHelpdeskAgentAccess.php ├── goGetHelpdeskAgentInfo.php ├── goGetHelpdeskAgentLists.php ├── goGetHelpdeskDepartmentInfo.php ├── goGetHelpdeskTeamLists.php ├── goGetMyTicketLists.php ├── goGetOpenedTicketLists.php ├── goGetOverdueTicketLists.php ├── goGetTicketInformation.php ├── goOpenTicket.php └── goPostReplyTicket.php ├── goPackages ├── goAPI.php └── goGetPackage.php ├── goPauseCodes ├── goAPI.php ├── goAddPauseCode.php ├── goDeletePauseCode.php ├── goEditPauseCode.php ├── goGetAllPauseCodes.php └── goGetPauseCodeInfo.php ├── goPhones ├── goAPI.php ├── goAddPhones.php ├── goCheckPhoneLogin.php ├── goDeletePhone.php ├── goEditPhone.php ├── goGetAllPhones.php └── goGetPhoneInfo.php ├── goReports ├── goAPI.php ├── goExportAgentDetails.php ├── goExportCallReport.php ├── goExportCountRows.php ├── goGetAgentPerformanceDetails.php ├── goGetAgentTimeDetails.php ├── goGetCallDetail.php ├── goGetDispoStats.php ├── goGetInboundReport.php ├── goGetPerformanceDetails.php ├── goGetReports.php ├── goGetSalesAgent.php ├── goGetSalesTracker.php ├── goGetStatisticalReports.php ├── goGetTimeReports.php └── goReportsFunctions.php ├── goSMS ├── goAPI.php ├── goReceiveSMS.php └── goSendSMS.php ├── goSMTP ├── goAPI.php ├── goAddSMTPSettings.php ├── goDeleteSMTP.php ├── goEditSMTP.php ├── goGetSMTPActivation.php ├── goGetSMTPSettings.php └── goSMTPActivation.php ├── goScripts ├── goAPI.php ├── goAddScript.php ├── goDeleteScript.php ├── goEditScript.php ├── goGetAllScripts.php ├── goGetScriptInfo.php ├── goGetStandardFields.php └── goGetSubscripts.php ├── goServers ├── goAPI.php ├── goAddServers.php ├── goDeleteServers.php ├── goEditServers.php ├── goGetAllServers.php └── goGetServerInfo.php ├── goSettings ├── goAPI.php ├── goActionSettings.php ├── goCheckPhones.php └── goCheckWebrtc.php ├── goStateCallTimes ├── goAPI.php ├── goAddStateCallTimes.php ├── goDeleteStateCallTimes.php ├── goEditStateCallTimes.php ├── goGetAllStateCallTimes.php └── goGetStateCallTimeInfo.php ├── goSystemSettings ├── goAPI.php ├── goEditSystemSetting.php ├── goGetSystemSettingInfo.php └── index.php ├── goUploadLeads ├── goAPI.php ├── goFunctions.php ├── goGetLeadsOfList.php ├── goLookupGMT.php ├── goReadUpload.php ├── goUploadMe.php └── goUploadMeJSON.php ├── goUserGroups ├── goAPI.php ├── goAddUserGroup.php ├── goCheckUserGroups.php ├── goDeleteUserGroup.php ├── goEditUserGroup.php ├── goGetAllUserGroups.php └── goGetUserGroupInfo.php ├── goUsers ├── goAPI.php ├── goAddUser.php ├── goCheckUser.php ├── goDeleteUser.php ├── goEditUser.php ├── goGetAgentLog.php ├── goGetAllUsers.php ├── goGetUserInfo.php └── goUserLogin.php ├── goViewScripts ├── goAPI.php └── goViewAgentScript.php ├── goVoiceFiles ├── goAPI.php ├── goAddVoiceFiles.php ├── goGetAllVoiceFiles.php └── goGetVoiceFileInfo.php ├── goVoicemails ├── goAPI.php ├── goAddVoicemail.php ├── goCheckVoicemail.php ├── goDeleteVoicemail.php ├── goEditVoicemail.php ├── goGetAllVoicemails.php ├── goGetVoicemailInfo.php └── index.php ├── includes ├── MySQLiDB.php └── XMLParser.php └── licensed-conf.php /README.md: -------------------------------------------------------------------------------- 1 | # goAPI 2 | 3 |

The GOautodial APIs allow you to perform operations and actions within GOautodial from external applications. This allows GOautodial to integrate seamlessly with third party software and custom code.

4 |

Access to the APIs are via HTTPS and authentication is done via username and password.

5 |

To install (need to have a working GOautodial v4):

6 |
 7 | cd /var/www/html
 8 | git clone https://github.com/goautodial/goAPIv2
 9 | 
10 |

Documentation (incomplete): https://drive.google.com/drive/folders/1ERrp_QdSVBsIpPKzoeU2hNQikCYSKJH0?usp=sharing.


11 |

Sample PHP code to create campaign: 12 | 13 | $postfields = array( 14 | 'goUser' => $goUser, 15 | 'goPass' => $goPass, 16 | 'goAction' => ‘goAddCampaign’, 17 | 'session_user' => $session_user, 18 | 'responsetype' => 'json', 19 | ‘campaign_id’ => ‘12231977’, 20 | ‘campaign_name’ => ‘Testcampaign’, 21 | ‘campaign_type’ => ‘outbound’, 22 | ‘dial_prefix’ => ‘CUSTOM’, 23 | ‘custom_prefix’ => ‘9’, 24 | ‘dial_method’ => ‘MANUAL’, 25 | ‘auto_dial_level’ => ‘OFF’, 26 | ‘campaign_recording’ => ‘NEVER’, 27 | ‘answering_machine_detection’ => ‘8369’, 28 | ‘session_user’ => ‘$session_user’, 29 | ‘user_group’ => ‘ADMIN’ 30 | ‘active’ => ‘Y’ 31 | ); 32 | 33 | $ch = curl_init(); 34 | curl_setopt($ch, CURLOPT_URL, $url); 35 | curl_setopt($ch, CURLOPT_POST, 1); 36 | curl_setopt($ch, CURLOPT_TIMEOUT, 30); 37 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 38 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); 39 | curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); 40 | curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postfields)); 41 | $data = curl_exec($ch); 42 | curl_close($ch); 43 | 44 |

45 |

Sample return: 46 | 47 | Success 48 | HTTP 200: 49 | {result: "success"} 50 | 51 | Failure 52 | HTTP 400: 53 | { 54 | "code" : "40001" 55 | "result" : "Error: Missing required parameters" 56 | } 57 |

58 |

Curl utility:

59 |
60 | curl 'https://DOMAINNAME/goAPIv2/goCampaigns/goAPI.php?goAction=goAddCampaign&goUser=goAPIuser&goPass=ENCRYPTED_PASSWORD&responsetype=json&campaign_id=12231977&campaign_name=CAMPAIGN_NAME&campaign_type=outbound&dial_prefix=CUSTOM&custom_prefix=9&dial_method=MANUAL&auto_dial_level=OFF&campaign_recording=NEVER&answering_machine_detection=8369&session_user=admin&user_group=ADMIN'
61 | 
62 | 63 | The encrypted password can be derived from the pass_hash column in the vicidial_users table under the asterisk database. Or use /var/www/html/bin/pass_hasher.php to generate the encrypted password. 64 | 65 | ## OpenAPI Spec 66 | 67 | There is also a work-in-progress openapi spec composed by @God-Zalo which can be used for 68 | code-generating 69 | [client sdks in different languages](https://github.com/OpenAPITools/openapi-generator): 70 | 71 | - https://app.swaggerhub.com/apis/godzalo/goautodial-users/0.1.3 72 | -------------------------------------------------------------------------------- /goAdminLogs/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goAdminLogs/goGetAdminLogsList.php: -------------------------------------------------------------------------------- 1 | License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | 24 | include_once ("goAPI.php"); 25 | 26 | $log_user = $session_user; 27 | $log_group = go_get_groupid($session_user, $astDB); 28 | 29 | if (isset($_REQUEST['limit'])) { 30 | $limit = $astDB->escape($_REQUEST['limit']); 31 | } else { $limit = 100; } 32 | 33 | if(!isset($session_user) || is_null($session_user)){ 34 | $apiresults = array("result" => "Error: Missing Required Parameters."); 35 | }elseif(is_null($log_group)) { 36 | $apiresults = array("result" => "Error: Set a value for User Group."); 37 | } else { 38 | if (!checkIfTenant($log_group, $goDB)) { 39 | if($log_group !== "ADMIN") 40 | $goDB->where("user_group", $log_group); 41 | } else { 42 | $goDB->where('user_group', $log_group); 43 | } 44 | } 45 | 46 | 47 | $cols = array("user", "ip_address", "event_date", "action", "details", "db_query"); 48 | $goDB->orderBy("event_date", "desc"); 49 | $adminLogs = $goDB->get("go_action_logs", $limit, $cols); 50 | 51 | if (!empty($adminLogs)) { 52 | $apiresults = array("result" => "success", "data" => $adminLogs); 53 | } else { 54 | $apiresults = array("result" => "Error: Empty"); 55 | } 56 | 57 | ?> 58 | -------------------------------------------------------------------------------- /goAgent/goClearAPIField.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * @par License: 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Affero General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Affero General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Affero General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | $is_logged_in = check_agent_login($astDB, $goUser); 24 | 25 | $agent = get_settings('user', $astDB, $goUser); 26 | 27 | if (isset($_GET['goServerIP'])) { $server_ip = $astDB->escape($_GET['goServerIP']); } 28 | else if (isset($_POST['goServerIP'])) { $server_ip = $astDB->escape($_POST['goServerIP']); } 29 | if (isset($_GET['goSessionName'])) { $session_name = $astDB->escape($_GET['goSessionName']); } 30 | else if (isset($_POST['goSessionName'])) { $session_name = $astDB->escape($_POST['goSessionName']); } 31 | if (isset($_GET['goComments'])) { $comments = $astDB->escape($_GET['goComments']); } 32 | else if (isset($_POST['goComments'])) { $comments = $astDB->escape($_POST['goComments']); } 33 | 34 | $user = $agent->user; 35 | 36 | if ($is_logged_in) { 37 | //$stmt="UPDATE vicidial_live_agents SET $comments='' where user='$user';"; 38 | $astDB->where('user', $user); 39 | $rslt = $astDB->update('vicidial_live_agents', array( "$comments" => '' )); 40 | 41 | //echo "DONE: $comments"; 42 | $APIResult = array( "result" => "success", "message" => "DONE: $comments" ); 43 | } else { 44 | $APIResult = array( "result" => "error", "message" => "Agent '$goUser' is currently NOT logged in" ); 45 | } 46 | ?> -------------------------------------------------------------------------------- /goAgent/goGetAgentSalesCount.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * @par License: 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Affero General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Affero General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Affero General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | if (isset($_GET['filter_date'])) { $filter_date = $astDB->escape($_GET['filter_date']); } 24 | else if (isset($_POST['filter_date'])) { $filter_date = $astDB->escape($_POST['filter_date']); } 25 | 26 | $filter_date = (empty($filter_date) ? $NOW_DATE : $filter_date); 27 | 28 | if ($goDB->has('go_sales_count')) { 29 | $closer_campaigns = go_getall_closer_campaigns($campaign, $astDB); 30 | $filter_campaigns = explode("','",trim($closer_campaigns, "'")); 31 | array_push($filter_campaigns, $campaign); 32 | 33 | $goDB->where('user', $goUser); 34 | //$goDB->where('campaign_id', $filter_campaigns, 'IN'); 35 | $goDB->where('entry_date', $filter_date); 36 | $goDB->groupBy('user'); 37 | $result = $goDB->getOne('go_sales_count', 'SUM(sales) AS sales, SUM(amount) AS amount'); 38 | $s_cnt = $goDB->getRowCount(); 39 | 40 | if ($s_cnt > 0) { 41 | $APIResult = array( 42 | "result" => "success", 43 | "data" => $result 44 | ); 45 | } else { 46 | $APIResult = array( 47 | "result" => "error", 48 | "message" => "No result for user $goUser." 49 | ); 50 | } 51 | } else { 52 | $APIResult = array( 53 | "result" => "error", 54 | "message" => "Table `go_sales_count` DOES NOT exist on the database." 55 | ); 56 | } -------------------------------------------------------------------------------- /goAgent/goGetCallLogs.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * @par License: 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Affero General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Affero General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Affero General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | if (isset($_GET['goLimit'])) { $limit = $astDB->escape($_GET['goLimit']); } 24 | else if (isset($_POST['goLimit'])) { $limit = $astDB->escape($_POST['goLimit']); } 25 | if (isset($_GET['goDate'])) { $date = $astDB->escape($_GET['goDate']); } 26 | else if (isset($_POST['goDate'])) { $date = $astDB->escape($_POST['goDate']); } 27 | 28 | if (!isset($limit) || strlen($limit) < 1 || !is_numeric($limit)) { 29 | $limit = 5; 30 | } 31 | if (!isset($date) || (isset($date) && strlen($date) !== 10)) { 32 | $date = date("Y-m-d"); 33 | } 34 | 35 | $statuses = array(); 36 | $rslt = $astDB->get('vicidial_statuses', null, 'status,status_name'); 37 | foreach ($rslt as $row) { 38 | $status = $row['status']; 39 | $statuses[$status] = $row['status_name']; 40 | } 41 | 42 | $astDB->where('campaign_id', $campaign); 43 | $rslt = $astDB->get('vicidial_campaign_statuses', null, 'status,status_name'); 44 | foreach ($rslt as $row) { 45 | $status = $row['status']; 46 | $statuses[$status] = $row['status_name']; 47 | } 48 | 49 | $astDB->where('campaign_id', $campaign); 50 | $astDB->where('user', $goUser); 51 | $astDB->where('event_time', array("$date 00:00:00", "$date 23:59:59"), 'between'); 52 | $astDB->where('talk_sec', '0', '>'); 53 | $astDB->orderBy('event_time', 'desc'); 54 | $rslt = $astDB->get('vicidial_agent_log', $limit, 'event_time AS time,lead_id,status'); 55 | 56 | $return = array(); 57 | foreach ($rslt as $row) { 58 | $astDB->where('lead_id', $row['lead_id']); 59 | $rslt2 = $astDB->getOne('vicidial_list', 'first_name,last_name'); 60 | $full_name = trim($rslt2['first_name']." ".$rslt2['last_name']); 61 | 62 | $status = $row['status']; 63 | $row['name'] = $full_name; 64 | $row['status'] = $statuses[$status]; 65 | unset($row['lead_id']); 66 | $return[] = $row; 67 | } 68 | 69 | $APIResult = array( "result" => "success", "data" => $return ); 70 | ?> -------------------------------------------------------------------------------- /goAgent/goGetInboundGroups.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * @par License: 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Affero General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Affero General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Affero General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | $astDB->where('campaign_id', $campaign); 24 | $query = $astDB->getOne('vicidial_campaigns', 'campaign_allow_inbound,closer_campaigns'); 25 | 26 | if ($query['campaign_allow_inbound'] == 'Y') { 27 | $inb_groups = explode(" ", $query['closer_campaigns']); 28 | foreach ($inb_groups as $inb) { 29 | if ($inb != "" && $inb != '-') { 30 | $astDB->where('group_id', $inb); 31 | $inbQ = $astDB->getOne('vicidial_inbound_groups', 'group_name'); 32 | if ($astDB->getRowCount() > 0) { 33 | $inbound_groups[$inb] = $inbQ['group_name']; 34 | } 35 | } 36 | } 37 | } 38 | 39 | if (count($inbound_groups)) { 40 | ksort($inbound_groups); 41 | $APIResult = array( "result" => "success", "data" => array("inbound_groups" => $inbound_groups) ); 42 | } else { 43 | $APIResult = array( "result" => "error", "message" => "No inbound groups assigned" ); 44 | } 45 | ?> -------------------------------------------------------------------------------- /goAgent/goGetLabels.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * @par License: 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Affero General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Affero General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Affero General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | if (isset($_GET['goLabelID'])) { $label_id = $astDB->escape($_GET['goLabelID']); } 24 | else if (isset($_POST['goLabelID'])) { $label_id = $astDB->escape($_POST['goLabelID']); } 25 | if (isset($_GET['goTableName'])) { $table_name = $astDB->escape($_GET['goTableName']); } 26 | else if (isset($_POST['goTableName'])) { $table_name = $astDB->escape($_POST['goTableName']); } 27 | 28 | 29 | if (!preg_match("/system_settings|vicidial_screen_labels/", $table_name)) { 30 | $APIResult = array( "result" => "error", "message" => "Getting label info from '{$table_name}' NOT allowed." ); 31 | } else { 32 | $astDB->where('campaign_id', $campaign); 33 | $rslt = $astDB->getOne('vicidial_campaigns', 'disable_alter_custphone'); 34 | $disable_alter_custphone = $rslt['disable_alter_custphone']; 35 | 36 | if ($table_name == 'vicidial_screen_labels') { 37 | $astDB->where('label_id', $label_id); 38 | $astDB->where('active', 'Y'); 39 | } 40 | 41 | $rslt = $astDB->getOne($table_name, 'label_title,label_first_name,label_middle_initial,label_last_name,label_address1,label_address2,label_address3,label_city,label_state,label_province,label_postal_code,label_vendor_lead_code,label_gender,label_phone_number,label_phone_code,label_alt_phone,label_security_phrase,label_email,label_comments'); 42 | 43 | $APIResult = array( "result" => "success", "data" => array( "disable_alter_custphone" => $disable_alter_custphone, "labels" => $rslt ) ); 44 | } 45 | ?> -------------------------------------------------------------------------------- /goAgent/includes/MySQLiDB.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goautodial/goAPIv2/4dff4ef89d40557b0cabfbd63811540a8e8a932b/goAgent/includes/MySQLiDB.php -------------------------------------------------------------------------------- /goAgent/includes/check_exten.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | use IO::Socket; 3 | 4 | $cmd_req = $ARGV[0]; 5 | 6 | # flush after every write 7 | #$| = 1; 8 | eval 9 | { 10 | local $SIG{ALRM} = sub { die 'Timed Out'; }; 11 | alarm 3; 12 | # creating object interface of IO::Socket::INET modules which internally creates 13 | # socket, binds and connects to the TCP server running on the specific port. 14 | my $socket = IO::Socket::INET->new( 15 | PF_INET, 16 | SOCK_STREAM, 17 | PeerHost => '127.0.0.1', 18 | PeerPort => '707', 19 | Timeout => '3600', 20 | Proto => 'tcp', 21 | ) or die "ERROR in Socket Creation : $!\n"; 22 | 23 | print "TCP Connection Success.\n"; 24 | 25 | $socket->autoflush(1); 26 | 27 | # write on the socket to server. 28 | #print $socket "$cmd_req\n"; 29 | # we can also send the data through IO::Socket::INET module, 30 | my $sendVal = $socket->send($cmd_req); 31 | print "Send to Server : $sendVal\n"; 32 | 33 | # read the socket data sent by server. 34 | #$data = <$socket>; 35 | # we can also read from socket through recv() in IO::Socket::INET 36 | my $retVal = $socket->recv($data, 10240); 37 | print "Received from Server : $data\n"; 38 | 39 | #sleep (10); 40 | close($socket); 41 | undef $/; $data = <$socket>; $/ = "\n"; 42 | alarm 0; 43 | }; 44 | alarm 0; # race condition protection -------------------------------------------------------------------------------- /goAgent/includes/index.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goautodial/goAPIv2/4dff4ef89d40557b0cabfbd63811540a8e8a932b/goAgent/includes/index.php -------------------------------------------------------------------------------- /goAgent/index.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * @par License: 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Affero General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Affero General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Affero General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | if ($_GET['dev'] == 'test') { 24 | //$lead_id = "12313"; 25 | //$lead_id = preg_replace("/[^0-9]/","",$lead_id); 26 | //var_dump($lead_id); 27 | $test1 = strtotime("2016-04-12 13:38:54"); 28 | $test2 = strtotime("2016-04-12 13:39:03"); 29 | $test3 = $test2 - $test1; 30 | var_dump($test1, $test2, $test3); 31 | } 32 | ?> -------------------------------------------------------------------------------- /goAreacodes/goGetAreacodeInfo.php: -------------------------------------------------------------------------------- 1 | License: 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Affero General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Affero General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Affero General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | $campaign_id = $_REQUEST['campaign_id']; 24 | $areacode = $_REQUEST['areacode']; 25 | 26 | $astDB->where('campaign_id', $campaign_id); 27 | $astDB->where('areacode', $areacode); 28 | 29 | $cols = array( 30 | 'campaign_id', 31 | 'areacode', 32 | 'outbound_cid', 33 | 'active', 34 | 'cid_description', 35 | 'call_count_today' 36 | ); 37 | 38 | $result = $astDB->getOne('vicidial_campaign_cid_areacodes', null, $cols); 39 | 40 | $dataCampID = $result['campaign_id']; 41 | $dataAreacode = $result['areacode']; 42 | $dataOutboundCID = $result['outbound_cid']; 43 | $dataActive = $result['active']; 44 | $dataDescription = $result['cid_description']; 45 | $dataCallCountToday = $result['call_count_today']; 46 | 47 | $apiresults = array( 48 | "result" => "success", 49 | "campaign_id" => $dataCampID, 50 | "areacode" => $dataAreacode, 51 | "outbound_cid" => $dataOutboundCID, 52 | "active" => $dataActive, 53 | "cid_description" => $dataDescription, 54 | "call_count_today" => $dataCallCountToday 55 | ); 56 | ?> 57 | -------------------------------------------------------------------------------- /goBarging/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goBarging/includes/MySQLiDB.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goautodial/goAPIv2/4dff4ef89d40557b0cabfbd63811540a8e8a932b/goBarging/includes/MySQLiDB.php -------------------------------------------------------------------------------- /goBarging/includes/check_exten.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | use IO::Socket; 3 | 4 | $cmd_req = $ARGV[0]; 5 | 6 | # flush after every write 7 | #$| = 1; 8 | eval 9 | { 10 | local $SIG{ALRM} = sub { die 'Timed Out'; }; 11 | alarm 3; 12 | # creating object interface of IO::Socket::INET modules which internally creates 13 | # socket, binds and connects to the TCP server running on the specific port. 14 | my $socket = IO::Socket::INET->new( 15 | PF_INET, 16 | SOCK_STREAM, 17 | PeerHost => '127.0.0.1', 18 | PeerPort => '707', 19 | Timeout => '3600', 20 | Proto => 'tcp', 21 | ) or die "ERROR in Socket Creation : $!\n"; 22 | 23 | print "TCP Connection Success.\n"; 24 | 25 | $socket->autoflush(1); 26 | 27 | # write on the socket to server. 28 | #print $socket "$cmd_req\n"; 29 | # we can also send the data through IO::Socket::INET module, 30 | my $sendVal = $socket->send($cmd_req); 31 | print "Send to Server : $sendVal\n"; 32 | 33 | # read the socket data sent by server. 34 | #$data = <$socket>; 35 | # we can also read from socket through recv() in IO::Socket::INET 36 | my $retVal = $socket->recv($data, 10240); 37 | print "Received from Server : $data\n"; 38 | 39 | #sleep (10); 40 | close($socket); 41 | undef $/; $data = <$socket>; $/ = "\n"; 42 | alarm 0; 43 | }; 44 | alarm 0; # race condition protection -------------------------------------------------------------------------------- /goBarging/includes/index.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goautodial/goAPIv2/4dff4ef89d40557b0cabfbd63811540a8e8a932b/goBarging/includes/index.php -------------------------------------------------------------------------------- /goBarging/index.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goautodial/goAPIv2/4dff4ef89d40557b0cabfbd63811540a8e8a932b/goBarging/index.php -------------------------------------------------------------------------------- /goCallRecordings/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goCalltimes/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goCampaigns/getAllAudioFiles.php: -------------------------------------------------------------------------------- 1 | License: 11 | * This program is free software: you can redistribute it and/or modify 12 | * it under the terms of the GNU Affero General Public License as published by 13 | * the Free Software Foundation, either version 3 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Affero General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU Affero General Public License 22 | * along with this program. If not, see . 23 | */ 24 | 25 | include_once ( "goAPI.php" ); 26 | 27 | // Check exisiting status 28 | if ( !isset($log_user) || is_null($log_user) ) { 29 | $apiresults = array( 30 | "result" => "Error: Session User Not Defined." 31 | ); 32 | } else { 33 | $sounds_web_directory = '../../sounds'; 34 | $files = scandir($sounds_web_directory); 35 | 36 | if ( !empty($files) ) { 37 | $apiresults = array ( 38 | "result" => "success", 39 | "data" => $files 40 | ); 41 | } else { 42 | $apiresults = array ( 43 | "result" => "error", 44 | "data" => $files 45 | ); 46 | } 47 | } 48 | ?> 49 | -------------------------------------------------------------------------------- /goCampaigns/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goCampaigns/goUpdateCampaignGoogleSheet.php: -------------------------------------------------------------------------------- 1 | escape($_REQUEST['goUser']); 14 | $ip_address = $astDB->escape($_REQUEST['hostname']); 15 | $campaign_id = $astDB->escape($_REQUEST['campaign_id']); 16 | $google_sheet_ids = $astDB->escape($_REQUEST['google_sheet_ids']); 17 | $log_user = $astDB->escape($_REQUEST['log_user']); 18 | $log_group = $astDB->escape($_REQUEST['log_group']); 19 | 20 | if($campaign_id != null) { 21 | //$updateQuery = "UPDATE go_campaigns SET google_sheet_ids = '$google_sheet_ids' WHERE campaign_id='$campaign_id' LIMIT 1;"; 22 | //echo $updateQuery; 23 | $updateData = array( 24 | 'google_sheet_ids' => $google_sheet_ids 25 | ); 26 | $goDB->where('campaign_id', $campaign_id); 27 | $updateResult = $goDB->update('go_campaigns', $updateData, 1); 28 | $updateQuery = $goDB->getLastQuery(); 29 | 30 | $log_id = log_action($goDB, 'MODIFY', $log_user, $ip_address, "Updated Google Sheets for Campaign ID: $campaign_id", $log_group, $updateQuery); 31 | 32 | $apiresults = array("result" => "success"); 33 | }else{ 34 | $apiresults = array("result" => "Error: Campaign doens't exist."); 35 | } 36 | ?> 37 | -------------------------------------------------------------------------------- /goCarriers/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goCarriers/goCheckCarriers.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * @par License: 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Affero General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Affero General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Affero General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | 24 | ### POST or GET Variables 25 | $carrier_id = $astDB->escape($_REQUEST['carrier_id']); 26 | 27 | //$queryCheck = "SELECT carrier_id FROM vicidial_server_carriers WHERE carrier_id ='$carrier_id';"; 28 | $astDB->where('carrier_id', $carrier_id); 29 | $rsltv = $astDB->get('vicidial_server_carriers'); 30 | $countCheck = $astDB->getRowCount(); 31 | 32 | if($countCheck > 0) { 33 | $apiresults = array("result" => "Error: Carrier already exist."); 34 | } else { 35 | $apiresults = array("result" => "success"); 36 | } 37 | ?> -------------------------------------------------------------------------------- /goChat/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goChat/goChatHistory.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * @par License: 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Affero General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Affero General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Affero General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | 24 | if (isset($_GET['user'])) { $user = $astDB->escape($_GET['user']); } 25 | else if (isset($_POST['user'])) { $user = $astDB->escape($_POST['user']); } 26 | if (isset($_GET['goLimit'])) { $limit = $astDB->escape($_GET['goLimit']); } 27 | else if (isset($_POST['goLimit'])) { $limit = $astDB->escape($_POST['goLimit']); } 28 | 29 | if (!is_numeric($limit) || $limit === '') { $limit = 50; } 30 | if ((($user === '' || is_null($user)) && $goUser !== 'goAPI')) { $user = $goUser; } 31 | 32 | 33 | if (isset($user) && $user !== '') { 34 | $astDB->where('sender', $user); 35 | $astDB->where('recipient', $user); 36 | $rslt = $astDB->get('go_chat_history', $limit); 37 | 38 | $APIResult = array( "result" => "success", "data" => $rslt ); 39 | } else { 40 | $APIResult = array( "result" => "error", "message" => "Field 'user' should not be empty." ); 41 | } 42 | ?> -------------------------------------------------------------------------------- /goChat/goChatSave.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * @par License: 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Affero General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Affero General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Affero General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | 24 | if (isset($_GET['goSender'])) { $sender = $astDB->escape($_GET['goSender']); } 25 | else if (isset($_POST['goSender'])) { $sender = $astDB->escape($_POST['goSender']); } 26 | if (isset($_GET['goRecipient'])) { $recipient = $astDB->escape($_GET['goRecipient']); } 27 | else if (isset($_POST['goRecipient'])) { $recipient = $astDB->escape($_POST['goRecipient']); } 28 | if (isset($_GET['goMessage'])) { $message = $astDB->escape($_GET['goMessage']); } 29 | else if (isset($_POST['goMessage'])) { $message = $astDB->escape($_POST['goMessage']); } 30 | 31 | 32 | if ((isset($sender) && $sender !== '') && (isset($recipient) && $recipient !== '') && (isset($message) && $message !== '')) { 33 | $insertData = array( 34 | 'sender' => $sender, 35 | 'recipient' => $recipient, 36 | 'message' => $message, 37 | 'entry_date' => date("Y-m-d H:i:s") 38 | ); 39 | 40 | $rslt = $goDB->insert('go_chat_history', $insertData); 41 | 42 | $APIResult = array( "result" => "success", "chat_id" => $goDB->getInsertId() ); 43 | } 44 | ?> -------------------------------------------------------------------------------- /goCountryCode/getAllCountryCodes.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * @par License: 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Affero General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Affero General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Affero General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | 24 | //$query = "SELECT country_code, country FROM vicidial_phone_codes"; 25 | $rsltv = $astDB->get('vicidial_phone_codes', null, 'country_code, country'); 26 | $codeCnt = $astDB->getRowCount(); 27 | 28 | if ($codeCnt > 0) { 29 | foreach ($rsltv as $fresults){ 30 | $dataCountryCode[] = $fresults['country_code']; 31 | $dataCountry[] = $fresults['country']; 32 | $apiresults = array( 33 | "result" => "success", 34 | "country_code" => $dataCountryCode, 35 | "country" => $dataCountry, 36 | ); 37 | } 38 | } 39 | ?> -------------------------------------------------------------------------------- /goCountryCode/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goCustomFields/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goCustomFields/goDeleteAllCustomFields.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * @par License: 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Affero General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Affero General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Affero General Public License 20 | * along with this program. If not, see . 21 | */ 22 | $list_id = $astDB->escape($_REQUEST['list_id']); 23 | 24 | #$selectTable = "SHOW TABLES LIKE 'custom_$list_id'"; 25 | $goTableName = "custom_".$list_id; 26 | $selectTable = "DESC $goTableName;"; 27 | $queryResult = $astDB->rawQuery($selectTable); 28 | $countResult = $astDB->getRowCount(); 29 | 30 | if($countResult > 0){ 31 | $astDB->where('list_id', $list_id); 32 | $queryDeleteCF = $astDB->delete('vicidial_lists_fields'); 33 | 34 | if($queryDeleteCF){ 35 | $astDB->dropTable($goTableName); 36 | 37 | $apiresults = array("result" => "success"); 38 | }else{ 39 | $apiresults = array("result" => "Error: Custom Field does not exist"); 40 | } 41 | }else{ 42 | $apiresults = array("result" => "Error: List does not exist"); 43 | } 44 | ?> 45 | -------------------------------------------------------------------------------- /goCustomFields/goDeleteCustomField.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Alexander Jim Abenoja 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | $list_id = $astDB->escape($_REQUEST['list_id']); 24 | $field_label = str_replace(" ","_",trim($astDB->escape($_REQUEST['field_label']))); 25 | $field_id = $astDB->escape($_REQUEST['field_id']); 26 | 27 | $selectTable = "SHOW TABLES LIKE 'custom_$list_id'"; 28 | $queryResult = $astDB->rawQuery($selectTable); 29 | $countResult = $astDB->getRowCount(); 30 | 31 | if($countResult > 0){ 32 | //$selectColumns = "SHOW COLUMNS FROM `custom_$list_id` LIKE '$field_label';"; 33 | //$queryResult1 = $astDB->rawQuery($selectColumns); 34 | //$countResult1 = $astDB->getRowCount(); 35 | $astDB->where('field_label', $field_label); 36 | $astDB->where('field_id', $field_id); 37 | $astDB->where('list_id', $list_id); 38 | $queryResult1 = $astDB->getOne('vicidial_lists_fields'); 39 | $countResult1 = $astDB->getRowCount(); 40 | 41 | if($countResult1 > 0 && $field_label != "lead_id"){ 42 | $table_name = 'custom_'.$list_id; 43 | 44 | $astDB->where('field_label', $field_label); 45 | $astDB->where('field_id', $field_id); 46 | $astDB->where('list_id', $list_id); 47 | $queryDeleteCF = $astDB->delete('vicidial_lists_fields'); 48 | 49 | if($queryDeleteCF){ 50 | $astDB->dropColumnFromTable($table_name, $field_label); 51 | 52 | $apiresults = array("result" => "success"); 53 | }else{ 54 | $apiresults = array("result" => "Error: Custom Field does not exist"); 55 | } 56 | }else{ 57 | $apiresults = array("result" => "Error: $field_label does not exist"); 58 | } 59 | }else{ 60 | $apiresults = array("result" => "Error: List does not exist"); 61 | } 62 | 63 | ?> -------------------------------------------------------------------------------- /goCustomFields/goGetAllCustomFields.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * @par License: 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Affero General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Affero General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Affero General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | $list_id = $astDB->escape($_REQUEST['list_id']); 24 | 25 | if(!empty($list_id)) { 26 | $astDB->where('list_id', $list_id); 27 | $astDB->orderBy('field_rank,field_order,field_label'); 28 | $rsltv = $astDB->get('vicidial_lists_fields', null, 'field_id,field_label,field_name,field_description,field_rank,field_help,field_type,field_options,field_size,field_max,field_default,field_cost,field_required,multi_position,name_position,field_order'); 29 | 30 | foreach($rsltv as $fresults){ 31 | $data[] = array( 32 | 'field_id' => $fresults['field_id'], 33 | 'field_label' => $fresults['field_label'], 34 | 'field_name' => $fresults['field_name'], 35 | 'field_description' => $fresults['field_description'], 36 | 'field_rank' => $fresults['field_rank'], 37 | 'field_help' => $fresults['field_help'], 38 | 'field_type' => $fresults['field_type'], 39 | 'field_options' => $fresults['field_options'], 40 | 'field_size' => $fresults['field_size'], 41 | 'field_max' => $fresults['field_max'], 42 | 'field_default' => $fresults['field_default'], 43 | 'field_cost' => $fresults['field_cost'], 44 | 'field_required' => $fresults['field_required'], 45 | 'multi_position' => $fresults['multi_position'], 46 | 'name_position' => $fresults['name_position'], 47 | 'field_order' => $fresults['field_order'] 48 | ); 49 | } 50 | $apiresults = array("result" => "success", "data" => $data); 51 | }else{ 52 | $err_msg = error_handle("10107"); 53 | $apiresults = array("error_code" => "10107","result" => $err_msg); 54 | } 55 | 56 | ?> 57 | -------------------------------------------------------------------------------- /goDashboard/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goDashboard/goGetActiveCampaignsToday.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Chris Lomuntad 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | 24 | $groupId = go_get_groupid($session_user, $astDB); 25 | 26 | if (checkIfTenant($groupId, $goDB)) { 27 | $ul=''; 28 | } else { 29 | $stringv = go_getall_allowed_campaigns($groupId, $astDB); 30 | if($stringv !== "'ALLCAMPAIGNS'") 31 | $ul = " and campaign_id IN ($stringv)"; 32 | else 33 | $ul = ""; 34 | } 35 | 36 | $NOW = date("Y-m-d"); 37 | 38 | $query = "SELECT campaign_id as getActiveCampaignsToday from vicidial_campaign_stats where calls_today > -1 and update_time BETWEEN '$NOW 00:00:00' AND '$NOW 23:59:59' $ul LIMIT 1000"; 39 | //$query = "SELECT sum(drops_today) as getTotalDroppedCalls from vicidial_campaign_stats where calls_today > -1 and $ul"; 40 | 41 | $rsltv = $astDB->rawQuery($query); 42 | $countResult = $astDB->getRowCount(); 43 | //echo "
";
44 |     //var_dump($rsltv);   
45 |         
46 |     if($countResult > 0) {
47 |         $data = array();
48 | 		foreach ($rsltv as $fresults){       
49 | 			array_push($data, $fresults);
50 | 		}
51 | 		$apiresults = array("result" => "success", "data" => $data);
52 |     }
53 | ?>
54 | 


--------------------------------------------------------------------------------
/goDashboard/goGetDroppedPercentage.php:
--------------------------------------------------------------------------------
 1 | License:
11 |  *  This program is free software: you can redistribute it and/or modify
12 |  *  it under the terms of the GNU Affero General Public License as published by
13 |  *  the Free Software Foundation, either version 3 of the License, or
14 |  *  (at your option) any later version.
15 |  *
16 |  *  This program is distributed in the hope that it will be useful,
17 |  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18 |  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 |  *  GNU Affero General Public License for more details.
20 |  *
21 |  *  You should have received a copy of the GNU Affero General Public License
22 |  *  along with this program.  If not, see .
23 | */
24 | 
25 |     include_once ("goAPI.php");
26 |  
27 | 	$campaigns 											= allowed_campaigns($log_group, $goDB, $astDB);
28 |     $NOW 												= date("Y-m-d");
29 |     
30 | 	// ERROR CHECKING 
31 | 	if (empty($goUser) || is_null($goUser)) {
32 | 		$apiresults 									= array(
33 | 			"result" 										=> "Error: goAPI User Not Defined."
34 | 		);
35 | 	} elseif (empty($goPass) || is_null($goPass)) {
36 | 		$apiresults 									= array(
37 | 			"result" 										=> "Error: goAPI Password Not Defined."
38 | 		);
39 | 	} elseif (empty($log_user) || is_null($log_user)) {
40 | 		$apiresults 									= array(
41 | 			"result" 										=> "Error: Session User Not Defined."
42 | 		);
43 | 	} else {
44 | 		// check if goUser and goPass are valid
45 | 		$fresults										= $astDB
46 | 			->where("user", $goUser)
47 | 			->where("pass_hash", $goPass)
48 | 			->getOne("vicidial_users", "user,user_level");
49 | 		
50 | 		$goapiaccess									= $astDB->getRowCount();
51 | 		$userlevel										= $fresults["user_level"];
52 | 		
53 | 		if ($goapiaccess > 0 && $userlevel > 7) {		
54 | 			$data 										= $astDB
55 | 				->where("campaign_id", $campaigns, "IN")
56 | 				->where("update_time", array("$NOW 00:00:00", "$NOW 23:59:59"), "BETWEEN")
57 | 				->getValue("vicidial_campaign_stats", "concat(round((sum(drops_today)/sum(answers_today) * 100)),'')");
58 | 					
59 | 			$apiresults 								= array(
60 | 				"result" 									=> "success",
61 | 				//"query"									=> $astDB->getLastQuery(),
62 | 				"data" 										=> $data
63 | 			);
64 | 		} else {
65 | 			$err_msg 									= error_handle("10001");
66 | 			$apiresults 								= array(
67 | 				"code" 										=> "10001", 
68 | 				"result" 									=> $err_msg
69 | 			);		
70 | 		}
71 | 	}
72 |     
73 | ?>
74 | 


--------------------------------------------------------------------------------
/goDashboard/goGetLeadsinHopper.php:
--------------------------------------------------------------------------------
 1 | License:
11 |  *  This program is free software: you can redistribute it and/or modify
12 |  *  it under the terms of the GNU Affero General Public License as published by
13 |  *  the Free Software Foundation, either version 3 of the License, or
14 |  *  (at your option) any later version.
15 |  *
16 |  *  This program is distributed in the hope that it will be useful,
17 |  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18 |  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 |  *  GNU Affero General Public License for more details.
20 |  *
21 |  *  You should have received a copy of the GNU Affero General Public License
22 |  *  along with this program.  If not, see .
23 | */
24 | 
25 |     include_once ("goAPI.php");
26 |  
27 | 	$campaigns 											= allowed_campaigns($log_group, $goDB, $astDB);
28 | 
29 | 	// ERROR CHECKING 
30 | 	if (empty($goUser) || is_null($goUser)) {
31 | 		$apiresults 									= array(
32 | 			"result" 										=> "Error: goAPI User Not Defined."
33 | 		);
34 | 	} elseif (empty($goPass) || is_null($goPass)) {
35 | 		$apiresults 									= array(
36 | 			"result" 										=> "Error: goAPI Password Not Defined."
37 | 		);
38 | 	} elseif (empty($log_user) || is_null($log_user)) {
39 | 		$apiresults 									= array(
40 | 			"result" 										=> "Error: Session User Not Defined."
41 | 		);
42 | 	} else {
43 | 		// check if goUser and goPass are valid
44 | 		$fresults										= $astDB
45 | 			->where("user", $goUser)
46 | 			->where("pass_hash", $goPass)
47 | 			->getOne("vicidial_users", "user,user_level");
48 | 		
49 | 		$goapiaccess									= $astDB->getRowCount();
50 | 		$userlevel										= $fresults["user_level"];
51 | 		
52 | 		if ($goapiaccess > 0 && $userlevel > 7) {
53 | 			$campaignsArr								= array();
54 | 			
55 | 			foreach ($campaigns["campaign_id"] as $key => $value) {
56 | 				array_push($campaignsArr, $value);
57 | 			}
58 | 			
59 | 			$astDB->where("campaign_id", $campaignsArr, "IN");
60 | 			$data										= $astDB->getValue("vicidial_hopper", "count(*)");
61 | 			
62 | 			$apiresults 								= array(
63 | 				"result" 									=> "success", 
64 | 				"data" 										=> $data
65 | 			);
66 | 		} else {
67 | 			$err_msg 									= error_handle("10001");
68 | 			$apiresults 								= array(
69 | 				"code" 										=> "10001", 
70 | 				"result" 									=> $err_msg
71 | 			);		
72 | 		}
73 | 	}
74 | 		
75 | ?>
76 | 


--------------------------------------------------------------------------------
/goDashboard/goGetLiveInbound.php:
--------------------------------------------------------------------------------
 1 | License:
11 |  *  This program is free software: you can redistribute it and/or modify
12 |  *  it under the terms of the GNU Affero General Public License as published by
13 |  *  the Free Software Foundation, either version 3 of the License, or
14 |  *  (at your option) any later version.
15 |  *
16 |  *  This program is distributed in the hope that it will be useful,
17 |  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18 |  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 |  *  GNU Affero General Public License for more details.
20 |  *
21 |  *  You should have received a copy of the GNU Affero General Public License
22 |  *  along with this program.  If not, see .
23 | */
24 | 
25 |     include_once ("goAPI.php");
26 |  
27 | 	$campaigns 											= allowed_campaigns($log_group, $goDB, $astDB);
28 | 
29 | 	// ERROR CHECKING 
30 | 	if (empty($goUser) || is_null($goUser)) {
31 | 		$apiresults 									= array(
32 | 			"result" 										=> "Error: goAPI User Not Defined."
33 | 		);
34 | 	} elseif (empty($goPass) || is_null($goPass)) {
35 | 		$apiresults 									= array(
36 | 			"result" 										=> "Error: goAPI Password Not Defined."
37 | 		);
38 | 	} elseif (empty($log_user) || is_null($log_user)) {
39 | 		$apiresults 									= array(
40 | 			"result" 										=> "Error: Session User Not Defined."
41 | 		);
42 | 	} else {
43 | 		// check if goUser and goPass are valid
44 | 		$fresults										= $astDB
45 | 			->where("user", $goUser)
46 | 			->where("pass_hash", $goPass)
47 | 			->getOne("vicidial_users", "user,user_level");
48 | 		
49 | 		$goapiaccess									= $astDB->getRowCount();
50 | 		$userlevel										= $fresults["user_level"];
51 | 		
52 | 		if ($goapiaccess > 0 && $userlevel > 7) {
53 | 			if (is_array($campaigns)) {
54 | 				$data									= $astDB
55 | 					->where("campaign_id", $campaigns, "IN")
56 | 					->where("vla.user = vu.user")
57 | 					->where("vu.user_level", 4, "!=")
58 | 					->where("status = 'INCALL'")
59 | 					->where("comments = 'INBOUND'")				
60 | 					->getValue("vicidial_live_agents as vla,vicidial_users as vu", "count(*)");
61 | 				
62 | 				$apiresults 							= array(
63 | 					"result" 								=> "success",
64 | 					//"query"								=> $astDB->getLastQuery(),
65 | 					"data" 									=> $data
66 | 				);
67 | 			}
68 | 		} else {
69 | 			$err_msg 									= error_handle("10001");
70 | 			$apiresults 								= array(
71 | 				"code" 										=> "10001", 
72 | 				"result" 									=> $err_msg
73 | 			);		
74 | 		}
75 | 	}
76 | 	
77 | ?>
78 | 


--------------------------------------------------------------------------------
/goDashboard/goGetLiveOutbound.php:
--------------------------------------------------------------------------------
 1 | License:
11 |  *  This program is free software: you can redistribute it and/or modify
12 |  *  it under the terms of the GNU Affero General Public License as published by
13 |  *  the Free Software Foundation, either version 3 of the License, or
14 |  *  (at your option) any later version.
15 |  *
16 |  *  This program is distributed in the hope that it will be useful,
17 |  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18 |  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 |  *  GNU Affero General Public License for more details.
20 |  *
21 |  *  You should have received a copy of the GNU Affero General Public License
22 |  *  along with this program.  If not, see .
23 | */
24 | 
25 |     include_once ("goAPI.php");
26 |  
27 | 	$campaigns 											= allowed_campaigns($log_group, $goDB, $astDB);
28 | 
29 | 	// ERROR CHECKING 
30 | 	if (empty($goUser) || is_null($goUser)) {
31 | 		$apiresults 									= array(
32 | 			"result" 										=> "Error: goAPI User Not Defined."
33 | 		);
34 | 	} elseif (empty($goPass) || is_null($goPass)) {
35 | 		$apiresults 									= array(
36 | 			"result" 										=> "Error: goAPI Password Not Defined."
37 | 		);
38 | 	} elseif (empty($log_user) || is_null($log_user)) {
39 | 		$apiresults 									= array(
40 | 			"result" 										=> "Error: Session User Not Defined."
41 | 		);
42 | 	} else {
43 | 		// check if goUser and goPass are valid
44 | 		$fresults										= $astDB
45 | 			->where("user", $goUser)
46 | 			->where("pass_hash", $goPass)
47 | 			->getOne("vicidial_users", "user,user_level");
48 | 		
49 | 		$goapiaccess									= $astDB->getRowCount();
50 | 		$userlevel										= $fresults["user_level"];
51 | 		
52 | 		if ($goapiaccess > 0 && $userlevel > 7) {
53 | 			if (is_array($campaigns)) {
54 | 				$data									= $astDB
55 | 					->where("campaign_id", $campaigns, "IN")
56 | 					->where("vla.user = vu.user")
57 | 					->where("vu.user_level", 4, "!=")
58 | 					->where("status = 'INCALL'")
59 | 					->where("comments", array("MANUAL", "AUTO"), "IN")
60 | 					//->orWhere("length(comments)", 1, "<");			
61 | 					->getValue("vicidial_live_agents as vla,vicidial_users as vu", "count(*)");
62 | 				
63 | 				$apiresults 							= array(
64 | 					"result" 								=> "success",
65 | 					//"query"								=> $astDB->getLastQuery(),
66 | 					"data" 									=> $data
67 | 				);
68 | 			}
69 | 		} else {
70 | 			$err_msg 									= error_handle("10001");
71 | 			$apiresults 								= array(
72 | 				"code" 										=> "10001", 
73 | 				"result" 									=> $err_msg
74 | 			);		
75 | 		}
76 | 	}
77 |  
78 | ?>
79 | 


--------------------------------------------------------------------------------
/goDashboard/goGetOfflineActiveAgents.php:
--------------------------------------------------------------------------------
 1 | 
 7 |  * @author     	Demian Lizandro A. Biscocho  
 8 |  * @author     	Chris Lomuntad  
 9 |  *
10 |  * @par License:
11 |  *  This program is free software: you can redistribute it and/or modify
12 |  *  it under the terms of the GNU Affero General Public License as published by
13 |  *  the Free Software Foundation, either version 3 of the License, or
14 |  *  (at your option) any later version.
15 |  *
16 |  *  This program is distributed in the hope that it will be useful,
17 |  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18 |  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 |  *  GNU Affero General Public License for more details.
20 |  *
21 |  *  You should have received a copy of the GNU Affero General Public License
22 |  *  along with this program.  If not, see .
23 | */
24 | 
25 |     $groupId = go_get_groupid($session_user, $astDB);
26 |     
27 |     if (checkIfTenant($groupId, $goDB)) {
28 |         $ul=' AND vicidial_users.user_level != 4';
29 |     } else { 
30 |         $stringv = go_getall_allowed_users($groupId, $astDB);
31 |         $ul = " AND vicidial_users.user IN ($stringv) AND vicidial_users.user_level != 4";
32 |     }
33 |     
34 |     $query_OfflineActiveAgents = "SELECT vicidial_users.user_id as 'vu_user_id', vicidial_users.user as 'vu_user', vicidial_users.full_name as 'vu_full_name',vicidial_users.user_group as 'vu_user_group', vicidial_users.user_level as 'vu_user_level', vicidial_users.active as 'vu_status' from vicidial_users where vicidial_users.active='Y' AND vicidial_users.user NOT IN (SELECT vicidial_live_agents.user as 'vla_user' from vicidial_live_agents) $ul";     
35 |     
36 |     //$queryGo = "SELECT userid, avatar FROM users";
37 |     $rsltvGo = $goDB->get('users', null, 'userid, avatar');
38 |     $countResultGo = $goDB->getRowCount();
39 |         
40 |     if($countResultGo > 0) {
41 |         $dataGo = array();
42 |         foreach ($rsltvGo as $fresultsGo){
43 |             array_push($dataGo, $fresultsGo);
44 |         }
45 |     }
46 |     
47 |     $rsltvOfflineAgents = $astDB->rawQuery($query_OfflineActiveAgents);
48 |     $data = array();        
49 |     foreach ($rsltvOfflineAgents as $resultsOfflineAgents){               
50 |         array_push($data, $resultsOfflineAgents);            
51 |     }
52 |     
53 |     //$dataM = array_merge($data, $dataGo);        
54 |     $apiresults = array("result" => "success", "data" => $data, "dataGo" => $dataGo);
55 | 
56 | ?>
57 | 


--------------------------------------------------------------------------------
/goDashboard/goGetOpenTickets.php:
--------------------------------------------------------------------------------
 1 | 
 7 |  * @author     	Chris Lomuntad  
 8 |  *
 9 |  * @par License:
10 |  *  This program is free software: you can redistribute it and/or modify
11 |  *  it under the terms of the GNU Affero General Public License as published by
12 |  *  the Free Software Foundation, either version 3 of the License, or
13 |  *  (at your option) any later version.
14 |  *
15 |  *  This program is distributed in the hope that it will be useful,
16 |  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17 |  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 |  *  GNU Affero General Public License for more details.
19 |  *
20 |  *  You should have received a copy of the GNU Affero General Public License
21 |  *  along with this program.  If not, see .
22 | */
23 | 
24 |     $userid = $_REQUEST['userid'];
25 |     $groupId = go_get_groupid($goUser, $astDB);
26 |     
27 |     if($userid == null && $userid == 0) { 
28 |         $apiresults = array("result" => "Error: Set a value for User ID"); 
29 |     } else {     
30 |     
31 |         if (!checkIfTenant($groupId, $goDB)) {
32 |             $ul='';
33 |         } else { 
34 |             $stringv = go_getall_allowed_users($groupId, $astDB);
35 |             $stringv .= "'j'";
36 |             $ul = "and vcl.campaign_id IN ($stringv) and user_level != 4";
37 |         }
38 |             
39 |         $state = "open";
40 |         $query = "SELECT count(*) as opentickets FROM ost_ticket WHERE status_id IN (SELECT id AS status_id FROM ost_ticket_status WHERE state='$state') AND dept_id IN ((select dept_id from ost_staff where staff_id='$userid'),(SELECT dept_id FROM ost_staff_dept_access WHERE staff_id='$userid')) AND isanswered=0";
41 | 
42 |         $fresults = $ostDB->rawQuery($query);
43 |         //$fresults = mysqli_fetch_assoc($rsltv);
44 |         $apiresults = array_merge( array( "result" => "success" ), $fresults);
45 |     
46 |     }
47 | ?>
48 | 


--------------------------------------------------------------------------------
/goDashboard/goGetOverdueTickets.php:
--------------------------------------------------------------------------------
 1 | 
 7 |  * @author     	Chris Lomuntad  
 8 |  *
 9 |  * @par License:
10 |  *  This program is free software: you can redistribute it and/or modify
11 |  *  it under the terms of the GNU Affero General Public License as published by
12 |  *  the Free Software Foundation, either version 3 of the License, or
13 |  *  (at your option) any later version.
14 |  *
15 |  *  This program is distributed in the hope that it will be useful,
16 |  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17 |  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 |  *  GNU Affero General Public License for more details.
19 |  *
20 |  *  You should have received a copy of the GNU Affero General Public License
21 |  *  along with this program.  If not, see .
22 | */
23 | 
24 |     $userid = $_REQUEST['userid'];
25 |     $groupId = go_get_groupid($goUser, $astDB);
26 |     
27 |     if($userid == null && $userid == 0) { 
28 |             $apiresults = array("result" => "Error: Set a value for User ID"); 
29 |     } else {    
30 |     
31 |         if (!checkIfTenant($groupId, $goDB)) {
32 |             $ul='';
33 |         } else { 
34 |             $stringv = go_getall_allowed_users($groupId, $astDB);
35 |             $stringv .= "'j'";
36 |             $ul = "and vcl.campaign_id IN ($stringv) and user_level != 4";
37 |         }
38 |         
39 |         $state = "open";
40 |         $query = "SELECT count(*) as overduetickets FROM ost_ticket WHERE status_id IN (SELECT id AS status_id FROM ost_ticket_status WHERE state='$state') AND dept_id IN ((select dept_id from ost_staff where staff_id='$userid'),(SELECT dept_id FROM ost_staff_dept_access WHERE staff_id='$userid')) AND isoverdue=1";
41 | 
42 |         $fresults = $ostDB->rawQuery($query);
43 |         //$fresults = mysqli_fetch_assoc($rsltv);
44 |         $apiresults = array_merge( array( "result" => "success" ), $fresults);
45 |         
46 |     }
47 | ?>
48 | 


--------------------------------------------------------------------------------
/goDashboard/goGetSLAPercentage.php:
--------------------------------------------------------------------------------
 1 | 
 7 |  * @author     	Chris Lomuntad  
 8 |  *
 9 |  * @par License:
10 |  *  This program is free software: you can redistribute it and/or modify
11 |  *  it under the terms of the GNU Affero General Public License as published by
12 |  *  the Free Software Foundation, either version 3 of the License, or
13 |  *  (at your option) any later version.
14 |  *
15 |  *  This program is distributed in the hope that it will be useful,
16 |  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17 |  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 |  *  GNU Affero General Public License for more details.
19 |  *
20 |  *  You should have received a copy of the GNU Affero General Public License
21 |  *  along with this program.  If not, see .
22 | */
23 | 
24 |     $groupId = go_get_groupid($session_user, $astDB);
25 |     
26 |     if (checkIfTenant($groupId, $goDB)) {
27 |         $ul='';
28 |     } else { 
29 |         $stringv = go_getall_allowed_users($groupId, $astDB);
30 |         $ul = "AND user_group not in ('','NULL','ADMIN') AND user_group in ($stringv)";
31 |     }
32 | 
33 |     $NOW = date("Y-m-d");
34 |     $queue_seconds = "queue_seconds <= 20";
35 |     
36 |     $query = "SELECT user_group, sum(term_reason in ('ABANDON','AFTERHOURS')) as abandon, sum(queue_seconds <= 20) as callsansweredlessthan20sec, sum(term_reason not in ('ABANDON','AFTERHOURS')) as answered, count(*) as calls_today, round((sum($queue_seconds <= 20)/count(*))*100) as SLA, round((sum(length_in_sec)/sum(user not in ('NULL','','VDCL')))/60,2) as AHT from vicidial_closer_log where call_date BETWEEN '$NOW 00:00:00' AND '$NOW 23:59:59' $ul";
37 |     //$query = "SELECT concat(round((sum($queue_seconds)/count(*))))*100 as SLA from vicidial_closer_log where call_date BETWEEN '$NOW 00:00:00' AND '$NOW 23:59:59' $ul";
38 | 
39 |     $rsltv = $astDB->rawQuery($query);
40 |     $countResult = $astDB->getRowCount();
41 |     //echo "
";
42 |     //var_dump($rsltv);   
43 |         
44 |     if($countResult > 0) {
45 |         $data = array();
46 |         foreach ($rsltv as $fresults){       
47 |             array_push($data, $fresults);
48 |         }
49 |         $apiresults = array("result" => "success", "data" => $data);
50 |     }
51 | ?>
52 | 


--------------------------------------------------------------------------------
/goDashboard/goGetSalesAgent.php:
--------------------------------------------------------------------------------
 1 | License:
10 |  *  This program is free software: you can redistribute it AND/or modify
11 |  *  it under the terms of the GNU Affero General Public License as published by
12 |  *  the Free Software Foundation, either version 3 of the License, or
13 |  *  (at your option) any later version.
14 |  *
15 |  *  This program is distributed in the hope that it will be useful,
16 |  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17 |  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 |  *  GNU Affero General Public License for more details.
19 |  *
20 |  *  You should have received a copy of the GNU Affero General Public License
21 |  *  along with this program.  If not, see .
22 | */
23 | 
24 |     include_once("goAPI.php");
25 | 
26 |     $fromDate 											= (empty($fromDate) ? date("Y-m-d") : "");
27 |     $toDate 											= (empty($toDate) ? date("Y-m-d") : "");
28 |     $campaignID											= (!empty($campaignID) ? $astDB->escape($_REQUEST['campaign_id']) : 'ALL');
29 |     
30 | 	if (empty($goUser) || is_null($goUser)) {
31 | 		$apiresults 									= array(
32 | 			"result" 										=> "Error: goAPI User Not Defined."
33 | 		);
34 | 	} elseif (empty($goPass) || is_null($goPass)) {
35 | 		$apiresults 									= array(
36 | 			"result" 										=> "Error: goAPI Password Not Defined."
37 | 		);
38 | 	} elseif (empty($log_user) || is_null($log_user)) {
39 | 		$apiresults 									= array(
40 | 			"result" 										=> "Error: Session User Not Defined."
41 | 		);
42 | 	} elseif ( empty($campaignID) || is_null($campaignID) ) {
43 | 		$err_msg 										= error_handle("40001");
44 |         	$apiresults 								= array(
45 | 			"code" 											=> "40001",
46 | 			"result" 										=> $err_msg
47 | 		);
48 | 	} else {
49 | 		// check if goUser and goPass are valid
50 | 		$fresults											= $astDB
51 | 			->where("user", $goUser)
52 | 			->where("pass_hash", $goPass)
53 | 			->getOne("vicidial_users", "user,user_level");
54 | 		
55 | 		$goapiaccess									= $astDB->getRowCount();
56 | 		$userlevel										= $fresults["user_level"];
57 | 		
58 | 		if ($goapiaccess > 0 && $userlevel > 7) {	
59 | 			$cols 										= array(
60 | 				"user",
61 | 				"full_name",
62 | 				"sum(sales) as sale",
63 | 				"sum(amount) as amount"
64 | 			);
65 | 
66 | 			$sql_sales = $goDB->where('entry_date', array($fromDate, $toDate), 'BETWEEN')
67 | 					//->where('amount', 0, '>')
68 | 					->groupBy('user')
69 | 					->get('go_sales_count', null, $cols);
70 | 
71 | 			$apiresults 								= array(
72 | 				"result"									=> "success",
73 | 				"amount"									=> $sql_sales,
74 | 			);
75 | 				
76 | 			return $apiresults;
77 | 		}
78 | 	}
79 | 
80 | ?>
81 | 


--------------------------------------------------------------------------------
/goDashboard/goGetTotalActiveAgents.php:
--------------------------------------------------------------------------------
 1 | 
 7 |  * @author     	Chris Lomuntad  
 8 |  *
 9 |  * @par License:
10 |  *  This program is free software: you can redistribute it and/or modify
11 |  *  it under the terms of the GNU Affero General Public License as published by
12 |  *  the Free Software Foundation, either version 3 of the License, or
13 |  *  (at your option) any later version.
14 |  *
15 |  *  This program is distributed in the hope that it will be useful,
16 |  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17 |  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 |  *  GNU Affero General Public License for more details.
19 |  *
20 |  *  You should have received a copy of the GNU Affero General Public License
21 |  *  along with this program.  If not, see .
22 | */
23 | 
24 |     $groupId = go_get_groupid($session_user, $astDB);
25 |     
26 |     if (checkIfTenant($groupId, $goDB)) {
27 |         $ul='';
28 |     } else {
29 |         $ul = "AND user_group='$groupId'";
30 |     }
31 | 
32 |    $query = "SELECT full_name,pass FROM vicidial_users WHERE active='Y' AND (user_level<>'4' AND user_level < '7') $ul AND user NOT IN ('VDAD','VDCL', 'goAPI', 'goautodial') ORDER BY user";
33 | 
34 |     $fresults = $astDB->rawQuery($query);
35 |     //$fresults = mysqli_fetch_assoc($rsltv);
36 |     $apiresults = array_merge( array( "result" => "success" ), $fresults );
37 | 	
38 | ?>
39 | 


--------------------------------------------------------------------------------
/goDashboard/goGetTotalActiveLeads.php:
--------------------------------------------------------------------------------
 1 | 
 7 |  * @author     	Chris Lomuntad  
 8 |  *
 9 |  * @par License:
10 |  *  This program is free software: you can redistribute it and/or modify
11 |  *  it under the terms of the GNU Affero General Public License as published by
12 |  *  the Free Software Foundation, either version 3 of the License, or
13 |  *  (at your option) any later version.
14 |  *
15 |  *  This program is distributed in the hope that it will be useful,
16 |  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17 |  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 |  *  GNU Affero General Public License for more details.
19 |  *
20 |  *  You should have received a copy of the GNU Affero General Public License
21 |  *  along with this program.  If not, see .
22 | */
23 | 
24 |     $groupId = go_get_groupid($session_user, $astDB);
25 |     
26 |     if (checkIfTenant($groupId, $goDB)) {
27 |         $ul='';
28 |     } else { 
29 |         $stringv = go_getall_allowed_campaigns($groupId, $astDB);
30 | 		if($stringv !== "'ALLCAMPAIGNS'")
31 | 			$ul = " and vls.campaign_id IN ($stringv)";
32 | 		else
33 | 			$ul = "";
34 |     }
35 | 	
36 |     $query = "SELECT count(*) as getTotalActiveLeads from vicidial_lists as vls,vicidial_list as vl where vl.list_id=vls.list_id and active='Y' $ul"; 
37 |     $fresults = $astDB->rawQuery($query);
38 |     //$fresults = mysqli_fetch_assoc($rsltv);
39 |     $apiresults = array_merge( array( "result" => "success" ), $fresults );
40 | ?>
41 | 


--------------------------------------------------------------------------------
/goDashboard/goGetTotalAgentsCall.php:
--------------------------------------------------------------------------------
 1 | License:
10 |  *  This program is free software: you can redistribute it and/or modify
11 |  *  it under the terms of the GNU Affero General Public License as published by
12 |  *  the Free Software Foundation, either version 3 of the License, or
13 |  *  (at your option) any later version.
14 |  *
15 |  *  This program is distributed in the hope that it will be useful,
16 |  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17 |  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 |  *  GNU Affero General Public License for more details.
19 |  *
20 |  *  You should have received a copy of the GNU Affero General Public License
21 |  *  along with this program.  If not, see .
22 | */
23 | 
24 |     include_once ("goAPI.php");
25 |  
26 | 	$campaigns 											= allowed_campaigns($log_group, $goDB, $astDB);
27 | 
28 | 	// ERROR CHECKING 
29 | 	if (empty($goUser) || is_null($goUser)) {
30 | 		$apiresults 									= array(
31 | 			"result" 										=> "Error: goAPI User Not Defined."
32 | 		);
33 | 	} elseif (empty($goPass) || is_null($goPass)) {
34 | 		$apiresults 									= array(
35 | 			"result" 										=> "Error: goAPI Password Not Defined."
36 | 		);
37 | 	} elseif (empty($log_user) || is_null($log_user)) {
38 | 		$apiresults 									= array(
39 | 			"result" 										=> "Error: Session User Not Defined."
40 | 		);
41 | 	} else {
42 | 		// check if goUser and goPass are valid
43 | 		$fresults										= $astDB
44 | 			->where("user", $goUser)
45 | 			->where("pass_hash", $goPass)
46 | 			->getOne("vicidial_users", "user,user_level");
47 | 		
48 | 		$goapiaccess									= $astDB->getRowCount();
49 | 		$userlevel										= $fresults["user_level"];
50 | 		
51 | 		if ($goapiaccess > 0 && $userlevel > 7) {
52 | 			if (is_array($campaigns)) {
53 | 				if (strtoupper($log_group) != 'ADMIN') {
54 | 					if ($userlevel < 9) {
55 |                         $astDB->where("user_group", $log_group);
56 | 					}
57 | 				}
58 |                 
59 | 				$calls 									= array( 'INCALL', 'QUEUE', '3-WAY', 'PARK' );		
60 | 				$data									= $astDB
61 | 					->where("campaign_id", $campaigns, "IN")
62 | 					->where("status", $calls, "IN")
63 | 					->where("user_level", 4, "!=")
64 | 					->getValue("vicidial_live_agents", "count(*)");
65 | 				
66 | 				$apiresults 							= array(
67 | 					"result" 								=> "success", 
68 | 					"data" 									=> $data
69 | 				);	
70 | 			}
71 | 		} else {
72 | 			$err_msg 									= error_handle("10001");
73 | 			$apiresults 								= array(
74 | 				"code" 										=> "10001", 
75 | 				"result" 									=> $err_msg
76 | 			);		
77 | 		}
78 | 	}
79 |     
80 | ?>
81 | 


--------------------------------------------------------------------------------
/goDashboard/goGetTotalAgentsOnline.php:
--------------------------------------------------------------------------------
 1 | 
 7 |  * @author     	Chris Lomuntad  
 8 |  *
 9 |  * @par License:
10 |  *  This program is free software: you can redistribute it and/or modify
11 |  *  it under the terms of the GNU Affero General Public License as published by
12 |  *  the Free Software Foundation, either version 3 of the License, or
13 |  *  (at your option) any later version.
14 |  *
15 |  *  This program is distributed in the hope that it will be useful,
16 |  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17 |  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 |  *  GNU Affero General Public License for more details.
19 |  *
20 |  *  You should have received a copy of the GNU Affero General Public License
21 |  *  along with this program.  If not, see .
22 | */
23 | 
24 |     $groupId = go_get_groupid($session_user, $astDB);
25 |     
26 |     if (checkIfTenant($groupId, $goDB)) {
27 | 		$stringv = '';
28 |         $ul_online='';
29 | 		$ul_calls='';
30 |     } else { 
31 |         $stringv = go_getall_allowed_users($groupId, $astDB);
32 | 		$ul = " and user IN ($stringv) and user_level != '4'";
33 |     }
34 |     
35 |     $query = "SELECT count(*) as getTotalAgentsOnline FROM vicidial_live_agents $ul"; 
36 |     $data = $astDB->rawQuery($query);
37 |     //$data = mysqli_fetch_assoc($rsltv);
38 |     $apiresults = array("result" => "success", "data" => $data);
39 | ?>
40 | 


--------------------------------------------------------------------------------
/goDashboard/goGetTotalAgentsPaused.php:
--------------------------------------------------------------------------------
 1 | License:
10 |  *  This program is free software: you can redistribute it and/or modify
11 |  *  it under the terms of the GNU Affero General Public License as published by
12 |  *  the Free Software Foundation, either version 3 of the License, or
13 |  *  (at your option) any later version.
14 |  *
15 |  *  This program is distributed in the hope that it will be useful,
16 |  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17 |  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 |  *  GNU Affero General Public License for more details.
19 |  *
20 |  *  You should have received a copy of the GNU Affero General Public License
21 |  *  along with this program.  If not, see .
22 | */
23 | 
24 |     include_once ("goAPI.php");
25 |  
26 | 	$campaigns 											= allowed_campaigns($log_group, $goDB, $astDB);
27 | 	$agentstatus										= "PAUSED";
28 | 
29 | 	// ERROR CHECKING 
30 | 	if (empty($goUser) || is_null($goUser)) {
31 | 		$apiresults 									= array(
32 | 			"result" 										=> "Error: goAPI User Not Defined."
33 | 		);
34 | 	} elseif (empty($goPass) || is_null($goPass)) {
35 | 		$apiresults 									= array(
36 | 			"result" 										=> "Error: goAPI Password Not Defined."
37 | 		);
38 | 	} elseif (empty($log_user) || is_null($log_user)) {
39 | 		$apiresults 									= array(
40 | 			"result" 										=> "Error: Session User Not Defined."
41 | 		);
42 | 	} else {
43 | 		// check if goUser and goPass are valid
44 | 		$fresults										= $astDB
45 | 			->where("user", $goUser)
46 | 			->where("pass_hash", $goPass)
47 | 			->getOne("vicidial_users", "user,user_level");
48 | 		
49 | 		$goapiaccess									= $astDB->getRowCount();
50 | 		$userlevel										= $fresults["user_level"];
51 | 		
52 | 		if ($goapiaccess > 0 && $userlevel > 7) {
53 | 			if (is_array($campaigns)) {
54 | 				if (strtoupper($log_group) != 'ADMIN') {
55 | 					if ($userlevel < 9) {
56 |                         $astDB->where("user_group", $log_group);
57 | 					}
58 | 				}
59 |                 
60 | 				$data									= $astDB
61 | 					->where("campaign_id", $campaigns, "IN")
62 | 					->where("status", array($agentstatus), "IN")
63 | 					->getValue("vicidial_live_agents", "count(*)");
64 | 				
65 | 				$apiresults 							= array(
66 | 					"result" 								=> "success", 
67 | 					"data" 									=> $data
68 | 				);	
69 | 			}
70 | 		} else {
71 | 			$err_msg 									= error_handle("10001");
72 | 			$apiresults 								= array(
73 | 				"code" 										=> "10001", 
74 | 				"result" 									=> $err_msg
75 | 			);		
76 | 		}
77 | 	}
78 | 	
79 | ?>
80 | 


--------------------------------------------------------------------------------
/goDashboard/goGetTotalAgentsWaitCalls.php:
--------------------------------------------------------------------------------
 1 | License:
11 |  *  This program is free software: you can redistribute it and/or modify
12 |  *  it under the terms of the GNU Affero General Public License as published by
13 |  *  the Free Software Foundation, either version 3 of the License, or
14 |  *  (at your option) any later version.
15 |  *
16 |  *  This program is distributed in the hope that it will be useful,
17 |  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18 |  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 |  *  GNU Affero General Public License for more details.
20 |  *
21 |  *  You should have received a copy of the GNU Affero General Public License
22 |  *  along with this program.  If not, see .
23 | */
24 | 
25 |     include_once ("goAPI.php");
26 |  
27 | 	$campaigns 											= allowed_campaigns($log_group, $goDB, $astDB);
28 | 
29 | 	// ERROR CHECKING 
30 | 	if (empty($goUser) || is_null($goUser)) {
31 | 		$apiresults 									= array(
32 | 			"result" 										=> "Error: goAPI User Not Defined."
33 | 		);
34 | 	} elseif (empty($goPass) || is_null($goPass)) {
35 | 		$apiresults 									= array(
36 | 			"result" 										=> "Error: goAPI Password Not Defined."
37 | 		);
38 | 	} elseif (empty($log_user) || is_null($log_user)) {
39 | 		$apiresults 									= array(
40 | 			"result" 										=> "Error: Session User Not Defined."
41 | 		);
42 | 	} else {
43 | 		// check if goUser and goPass are valid
44 | 		$fresults										= $astDB
45 | 			->where("user", $goUser)
46 | 			->where("pass_hash", $goPass)
47 | 			->getOne("vicidial_users", "user,user_level");
48 | 		
49 | 		$goapiaccess									= $astDB->getRowCount();
50 | 		$userlevel										= $fresults["user_level"];
51 | 		
52 | 		if ($goapiaccess > 0 && $userlevel > 7) {
53 | 			if (is_array($campaigns)) {
54 | 				if (strtoupper($log_group) != 'ADMIN') {
55 | 					if ($userlevel < 9) {
56 |                         $astDB->where("user_group", $log_group);
57 | 					}
58 | 				}
59 |                 
60 | 				$ready									= array( "READY", "CLOSER" );
61 | 				$data									= $astDB
62 | 					->where("campaign_id", $campaigns, "IN")
63 | 					->where("status", $ready, "IN")
64 | 					->where("user_level", 4, "!=")
65 | 					->getValue("vicidial_live_agents", "count(*)");
66 | 				
67 | 				$apiresults 							= array(
68 | 					"result" 								=> "success", 
69 | 					"data" 									=> $data
70 | 				);
71 | 			}
72 | 		} else {
73 | 			$err_msg 									= error_handle("10001");
74 | 			$apiresults 								= array(
75 | 				"code" 										=> "10001", 
76 | 				"result" 									=> $err_msg
77 | 			);		
78 | 		}
79 | 	}
80 | 	
81 | ?>
82 | 


--------------------------------------------------------------------------------
/goDashboard/goGetTotalCallsAgent.php:
--------------------------------------------------------------------------------
 1 | 
 7 |  * @author     	Chris Lomuntad  
 8 |  *
 9 |  * @par License:
10 |  *  This program is free software: you can redistribute it and/or modify
11 |  *  it under the terms of the GNU Affero General Public License as published by
12 |  *  the Free Software Foundation, either version 3 of the License, or
13 |  *  (at your option) any later version.
14 |  *
15 |  *  This program is distributed in the hope that it will be useful,
16 |  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17 |  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 |  *  GNU Affero General Public License for more details.
19 |  *
20 |  *  You should have received a copy of the GNU Affero General Public License
21 |  *  along with this program.  If not, see .
22 | */
23 | 
24 |     $groupId = go_get_groupid($session_user, $astDB);
25 |     
26 |     if (checkIfTenant($groupId, $goDB)) {
27 |         $ul='';
28 |     } else { 
29 |         $stringv = go_getall_allowed_campaigns($groupId, $astDB);
30 | 		if($stringv !== "'ALLCAMPAIGNS'")
31 | 			$ul = " and campaign_id IN ($stringv)";
32 | 		else
33 | 			$ul = "";
34 |     }
35 | 
36 |     $NOW = date("Y-m-d");
37 | 
38 |     $query = "select sum(calls_today) as getTotalCalls from vicidial_campaign_stats where calls_today > -1 and update_time BETWEEN '$NOW 00:00:00' AND '$NOW 23:59:59' $ul";
39 |     //$drop_percentage = ( ($line->drops_today / $line->answers_today) * 100); 
40 |     $fresults = $astDB->rawQuery($query);
41 |     //$fresults = mysqli_fetch_assoc($rsltv);
42 |     $apiresults = array_merge( array( "result" => "success" ), $fresults );
43 | ?>
44 | 


--------------------------------------------------------------------------------
/goDashboard/goGetTotalDialableLeads.php:
--------------------------------------------------------------------------------
 1 | License:
11 |  *  This program is free software: you can redistribute it and/or modify
12 |  *  it under the terms of the GNU Affero General Public License as published by
13 |  *  the Free Software Foundation, either version 3 of the License, or
14 |  *  (at your option) any later version.
15 |  *
16 |  *  This program is distributed in the hope that it will be useful,
17 |  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18 |  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 |  *  GNU Affero General Public License for more details.
20 |  *
21 |  *  You should have received a copy of the GNU Affero General Public License
22 |  *  along with this program.  If not, see .
23 | */
24 | 
25 |     include_once ("goAPI.php");
26 |  
27 | 	$campaigns 											= allowed_campaigns($log_group, $goDB, $astDB);
28 | 
29 | 	// ERROR CHECKING 
30 | 	if (empty($goUser) || is_null($goUser)) {
31 | 		$apiresults 									= array(
32 | 			"result" 										=> "Error: goAPI User Not Defined."
33 | 		);
34 | 	} elseif (empty($goPass) || is_null($goPass)) {
35 | 		$apiresults 									= array(
36 | 			"result" 										=> "Error: goAPI Password Not Defined."
37 | 		);
38 | 	} elseif (empty($log_user) || is_null($log_user)) {
39 | 		$apiresults 									= array(
40 | 			"result" 										=> "Error: Session User Not Defined."
41 | 		);
42 | 	} else {
43 | 		// check if goUser and goPass are valid
44 | 		$fresults										= $astDB
45 | 			->where("user", $goUser)
46 | 			->where("pass_hash", $goPass)
47 | 			->getOne("vicidial_users", "user,user_level");
48 | 		
49 | 		$goapiaccess									= $astDB->getRowCount();
50 | 		$userlevel										= $fresults["user_level"];
51 | 		
52 | 		if ($goapiaccess > 0 && $userlevel > 7) {
53 | 			if (is_array($campaigns)) {
54 | 				$data 									= $astDB
55 | 					->where("campaign_id", $campaigns, "IN")
56 | 					->getValue("vicidial_campaign_stats", "sum(dialable_leads)");
57 | 						
58 | 				$apiresults 							= array(
59 | 					"result" 								=> "success",
60 | 					//"query"								=> $astDB->getLastQuery(),
61 | 					"data" 									=> $data
62 | 				);
63 | 			}
64 | 		} else {
65 | 			$err_msg 									= error_handle("10001");
66 | 			$apiresults 								= array(
67 | 				"code" 										=> "10001", 
68 | 				"result" 									=> $err_msg
69 | 			);		
70 | 		}
71 | 	}
72 | 
73 | ?>
74 | 


--------------------------------------------------------------------------------
/goDashboard/goGetTotalNumberOfAgents.php:
--------------------------------------------------------------------------------
 1 | 
 7 |  * @author     	Chris Lomuntad  
 8 |  *
 9 |  * @par License:
10 |  *  This program is free software: you can redistribute it and/or modify
11 |  *  it under the terms of the GNU Affero General Public License as published by
12 |  *  the Free Software Foundation, either version 3 of the License, or
13 |  *  (at your option) any later version.
14 |  *
15 |  *  This program is distributed in the hope that it will be useful,
16 |  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17 |  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 |  *  GNU Affero General Public License for more details.
19 |  *
20 |  *  You should have received a copy of the GNU Affero General Public License
21 |  *  along with this program.  If not, see .
22 | */
23 | 
24 |     $groupId = go_get_groupid($session_user, $astDB);
25 |     
26 |     if (checkIfTenant($groupId, $goDB)) {
27 |         $ul='';
28 |     } else { 
29 |         $ul = "AND user_group='$groupId'";
30 |     }
31 | 
32 |     $query = "select count(user) as num_seats from vicidial_users where user_level < '4' and user NOT IN ('VDAD','VDCL', 'goAPI','goautodial') $ul";
33 |     $fresults = $astDB->rawQuery($query);
34 |     //$fresults = mysqli_fetch_assoc($rsltv);
35 |     $apiresults = array_merge( array( "result" => "success" ), $fresults );
36 | ?>
37 | 


--------------------------------------------------------------------------------
/goDashboard/goGetURLResources.php:
--------------------------------------------------------------------------------
 1 | 
 7 |  * @author     	Chris Lomuntad  
 8 |  *
 9 |  * @par License:
10 |  *  This program is free software: you can redistribute it and/or modify
11 |  *  it under the terms of the GNU Affero General Public License as published by
12 |  *  the Free Software Foundation, either version 3 of the License, or
13 |  *  (at your option) any later version.
14 |  *
15 |  *  This program is distributed in the hope that it will be useful,
16 |  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17 |  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 |  *  GNU Affero General Public License for more details.
19 |  *
20 |  *  You should have received a copy of the GNU Affero General Public License
21 |  *  along with this program.  If not, see .
22 | */
23 |     
24 |     $groupId = go_get_groupid($goUser, $astDB);
25 |     
26 |     if (!checkIfTenant($groupId, $goDB)) {
27 |         //$ul='';
28 |     } else { 
29 |         //$ul = "AND user_group='$groupId'";
30 |         $astDB->where('user_group', $groupId);
31 |     }
32 | 
33 |     //$query = "select count(user) as num_seats from vicidial_users where user_level < '4' and user NOT IN ('VDAD','VDCL') $ul";
34 |     $astDB->where('user_level', '4', '<');
35 |     $astDB->where('user', array('VDAD', 'VDCL'), 'not in');
36 |     $fresults = $astDB->get('vicidial_users', null, 'COUNT(user) AS num_seats');
37 |     //$fresults = mysql_fetch_assoc($rsltv);
38 |     $apiresults = array_merge( array( "result" => "success" ), $fresults );
39 | ?>
40 | 


--------------------------------------------------------------------------------
/goDialStatus/goAPI.php:
--------------------------------------------------------------------------------
1 | ../goAPI.php


--------------------------------------------------------------------------------
/goDialStatus/goGetAllCampaignDialStatuses.php:
--------------------------------------------------------------------------------
 1 | 
 7 |  * @author     	Alexander Jim Abenoja  
 8 |  *
 9 |  * @par License:
10 |  *  This program is free software: you can redistribute it and/or modify
11 |  *  it under the terms of the GNU Affero General Public License as published by
12 |  *  the Free Software Foundation, either version 3 of the License, or
13 |  *  (at your option) any later version.
14 |  *
15 |  *  This program is distributed in the hope that it will be useful,
16 |  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17 |  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 |  *  GNU Affero General Public License for more details.
19 |  *
20 |  *  You should have received a copy of the GNU Affero General Public License
21 |  *  along with this program.  If not, see .
22 | */
23 | 
24 |     //$campaign_id = $astDB->escape($_REQUEST['campaign_id']);
25 |     
26 |     //$query = "SELECT status,status_name
27 |     //        FROM vicidial_campaign_statuses 
28 |     //        WHERE campaign_id='$campaign_id'
29 |     //        ORDER BY status";
30 | 	$astDB->where('campaign_id', $campaign_id);
31 | 	$astDB->orderBy('status', 'desc');
32 |    	$rsltv = $astDB->get('vicidial_campaign_statuses', null, 'status,status_name');
33 |     
34 |     foreach ($rsltv as $fresults){
35 | 		$dataStatus[] = $fresults['status'];
36 |        	$dataStatusName[] = $fresults['status_name'];
37 |    		$apiresults = array(
38 | 			"result" => "success",
39 | 			"status" => $dataStatus,
40 | 			"status_name" => $dataStatusName,
41 | 			"test" => $query
42 | 		);
43 | 	}
44 | ?>
45 | 


--------------------------------------------------------------------------------
/goDispositions/goAPI.php:
--------------------------------------------------------------------------------
1 | ../goAPI.php


--------------------------------------------------------------------------------
/goFilters/goAPI.php:
--------------------------------------------------------------------------------
1 | ../goAPI.php


--------------------------------------------------------------------------------
/goGetLeads/goAPI.php:
--------------------------------------------------------------------------------
1 | ../goAPI.php


--------------------------------------------------------------------------------
/goHotkeys/goAPI.php:
--------------------------------------------------------------------------------
1 | ../goAPI.php


--------------------------------------------------------------------------------
/goHotkeys/goEditHotkey.php:
--------------------------------------------------------------------------------
 1 | 
 7 |  * @author      Alexander Jim Abenoja  
 8 |  *
 9 |  * @par License:
10 |  *  This program is free software: you can redistribute it and/or modify
11 |  *  it under the terms of the GNU Affero General Public License as published by
12 |  *  the Free Software Foundation, either version 3 of the License, or
13 |  *  (at your option) any later version.
14 |  *
15 |  *  This program is distributed in the hope that it will be useful,
16 |  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17 |  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 |  *  GNU Affero General Public License for more details.
19 |  *
20 |  *  You should have received a copy of the GNU Affero General Public License
21 |  *  along with this program.  If not, see .
22 | */
23 | 
24 |   $campaign_id = $_REQUEST['campaign_id'];
25 | 
26 |   $astDB->where('campaign_id', $campaign_id);
27 |   $astDB->orderBy('hotkey');
28 |   $hotkeys = $astDB->get('vicidial_campaign_hotkeys', null, 'status,hotkey,status_name');
29 |   
30 |   foreach($hotkeys as $fresults){
31 | 	  $dataHotkey[]   = $fresults['hotkey'];
32 | 	}
33 |   
34 |   $apiresults = array(
35 |     "result"        => "success",
36 |     "hotkey"        => $dataHotkey
37 |   );
38 | ?>


--------------------------------------------------------------------------------
/goInbound/goAPI.php:
--------------------------------------------------------------------------------
1 | ../goAPI.php


--------------------------------------------------------------------------------
/goInbound/goCheckDID.php:
--------------------------------------------------------------------------------
 1 | 
 7 |  *
 8 |  * @par License:
 9 |  *  This program is free software: you can redistribute it and/or modify
10 |  *  it under the terms of the GNU Affero General Public License as published by
11 |  *  the Free Software Foundation, either version 3 of the License, or
12 |  *  (at your option) any later version.
13 |  *
14 |  *  This program is distributed in the hope that it will be useful,
15 |  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16 |  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 |  *  GNU Affero General Public License for more details.
18 |  *
19 |  *  You should have received a copy of the GNU Affero General Public License
20 |  *  along with this program.  If not, see .
21 | */
22 |     
23 |   include_once ("goAPI.php");
24 | 
25 |   // POST or GET Variables
26 |   $did_pattern = $astDB->escape($_REQUEST['did_pattern']);
27 | 
28 |   $astDB->where("did_pattern", $did_pattern);
29 |   $rowdf = $astDB->getValue("vicidial_inbound_dids", "count(*)");
30 |   //$stmtdf = "SELECT did_pattern from vicidial_inbound_dids where did_pattern='$did_pattern';";
31 |   
32 |   if ($rowdf > 0) {
33 |     $apiresults = array("result" => "
DID NOT ADDED - DID already exist.\n"); 34 | } else { 35 | $apiresults = array("result" => "success"); 36 | } 37 | ?> -------------------------------------------------------------------------------- /goInbound/goCheckIVR.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * @par License: 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Affero General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Affero General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Affero General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | include_once ("goAPI.php"); 24 | 25 | // POST or GET Variables 26 | $menu_id = $astDB->escape($_REQUEST['menu_id']); 27 | 28 | $astDB->where("menu_id", $menu_id); 29 | $row = $astDB->getValue("vicidial_call_menu", "count(*)"); 30 | //$stmtCheck = "SELECT menu_id from vicidial_call_menu where menu_id='$menu_id';"; 31 | 32 | if ($row > 0) { 33 | $apiresults = array("result" => "Error: CALL MENU NOT ADDED - there is already a CALL MENU in the system with this ID"); 34 | }else{ 35 | $apiresults = array("result" => "success"); 36 | } 37 | ?> -------------------------------------------------------------------------------- /goInbound/goCheckIngroup.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * @par License: 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Affero General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Affero General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Affero General Public License 20 | * along with this program. If not, see . 21 | */ 22 | include_once ("goAPI.php"); 23 | 24 | // POST or GET Variables 25 | $group_id = $astDB->escape($_REQUEST['group_id']); 26 | 27 | $astDB->where("group_id", $group_id); 28 | $row = $astDB->getValue("vicidial_inbound_groups", "count(*)"); 29 | //$stmtCheck = "SELECT group_id from vicidial_inbound_groups where group_id='$group_id';"; 30 | 31 | if ($row > 0) { 32 | $apiresults = array("result" => "GROUP NOT ADDED - there is already a Inbound in the system with this ID\n"); 33 | } else { 34 | $apiresults = array("result" => "success"); 35 | } 36 | 37 | ?> -------------------------------------------------------------------------------- /goInbound/goDeleteIVR.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Alexander Jim Abenoja 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | 24 | include_once ("goAPI.php"); 25 | 26 | // POST or GET Variables 27 | $menu_id = $astDB->escape($_REQUEST['menu_id']); 28 | 29 | if (empty($log_user) || is_null($log_user)) { 30 | $apiresults = array( 31 | "result" => "Error: Session User Not Defined." 32 | ); 33 | } elseif (empty($menu_id) || is_null($menu_id)) { 34 | $apiresults = array( 35 | "result" => "Error: Set a value for Menu ID." 36 | ); 37 | } else { 38 | if (checkIfTenant($log_group, $goDB)) { 39 | $astDB->where("user_group", $log_group); 40 | } else { 41 | if (strtoupper($log_group) != 'ADMIN') { 42 | if ($user_level > 8) { 43 | $astDB->where("user_group", $log_group); 44 | } 45 | } 46 | } 47 | 48 | $astDB->where("menu_id", $menu_id); 49 | $astDB->where("menu_id", "defaultlog", "!="); 50 | $astDB->getOne("vicidial_call_menu"); 51 | 52 | if ($astDB->count > 0) { 53 | $astDB->where("menu_id", $menu_id); 54 | $astDB->delete("vicidial_call_menu"); 55 | 56 | $log_id = log_action($goDB, 'DELETE', $log_user, $log_ip, "Deleted call menu ID: $menu_id", $log_group, $astDB->getLastQuery()); 57 | 58 | $astDB->where("menu_id", $menu_id); 59 | $astDB->delete("vicidial_call_menu_options"); 60 | 61 | $log_id = log_action($goDB, 'DELETE', $log_user, $log_ip, "Deleted call menu ID: $menu_id", $log_group, $astDB->getLastQuery()); 62 | 63 | $apiresults = array( 64 | "result" => "success" 65 | ); 66 | } else { 67 | $apiresults = array( 68 | "result" => "Error: Call menu doesn't exist or insufficient rights." 69 | ); 70 | } 71 | } 72 | ?> 73 | -------------------------------------------------------------------------------- /goInbound/goGetCampaignDID.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Alexander Jim Abenoja 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | 24 | include_once("goAPI.php"); 25 | 26 | $campaign_id = $_REQUEST['campaign_id']; 27 | 28 | if(empty($campaign_id)){ 29 | $apiresults = array("result" => "Error: Set a value for campaign_id."); 30 | }else{ 31 | $cols = Array("did_id", "did_pattern", "did_description", "did_actived", "did_route"); 32 | $astDB->where("campaign_id", $campaign_id); 33 | $query = $astDB->get("vicidial_inbound_dids", NULL, $cols); 34 | 35 | //$query = "SELECT did_id,did_pattern,did_description,did_active,did_route FROM vicidial_inbound_dids WHERE campaign_id = '$campaign_id' ORDER BY did_pattern"; 36 | 37 | foreach($query as $fresults){ 38 | $dataDidID[] = $fresults['did_id']; 39 | $dataDidPattern[] = $fresults['did_pattern']; 40 | $dataDidDescription[] = $fresults['did_description']; 41 | $dataActive[] = $fresults['did_active']; 42 | $dataDidRoute[] = $fresults['did_route']; 43 | } 44 | $apiresults = array( 45 | "result" => "success", 46 | "did_id" => $dataDidID, 47 | "did_pattern" => $dataDidPattern, 48 | "did_description" => $dataDidDescription, 49 | "active" => $dataActive, 50 | "did_route" => $dataDidRoute 51 | ); 52 | } 53 | 54 | 55 | ?> -------------------------------------------------------------------------------- /goInbound/index.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goautodial/goAPIv2/4dff4ef89d40557b0cabfbd63811540a8e8a932b/goInbound/index.php -------------------------------------------------------------------------------- /goLeadFilters/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goLeadFilters/goDeleteLeadFilter.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Chris Lomuntad 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | include_once ("goAPI.php"); 24 | 25 | ### POST or GET Variables 26 | $lead_filter_id = $astDB->escape($_REQUEST['lead_filter_id']); 27 | 28 | ### Check lead filter ID if its null or empty 29 | if($lead_filter_id == null) { 30 | $apiresults = array("result" => "Error: Set a value for Lead Filter ID."); 31 | } else { 32 | $groupId = go_get_groupid($goUser, $astDB); 33 | 34 | if (!checkIfTenant($groupId, $goDB)) { 35 | //$ul = ""; 36 | } else { 37 | //$ul = "AND user_group='$groupId'"; 38 | //$addedSQL = "WHERE user_group='$groupId'"; 39 | $astDB->where('user_group', $groupId); 40 | } 41 | //$query = "SELECT lead_filter_id FROM vicidial_lead_filters $ul where lead_filter_id='$lead_filter_id';"; 42 | $astDB->where('lead_filter_id', $lead_filter_id); 43 | $rsltv = $astDB->get('vicidial_lead_filters'); 44 | $countResult = $astDB->getRowCount(); 45 | 46 | if($countResult > 0) { 47 | $dataLeadFilterID = $lead_filter_id; 48 | 49 | if(!$dataLeadFilterID == null) { 50 | //$deleteQuery = "DELETE FROM vicidial_lead_filters WHERE lead_filter_id='$dataLeadFilterID';"; 51 | $astDB->where('lead_filter_id', $dataLeadFilterID); 52 | $deleteResult = $astDB->delete('vicidial_lead_filters'); 53 | 54 | $log_id = log_action($goDB, 'DELETE', $log_user, $log_ip, "Deleted Lead Filter ID: $dataLeadFilterID", $log_group, $astDB->getLastQuery()); 55 | $apiresults = array("result" => "success"); 56 | } else { 57 | $apiresults = array("result" => "Error: Lead Filter doesn't exist."); 58 | } 59 | } else { 60 | $apiresults = array("result" => "Error: Lead Filter doesn't exist."); 61 | } 62 | }//end 63 | ?> -------------------------------------------------------------------------------- /goLeadFilters/goGetAllLeadFilters.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Chris Lomuntad 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | include_once ("goAPI.php"); 24 | 25 | $groupId = go_get_groupid($goUser, $astDB); 26 | 27 | if (!checkIfTenant($groupId, $goDB)) { 28 | //$ul = ""; 29 | } else { 30 | //$ul = "AND user_group='$groupId'"; 31 | //$addedSQL = "WHERE user_group='$groupId'"; 32 | $astDB->where('user_group', $groupId); 33 | } 34 | 35 | 36 | //$query = "SELECT lead_filter_id,lead_filter_name FROM vicidial_lead_filters $ul $addedSQL ORDER BY lead_filter_id;"; 37 | $astDB->orderBy('lead_filter_id', 'desc'); 38 | $rsltv = $astDB->get('vicidial_lead_filters', null, 'lead_filter_id,lead_filter_name'); 39 | 40 | foreach ($rsltv as $fresults){ 41 | $dataLeadFilterID[] = $fresults['lead_filter_id']; 42 | $dataLeadFilterName[] = $fresults['lead_filter_name']; 43 | $apiresults = array("result" => "success", "lead_filter_id" => $dataLeadFilterID, "lead_filter_name" => $dataLeadFilterName); 44 | } 45 | ?> -------------------------------------------------------------------------------- /goLeadFilters/goGetLeadFilterInfo.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Chris Lomuntad 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | include_once ("goAPI.php"); 24 | 25 | $lead_filter_id = $astDB->escape($_REQUEST["lead_filter_id"]); 26 | 27 | if($lead_filter_id == null) { 28 | $apiresults = array("result" => "Error: Set a value for Lead Filter ID."); 29 | } else { 30 | $groupId = go_get_groupid($goUser, $astDB); 31 | 32 | if (!checkIfTenant($groupId, $goDB)) { 33 | //$ul = ""; 34 | } else { 35 | //$ul = "AND user_group='$groupId'"; 36 | //$addedSQL = "WHERE user_group='$groupId'"; 37 | $astDB->where('user_group', $groupId); 38 | } 39 | 40 | 41 | //$query = "SELECT lead_filter_id,lead_filter_name FROM vicidial_lead_filters where lead_filter_id='$lead_filter_id' $ul $addedSQL ORDER BY lead_filter_id LIMIT 1;"; 42 | $astDB->where('lead_filter_id', $lead_filter_id); 43 | $astDB->orderBy('lead_filter_id', 'desc'); 44 | $rsltv = $astDB->getOne('vicidial_lead_filters', 'lead_filter_id,lead_filter_name'); 45 | $exist = $astDB->getRowCount(); 46 | if($exist >= 1){ 47 | foreach ($rsltv as $fresults){ 48 | $dataLeadFilterID[] = $fresults['lead_filter_id']; 49 | $dataLeadFilterName[] = $fresults['lead_filter_name']; 50 | $apiresults = array("result" => "success", "lead_filter_id" => $dataLeadFilterID, "lead_filter_name" => $dataLeadFilterName); 51 | } 52 | } else { 53 | $apiresults = array("result" => "Error: Lead Filter does not exist."); 54 | } 55 | } 56 | ?> -------------------------------------------------------------------------------- /goLeadRecycling/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goLeadRecycling/goGetLeadRecycleInfo.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Chris Lomuntad 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | include_once ("goAPI.php"); 24 | 25 | $campaign_id = $astDB->escape($_REQUEST['campaign_id']); 26 | $status = $astDB->escape($_REQUEST['status']); 27 | 28 | $groupId = go_get_groupid($session_user, $astDB); 29 | $check_usergroup = go_check_usergroup_campaign($astDB, $groupId, $campaign_id); 30 | 31 | if(empty($campaign_id) || empty($status) || empty($session_user)) { 32 | $err_msg = error_handle("40001", "campaign_id, session_user and status"); 33 | $apiresults = array("code" => "40001", "result" => $err_msg); 34 | } elseif($check_usergroup <= 0){ 35 | $apiresults = array("result" => "Error: Usergroup error. You don't have permission to access this feature."); 36 | }else { 37 | //$query = "SELECT * FROM vicidial_lead_recycle WHERE campaign_id='$campaign_id' AND status='$status' ORDER BY status LIMIT 1;"; 38 | $astDB->where('campaign_id', $campaign_id); 39 | $astDB->where('status', $status); 40 | $astDB->orderBy('status', 'desc'); 41 | $rsltv = $astDB->getOne('vicidial_lead_recycle'); 42 | $exist = $astDB->getRowCount(); 43 | 44 | if($exist >= 1) { 45 | foreach ($rsltv as $fresults){ 46 | $dataCampID[] = $fresults['campaign_id']; 47 | $dataStatus[] = $fresults['status']; 48 | $dataAttemptDelay[] = $fresults['attempt_delay']; 49 | $dataAttemptMax[] = $fresults['attempt_maximum']; 50 | $dataActive[] = $fresults['active']; 51 | } 52 | $apiresults = array("result" => "success", "campaign_id" => $dataCampID, "status" => $dataStatus, "attempt_delay" => $dataAttemptDelay, "attempt_maximum" => $dataAttemptMax, "active" => $dataActive); 53 | } else { 54 | $apiresults = array("result" => "Error: Lead Filter does not exist."); 55 | } 56 | } 57 | ?> 58 | -------------------------------------------------------------------------------- /goLists/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goLists/goAddDeleteDNC.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goautodial/goAPIv2/4dff4ef89d40557b0cabfbd63811540a8e8a932b/goLists/goAddDeleteDNC.php -------------------------------------------------------------------------------- /goLists/goListExportCountRows.php: -------------------------------------------------------------------------------- 1 | License: 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Affero General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Affero General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Affero General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | ini_set('memory_limit', '2048M'); 24 | include_once ("goAPI.php"); 25 | 26 | $list_id = $astDB->escape($_REQUEST["list_id"]); 27 | 28 | // Error Checking 29 | if (empty($goUser) || is_null($goUser)) { 30 | $apiresults = array( 31 | "result" => "Error: goAPI User Not Defined." 32 | ); 33 | } elseif (empty($goPass) || is_null($goPass)) { 34 | $apiresults = array( 35 | "result" => "Error: goAPI Password Not Defined." 36 | ); 37 | } elseif (empty($log_user) || is_null($log_user)) { 38 | $apiresults = array( 39 | "result" => "Error: Session User Not Defined." 40 | ); 41 | } elseif (empty($list_id) || is_null($list_id)) { 42 | $err_msg = error_handle("10107"); 43 | $apiresults = array( 44 | "code" => "10107", 45 | "result" => $err_msg 46 | ); 47 | } else { 48 | 49 | $result = $astDB->where('list_id', $list_id) 50 | ->getOne("vicidial_list", "count(lead_id) as row_count"); 51 | 52 | $apiresults = array( 53 | "result" => "success", 54 | "row_count" => $result['row_count'] 55 | ); 56 | } 57 | 58 | 59 | ?> 60 | 61 | -------------------------------------------------------------------------------- /goLoadLeads/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goLoadLeads/goDeleteList.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Chris Lomuntad 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | include_once ("goAPI.php"); 24 | 25 | ### POST or GET Variables 26 | $list_id = $astDB->escape($_REQUEST['list_id']); 27 | 28 | if($list_id == null) { 29 | $apiresults = array("result" => "Error: Set a value for List ID."); 30 | } else { 31 | $groupId = go_get_groupid($goUser, $astDB); 32 | if (!checkIfTenant($groupId, $goDB)) { 33 | //$ul = "WHERE list_id='$list_id'"; 34 | $astDB->where('list_id', $list_id); 35 | } else { 36 | //$ul = "WHERE list_id='$list_id' AND user_group='$groupId'"; 37 | $astDB->where('list_id', $list_id); 38 | $astDB->where('user_group', $groupId); 39 | } 40 | 41 | //$query = "SELECT list_id,list_name FROM vicidial_lists $ul order by list_id LIMIT 1"; 42 | $astDB->orderBy('list_id', 'desc'); 43 | $rsltv = $astDB->getOne('vicidial_lists', 'list_id,list_name'); 44 | $countResult = $astDB->getRowCount(); 45 | 46 | if($countResult > 0) { 47 | $dataListID = $rsltv['list_id']; 48 | 49 | if(!$dataListID == null) { 50 | $deleteQuery = "DELETE FROM vicidial_lists WHERE list_id='$dataListID';"; 51 | $deleteResult = $astDB->rawQuery($deleteQuery); 52 | $deleteQueryLeads = "DELETE FROM vicidial_list WHERE list_id='$dataListID';"; 53 | $deleteResultLeads = $astDB->rawQuery($deleteQueryLeads); 54 | $deleteQueryStmt = "DELETE FROM vicidial_lists_fields WHERE list_id='$dataListID' LIMIT 1;"; 55 | $deleteResultStmt = $astDB->rawQuery($deleteQueryStmt); 56 | 57 | $log_id = log_action($goDB, 'DELETE', $log_user, $log_ip, "Deleted List ID: $dataListID", $log_group, $deleteQuery); 58 | $apiresults = array("result" => "success"); 59 | } else { 60 | $apiresults = array("result" => "Error: List doesn't exist."); 61 | } 62 | } else { 63 | $apiresults = array("result" => "Error: List doesn't exist."); 64 | } 65 | }//end 66 | ?> -------------------------------------------------------------------------------- /goLoadLeads/goGetAllLists.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Chris Lomuntad 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | include_once ("goAPI.php"); 24 | 25 | $limit = $astDB->escape($_REQUEST['limit']); 26 | if($limit < 1){ $limit = 20; } else { $limit = $limit; } 27 | 28 | $groupId = go_get_groupid($goUser, $astDB); 29 | 30 | if (!checkIfTenant($groupId, $goDB)) { 31 | $ul=''; 32 | } else { 33 | $ul = "WHERE user_group='$groupId'"; 34 | } 35 | 36 | $query = "SELECT list_id,list_name,list_description,(SELECT count(*) AS tally FROM vicidial_list WHERE list_id = vicidial_lists.list_id) AS tally,active,list_lastcalldate,campaign_id,reset_time FROM vicidial_lists $wherecampaigns ORDER BY list_id LIMIT $limit"; 37 | $rsltv = $astDB->rawQuery($query); 38 | foreach ($rsltv as $fresults){ 39 | $dataListId[] = $fresults['list_id']; 40 | $dataListName[] = $fresults['list_name']; 41 | $dataActive[] = $fresults['active']; 42 | $dataListLastcallDate[] = $fresults['list_lastcalldate']; 43 | $dataTally[] = $fresults['tally']; 44 | $dataCampaignId[] = $fresults['campaign_id']; 45 | 46 | $apiresults = array( "result" => "success", "list_id" => $dataListId, "list_name" => $dataListName, "active" => $dataActive, "list_lastcalldate" => $dataListLastcallDate, "tally" => $dataTally, "campaign_id" => $dataCampaignId); 47 | } 48 | ?> -------------------------------------------------------------------------------- /goLoadLeads/goGetListInfo.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Chris Lomuntad 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | include_once ("goAPI.php"); 24 | 25 | ### POST or GET Variables 26 | $list_id = $astDB->escape($_REQUEST['list_id']); 27 | 28 | if($list_id == null) { 29 | $apiresults = array("result" => "Error: Set a value for List ID."); 30 | } else { 31 | $groupId = go_get_groupid($goUser, $astDB); 32 | 33 | if (!checkIfTenant($groupId, $goDB)) { 34 | $ul = "WHERE list_id='$list_id'"; 35 | } else { 36 | $ul = "WHERE list_id='$list_id' AND user_group='$groupId'"; 37 | } 38 | 39 | $query = "SELECT list_id,list_name,list_description,(SELECT count(*) AS tally FROM vicidial_list WHERE list_id = vicidial_lists.list_id) AS tally,active,list_lastcalldate,campaign_id,reset_time FROM vicidial_lists $ul ORDER BY list_id LIMIT 1"; 40 | $rsltv = $astDB->rawQuery($query); 41 | $countResult = $astDB->getRowCount(); 42 | 43 | if($countResult > 0) { 44 | foreach ($rsltv as $fresults){ 45 | $dataListId[] = $fresults['list_id']; 46 | $dataListName[] = $fresults['list_name']; 47 | $dataActive[] = $fresults['active']; 48 | $dataListLastcallDate[] = $fresults['list_lastcalldate']; 49 | $dataTally[] = $fresults['tally']; 50 | $dataCampaignId[] = $fresults['campaign_id']; 51 | 52 | $apiresults = array( "result" => "success", "list_id" => $dataListId, "list_name" => $dataListName, "active" => $dataActive, "list_lastcalldate" => $dataListLastcallDate, "tally" => $dataTally, "campaign_id" => $dataCampaignId); 53 | } 54 | 55 | $log_id = log_action($goDB, 'VIEW', $log_user, $log_ip, "Viewed the info of List ID: $list_id", $log_group); 56 | } else { 57 | $apiresults = array("result" => "Error: List doesn't exist."); 58 | } 59 | } 60 | ?> -------------------------------------------------------------------------------- /goLocations/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goLocations/goDeleteLocation.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * @par License: 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Affero General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Affero General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Affero General Public License 20 | * along with this program. If not, see . 21 | */ 22 | include_once ("goAPI.php"); 23 | 24 | // POST or GET Variables 25 | $location = $goDB->escape($_REQUEST['location']); 26 | 27 | if($location == null) { 28 | $err_msg = error_handle("40001"); 29 | $APIResult = array("code" => "40001", "result" => $err_msg); 30 | } else { 31 | $groupId = go_get_groupid($goUser, $astDB); 32 | 33 | $goDB->where('name', $location); 34 | if (checkIfTenant($groupId, $goDB)) { 35 | $goDB->where('user_group', $groupId); 36 | } 37 | 38 | //$query = "SELECT user_group FROM vicidial_user_groups $ul ORDER BY user_group LIMIT 1;"; 39 | $goDB->orderBy('name', 'desc'); 40 | $rsltv = $goDB->getOne('locations', 'name'); 41 | $countResult = $goDB->getRowCount(); 42 | 43 | if($countResult > 0) { 44 | $dataLocation = $rsltv['name']; 45 | 46 | if(!is_null($dataLocation)) { 47 | $goDB->where('name', $dataLocation); 48 | $rsltD = $goDB->delete('locations'); 49 | $deleteQuery = $goDB->getLastQuery(); 50 | } else { 51 | $err_msg = error_handle("10010"); 52 | $APIResult = array("code" => "10010", "result" => $err_msg); 53 | } 54 | } else { 55 | $err_msg = error_handle("41004", "location. Does not exist"); 56 | $APIResult = array("code" => "41004", "result" => $err_msg); 57 | } 58 | 59 | //$query = "SELECT user_group FROM vicidial_user_groups $ul ORDER BY user_group LIMIT 1;"; 60 | $goDB->where('name', $location); 61 | $goDB->orderBy('name', 'desc'); 62 | $rsltv = $goDB->getOne('locations', 'name'); 63 | $countResult = $goDB->getRowCount(); 64 | 65 | if($countResult > 0) { 66 | $err_msg = error_handle("41004", "location"); 67 | $APIResult = array("code" => "41004", "result" => $err_msg); 68 | } else { 69 | $APIResult = array("result" => "success"); 70 | $log_id = log_action($goDB, 'DELETE', $log_user, log_ip, "Deleted User Group: $dataUserGroup", $log_group, $deleteQuery); 71 | } 72 | }//end 73 | ?> 74 | -------------------------------------------------------------------------------- /goLocations/goGetLocationInfo.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * @par License: 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Affero General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Affero General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Affero General Public License 20 | * along with this program. If not, see . 21 | */ 22 | include_once ("goAPI.php"); 23 | 24 | ### POST or GET Variables 25 | $location = $astDB->escape($_REQUEST['location']); 26 | 27 | if($location == null) { 28 | $APIResult = array("code" => "41004", "result" => "Error: Set a value for Location."); 29 | } else { 30 | $groupId = go_get_groupid($goUser, $astDB); 31 | 32 | $goDB->where('name', $location); 33 | if (checkIfTenant($groupId, $goDB)) { 34 | $goDB->where('user_group', $groupId); 35 | } 36 | 37 | //$query = "SELECT user_group,group_name,forced_timeclock_login,shift_enforcement,allowed_campaigns FROM vicidial_user_groups $ul ORDER BY user_group LIMIT 1;"; 38 | $goDB->orderBy('name', 'desc'); 39 | $rsltv = $goDB->getOne('locations', 'id,name,description,user_group,active,date_add,date_edit'); 40 | $countResult = $goDB->getRowCount(); 41 | $data = $rsltv; 42 | 43 | $log_id = log_action($goDB, 'VIEW', $log_user, $log_ip, "Viewed the info of Location: $location", $log_group); 44 | 45 | $APIResult = array("result" => "success", "data" => $data); 46 | } 47 | ?> 48 | -------------------------------------------------------------------------------- /goLocations/goGetLocationsList.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * @par License: 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Affero General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Affero General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Affero General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | $limit = $goDB->escape($_REQUEST['limit']); 24 | if($limit < 1){ $limit = 100; } else { $limit = $limit; } 25 | 26 | //$groupId = go_get_groupid($session_user); 27 | $groupId = $goDB->escape($_REQUEST['user_group']); 28 | 29 | if(!checkIfTenant($groupId, $goDB) && $groupId !== "ADMIN") { 30 | $goDB->where('user_group', $groupId); 31 | } 32 | 33 | $goDB->orderBy('name', 'desc'); 34 | $rsltv = $goDB->get('locations', $limit, 'id,name,description,user_group,active'); 35 | 36 | foreach ($rsltv as $row) { 37 | $dataLocationID[] = $row['id']; 38 | $dataLocation[] = $row['name']; 39 | $dataDescription[] = $row['description']; 40 | $dataUserGroup[] = $row['user_group']; 41 | $dataActive[] = $row['active']; 42 | } 43 | $APIResult = array("result" => "success", "location_id" => $dataLocationID, "location" => $dataLocation, "description" => $dataDescription, "user_group" => $dataUserGroup, "active" => $dataActive); 44 | 45 | ?> 46 | -------------------------------------------------------------------------------- /goLocations/goGetUnassignedAgents.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * @par License: 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Affero General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Affero General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Affero General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | if (isset($_GET['location'])) { $location = $astDB->escape($_GET['location']); } 24 | else if (isset($_POST['location'])) { $location = $astDB->escape($_POST['location']); } 25 | if (isset($_GET['agent'])) { $agent = $astDB->escape($_GET['agent']); } 26 | else if (isset($_POST['agent'])) { $agent = $astDB->escape($_POST['agent']); } 27 | if (isset($_GET['active'])) { $active = $astDB->escape($_GET['active']); } 28 | else if (isset($_POST['active'])) { $active = $astDB->escape($_POST['active']); } 29 | 30 | if (!is_null($location) && $location !== '') { 31 | $goDB->where('locations.name', $location); 32 | } 33 | if (!is_null($agent) && $agent !== '') { 34 | $goDB->where('users.name', $agent); 35 | } 36 | if (!is_null($active) && $active !== '') { 37 | $goDB->where("vu.active", $active); 38 | } 39 | $goDB->where('users.user_group', 'AGENTS'); 40 | $goDB->join('locations', 'users.location_id=locations.id', 'LEFT'); 41 | $goDB->join("`$VARDB_database`.vicidial_users AS vu", 'vu.user_id=users.userid', 'LEFT'); 42 | $rsltv = $goDB->get('users', null, 'users.userid,users.name,users.fullname,locations.name AS location_name, role, locations.id AS location_id'); 43 | 44 | $dataUserID = []; 45 | $dataName = []; 46 | $dataFullName = []; 47 | $dataLocation = []; 48 | $dataRole = []; 49 | foreach ($rsltv as $row) { 50 | $dataUserID[] = $row['userid']; 51 | $dataLocationID[] = $row['location_id']; 52 | $dataName[] = $row['name']; 53 | $dataFullName[] = $row['fullname']; 54 | $dataLocation[] = $row['location_name']; 55 | $dataRole[] = $row['role']; 56 | } 57 | $APIResult = array("result" => "success", "user_id" => $dataUserID, "location_id" => $dataLocationID, "user" => $dataName, "full_name" => $dataFullName, "location_name" => $dataLocation, "role" => $dataRole); 58 | 59 | ?> 60 | -------------------------------------------------------------------------------- /goLocations/goUnassignAgents.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * @par License: 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Affero General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Affero General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Affero General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | if (isset($_GET['unassigned'])) { $unassigned = $_GET['unassigned']; } 24 | else if (isset($_POST['unassigned'])) { $unassigned = $_POST['unassigned']; } 25 | 26 | if (isset($unassigned) && count($unassigned) > 0) { 27 | foreach ($unassigned as $unassign) { 28 | $astDB->where('id', $unassign); 29 | $astDB->delete('vicidial_campaign_agents'); 30 | } 31 | 32 | $APIResult = array("result" => "success"); 33 | } else { 34 | $APIResult = array("result" => "error"); 35 | } 36 | ?> -------------------------------------------------------------------------------- /goMultiTenant/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goMultiTenant/goGetMultiTenantInfo.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Chris Lomuntad 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | include_once ("goAPI.php"); 24 | 25 | ### POST or GET Variables 26 | $tenant_id = $astDB->escape($_REQUEST['tenant_id']); 27 | 28 | ### Check tenant_id if its null or empty 29 | if($tenant_id == null) { 30 | $apiresults = array("result" => "Error: Set a value for Tenant ID."); 31 | } else { 32 | $groupId = go_get_groupid($goUser, $astDB); 33 | 34 | if (!checkIfTenant($groupId, $goDB)) { 35 | //$ul = "WHERE tenant_id='$tenant_id'"; 36 | $goDB->where('tenant_id', $tenant_id); 37 | } else { 38 | //$ul = "WHERE tenant_id='$tenant_id' AND user_group='$groupId'"; 39 | $goDB->where('tenant_id', $tenant_id); 40 | $goDB->where('user_group', $groupId); 41 | } 42 | 43 | //$query = "SELECT tenant_id,tenant_name,active FROM go_multi_tenant $ul ORDER BY tenant_id LIMIT 1;"; 44 | $goDB->orderBy('tenant_id', 'desc'); 45 | $rsltv = $goDB->getOne('go_multi_tenant', 'tenant_id,tenant_name,active'); 46 | $countResult = $goDB->getRowCount(); 47 | 48 | if($countResult > 0) { 49 | foreach ($rsltv as $fresults){ 50 | $dataTenantId[] = $fresults['tenant_id']; 51 | $dataTenantName[] = $fresults['tenant_name'];// .$fresults['dial_method'].$fresults['active']; 52 | //$dataDialMethod[] = $fresults['active']; 53 | $dataActive[] = $fresults['active']; 54 | 55 | //$query1 = "SELECT count(*) as cnt FROM vicidial_users WHERE user_group='{$fresults['tenant_id']}' AND user_level < '7';"; 56 | $astDB->where('user_group', $fresults['tenant_id']); 57 | $astDB->where('user_level', 7, '<'); 58 | $rsltv1 = $astDB->get('vicidial_users'); 59 | $dataCount = $astDB->getRowCount(); 60 | 61 | $apiresults = array("result" => "success", "cnt" => $dataCount, "tenant_id" => $dataTenantId, "tenant_name" => $dataTenantName, "active" => $dataActive); 62 | } 63 | } else { 64 | $apiresults = array("result" => "Error: Tenant doesn't exist."); 65 | } 66 | } 67 | ?> -------------------------------------------------------------------------------- /goMultiTenant/goGetMultiTenantList.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Chris Lomuntad 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | include_once ("goAPI.php"); 24 | 25 | $limit = $astDB->escape($_REQUEST['limit']); 26 | if($limit < 1){ $limit = 20; } else { $limit = $limit; } 27 | 28 | $groupId = go_get_groupid($goUser, $astDB); 29 | 30 | if (!checkIfTenant($groupId, $goDB)) { 31 | //$ul=''; 32 | } else { 33 | //$ul = "WHERE user_group='$groupId'"; 34 | $goDB->where('user_group', $groupId); 35 | } 36 | 37 | //$query = "SELECT tenant_id,tenant_name,active FROM go_multi_tenant $ul ORDER BY tenant_id LIMIT $limit;"; 38 | $goDB->orderBy('tenant_id', 'desc'); 39 | $rsltv = $goDB->get('go_multi_tenant', $limit, 'tenant_id,tenant_name,active'); 40 | 41 | foreach ($rsltv as $fresults){ 42 | $dataTenantId[] = $fresults['tenant_id']; 43 | $dataTenantName[] = $fresults['tenant_name'];// .$fresults['dial_method'].$fresults['active']; 44 | //$dataDialMethod[] = $fresults['active']; 45 | $dataActive[] = $fresults['active']; 46 | 47 | //$query1 = "SELECT count(*) as cnt FROM vicidial_users WHERE user_group='{$fresults['tenant_id']}' AND user_level < '7';"; 48 | $astDB->where('user_group', $fresults['tenant_id']); 49 | $astDB->where('user_level', 7, '<'); 50 | $rsltv1 = $astDB->get('vicidial_users'); 51 | $dataCount = $astDB->getRowCount(); 52 | 53 | $apiresults = array("result" => "success", "cnt" => $dataCount, "tenant_id" => $dataTenantId, "tenant_name" => $dataTenantName, "active" => $dataActive); 54 | } 55 | ?> -------------------------------------------------------------------------------- /goMusicOnHold/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goMusicOnHold/goCheckMOH.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Chris Lomuntad 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | 24 | ### POST or GET Variables 25 | $moh_id = $astDB->escape($_REQUEST['moh_id']); 26 | 27 | //$queryCheck = "SELECT moh_id from vicidial_music_on_hold where moh_id='".$moh_id."';"; 28 | $astDB->where('moh_id', $moh_id); 29 | $sqlCheck = $astDB->get('vicidial_music_on_hold'); 30 | $countCheck = $astDB->getRowCount(); 31 | 32 | if($countCheck <= 0) { 33 | $apiresults = array("result" => "success"); 34 | } else { 35 | $apiresults = array("result" => "Error: Add failed, Music On Hold already already exist!"); 36 | } 37 | ?> -------------------------------------------------------------------------------- /goOSTicket/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goOSTicket/goDeleteTicket.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Chris Lomuntad 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | 24 | $ticketid = $ostDB->escape($_REQUEST['ticket_id']); 25 | 26 | if(!empty($ticketid)) { 27 | //delete from ticket table 28 | //$queryDeleteTicket = "DELETE FROM ost_ticket WHERE ticket_id='$ticketid';"; 29 | $ostDB->where('ticket_id', $ticketid); 30 | $resultDeleteTicket = $ostDB->delete('ost_ticket'); 31 | 32 | //get thread id 33 | //$queryGetThread = "SELECT * FROM ost_thread WHERE object_id='$ticketid';"; 34 | $ostDB->where('object_id', $ticketid); 35 | $resultThread = $ostDB->get('ost_thread'); 36 | foreach ($resultThread as $thread) { 37 | $threadid = $thread['id']; 38 | } 39 | 40 | if(!empty($threadid)) { 41 | //delete all thread from thread entry 42 | //$queryDeleteThreadEntry = "DELETE FROM ost_thread_entry WHERE thread_id='$threadid';"; 43 | $ostDB->where('thread_id', $threadid); 44 | $resultDeleteThreadEntry = $ostDB->delete('ost_thread_entry'); 45 | 46 | //delete from thread 47 | //$queryDeleteThread= "DELETE FROM ost_thread WHERE id='$threadid';"; 48 | $ostDB->where('id', $threadid); 49 | $resultDeleteThread = $ostDB->delete('ost_thread'); 50 | } 51 | 52 | $apiresults = array("result" => "success"); 53 | } else { 54 | $apiresults = array("result" => "Error: Ticket id not found."); 55 | } 56 | ?> -------------------------------------------------------------------------------- /goOSTicket/goEditTicket.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Chris Lomuntad 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | 24 | $goUser = $ostDB->escape($_REQUEST['goUser']); 25 | $ip_address = $ostDB->escape($_REQUEST['hostname']); 26 | $threadID = $ostDB->escape($_REQUEST['thread_id']); 27 | $title = $ostDB->escape($_REQUEST['title']); 28 | $body = $ostDB->escape($_REQUEST['body']); 29 | $date = date('Y-m-d H:i:s'); 30 | 31 | //update thread entry 32 | //$queryUpdateThreadEntry = "UPDATE vicidial_campaigns SET 33 | // title = '$title', 34 | // body = '$body', 35 | // updated = '$date' 36 | // WHERE thread_id='$threadID' LIMIT 1;"; 37 | $updateData = array( 38 | 'title' => $title, 39 | 'body' => $body, 40 | 'updated' => $date 41 | ); 42 | $ostDB->where('thread_id', $threadID); 43 | $resultUpdateThreadEntry = $ostDB->update('vicidial_campaigns', $updateData, 1); 44 | 45 | if($ostDB->getRowCount() > 0){ 46 | $apiresults = array("result" => "success"); 47 | }else{ 48 | $apiresults = array("result" => "Error: Something went wrong."); 49 | } 50 | ?> -------------------------------------------------------------------------------- /goOSTicket/goGetCannedResponseLists.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Chris Lomuntad 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | 24 | $groupId = go_get_groupid($goUser, $astDB); 25 | 26 | if (!checkIfTenant($groupId, $goDB)) { 27 | $ul=''; 28 | } else { 29 | $ul = "AND p.user_group='$groupId'"; 30 | } 31 | 32 | //$query = "SELECT canned_id, dept_id, isenabled, title, updated from ost_canned_response ORDER by updated DESC LIMIT 2000"; 33 | $query = "SELECT isenabled, title, ost_canned_response.updated, name FROM ost_canned_response LEFT OUTER JOIN ost_department ON ost_canned_response.dept_id=ost_department.id"; 34 | $rsltv = $ostDB->rawQuery($query); 35 | $countResult = $ostDB->getRowCount(); 36 | 37 | if($countResult > 0) { 38 | $data = array(); 39 | foreach ($rsltv as $fresults){ 40 | array_push($data, urlencode_array($fresults)); 41 | } 42 | $apiresults = array("result" => "success", "data" => $data); 43 | } else { 44 | $apiresults = array("result" => "Error: No data to show."); 45 | } 46 | 47 | function urlencode_array($array) { 48 | $out_array = array(); 49 | foreach($array as $key => $value) { 50 | $out_array[urlencode($key)] = urlencode($value); 51 | } 52 | return $out_array; 53 | } 54 | ?> -------------------------------------------------------------------------------- /goOSTicket/goGetClosedTicketLists.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Chris Lomuntad 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | 24 | $userid = $ostDB->escape($_REQUEST['userid']); 25 | 26 | if($userid == null && $userid == 0) { 27 | $apiresults = array("result" => "Error: Set a value for User ID"); 28 | } else { 29 | $groupId = go_get_groupid($goUser, $astDB); 30 | 31 | if (!checkIfTenant($groupId, $goDB)) { 32 | $ul=''; 33 | } else { 34 | $ul = "AND p.user_group='$groupId'"; 35 | } 36 | 37 | $state= "closed"; 38 | $query = "SELECT number, ot.updated, ot.ticket_id, otc.subject, ou.name as customer, otp.priority from ost_ticket as ot, ost_ticket__cdata as otc, ost_user as ou, ost_ticket_priority as otp WHERE status_id IN (SELECT id AS status_id FROM ost_ticket_status WHERE state='$state') AND ot.ticket_id=otc.ticket_id AND ot.user_id=ou.id AND otc.priority=otp.priority_id AND dept_id IN ((select dept_id from ost_staff where staff_id='$userid'),(SELECT dept_id FROM ost_staff_dept_access WHERE staff_id='$userid')) LIMIT 2000"; 39 | 40 | $rsltv = $ostDB->rawQuery($query); 41 | //var_dump($rsltv); 42 | $countResult = $ostDB->getRowCount(); 43 | 44 | if($countResult > 0) { 45 | $data = array(); 46 | foreach ($rsltv as $fresults){ 47 | array_push($data, urlencode_array($fresults)); 48 | } 49 | $apiresults = array("result" => "success", "data" => $data); 50 | } else { 51 | $apiresults = array("result" => "Error: No data to show."); 52 | } 53 | } 54 | 55 | function urlencode_array($array) { 56 | $out_array = array(); 57 | foreach($array as $key => $value) { 58 | $out_array[rawurlencode($key)] = rawurlencode($value); 59 | } 60 | return $out_array; 61 | } 62 | ?> -------------------------------------------------------------------------------- /goOSTicket/goGetHelpdeskAgentAccess.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Chris Lomuntad 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | 24 | $userid = $ostDB->escape($_REQUEST['userid']); 25 | ### Check user_id if its null or empty 26 | if($userid == null && $userid == 0) { 27 | $apiresults = array("result" => "Error: Set a value for User ID."); 28 | } else { 29 | $userid = $userid; 30 | $groupId = go_get_groupid($goUser, $astDB); 31 | 32 | if (!checkIfTenant($groupId, $goDB)) { 33 | $ul=''; 34 | } else { 35 | $ul = "AND p.user_group='$groupId'"; 36 | } 37 | 38 | //$query = "SELECT dept_id FROM ost_staff_dept_access WHERE staff_id='$userid'"; 39 | $ostDB->where('staff_id', $userid); 40 | $rsltv = $ostDB->get('ost_staff_dept_access', null, 'dept_id'); 41 | //var_dump($rsltv); 42 | $countResult = $ostDB->getRowCount(); 43 | 44 | if($countResult > 0) { 45 | $data = array(); 46 | foreach ($rsltv as $fresults){ 47 | array_push($data, ($fresults)); 48 | } 49 | $apiresults = array("result" => "success", "data" => $data); 50 | } else { 51 | $apiresults = array("result" => "Error: No data to show."); 52 | } 53 | } 54 | ?> -------------------------------------------------------------------------------- /goOSTicket/goGetHelpdeskAgentInfo.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Chris Lomuntad 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | 24 | $userid = $ostDB->escape($_REQUEST['userid']); 25 | ### Check user_id if its null or empty 26 | if($userid == null && $userid == 0) { 27 | $apiresults = array("result" => "Error: Set a value for User ID."); 28 | } else { 29 | $userid = $userid; 30 | $groupId = go_get_groupid($goUser, $astDB); 31 | 32 | if (!checkIfTenant($groupId, $goDB)) { 33 | $ul=''; 34 | } else { 35 | $ul = "AND p.user_group='$groupId'"; 36 | } 37 | 38 | //$query = "SELECT staff_id, dept_id, role_id, firstname, lastname, email, isadmin, isactive, signature FROM ost_staff WHERE staff_id='$userid'"; 39 | $ostDB->where('staff_id', $userid); 40 | $rsltv = $ostDB->get('ost_staff', null, 'staff_id, dept_id, role_id, firstname, lastname, email, isadmin, isactive, signature'); 41 | //var_dump($rsltv); 42 | $countResult = $ostDB->getRowCount(); 43 | 44 | if($countResult > 0) { 45 | $data = array(); 46 | foreach ($rsltv as $fresults) { 47 | array_push($data, urlencode_array($fresults)); 48 | } 49 | $apiresults = array("result" => "success", "data" => $data); 50 | } else { 51 | $apiresults = array("result" => "Error: No data to show."); 52 | } 53 | } 54 | 55 | function urlencode_array($array) { 56 | $out_array = array(); 57 | foreach($array as $key => $value) { 58 | $out_array[rawurlencode($key)] = rawurlencode($value); 59 | } 60 | return $out_array; 61 | } 62 | ?> -------------------------------------------------------------------------------- /goOSTicket/goGetHelpdeskAgentLists.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Chris Lomuntad 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | 24 | $groupId = go_get_groupid($goUser, $astDB); 25 | 26 | if (!checkIfTenant($groupId, $goDB)) { 27 | $ul=''; 28 | } else { 29 | $ul = "AND p.user_group='$groupId'"; 30 | } 31 | 32 | $query = "SELECT staff_id, dept_id, role_id, username, firstname, lastname, isactive, id, name as dept_name FROM ost_staff, ost_department WHERE dept_id=id ORDER BY username DESC LIMIT 2000"; 33 | 34 | $rsltv = $ostDB->rawQuery($query); 35 | //var_dump($rsltv); 36 | $countResult = $ostDB->getRowCount(); 37 | 38 | if($countResult > 0) { 39 | $data = array(); 40 | foreach ($rsltv as $fresults){ 41 | array_push($data, urlencode_array($fresults)); 42 | } 43 | $apiresults = array("result" => "success", "data" => $data); 44 | } else { 45 | $apiresults = array("result" => "Error: No data to show."); 46 | } 47 | 48 | function urlencode_array($array) { 49 | $out_array = array(); 50 | foreach($array as $key => $value) { 51 | $out_array[rawurlencode($key)] = rawurlencode($value); 52 | } 53 | return $out_array; 54 | } 55 | ?> -------------------------------------------------------------------------------- /goOSTicket/goGetHelpdeskDepartmentInfo.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Chris Lomuntad 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | 24 | $deptid = $ostDB->escape($_REQUEST['deptid']); 25 | ### Check user_id if its null or empty 26 | if($deptid == null && $deptid == 0) { 27 | $apiresults = array("result" => "Error: Set a value for Department ID."); 28 | } else { 29 | $deptid = $deptid; 30 | $groupId = go_get_groupid($goUser, $astDB); 31 | 32 | if (!checkIfTenant($groupId, $goDB)) { 33 | $ul=''; 34 | } else { 35 | $ul = "AND p.user_group='$groupId'"; 36 | } 37 | 38 | //$query = "SELECT id, name from ost_department WHERE id='$deptid'"; 39 | $ostDB->where('id', $deptid); 40 | $rsltv = $ostDB->get('ost_department', null, 'id,name'); 41 | //var_dump($rsltv); 42 | $countResult = $ostDB->getRowCount(); 43 | 44 | if($countResult > 0) { 45 | $data = array(); 46 | foreach ($rsltv as $fresults){ 47 | array_push($data, urlencode_array($fresults)); 48 | } 49 | $apiresults = array("result" => "success", "data" => $data); 50 | } else { 51 | $apiresults = array("result" => "Error: No data to show."); 52 | } 53 | } 54 | 55 | function urlencode_array($array) { 56 | $out_array = array(); 57 | foreach($array as $key => $value) { 58 | $out_array[rawurlencode($key)] = rawurlencode($value); 59 | } 60 | return $out_array; 61 | } 62 | ?> -------------------------------------------------------------------------------- /goOSTicket/goGetHelpdeskTeamLists.php: -------------------------------------------------------------------------------- 1 | 0) { 27 | $data = array(); 28 | while($fresults = mysqli_fetch_array($rsltv, MYSQLI_ASSOC)){ 29 | array_push($data, urlencode_array($fresults)); 30 | } 31 | $apiresults = array("result" => "success", "data" => $data); 32 | } else { 33 | $apiresults = array("result" => "Error: No data to show."); 34 | } 35 | 36 | function urlencode_array($array){ 37 | $out_array = array(); 38 | foreach($array as $key => $value){ 39 | $out_array[rawurlencode($key)] = rawurlencode($value); 40 | } 41 | return $out_array; 42 | } 43 | 44 | ?> 45 | -------------------------------------------------------------------------------- /goOSTicket/goGetTicketInformation.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Chris Lomuntad 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | 24 | //$userid = $_REQUEST['userid']; 25 | $ticketid = $ostDB->escape($_REQUEST['ticket_id']); 26 | 27 | if($ticketid == null && $ticketid == 0) { 28 | $apiresults = array("result" => "Error: Set a value for Ticket ID"); 29 | } else { 30 | $groupId = go_get_groupid($goUser, $astDB); 31 | 32 | if (!checkIfTenant($groupId, $goDB)) { 33 | $ul=''; 34 | } else { 35 | $ul = "AND p.user_group='$groupId'"; 36 | } 37 | 38 | $query = "SELECT ote.user_id, ote.source, poster, ote.title, body, ote.created, ot.number FROM ost_thread_entry as ote, ost_ticket as ot WHERE id='$ticketid'"; 39 | $rsltv = $ostDB->rawQuery($query); 40 | //var_dump($rsltv); 41 | $countResult = $ostDB->getRowCount(); 42 | 43 | if($countResult > 0) { 44 | $data = array(); 45 | foreach ($rsltv as $fresults){ 46 | array_push($data, urlencode_array($fresults)); 47 | } 48 | $apiresults = array("result" => "success", "data" => $data); 49 | } else { 50 | $apiresults = array("result" => "Error: No data to show."); 51 | } 52 | } 53 | 54 | function urlencode_array($array) { 55 | $out_array = array(); 56 | foreach($array as $key => $value) { 57 | $out_array[rawurlencode($key)] = rawurlencode($value); 58 | } 59 | return $out_array; 60 | } 61 | ?> -------------------------------------------------------------------------------- /goPackages/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goPackages/goGetPackage.php: -------------------------------------------------------------------------------- 1 | License: 11 | * This program is free software: you can redistribute it and/or modify 12 | * it under the terms of the GNU Affero General Public License as published by 13 | * the Free Software Foundation, either version 3 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Affero General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU Affero General Public License 22 | * along with this program. If not, see . 23 | */ 24 | include_once ("goAPI.php"); 25 | 26 | // Error Checking 27 | if (empty($goUser) || is_null($goUser)) { 28 | $apiresults = array( 29 | "result" => "Error: goAPI User Not Defined." 30 | ); 31 | } elseif (empty($goPass) || is_null($goPass)) { 32 | $apiresults = array( 33 | "result" => "Error: goAPI Password Not Defined." 34 | ); 35 | } elseif (empty($log_user) || is_null($log_user)) { 36 | $apiresults = array( 37 | "result" => "Error: Session User Not Defined." 38 | ); 39 | } else { 40 | // check if goUser and goPass are valid 41 | $fresults = $astDB 42 | ->where("user", $goUser) 43 | ->where("pass_hash", $goPass) 44 | ->getOne("vicidial_users", "user,user_level"); 45 | 46 | $goapiaccess = $astDB->getRowCount(); 47 | $userlevel = $fresults["user_level"]; 48 | $VARBRINGOWNVOIP = $VARBRINGOWNVOIP ?? ''; 49 | $VARPACKAGETYPE = $VARPACKAGETYPE ?? ''; 50 | 51 | if ($goapiaccess > 0 && $userlevel > 7) { 52 | $apiresults = array("result" => "success", "show_carrier_settings" => $VARBRINGOWNVOIP, "packagetype" => $VARPACKAGETYPE); 53 | } else { 54 | $err_msg = error_handle("10001"); 55 | $apiresults = array( 56 | "code" => "10001", 57 | "result" => $err_msg 58 | ); 59 | } 60 | } 61 | 62 | ?> 63 | -------------------------------------------------------------------------------- /goPauseCodes/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goPhones/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goPhones/goCheckPhoneLogin.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * @par License: 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Affero General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Affero General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Affero General Public License 20 | * along with this program. If not, see . 21 | **/ 22 | 23 | @include_once ("goAPI.php"); 24 | 25 | // POST or GET Variables 26 | $extension = $_REQUEST['extension']; 27 | 28 | if(!empty($extension) && !empty($session_user)){ 29 | $astDB->where("extension", $extension); 30 | $astDB->getOne("phones", "extension"); 31 | //$query = "SELECT extension FROM phones WHERE extension='$extension';"; 32 | 33 | if($astDB->count < 1) { 34 | $apiresults = array("result" => "success"); 35 | }else{ 36 | $apiresults = array("result" => "Error: Phone already exist."); 37 | } 38 | }else{ 39 | $apiresults = array("result" => "Error: Missing parameters."); 40 | } 41 | 42 | ?> 43 | -------------------------------------------------------------------------------- /goReports/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goSMS/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goSMS/goReceiveSMS.php: -------------------------------------------------------------------------------- 1 | "REPLY", 37 | "mobile_number" => $mobile_number, 38 | "shortcode" => "29290462886", 39 | "request_id" => $request_id, 40 | "message_id" => gen_random(), 41 | "message" => $message, 42 | "client_id" => "fdd645b7328431d8f21a6301de52b42fe4b06514f47fcaae0e70790e3fb8cd8d", 43 | "secret_key" => "649dc271effa414ebfa2c3d473024cf4362f994b1d42c1a4b92d088f8a4c1bec" 44 | ); 45 | 46 | $query_string = ""; 47 | foreach($arr_post_body as $key => $frow) 48 | { 49 | $query_string .= '&'.$key.'='.$frow; 50 | } 51 | 52 | $URL = "https://post.chikka.com/smsapi/request"; 53 | 54 | $ch = curl_init(); 55 | curl_setopt($ch, CURLOPT_URL, $URL); 56 | curl_setopt($ch, CURLOPT_POST, count($arr_post_body)); 57 | curl_setopt($ch, CURLOPT_POSTFIELDS, $query_string); 58 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); 59 | $response = curl_exec($ch); 60 | $curlError = curl_error($ch); 61 | curl_close($ch); 62 | 63 | exit(0); 64 | } 65 | catch (Exception $e) 66 | { 67 | echo "Error 2"; 68 | exit(0); 69 | } 70 | }else{ 71 | echo "Error 3"; 72 | exit(0); 73 | } 74 | 75 | function gen_random($length=32){ 76 | $final_rand=''; 77 | for($i=0;$i< $length;$i++){ 78 | $final_rand .= rand(0,9); 79 | 80 | } 81 | 82 | return $final_rand; 83 | } 84 | 85 | ?> -------------------------------------------------------------------------------- /goSMTP/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goSMTP/goDeleteSMTP.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Chris Lomuntad 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | 24 | //$query = "SELECT * FROM smtp_settings LIMIT 1;"; 25 | $rsltv = $goDB->getOne('smtp_settings'); 26 | $exist = $goDB->getRowCount(); 27 | 28 | if($exist <= 1){ 29 | //$delete_query = "DELETE FROM smtp_settings;"; 30 | $execute_delete = $goDB->delete('smtp_settings'); 31 | $apiresults = array("result" => "success"); 32 | } else { 33 | $apiresults = array("result" => "No SMTP Setting exists. Please configure a valid SMTP Setting first."); 34 | } 35 | ?> -------------------------------------------------------------------------------- /goSMTP/goGetSMTPActivation.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Chris Lomuntad 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | 24 | //$query = "SELECT value FROM settings WHERE setting = 'enable_smtp' LIMIT 1;"; 25 | $goDB->where('setting', 'enable_smtp'); 26 | $rsltv = $goDB->getOne('settings', 'value'); 27 | $exist = $goDB->getRowCount(); 28 | 29 | if($exist > 0){ 30 | $data = $rsltv; 31 | 32 | $apiresults = array("result" => "success", "data" => $data); 33 | } else { 34 | $apiresults = array("result" => "SMTP Setting doesn't exist. Please configure a valid SMTP Setting to continue."); 35 | } 36 | ?> -------------------------------------------------------------------------------- /goSMTP/goGetSMTPSettings.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Chris Lomuntad 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | 24 | //$query = "SELECT * FROM smtp_settings LIMIT 1;"; 25 | $rsltv = $goDB->getOne('smtp_settings'); 26 | $exist = $goDB->getRowCount(); 27 | 28 | if($exist > 0){ 29 | $data = $rsltv; 30 | 31 | $apiresults = array("result" => "success", "data" => $data); 32 | } else { 33 | $apiresults = array("result" => "SMTP Setting doesn't exist. Please configure a valid SMTP Setting to continue."); 34 | } 35 | ?> -------------------------------------------------------------------------------- /goScripts/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goServers/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goSettings/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goSettings/goActionSettings.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Chris Lomuntad 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | 24 | $seats_param = $astDB->escape($_REQUEST["seats"]); 25 | 26 | if(!empty($seats_param) && $seats_param > 0) { 27 | $seats = $seats_param; 28 | } else { 29 | $seats = 0; 30 | } 31 | 32 | //$query = "SELECT * FROM settings WHERE setting = 'GO_licensed_seats' LIMIT 1;"; 33 | $goDB->where('setting', 'GO_licensed_seats'); 34 | $rsltv = $goDB->getOne('settings'); 35 | $exist = $goDB->getRowCount(); 36 | 37 | if($exist <= 0){ 38 | //$create_default_query = "INSERT INTO settings (setting, context, value) VALUES('GO_licensed_seats', 'module_licensedSeats', '$seats');"; 39 | $insertData = array( 40 | 'setting' => 'GO_licensed_seats', 41 | 'context' => 'module_licensedSeats', 42 | 'value' => $seats 43 | ); 44 | $exec_create_default = $goDB->insert('settings', $insertData); 45 | 46 | if($exec_create_default) { 47 | if($seats > 0) 48 | $msg_seats = $seats; 49 | else 50 | $msg_seats = "Unlimited"; 51 | 52 | $apiresults = array("result" => "success", "msg" => "Created ( $msg_seats ) Default Licensed Seats."); 53 | } else { 54 | $apiresults = array("result" => "error", "msg" => "An error has occured, please contact the System Administrator to fix the issue.", "query" => mysqli_error($exec_create_default) ); 55 | } 56 | } else { 57 | //$update_query = "UPDATE settings SET value = '$seats' WHERE setting = 'GO_licensed_seats';"; 58 | $goDB->where('setting', 'GO_licensed_seats'); 59 | $exec_update = $goDB->update('settings', array('value' => $seats)); 60 | 61 | if($goDB->getRowCount()){ 62 | if($seats > 0) 63 | $msg_seats = $seats; 64 | else 65 | $msg_seats = "Unlimited"; 66 | 67 | $apiresults = array("result" => "success", "msg" => "Updated ( $msg_seats ) Licensed Seats."); 68 | } else { 69 | $apiresults = array("result" => "error", "msg" => "An error has occured, please contact the System Administrator to fix the issue.", "query" => mysqli_error($exec_update) ); 70 | } 71 | } 72 | ?> -------------------------------------------------------------------------------- /goSettings/goCheckPhones.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * @par License: 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Affero General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Affero General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Affero General Public License 20 | * along with this program. If not, see . 21 | */ 22 | $goDB->where('setting', 'GO_modify_phones'); 23 | $rslt = $goDB->getOne('settings', 'value'); 24 | 25 | if($rslt){ 26 | $modify_phones = $rslt['value']; 27 | 28 | $apiresults = array("result" => $modify_phones); 29 | } else { 30 | $apiresults = array("result" => "Failed to get Result."); 31 | } 32 | ?> 33 | 34 | -------------------------------------------------------------------------------- /goSettings/goCheckWebrtc.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * @par License: 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Affero General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Affero General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Affero General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | $user_id = $goDB->escape($_REQUEST['user_id']); 24 | 25 | $goDB->where('setting', 'GO_agent_use_wss'); 26 | $rslt = $goDB->getOne('settings', 'value'); 27 | 28 | if($rslt){ 29 | $webrtc = $rslt['value']; 30 | if ($webrtc > 0 && (!empty($user_id) && !is_null($user_id))) { 31 | $goDB->where('userid', $user_id); 32 | $rsltu = $goDB->getOne('users', 'enable_webrtc'); 33 | if ($rsltu['enable_webrtc'] > -1) { 34 | $webrtc = $rsltu['enable_webrtc']; 35 | } 36 | } 37 | 38 | $apiresults = array("result" => $webrtc); 39 | } else { 40 | $apiresults = array("result" => "Failed to get Result."); 41 | } 42 | ?> 43 | 44 | -------------------------------------------------------------------------------- /goStateCallTimes/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goStateCallTimes/goDeleteStateCallTimes.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Chris Lomuntad 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | include_once ("goAPI.php"); 24 | 25 | ### POST or GET Variables 26 | $state_call_time_id = $astDB->escape($_REQUEST['state_call_time_id']); 27 | 28 | ### Check Voicemail ID if its null or empty 29 | if($state_call_time_id == null) { 30 | $apiresults = array("result" => "Error: Set a value for State Call Time ID."); 31 | } else { 32 | $groupId = go_get_groupid($goUser); 33 | 34 | if (!checkIfTenant($groupId)) { 35 | //$ul = ""; 36 | } else { 37 | //$ul = "AND user_group='$groupId'"; 38 | //$addedSQL = "WHERE user_group='$groupId'"; 39 | $astDB->where('user_group', $groupId); 40 | } 41 | 42 | 43 | //$queryOne = "SELECT state_call_time_id FROM vicidial_state_call_times $ul where state_call_time_id='".mysqli_escape_string($state_call_time_id)."';"; 44 | $astDB->where('state_call_time_id', $state_call_time_id); 45 | $rsltvOne = $astDB->get('vicidial_state_call_times'); 46 | $countResult = $astDB->getRowCount(); 47 | 48 | if($countResult > 0) { 49 | //$deleteQuery = "DELETE FROM vicidial_state_call_times WHERE state_call_time_id= '$state_call_time_id';"; 50 | $astDB->where('state_call_time_id', $state_call_time_id); 51 | $astDB->delete('vicidial_state_call_times'); 52 | 53 | $log_id = log_action($goDB, 'DELETE', $log_user, $log_ip, "Deleted State Call Time: $state_call_time_id", $log_group, $astDB->getLastQuery()); 54 | $apiresults = array("result" => "success"); 55 | } else { 56 | $apiresults = array("result" => "Error: State Call Menu doesn't exist."); 57 | } 58 | }//end 59 | ?> -------------------------------------------------------------------------------- /goStateCallTimes/goGetAllStateCallTimes.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Chris Lomuntad 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | 24 | $groupId = go_get_groupid($goUser, $astDB); 25 | 26 | if (!checkIfTenant($groupId, $goDB)) { 27 | //$ul = ""; 28 | } else { 29 | //$ul = "AND user_group='$groupId'"; 30 | //$addedSQL = "WHERE user_group='$groupId'"; 31 | $astDB->where('user_group', $groupId); 32 | } 33 | 34 | //$query = "SELECT state_call_time_id, state_call_time_state, state_call_time_name, sct_default_start, sct_default_stop, user_group from vicidial_state_call_times $ul $addedSQL;"; 35 | $rsltv = $astDB->get('vicidial_state_call_times', null, 'state_call_time_id, state_call_time_state, state_call_time_name, sct_default_start, sct_default_stop, user_group'); 36 | 37 | foreach ($rsltv as $fresults){ 38 | $dataStateID[] = $fresults['state_call_time_id']; 39 | $dataStateState[] = $fresults['state_call_time_state']; 40 | $dataStateName[] = $fresults['state_call_time_name']; 41 | $dataDefStart[] = $fresults['sct_default_start']; 42 | $dataDefStop[] = $fresults['sct_default_stop']; 43 | $dataUserGroup[] = $fresults['user_group']; 44 | $apiresults = array("result" => "success", "state_call_time_id" => $dataStateID, "state_call_time_state" => $dataStateState, "state_call_time_name" => $dataStateName, "sct_default_start" => $dataDefStart, "sct_default_stop" => $dataDefStop, "user_group" => $dataUserGroup); 45 | } 46 | ?> -------------------------------------------------------------------------------- /goStateCallTimes/goGetStateCallTimeInfo.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Chris Lomuntad 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | 24 | $state_call_time_id = $astDB->escape($_REQUEST["state_call_time_id"]); 25 | 26 | if($state_call_time_id == null) { 27 | $apiresults = array("result" => "Error: Set a value for State Call Time ID."); 28 | } else { 29 | $groupId = go_get_groupid($goUser, $astDB); 30 | 31 | if (!checkIfTenant($groupId, $goDB)) { 32 | $ul = ""; 33 | } else { 34 | //$ul = "AND user_group='$groupId'"; 35 | //$addedSQL = "WHERE user_group='$groupId'"; 36 | $astDB->where('user_group', $groupId); 37 | } 38 | 39 | //$query = "SELECT state_call_time_id, state_call_time_state, state_call_time_name, sct_default_start, sct_default_stop, user_group from vicidial_state_call_times WHERE state_call_time_id='".mysqli_real_escape_string($state_call_time_id)."' $ul $addedSQL ORDER BY state_call_time_id LIMIT 1;"; 40 | $astDB->where('state_call_time_id', $state_call_time_id); 41 | $astDB->orderBy('state_call_time_id', 'desc'); 42 | $rsltv = $astDB->getOne('vicidial_state_call_times', 'state_call_time_id, state_call_time_state, state_call_time_name, sct_default_start, sct_default_stop, user_group'); 43 | $exist = $astDB->getRowCount(); 44 | if($exist > 0){ 45 | foreach ($rsltv as $fresults){ 46 | $dataStateID[] = $fresults['state_call_time_id']; 47 | $dataStateState[] = $fresults['state_call_time_state']; 48 | $dataStateName[] = $fresults['state_call_time_name']; 49 | $dataDefStart[] = $fresults['sct_default_start']; 50 | $dataDefStop[] = $fresults['sct_default_stop']; 51 | $dataUserGroup[] = $fresults['user_group']; 52 | $apiresults = array("result" => "success", "state_call_time_id" => $dataStateID, "state_call_time_state" => $dataStateState, "state_call_time_name" => $dataStateName, "sct_default_start" => $dataDefStart, "sct_default_stop" => $dataDefStop, "user_group" => $dataUserGroup); 53 | } 54 | } else { 55 | $apiresults = array("result" => "Error: Lead Filter does not exist."); 56 | } 57 | } 58 | ?> -------------------------------------------------------------------------------- /goSystemSettings/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goSystemSettings/goEditSystemSetting.php: -------------------------------------------------------------------------------- 1 | License: 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Affero General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Affero General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Affero General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | include_once ("goAPI.php"); 24 | 25 | ### POST or GET Variables 26 | $allow_voicemail_greeting = $astDB->escape($_REQUEST["allow_voicemail_greeting"]); 27 | 28 | ### ERROR CHECKING 29 | if (!isset($session_user) || is_null($session_user)){ 30 | $apiresults = array( 31 | "result" => "Error: Session User Not Defined." 32 | ); 33 | } else { 34 | 35 | $resultGet = $astDB->getOne("system_settings", "allow_voicemail_greeting"); 36 | 37 | if ( $resultGet["allow_voicemail_greeting"] !== $allow_voicemail_greeting ){ 38 | $result = $resultGet["allow_voicemail_greeting"]; 39 | $data = array( 40 | "allow_voicemail_greeting" => $allow_voicemail_greeting 41 | ); 42 | 43 | $update = $astDB->update("system_settings", $data); 44 | 45 | if ($update) { 46 | $apiresults = array( 47 | "result" => "success", 48 | "data" => $data 49 | ); 50 | 51 | if ( $allow_voicemail_greeting ) { 52 | $act = "Enabled"; 53 | } else { 54 | $act = "Disabled"; 55 | } 56 | 57 | $log_message = "$act Voicemail Greeting"; 58 | 59 | } else { 60 | $apiresults = array( 61 | "result" => "Error: Allow voicemail greeting update failed, check your details" 62 | ); 63 | 64 | $log_message = "Failed to Update System Settings: Voicemail Setting"; 65 | 66 | } 67 | 68 | $log_id = log_action( $goDB, 'MODIFY', $log_user, $log_ip, $log_message, $log_group, $astDB->getLastQuery() ); 69 | } 70 | 71 | $apiresults = array( 72 | "result" => "success", 73 | "message" => "Allow Voicemail Geeting Unchanged" 74 | ); 75 | } 76 | ?> 77 | -------------------------------------------------------------------------------- /goSystemSettings/goGetSystemSettingInfo.php: -------------------------------------------------------------------------------- 1 | License: 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Affero General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Affero General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Affero General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | include_once ("goAPI.php"); 24 | 25 | 26 | if (!isset($session_user) || is_null($session_user)){ 27 | $apiresults = array( 28 | "result" => "Error: Session User Not Defined." 29 | ); 30 | } else { 31 | $rsltv = $astDB->getOne("system_settings"); 32 | 33 | if ($astDB->count > 0) { 34 | $apiresults = array( 35 | "result" => "success", 36 | "data" => $rsltv 37 | ); 38 | } else { 39 | $apiresults = array( 40 | "result" => "Error: Empty." 41 | ); 42 | } 43 | } 44 | ?> 45 | -------------------------------------------------------------------------------- /goSystemSettings/index.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goautodial/goAPIv2/4dff4ef89d40557b0cabfbd63811540a8e8a932b/goSystemSettings/index.php -------------------------------------------------------------------------------- /goUploadLeads/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goUploadLeads/goLookupGMT.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Chris Lomuntad 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | 24 | include_once('../MySQLiDB.php'); 25 | @include_once('../goDBasterisk.php'); 26 | @include_once('../goDBgoautodial.php'); 27 | @include_once('../goFunctions.php'); 28 | 29 | ### Check if DB variables are not set ### 30 | $VARDB_server = (!isset($VARDB_server)) ? "162.254.144.92" : $VARDB_server; 31 | $VARDB_user = (!isset($VARDB_user)) ? "justgocloud" : $VARDB_user; 32 | $VARDB_pass = (!isset($VARDB_pass)) ? "justgocloud1234" : $VARDB_pass; 33 | $VARDB_database = (!isset($VARDB_database)) ? "asterisk" : $VARDB_database; 34 | 35 | $VARDBgo_server = (!isset($VARDBgo_server)) ? "162.254.144.92" : $VARDBgo_server; 36 | $VARDBgo_user = (!isset($VARDBgo_user)) ? "goautodialu" : $VARDBgo_user; 37 | $VARDBgo_pass = (!isset($VARDBgo_pass)) ? "pancit8888" : $VARDBgo_pass; 38 | $VARDBgo_database = (!isset($VARDBgo_database)) ? "goautodial" : $VARDBgo_database; 39 | ### End of DB variables ### 40 | 41 | $goGMTastDB = new MySQLiDB($VARDB_server, $VARDB_user, $VARDB_pass, $VARDB_database); 42 | ?> -------------------------------------------------------------------------------- /goUserGroups/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goUserGroups/goCheckUserGroups.php: -------------------------------------------------------------------------------- 1 | License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | **/ 23 | 24 | include_once ("goAPI.php"); 25 | 26 | // POST or GET Variables 27 | $user_group = $astDB->escape($_REQUEST['user_group']); 28 | 29 | if (!isset($user_group) || is_null($user_group)){ 30 | $apiresults = array( 31 | "result" => "Error: Missing Required Parameters." 32 | ); 33 | } else { 34 | if (checkIfTenant($log_group, $goDB)) { 35 | $astDB->where("user_group", $log_group); 36 | } 37 | 38 | $astDB->where("user_group", $user_group); 39 | $astDB->getOne("vicidial_user_groups", "user_group"); 40 | //$query = "SELECT user_group FROM vicidial_user_groups WHERE user_group='$user_group';"; 41 | 42 | if($astDB->count > 0) { 43 | $apiresults = array( 44 | "result" => "Error: User Group already exist." 45 | ); 46 | } else { 47 | $apiresults = array( 48 | "result" => "success" 49 | ); 50 | } 51 | } 52 | ?> 53 | -------------------------------------------------------------------------------- /goUsers/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goViewScripts/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goVoiceFiles/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goVoiceFiles/goGetAllVoiceFiles.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Chris Lomuntad 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | 24 | include_once("goAPI.php"); 25 | 26 | $limit = 50; 27 | 28 | if (isset($_REQUEST['limit'])) { 29 | $limit = $astDB->escape($_REQUEST['limit']); 30 | } 31 | 32 | // Error Checking 33 | if (empty($log_user) || is_null($log_user)) { 34 | $apiresults = array( 35 | "result" => "Error: Session User Not Defined." 36 | ); 37 | } else { 38 | if (checkIfTenant($log_group, $goDB)) { 39 | $astDB->where('user_group', $log_group); 40 | } 41 | 42 | $astDB->where("user", $log_user); 43 | $astDB->where('user_level', '6', '>'); 44 | $astDB->get('vicidial_users'); 45 | 46 | if ($astDB->count < 1) { 47 | $result = 'ERROR'; 48 | $result_reason = "sounds_list USER DOES NOT HAVE PERMISSION TO VIEW SOUNDS LIST"; 49 | $apiresults = array( 50 | "result" => "Error".$result_reason 51 | ); 52 | } else { 53 | //$query = "SELECT goFilename, goFileDate, goFilesize, goDirectory FROM sounds $ul"; 54 | if($log_group === 'ADMIN'){ 55 | $exec_query = $goDB->get('sounds'); 56 | } else { 57 | $exec_query = $goDB->rawQuery("SELECT * FROM `sounds` WHERE `uploaded_by` IN (SELECT `name` FROM `users` WHERE `user_group` = '$log_group')"); 58 | } 59 | 60 | if ($goDB->count > 0) { 61 | foreach ($exec_query as $rslt) { 62 | $file_names[] = $rslt['goFilename']; 63 | $file_dates[] = $rslt['goFileDate']; 64 | $file_size[] = $rslt['goFilesize']; 65 | $file_directory[] = $rslt['goDirectory']; 66 | } 67 | 68 | $apiresults = array( 69 | "result" => "success", 70 | "file_name" => $file_names, 71 | "file_date" => $file_dates, 72 | "file_size" => $file_size, 73 | "file_directory" => $file_directory 74 | ); 75 | } else { 76 | $apiresults = array( 77 | "result" => "Error" 78 | ); 79 | } 80 | } 81 | } 82 | 83 | ?> 84 | -------------------------------------------------------------------------------- /goVoicemails/goAPI.php: -------------------------------------------------------------------------------- 1 | ../goAPI.php -------------------------------------------------------------------------------- /goVoicemails/goCheckVoicemail.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Chris Lomuntad 8 | * 9 | * @par License: 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | */ 23 | 24 | ### POST or GET Variables 25 | $voicemail_id = $astDB->escape($_REQUEST['voicemail_id']); 26 | 27 | //$queryCheck = "SELECT voicemail_id from vicidial_voicemail where voicemail_id='".$voicemail_id."';"; 28 | $astDB->where('voicemail_id', $voicemail_id); 29 | $sqlCheck = $astDB->get('vicidial_voicemail'); 30 | $countCheck = $astDB->getRowCount(); 31 | 32 | if($countCheck <= 0) { 33 | $apiresults = array("result" => "success"); 34 | } else { 35 | $apiresults = array("result" => "Error: Add failed, Voicemail already already exist!"); 36 | } 37 | ?> -------------------------------------------------------------------------------- /goVoicemails/goDeleteVoicemail.php: -------------------------------------------------------------------------------- 1 | License: 11 | * This program is free software: you can redistribute it and/or modify 12 | * it under the terms of the GNU Affero General Public License as published by 13 | * the Free Software Foundation, either version 3 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Affero General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU Affero General Public License 22 | * along with this program. If not, see . 23 | */ 24 | 25 | include_once ("goAPI.php"); 26 | 27 | ### POST or GET Variables 28 | $voicemail_id = $astDB->escape($_REQUEST['voicemail_id']); 29 | 30 | ### ERROR CHECKING 31 | if (!isset($session_user) || is_null($session_user)){ 32 | $apiresults = array( 33 | "result" => "Error: Session User Not Defined." 34 | ); 35 | } elseif ($voicemail_id == null) { 36 | $apiresults = array( 37 | "result" => "Error: Set a value for Voicemail ID." 38 | ); 39 | } else { 40 | if (checkIfTenant($log_group, $goDB)) { 41 | $astDB->where("user_group", $log_group); 42 | $astDB->orWhere("user_group", "---ALL---"); 43 | } 44 | 45 | // check voicemail ID if valid 46 | $astDB->where('voicemail_id', $voicemail_id); 47 | $astDB->getOne('vicidial_voicemail'); 48 | 49 | if ($astDB->count > 0) { 50 | $astDB->where('voicemail_id', $voicemail_id); 51 | $astDB->delete('vicidial_voicemail'); 52 | 53 | $log_id = log_action($goDB, 'DELETE', $log_user, $log_ip, "Deleted Voicemail ID: $voicemail_id", $log_group, $astDB->getLastQuery()); 54 | $apiresults = array( 55 | "result" => "success" 56 | ); 57 | } else { 58 | $apiresults = array( 59 | "result" => "Error: Voicemail doesn't exist." 60 | ); 61 | } 62 | } 63 | ?> 64 | -------------------------------------------------------------------------------- /goVoicemails/goGetAllVoicemails.php: -------------------------------------------------------------------------------- 1 | License: 12 | * This program is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU Affero General Public License as published by 14 | * the Free Software Foundation, either version 3 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU Affero General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU Affero General Public License 23 | * along with this program. If not, see . 24 | */ 25 | 26 | include_once ("goAPI.php"); 27 | 28 | if (!isset($session_user) || is_null($session_user)){ 29 | $apiresults = array( 30 | "result" => "Error: Session User Not Defined." 31 | ); 32 | } 33 | 34 | if (isset($_REQUEST['limit'])) { 35 | $limit = $astDB->escape($_REQUEST['limit']); 36 | } else { 37 | $limit = "50"; 38 | } 39 | 40 | if (checkIfTenant($log_group, $goDB)) { 41 | $astDB->where("user_group", $log_group); 42 | $astDB->orWhere("user_group", "---ALL---"); 43 | } 44 | 45 | $astDB->orderBy('voicemail_id', 'desc'); 46 | $rsltv = $astDB->get('vicidial_voicemail', $limit); 47 | 48 | if ($astDB->count > 0) { 49 | foreach ($rsltv as $fresults) { 50 | $dataVoicemailID[] = $fresults['voicemail_id']; 51 | $dataFullname[] = $fresults['fullname']; 52 | $dataActive[] = $fresults['active']; 53 | $dataMessages[] = $fresults['messages']; 54 | $dataOldMessages[] = $fresults['old_messages']; 55 | $dataDeleteVMAfterEmail[] = $fresults['delete_vm_after_email']; 56 | $dataUserGroup[] = $fresults['user_group']; 57 | } 58 | 59 | $apiresults = array( 60 | "result" => "success", 61 | "voicemail_id" => $dataVoicemailID, 62 | "fullname" => $dataFullname, 63 | "active" => $dataActive, 64 | "messages" => $dataMessages, 65 | "old_messages" => $dataOldMessages, 66 | "delete_vm_after_email" => $dataDeleteVMAfterEmail, 67 | "user_group" => $dataUserGroup 68 | ); 69 | } else { 70 | $apiresults = array( 71 | "result" => "Empty" 72 | ); 73 | } 74 | 75 | ?> 76 | -------------------------------------------------------------------------------- /goVoicemails/goGetVoicemailInfo.php: -------------------------------------------------------------------------------- 1 | License: 11 | * This program is free software: you can redistribute it and/or modify 12 | * it under the terms of the GNU Affero General Public License as published by 13 | * the Free Software Foundation, either version 3 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Affero General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU Affero General Public License 22 | * along with this program. If not, see . 23 | */ 24 | 25 | include_once ("goAPI.php"); 26 | 27 | ### POST or GET Variables 28 | $voicemail_id = $astDB->escape($_REQUEST["voicemail_id"]); 29 | $active = $astDB->escape($_REQUEST['active']); 30 | 31 | ### Default values 32 | $defActive = array( 33 | "Y", 34 | "N" 35 | ); 36 | 37 | if (!isset($session_user) || is_null($session_user)){ 38 | $apiresults = array( 39 | "result" => "Error: Session User Not Defined." 40 | ); 41 | } elseif ($voicemail_id == null || strlen($voicemail_id) < 3) { 42 | $apiresults = array( 43 | "result" => "Error: Set a value for Voicemail ID." 44 | ); 45 | } elseif (!in_array($active,$defActive) && $active != null) { 46 | $apiresults = array( 47 | "result" => "Error: Default value for active is Y or N only." 48 | ); 49 | } else { 50 | if (checkIfTenant($log_group, $goDB)) { 51 | $astDB->where("user_group", $log_group); 52 | $astDB->orWhere("user_group", "---ALL---"); 53 | } 54 | 55 | $astDB->where("voicemail_id", $voicemail_id); 56 | $astDB->orderBy("voicemail_id", "desc"); 57 | $rsltv = $astDB->getOne("vicidial_voicemail"); 58 | //$log_id = log_action($goDB, "VIEW", $log_user, $log_ip, "Viewed voicemail ID: $carrier_id", $astDB->getLastQuery()); 59 | 60 | if ($astDB->count > 0) { 61 | $apiresults = array( 62 | "result" => "success", 63 | "data" => $rsltv 64 | ); 65 | } else { 66 | $apiresults = array( 67 | "result" => "Error: Empty." 68 | ); 69 | } 70 | } 71 | ?> 72 | -------------------------------------------------------------------------------- /goVoicemails/index.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goautodial/goAPIv2/4dff4ef89d40557b0cabfbd63811540a8e8a932b/goVoicemails/index.php -------------------------------------------------------------------------------- /includes/MySQLiDB.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goautodial/goAPIv2/4dff4ef89d40557b0cabfbd63811540a8e8a932b/includes/MySQLiDB.php -------------------------------------------------------------------------------- /licensed-conf.php: -------------------------------------------------------------------------------- 1 | 4 | --------------------------------------------------------------------------------