Show
Ignore:
Timestamp:
05/29/09 14:01:54 (3 years ago)
Author:
seanmh
Message:

1.0.0 Added backward compatibility support for 2.0 rev 1104.

Fixed bug in which a flawed context would prevent orphaned parked calls from ringing back to the parking extension if parked via the panel.
Made debug menu always visible.
Added server debug menu.
Debug logs now show on main module page.
Multiple debug options can now be set at once.
Added database column checks in installation script to handle module upgrades.
Added default FreePBX page context to configuration.
Added admin username and password fields to the main module page.
Added originate timeout field to main module page.
Added auto reload and enable page status checkboxes to main module page.
Added global Jabber connection configuration fields on main module page.
Added email and cell phone fields to extension page.
Added Jabber connection configuration override fields to extension page.
Added Jabber username and password fields to extension page.
Added auto answer checkbox to extension page.
Modified database debug tables to account for new tables and columns.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • contributed_modules/modules/isymphony/install.php

    r6771 r7772  
    44 *Author       : Michael Yara 
    55 *Created      : August 15, 2008 
    6  *Last Updated : September 17, 2008 
    7  *History      : 0.2 
     6 *Last Updated : May 26, 2009 
     7 *History      : 0.3 
    88 *Purpose      : Create and populate isymphony tables 
    99 *Copyright    : 2008 HEHE Enterprises, LLC 
     
    1111 
    1212global $db; 
     13 
     14//Create location table 
     15$query = "  CREATE TABLE IF NOT EXISTS  
     16      isymphony_location( admin_user_name VARCHAR(100), 
     17                admin_password VARCHAR(100), 
     18                originate_timeout INTEGER(10), 
     19                auto_reload INTEGER(1), 
     20                page_status_enabled INTEGER(1), 
     21                jabber_host VARCHAR(100), 
     22                jabber_domain VARCHAR(100), 
     23                jabber_resource VARCHAR(100), 
     24                jabber_port INTEGER(10))";  
     25                 
     26echo "Creating \"isymphony_location\" Table....<br>";                
     27$results = $db->query($query); 
     28if(DB::IsError($results) && ($results->getCode() != DB_ERROR_ALREADY_EXISTS)) { 
     29  echo "ERROR: could not create table.<br>"; 
     30} else { 
     31   
     32  //Check to see if table already contains location information if not insert row of default values 
     33  $result = $db->query("SELECT * FROM isymphony_location"); 
     34  if($result->numRows() == 0) { 
     35     
     36    //Populate with default values 
     37    echo "Populating table.....<br>"; 
     38    $prepStatement = $db->prepare("INSERT INTO isymphony_location (admin_user_name, admin_password, originate_timeout, auto_reload, page_status_enabled, jabber_port, jabber_resource) VALUES (?, ?, ?, ?, ?, ?, ?)"); 
     39    $values = array("admin", "secret", "30000", 1, 1, 5222, "iSymphony"); 
     40    $db->execute($prepStatement, $values); 
     41  } 
     42}                
     43echo "Done<br>";                 
    1344 
    1445//Create users table 
     
    2051              password VARCHAR(100),  
    2152              display_name VARCHAR(100),  
    22               peer VARCHAR(100))"; 
     53              peer VARCHAR(100), 
     54              email VARCHAR(100), 
     55              cell_phone VARCHAR(100), 
     56              auto_answer INTEGER(1), 
     57              jabber_host VARCHAR(100), 
     58              jabber_domain VARCHAR(100), 
     59              jabber_resource VARCHAR(100), 
     60              jabber_port INTEGER(10), 
     61              jabber_user_name VARCHAR(100), 
     62              jabber_password VARCHAR(100))"; 
    2363 
    2464echo "Creating \"isymphony_users\" Table....<br>"; 
     
    2767  echo "ERROR: could not create table.<br>"; 
    2868} else { 
     69 
     70 
     71  //If updating check if proper column entries exist. If not create them. Used for module upgrade purposes. 
     72  $iSymphonyUserTableStringColumns = array("email", "cell_phone", "jabber_host", "jabber_domain", "jabber_resource", "jabber_user_name", "jabber_password"); 
     73  $iSymphonyUserTableIntegerColumns = array("jabber_port"); 
     74  $iSymphonyUserTableBooleanColumns= array("auto_answer"); 
     75 
     76  foreach($iSymphonyUserTableStringColumns as $stringColumn) { 
     77    $sql = "SELECT $stringColumn FROM isymphony_users"; 
     78    $check = $db->getRow($sql, DB_FETCHMODE_ASSOC); 
     79    if(DB::IsError($check)) { 
     80        $sql = "ALTER TABLE isymphony_users ADD $stringColumn VARCHAR(200);"; 
     81        $result = $db->query($sql); 
     82        if(DB::IsError($result)) { die_freepbx($result->getDebugInfo()); } 
     83    } 
     84  } 
     85   
     86  foreach($iSymphonyUserTableIntegerColumns as $integerColumn) { 
     87    $sql = "SELECT $integerColumn FROM isymphony_users"; 
     88    $check = $db->getRow($sql, DB_FETCHMODE_ASSOC); 
     89    if(DB::IsError($check)) { 
     90        $sql = "ALTER TABLE isymphony_users ADD $integerColumn INTEGER(10);"; 
     91        $result = $db->query($sql); 
     92        if(DB::IsError($result)) { die_freepbx($result->getDebugInfo()); } 
     93    } 
     94  } 
     95   
     96  foreach($iSymphonyUserTableBooleanColumns as $booleanColumn) { 
     97    $sql = "SELECT $booleanColumn FROM isymphony_users"; 
     98    $check = $db->getRow($sql, DB_FETCHMODE_ASSOC); 
     99    if(DB::IsError($check)) { 
     100        $sql = "ALTER TABLE isymphony_users ADD $booleanColumn INTEGER(1);"; 
     101        $result = $db->query($sql); 
     102        if(DB::IsError($result)) { die_freepbx($result->getDebugInfo()); } 
     103    } 
     104  } 
    29105 
    30106  //Add users to table 
     
    39115        $extensionPeer = ($freePBXDeviceInfo['dial'] != "") ? $freePBXDeviceInfo['dial'] : "SIP/$userId"; 
    40116         
    41         $prepStatement = $db->prepare("INSERT INTO isymphony_users (user_id, add_extension, add_profile, password, display_name, peer) VALUES (?, ?, ?, ?, ?, ?)"); 
    42         $values = array($userId, 1, 1, "secret", $extensionDisplayName, $extensionPeer); 
     117        $prepStatement = $db->prepare("INSERT INTO isymphony_users (user_id, add_extension, add_profile, password, display_name, peer, auto_answer, jabber_resource) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"); 
     118        $values = array($userId, 1, 1, "secret", $extensionDisplayName, $extensionPeer, 0, "iSymphony"); 
    43119        $db->execute($prepStatement, $values); 
    44120      }