dial different number with caller based on webform variable

All installation and configuration problems and questions

Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N

dial different number with caller based on webform variable

Postby DruRoland » Tue Oct 01, 2013 2:58 pm

I have 2 customers that I'd like to run in the same campaign. They're in the same states, looking for the same product, etc. The sole difference is one accepts up to 110% LTV, one accepts up to 115%.
Our lead distributor filters calls via area code, not data variables, so I have to dial 2 different numbers to tell them which lead has which value.

I currently calculate the LTV as part of the webform POST; can I also set a delivery phone number as part of that webform?

Semi-related; is there a way to automatically webform data when Dial with Customer is pressed?
2x ViciBox v.5.0.2-130807 | BUILD: 130809-1410 | SVN Version: 2019 | Asterisk: 1.8.23-vici
Debian 7 MySQL 5.5 server 4-core 16GB RAM Master & Slave
18 seats, outbound/blended with full recording
DruRoland
 
Posts: 52
Joined: Wed Jan 23, 2013 8:33 pm

Re: dial different number with caller based on webform varia

Postby williamconley » Tue Oct 01, 2013 3:32 pm

It would be possible to build a web form that would initiate the process via the vicidial api ... in which case the web form would actually be in charge of the entire process ... thus able to determine the number to dial programmatically. Inside Vicidial, however, it is not possible to do so.

It would also be possible to dial a 3rd number which pulls an agi which would Check the values in question and re-dial the correct number based on the LTV, but this would require the data to be in the database already which may not be the case if the call has not yet been "submitted".
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20258
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Re: dial different number with caller based on webform varia

Postby DruRoland » Tue Oct 01, 2013 6:08 pm

Thanks for the quick reply as usual William!
Let me make sure I have the logic down...

Agent presses "Dial with customer" button, which calls a webform that'll control the process.
The webform:
    pulls variables
    makes calculations
    pushes calculated variables back to SQL
    selects campaign to 3-way dial
    pushes data to selected customer
    pushes data to vicidial API to initiate call to selected customer
2x ViciBox v.5.0.2-130807 | BUILD: 130809-1410 | SVN Version: 2019 | Asterisk: 1.8.23-vici
Debian 7 MySQL 5.5 server 4-core 16GB RAM Master & Slave
18 seats, outbound/blended with full recording
DruRoland
 
Posts: 52
Joined: Wed Jan 23, 2013 8:33 pm

Re: dial different number with caller based on webform varia

Postby DruRoland » Wed Oct 02, 2013 6:36 pm

I've almost gotten it. Just stuck on a stupid PHP problem. When I convert the updateArray array to URL format, it converts the array key "ltv" into ">v", and I can't figure out why.
Example echo'd string post URL-ification:
source=test&user=APIUser&pass=test&function=update_lead&lead_id=324523&last_name=Dummy&city=Anytown&custom_fields=Y<v=62.5&

Here's the sanitized webform
Code: Select all
<?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
?>
2x ViciBox v.5.0.2-130807 | BUILD: 130809-1410 | SVN Version: 2019 | Asterisk: 1.8.23-vici
Debian 7 MySQL 5.5 server 4-core 16GB RAM Master & Slave
18 seats, outbound/blended with full recording
DruRoland
 
Posts: 52
Joined: Wed Jan 23, 2013 8:33 pm

Re: dial different number with caller based on webform varia

Postby williamconley » Wed Oct 02, 2013 7:12 pm

change the name of the variable so it no longer coincides with "less than".
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20258
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Re: dial different number with caller based on webform varia

Postby DruRoland » Wed Oct 02, 2013 9:37 pm

Yea... I did exactly that. However, it presents another problem..
Happen to know an easy way to update a custom field variable name set in a couple hundred lists? SQL query?
2x ViciBox v.5.0.2-130807 | BUILD: 130809-1410 | SVN Version: 2019 | Asterisk: 1.8.23-vici
Debian 7 MySQL 5.5 server 4-core 16GB RAM Master & Slave
18 seats, outbound/blended with full recording
DruRoland
 
Posts: 52
Joined: Wed Jan 23, 2013 8:33 pm

Re: dial different number with caller based on webform varia

Postby williamconley » Thu Oct 03, 2013 11:22 am

Of course a sql query. Don't be silly. Do it once with phpMyAdmin and it will generate the sql code for you, then you can apply it to the others after duping/modifying in excel and executing all the rest at once. Simplest method without writing a more complex sql query.
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20258
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)


Return to Support

Who is online

Users browsing this forum: No registered users and 151 guests