public function testLeadExists() { $_POST['ClientPhone'] = "+380991133231"; $_POST['ClientEmail'] = "*****@*****.**"; $_POST['ClientName'] = "NEW"; $Lead = new LeadModel($this->config); $this->assertEquals(false, $Lead->LeadExists()); $_POST['ClientPhone'] = "380-111-111111"; $_POST['ClientEmail'] = "*****@*****.**"; $_POST['ClientName'] = "Old"; $Lead = new LeadModel($this->config); $this->assertEquals(true, $Lead->LeadExists()); }
function cretate_conference($LeadID) { global $google; global $twilio; global $DBconfig; $Lead = new LeadModel(array('google' => $google, 'twilio' => $twilio, 'DBconfig' => $DBconfig), $LeadID); $Lead->SetNextCallOffset("never", $LeadID); header("content-type: text/xml"); echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; ?> <Response> <Dial><?php echo $Lead->UserData['Phone']; ?> </Dial> <Say>The call failed or the remote party hung up. Goodbye.</Say> </Response> <?php exit; }
<?php include_once '../../core/init.php'; $Lead = new LeadModel(array('google' => $google, 'twilio' => $twilio, 'DBconfig' => $DBconfig)); if ($Lead->Complete()) { if (!$Lead->Save()) { PageModel::Error($Lead->error); } else { PageModel::Success($Lead); } } else { PageModel::Error("Incomplete"); }
<?php require dirname(__FILE__) . '/../../../core/init.php'; if (!isset($_REQUEST['lead_id'])) { create_error_voice(); } $LeadID = $_REQUEST['lead_id']; $Lead = new LeadModel(array('google' => $google, 'twilio' => $twilio, 'DBconfig' => $DBconfig), $LeadID); $Lead->CompleteLead(); function create_error_voice() { header("content-type: text/xml"); echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; ?> <Response> <Say> Sorry. Something is wrong with service. We will call You as soon as possible. </Say> </Response> <?php exit; }