Exemplo n.º 1
0
 public function createList(array $deviceArray)
 {
     //Get App User
     $appUserObj = $this->axl->getAppUser(env('CUCM_LOGIN'));
     Log::info('getAppUser(),$appUserObj,', [$appUserObj]);
     //Create Device Array
     $appUserDeviceArray = createDeviceArray($appUserObj, $deviceArray);
     Log::info('createDeviceArray(),$appUserDeviceArray,', [$appUserDeviceArray]);
     //Associate Devices to App User
     $res = $this->axl->updateAppUser(env('CUCM_LOGIN'), $appUserDeviceArray);
     Log::info('updateAppUser(),$res,', [$res]);
     //Create RIS Port Phone Array
     $risArray = createRisPhoneArray($deviceArray);
     Log::info('createRisPhoneArray(),$risArray,', [$risArray]);
     //Get Device IP's from RIS Port
     $SelectCmDeviceResult = $this->sxml->getDeviceIp($risArray);
     Log::info('getDeviceIp(),$SelectCmDeviceResult,', [$SelectCmDeviceResult]);
     //Process RIS Port Results
     $risPortResults = processRisResults($SelectCmDeviceResult, $risArray);
     //Fetch device model from type product
     for ($i = 0; $i < count($risPortResults); $i++) {
         if ($risPortResults[$i]['IsRegistered']) {
             $results = $this->axl->executeSQLQuery('SELECT name FROM typeproduct WHERE enum = "' . $risPortResults[$i]['Product'] . '"');
             $risPortResults[$i]['Model'] = $results->return->row->name;
         }
     }
     Log::info('processRisResults(),$risPortResults,', [$risPortResults]);
     return $risPortResults;
 }
Exemplo n.º 2
0
/**
 * @param $deviceList
 * @return mixed
 */
function generateEraserList($deviceList)
{
    $macList = array_column($deviceList, 'mac');
    $axl = new AxlSoap();
    $user = $axl->getAxlUser();
    $devices = createDeviceArray($user, $macList);
    $res = $axl->updateAxlUser($devices);
    $risArray = createRisPhoneArray($macList);
    // Get Device IP's
    $sxml = new RisSoap();
    $risResults = $sxml->getDeviceIP($risArray);
    $risPortResults = processRisResults($risResults, $risArray);
    //Fetch device model from type product
    for ($i = 0; $i < count($risPortResults); $i++) {
        if ($risPortResults[$i]['IsRegistered']) {
            $results = $axl->executeQuery('SELECT name FROM typeproduct WHERE enum = "' . $risPortResults[$i]['Product'] . '"');
            $risPortResults[$i]['Model'] = $results->return->row->name;
        }
    }
    foreach ($deviceList as $row) {
        $key = array_search($row['mac'], array_column($risPortResults, 'DeviceName'));
        $risPortResults[$key]['type'] = $row['type'];
        if (isset($row['bulk_id'])) {
            $risPortResults[$key]['bulk_id'] = $row['bulk_id'];
        }
    }
    return $risPortResults;
}