public function testFirstCall()
 {
     $this->assertEquals(true, $this->Call->FirstCall());
     $Lead = new LeadModel($this->config, 11);
     $Call = new CallModel($this->config['twilio'], $Lead->UserData, $Lead->SalesPerson, $this->config['DBconfig']);
     $this->assertEquals(false, $Call->FirstCall());
 }
 public function Save()
 {
     if ($this->LeadExists()) {
         return false;
     }
     $this->MLSSourceID = $this->GetMLSSourceID();
     $this->GetSalesPerson();
     //Save Lead
     $this->Db->PrepareQuery("INSERT INTO `GA_Lead` (`Name`, `Phone`, `Email`, `Source`, `SalesPersonID`, `BadNumber`) " . "VALUES ('%s', '%s', '%s', '%s', %d, %d)", array($this->UserData['Name'], $this->phone->formatted_number, $this->UserData['Email'], $this->Source, $this->SalesPersonID, (int) $this->UserData['IsCompanyPhone']));
     if (!($result = $this->Db->Query())) {
         $this->error = "Wrong query\n";
         return false;
     }
     $this->Id = $this->Db->LastInsertId();
     $this->UserData['LeadID'] = $this->Id;
     //call if phone OK and SalesPerson exist;
     $Call = new CallModel($this->twilio, $this->UserData, $this->SalesPerson, $this->DBconfig);
     $Call->FirstCall();
     return true;
 }