#!/usr/bin/env php connect("127.0.0.1", $amp_conf["AMPMGRUSER"] , $amp_conf["AMPMGRPASS"])) { unset( $astman ); } $dump = file_get_contents("/home/e-smith/db/freepbx/astdb.dump"); // Before restoring, let's clear out all of the current settings for the main objects // but as a safety, if the dump file is empy, we won't clear it out. // if (!empty($dump)) { $arr = explode("\n", $dump); foreach ($deltree as $family) { $astman->database_deltree($family); } foreach ($arr as $line) { $result = preg_match("/\[(.+)\] \[(.+)\]/", $line, $matches); // Now, the bad ones we know about are the ones that start with //, anything starting with SIP or IAX, // and RG (which are only temporary anyway). if (!isset($matches[1]) || $matches[1] == "") { continue; } $pattern = "/(^\/\/)|(^\/IAX)|(^\/SIP)|(^\/RG)|(^\/BLKVM)|(^\/FM)|(^\/dundi)/"; if (preg_match($pattern, $matches[1])) { continue; } preg_match("/(.+)\/(.+)$/", $matches[1], $famkey); $famkey[1]=trim($famkey[1], '/'); $astman->database_put($famkey[1], $famkey[2], '"'.$matches[2].'"'); } } ?>