/**
  * constructor
  *
  * @param Zend_Db_Adapter_Abstract|optional $_db the database adapter to use
  */
 public function __construct($_db = NULL)
 {
     if ($_db instanceof Zend_Db_Adapter_Abstract) {
         $this->_db = $_db;
     } else {
         $this->_db = Zend_Db_Table_Abstract::getDefaultAdapter();
     }
     $this->_baseURL = Voipmanager_Frontend_Snom_Abstract::getBaseUrl();
 }
Exemple #2
0
 protected function _appendLocationSettings(Voipmanager_Model_Snom_Phone $_phone, SimpleXMLElement $_xml)
 {
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " xml " . $_xml->asXML());
     }
     $snomLocation = new Voipmanager_Backend_Snom_Location($this->_db);
     $locationSettings = $snomLocation->get($_phone->location_id);
     #if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " localtion_id " . print_r($locationSettings, true));
     $locationSettings = $locationSettings->toArray();
     unset($locationSettings['id']);
     unset($locationSettings['name']);
     unset($locationSettings['description']);
     unset($locationSettings['registrar']);
     unset($locationSettings['base_download_url']);
     // see http://wiki.snom.com/Interoperability/Asterisk#Basic_Asterisk_configuration
     $locationSettings['user_phone'] = 'off';
     $locationSettings['filter_registrar'] = 'off';
     $locationSettings['challenge_response'] = 'off';
     $locationSettings['call_completion'] = 'off';
     // disable redundant keys
     $locationSettings['redundant_fkeys'] = 'off';
     $locationSettings['setting_server'] = Voipmanager_Frontend_Snom_Abstract::getBaseUrl() . '?method=Voipmanager.settings&mac=' . $_phone->macaddress;
     $locationSettings['firmware_status'] = Voipmanager_Frontend_Snom_Abstract::getBaseUrl() . '?method=Voipmanager.firmware&mac=' . $_phone->macaddress;
     foreach ($locationSettings as $key => $value) {
         $child = $_xml->addChild($key, $value);
         if ($key == 'admin_mode') {
             $child->addAttribute('perm', 'RW');
         } else {
             $child->addAttribute('perm', 'RO');
         }
     }
     // reset old dialplan
     $child = $_xml->addChild('user_dp_str1');
     $child->addAttribute('perm', 'RW');
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " xml " . $_xml->asXML());
     }
 }