Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N
<?php
//***********************************Set defaults***************************************
//Debug
$debug = FALSE;
//Campaign setup
$campaignHighLTVPhone = '1XXXXXXXXXX';
$campaignMedLTVPhone = '1XXXXXXXXXX';
$campaignLowLTVPhone = '1XXXXXXXXXX';
$campaignDefaultLTVPhone = '1XXXXXXXXXX';
$campaignPost = 'https://server/genericPostlead.php';
//Vicidial API setup
$source='test';
$user='APITestUser';
$pass='test';
$leadUpdate = 'http://server/non_agent_api.php';
$voicePost = 'http://server/agc/api.php';
//**********************************Initial data processing****************************************
//LTV pre-processing
$fmb = $_GET['firstmortgage_balance'];
$smb = $_GET['secondmortgage_balance'];
$hv = $_GET['home_value'];
if ($debug) {
echo "First Mortgage Balance: $fmb";
echo "Second Mortgage Balance: $smb";
echo "Home Value: $hv";
}
//Calculate LTV if pre-requisites are there, or at least set a value.
if (isset($fmb) && ($fmb > 0)) {
if (isset($hv) && ($hv > 0)) {
if (isset ($smb) && ($smb > 0)) {
$ltv = ((($fmb + $smb) / $hv) * 100);
} else {
$ltv = (($fmb / $hv) * 100);
}
}
} else {
$ltv = 0;
if ($debug){ echo "LTV: $ltv"; }
}
//Determine which campaign phone number to send the call to based on LTV.
if ($ltv >= 251) { $campaignNumber = $campaignDefaultLTVPhone; }
elseif ($ltv >= 201) { $campaignNumber = $campaignHighLTVPhone; }
elseif ($ltv >= 151) { $campaignNumber = $campaignMedLTVPhone; }
elseif ($ltv >= 101) { $campaignNumber = $campaignLowLTVPhone; }
elseif ($ltv >= 1) { $campaignNumber = $campaignLowLTVPhone; }
elseif ($ltv = 0) { $campaignNumber = $campaignDefaultLTVPhone; }
if ($debug){ echo "Campaign number to dial: $campaignNumber"; }
//************************************************ARRAY CREATION***********************************
//We want to update our records first, post data second, and dial with customer third
//Build DATA UPDATE array
$updateArray=array(
'source' => $source,
'user' => $user,
'pass' => $pass,
'function' => 'update_lead',
'lead_id' => $_GET['lead_id'],
'last_name' => $_GET['last_name'],
'city' => $_GET['city'],
'custom_fields' => 'Y',
'ltv' => $ltv
);
if ($debug){ print_r($updateArray);}
//Build DATA DELIVERY array
//Arrangement and variables set by Boberdoo
$dataArray=array(
TYPE => '23',
Test_Lead => $debug, // 1 (Only when testing)
//Skip_XSL => '0', // Do not include XSL path in XML response
//Match_With_Partner_ID => '22,456', //Comma separated list with Partner IDs to only match with
SRC => 'LCCCallCenter',
Landing_Page => 'index.php',
Redirect_URL => '', //Set your redirect URL
IP_Address => '4.53.176.114',
Lead_ID => $_GET['lead_id'],
List_ID => $_GET['list_id'],
Campaign => $_GET['campaign'],
First_Name => $_GET['first_name'],
Middle_Name => $_GET['middle_initial'],
Last_Name => $_GET['last_name'],
Primary_Phone => $_GET['phone_number'],
Address_1 => $_GET['address1'],
Address_2 => $_GET['address2'],
Address_3 => $_GET['address3'],
City => $_GET['city'],
State => $_GET['state'],
Postal_Code => $_GET['postal_code'],
Alt_Phone => $_GET['alt_phone'],
Email => $_GET['email'],
FHA => $_GET['fha'],
VA => $_GET['va'],
Fannie => $_GET['fannie'],
Freddie => $_GET['freddie'],
ARM => $_GET['arm'],
Fixed_Period => $_GET['fixed_period'],
Interest_Rate => $_GET['interest_rate'],
Credit_Score => $_GET['credit_score'],
Income_Source => $_GET['income_source'],
Late_Pay => $_GET['late_pay'],
First_Mortgage_Balance => $_GET['firstmortgage_balance'],
Second_Mortgage_Balance => $_GET['secondmortgage_balance'],
Manufactured => $_GET['manufactured'],
Loan_Mod => $_GET['loanmod'],
Home_Value => $_GET['home_value'],
Owner_Occupied => $_GET['owner_occupied'],
Spanish => $_GET['spanish'],
Bankruptcy => $_GET['bankruptcy'],
Foreclosure => $_GET['foreclosure'],
LTV => $ltv,
Unsecured_Debt => $_GET['unsecured_debt'],
);
//Build VOICE DELIVERY array
$voiceArray = array (
'source' => $source,
'user' => $user,
'pass' => $pass,
'agent_user' => $user_agent,
'function' => 'transfer_conference',
'value' => 'DIAL_WITH_CUSTOMER',
'phone_number' => $campaignNumber,
'dial_override' => 'YES',
);
//url-ify the data array for the DATA UPDATE
foreach($updateArray as $key=>$value) { $updateArray_string .= $key.'='.$value.'&'; }
rtrim($updateArray_string, '&');
//url-ify the data array for the DATA DELIVERY
foreach($dataArray as $key=>$value) { $dataArray_string .= $key.'='.$value.'&'; }
rtrim($dataArray_string, '&');
//url-ify the data array for the VOICE DELIVERY
foreach($voiceArray as $key=>$value) { $voiceArray_string .= $key.'='.$value.'&'; }
rtrim($voiceArray_string, '&');
if ($debug) {
echo "Update Array: $updateArray";
echo "Update Array String: $updateArray_string";
echo "Data Array: $dataArray";
echo "Data Array String: $dataArray_string";
echo "Voice Array: $voiceArray";
echo "Voice Array String: $voiceArray_string";
};
//******************************************DELIVERY TIME******************************************
//Set delivery specific debugging
$deliveryDebug=0; //1 is Update, 2 is Data Delivery, 3 is Voice Delivery.
if (!$debug) {
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data for DATA UPDATE
curl_setopt($ch,CURLOPT_URL, $dataUpdate);
curl_setopt($ch,CURLOPT_POST, count($updateArray));
curl_setopt($ch,CURLOPT_POSTFIELDS, $updateArray_string);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
//execute post
$result = curl_exec($ch);
echo $updateArray_string;
//set the url, number of POST vars, POST data for DATA DELIVERY
//curl_setopt($ch,CURLOPT_URL, $campaignPost);
//curl_setopt($ch,CURLOPT_POST, count($dataArray));
//curl_setopt($ch,CURLOPT_POSTFIELDS, $dataArray_string);
//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
//execute post
//$result = curl_exec($ch);
//set the url, number of POST vars, POST data for VOICE DELIVERY
//curl_setopt($ch,CURLOPT_URL, $viciPost);
//curl_setopt($ch,CURLOPT_POST, count($voiceArray));
//curl_setopt($ch,CURLOPT_POSTFIELDS, $voiceArray_string);
//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
//execute post
//$result = curl_exec($ch);
//close connection
curl_close($ch);
} else { echo 'Debug mode enabled, no deliveries occurred'; }
//Escort Elvis from building
?>
Users browsing this forum: Google [Bot] and 125 guests