Show
Ignore:
Timestamp:
08/22/08 14:36:04 (3 months ago)
Author:
seanmh
Message:

Added back end database to handle state for extensions/users, profiles queues and conference rooms.
Added checkboxes to relevant pages to specify which extensions/users, profiles, queues, and conference rooms should be displayed in iSymphony.
Added password field on the extension/user page to specify profile passwords.
Added iSymphony sever process state and version display on the FreePBX iSymphony page.
Added the ability to reload the iSymphony server from the FreePBX iSymphony page.
Added license information display on the FreePBX iSymphony page.
Added the ability to activate a license via the FreePBX iSymphony page.
Added module debug options to the FreePBX iSymphony page via the addition of "&debug=yes" to the URL.
Added support for Device User Mode configuration while using iSymphony 2.1.
Modified description and setup instructions on the FreePBX iSymphony page.

Files:

Legend:

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

    r6242 r6438  
    44 *Author       : Michael Yara 
    55 *Created      : June 27, 2008 
    6  *Last Updated : July 28, 2008 
    7  *History      : 0.4 
     6 *Last Updated : August 22, 2008 
     7 *History      : 0.6 
    88 *Purpose      : FreePBX module that automatically updates the iSymphony configuration from the FreePBX configuration. 
    99 *Copyright    : 2008 HEHE Enterprises, LLC 
     
    3737} 
    3838 
     39//If check box GUI element does not exist add it 
     40if(!class_exists("gui_checkbox")) { 
     41        class gui_checkbox extends guiinput { 
     42               function gui_checkbox($elemname, $checked=false, $prompttext='', $helptext='', $value='on', $post_text = '', $jsonclick = '', $disable=false) { 
     43                       $parent_class = get_parent_class($this); 
     44                       parent::$parent_class($elemname, '', $prompttext, $helptext); 
     45         
     46                       $itemchecked = $checked ? 'checked' : ''; 
     47                       $disable_state = $disable ? 'disabled="true"' : ''; 
     48                       $js_onclick_include = ($jsonclick != '') ? 'onclick="' . $jsonclick. '"' : ''; 
     49                       $tabindex = function_exists("guielement::gettabindex") ? "tabindex=" . guielement::gettabindex() : "";  
     50 
     51                       $this->html_input = "<input type=\"checkbox\" name=\"$this->_elemname\" id=\"$this->_elemname\" $disable_state $tabindex value=\"$value\" $js_onclick_include $itemchecked/>$post_text\n"; 
     52               } 
     53        } 
     54} 
     55 
     56 
     57//Main contributing module function------------------------------------------------------------------------------------------------------------------ 
    3958function isymphony_get_config($engine) { 
    4059         
    41         global $ext, $ISERROR
     60        global $ext, $ISERROR, $amp_conf
    4261         
    4362        switch($engine) { 
     
    111130 
    112131                        //Connect to iSymphony server to query and submit information 
    113                         if(!iSymphonyConnect()) { 
    114                                 isymphony_write_to_file($errorLogFile, $ISERROR. "\n"); 
    115                         } 
     132                        if(iSymphonyConnect()) { 
    116133                         
    117                         //Check if default location exists if not create it else update manager connection values to stay consistent 
    118                         if(($iSymphonyLocations = getISymphonyLocationList()) !== false) { 
    119                                 if(!in_array("default", $iSymphonyLocations)) { 
    120                                         $object = new ISymphonyLocation; 
    121                                         $object->name = "default"; 
    122                                         $object->admin_password = "secret"; 
    123                                         $object->asterisk_host = "localhost"; 
    124                                         $object->asterisk_port = "5038"; 
    125                                         $object->asterisk_login = "isymphony"; 
    126                                         $object->asterisk_password = "ismanager*con"; 
    127                                         $object->originate_timeout = "30000"; 
    128                                         $object->jabber_host = ""; 
    129                                         $object->jabber_port = "5222"; 
    130                                         if($object->add()) { 
    131                                                 isymphony_write_to_file($debugLogFile, "Added location default\n"); 
    132                                         } else { 
    133                                                 isymphony_write_to_file($errorLogFile, "(Add location)" . $ISERROR. "\n"); 
    134                                         } 
    135                                 } else { 
    136                                         if(($object = getISymphonyLocation("default")) !== false) { 
    137                                                  
    138                                                 //Check if update needs to occur 
    139                                                 if(($object->asterisk_host != "localhost") || ($object->asterisk_port != "5038") || ($object->asterisk_login != "isymphony") || ($object->asterisk_password != "ismanager*con")) {               
    140                                                                  
    141                                                         $object->asterisk_host = "localhost"; 
    142                                                         $object->asterisk_port = "5038"; 
    143                                                         $object->asterisk_login = "isymphony"; 
    144                                                         $object->asterisk_password = "ismanager*con"; 
    145                                                          
    146                                                         if($object->update()) { 
    147                                                                 isymphony_write_to_file($debugLogFile, "Updated location default\n"); 
    148                                                         } else { 
    149                                                                 isymphony_write_to_file($errorLogFile, "(Update location)" . $ISERROR. "\n");    
    150                                                         } 
    151                                                 }        
    152                                         } else { 
    153                                                 isymphony_write_to_file($errorLogFile, "(Query location)" . $ISERROR. "\n"); 
    154                                         } 
    155                                 } 
    156                         } else { 
    157                                 isymphony_write_to_file($errorLogFile, "(List locations)" . $ISERROR. "\n"); 
    158                         } 
    159  
    160                         //Check if default tenant exists if not create it else update context values to stay consistent 
    161                         if(($iSymphonyTenants = getISymphonyTenantList("default")) !== false) { 
    162                                 if(!in_array("default", $iSymphonyTenants)) { 
    163                                         $object = new ISymphonyTenant; 
    164                                         $object->name = "default"; 
    165                                         $object->admin_password = "secret"; 
    166                                         $object->originating_context = "from-internal"; 
    167                                         $object->redirecting_context = "from-internal"; 
    168                                         $object->music_on_hold_class = "default"; 
    169                                         $object->outside_line_number = ""; 
    170                                         $object->record_file_name = "%EXT%-%NAME%-%CID_NAME%-%CID_NUMBER%-%DATE%-%TIME%"; 
    171                                         $object->record_file_extension = "wav"; 
    172                                         $object->mix_mode = "true"; 
    173                                         if($object->add("default")) { 
    174                                                 isymphony_write_to_file($debugLogFile, "Added tenant default\n"); 
    175                                         } else { 
    176                                                 isymphony_write_to_file($errorLogFile, "(Add tenant)" . $ISERROR. "\n"); 
    177                                         } 
    178                                 } else { 
    179                                         if(($object = getISymphonyTenant("default", "default")) !== false) { 
    180                                                  
    181                                                 //Check if update needs to occur 
    182                                                 if(($object->originating_context != "from-internal") || ($object->redirecting_context != "from-internal")) { 
    183                                                          
    184                                                         $object->originating_context = "from-internal"; 
    185                                                         $object->redirecting_context = "from-internal"; 
    186                                                          
    187                                                         if($object->update()) { 
    188                                                                 isymphony_write_to_file($debugLogFile, "Updated tenant default\n"); 
    189                                                         } else { 
    190                                                                 isymphony_write_to_file($errorLogFile, "(Update tenant)" . $ISERROR. "\n");      
    191                                                         }        
     134                                //Check for device user mode 
     135                                $deviceUserMode = ($amp_conf["AMPEXTENSIONS"] == "deviceanduser") ? "true" : "false"; 
     136                                 
     137                                //Check if default location exists if not create it else update manager connection values to stay consistent 
     138                                if(($iSymphonyLocations = getISymphonyLocationList()) !== false) { 
     139                                        if(!in_array("default", $iSymphonyLocations)) { 
     140                                                $object = new ISymphonyLocation; 
     141                                                $object->name = "default"; 
     142                                                $object->admin_password = "secret"; 
     143                                                $object->asterisk_host = "localhost"; 
     144                                                $object->asterisk_port = "5038"; 
     145                                                $object->asterisk_login = "isymphony"; 
     146                                                $object->asterisk_password = "ismanager*con"; 
     147                                                $object->originate_timeout = "30000"; 
     148                                                $object->jabber_host = ""; 
     149                                                $object->jabber_port = "5222"; 
     150                                                $object->device_user_mode = $deviceUserMode; 
     151                                                if($object->add()) { 
     152                                                        isymphony_write_to_file($debugLogFile, "Added location default\n"); 
     153                                                } else { 
     154                                                        isymphony_write_to_file($errorLogFile, "(Add location)" . $ISERROR. "\n"); 
    192155                                                } 
    193156                                        } else { 
    194                                                 isymphony_write_to_file($errorLogFile, "(Query tenant)" . $ISERROR. "\n"); 
    195                                         } 
     157                                                if(($object = getISymphonyLocation("default")) !== false) { 
     158                                                         
     159                                                        //Check if update needs to occur 
     160                                                        if(($object->asterisk_host != "localhost") || ($object->asterisk_port != "5038") || ($object->asterisk_login != "isymphony") || ($object->asterisk_password != "ismanager*con") || ($object->device_user_mode != $deviceUserMode)) {             
     161                                                                         
     162                                                                $object->asterisk_host = "localhost"; 
     163                                                                $object->asterisk_port = "5038"; 
     164                                                                $object->asterisk_login = "isymphony"; 
     165                                                                $object->asterisk_password = "ismanager*con"; 
     166                                                                $object->device_user_mode = $deviceUserMode; 
     167                                                                 
     168                                                                if($object->update()) { 
     169                                                                        isymphony_write_to_file($debugLogFile, "Updated location default\n"); 
     170                                                                } else { 
     171                                                                        isymphony_write_to_file($errorLogFile, "(Update location)" . $ISERROR. "\n");    
     172                                                                } 
     173                                                        }        
     174                                                } else { 
     175                                                        isymphony_write_to_file($errorLogFile, "(Query location)" . $ISERROR. "\n"); 
     176                                                } 
     177                                        } 
     178                                } else { 
     179                                        isymphony_write_to_file($errorLogFile, "(List locations)" . $ISERROR. "\n"); 
    196180                                } 
    197                         } else { 
    198                                 isymphony_write_to_file($errorLogFile, "(List tenants)" . $ISERROR. "\n"); 
    199                         } 
    200  
    201                         /* 
    202                          * Grab list of configured users from FreePBX and 
    203                          * compare them to the ones configured in iSymphony. Add, remove, and update  
    204                          * any extensions and profiles that differ from the FreePBX config. 
    205                          */                      
    206                         if((!function_exists("core_users_list")) || (($freePBXUsers = core_users_list()) === null)){ 
     181         
     182                                //Check if default tenant exists if not create it else update context values to stay consistent 
     183                                if(($iSymphonyTenants = getISymphonyTenantList("default")) !== false) { 
     184                                        if(!in_array("default", $iSymphonyTenants)) { 
     185                                                $object = new ISymphonyTenant; 
     186                                                $object->name = "default"; 
     187                                                $object->admin_password = "secret"; 
     188                                                $object->originating_context = "from-internal"; 
     189                                                $object->redirecting_context = "from-internal"; 
     190                                                $object->music_on_hold_class = "default"; 
     191                                                $object->outside_line_number = ""; 
     192                                                $object->record_file_name = "%EXT%-%NAME%-%CID_NAME%-%CID_NUMBER%-%DATE%-%TIME%"; 
     193                                                $object->record_file_extension = "wav"; 
     194                                                $object->mix_mode = "true"; 
     195                                                if($object->add("default")) { 
     196                                                        isymphony_write_to_file($debugLogFile, "Added tenant default\n"); 
     197                                                } else { 
     198                                                        isymphony_write_to_file($errorLogFile, "(Add tenant)" . $ISERROR. "\n"); 
     199                                                } 
     200                                        } else { 
     201                                                if(($object = getISymphonyTenant("default", "default")) !== false) { 
     202                                                         
     203                                                        //Check if update needs to occur 
     204                                                        if(($object->originating_context != "from-internal") || ($object->redirecting_context != "from-internal")) { 
     205                                                                 
     206                                                                $object->originating_context = "from-internal"; 
     207                                                                $object->redirecting_context = "from-internal"; 
     208                                                                 
     209                                                                if($object->update()) { 
     210                                                                        isymphony_write_to_file($debugLogFile, "Updated tenant default\n"); 
     211                                                                } else { 
     212                                                                        isymphony_write_to_file($errorLogFile, "(Update tenant)" . $ISERROR. "\n");      
     213                                                                }        
     214                                                        } 
     215                                                } else { 
     216                                                        isymphony_write_to_file($errorLogFile, "(Query tenant)" . $ISERROR. "\n"); 
     217                                                } 
     218                                        } 
     219                                } else { 
     220                                        isymphony_write_to_file($errorLogFile, "(List tenants)" . $ISERROR. "\n"); 
     221                                } 
     222         
     223                                //Grab list of configured extensions from the database   
     224                                $freePBXTempUsers = isymphony_user_list(); 
     225                                 
     226                                //Filter list to exclude extensions that are not marked for addition 
    207227                                $freePBXUsers = array(); 
    208                         } 
    209                          
    210                         if((($iSymphonyExtensions = getISymphonyExtensionList("default", "default")) !== false) && (($iSymphonyProfiles = getISymphonyProfileList("default", "default")) !== false)) { 
    211                                  
    212                                 //Build array of freePBX extensions to compare to iSymphony list for deletes  
    213                                 $freePBXExtensionCheckDeleteArray = array(); 
    214                                 foreach($freePBXUsers as $freePBXUser) { 
    215                                         array_push($freePBXExtensionCheckDeleteArray, $freePBXUser[0]); 
     228                                foreach($freePBXTempUsers as $freePBXTempUser) { 
     229                                        if($freePBXTempUser["add_extension"] == "1") { 
     230                                                array_push($freePBXUsers, $freePBXTempUser); 
     231                                        } 
    216232                                } 
    217233                                 
    218                                 //Delete appropriate extensions 
    219                                 $deleteExtensionArray = array_diff($iSymphonyExtensions, $freePBXExtensionCheckDeleteArray); 
    220                                 foreach($deleteExtensionArray as $val) { 
    221                                         if(removeISymphonyExtension("default", "default", $val)) { 
    222                                                 isymphony_write_to_file($debugLogFile, "Deleted extension {$val}\n"); 
    223                                                 $iSymphonyExtensions = isymphony_remove_array_item($iSymphonyExtensions, $val); 
    224                                         } else { 
    225                                                 isymphony_write_to_file($errorLogFile, "(Delete extension)" . $ISERROR. "\n"); 
     234                                //Filter the previous list for profiles excluding ones not marked for profile addition 
     235                                $freePBXProfiles = array(); 
     236                                foreach($freePBXUsers as $freePBXUser) { 
     237                                        if($freePBXUser["add_profile"] == "1") { 
     238                                                array_push($freePBXProfiles, $freePBXUser); 
    226239                                        } 
    227240                                } 
    228                                  
    229                                 //Delete appropriate profiles 
    230                                 $deleteProfileArray = array_diff($iSymphonyProfiles, $freePBXExtensionCheckDeleteArray); 
    231                                 foreach($deleteProfileArray as $val) { 
    232                                         if(removeISymphonyProfile("default", "default", $val)) { 
    233                                                 isymphony_write_to_file($debugLogFile, "Deleted profile {$val}\n"); 
    234                                                 $iSymphonyProfiles = isymphony_remove_array_item($iSymphonyProfiles, $val); 
    235                                         } else { 
    236                                                 isymphony_write_to_file($errorLogFile, "(Delete profile)" . $ISERROR. "\n"); 
    237                                         } 
    238                                 } 
    239                                                                  
    240                                 foreach($freePBXUsers as $freePBXUser) { 
     241         
     242                                //Add, edit and remove extensions and profiles 
     243                                if((($iSymphonyExtensions = getISymphonyExtensionList("default", "default")) !== false) && (($iSymphonyProfiles = getISymphonyProfileList("default", "default")) !== false)) { 
    241244                                         
    242                                         if(function_exists("core_devices_get") && function_exists("core_devices_getsip") && function_exists("core_devices_getiax2")) { 
     245                                        //Build array of freePBX extensions to compare to iSymphony list for deletes  
     246                                        $freePBXExtensionCheckDeleteArray = array(); 
     247                                        foreach($freePBXUsers as $freePBXUser) { 
     248                                                array_push($freePBXExtensionCheckDeleteArray, $freePBXUser["user_id"]); 
     249                                        } 
    243250                                         
    244                                                 $freePBXDeviceInfo = core_devices_get($freePBXUser[0]); 
    245                                                 $extensionDispalyName = $freePBXUser[1] == "" ? $freePBXUser[0] : $freePBXUser[1]; 
     251                                        //Delete appropriate extensions 
     252                                        $deleteExtensionArray = array_diff($iSymphonyExtensions, $freePBXExtensionCheckDeleteArray); 
     253                                        foreach($deleteExtensionArray as $val) { 
     254                                                if(removeISymphonyExtension("default", "default", $val)) { 
     255                                                        isymphony_write_to_file($debugLogFile, "Deleted extension {$val}\n"); 
     256                                                        $iSymphonyExtensions = isymphony_remove_array_item($iSymphonyExtensions, $val); 
     257                                                } else { 
     258                                                        isymphony_write_to_file($errorLogFile, "(Delete extension)" . $ISERROR. "\n"); 
     259                                                } 
     260                                        } 
     261                                                                         
     262                                        //Add and update extensions 
     263                                        foreach($freePBXUsers as $freePBXUser) { 
    246264                                                 
    247                                                 //If extension does not exist add it 
    248                                                 if(!in_array($freePBXUser[0], $iSymphonyExtensions)) { 
     265                                                //If extension does not exist add it else update it 
     266                                                if(!in_array($freePBXUser["user_id"], $iSymphonyExtensions)) { 
    249267                                                         
    250268                                                        //Add extension 
    251269                                                        $object = new ISymphonyExtension; 
    252                                                         $object->extension_val = $freePBXUser[0]; 
    253                                                         $object->name = $extensionDispalyName
    254                                                         $object->peer = $freePBXDeviceInfo['dial']; 
     270                                                        $object->extension_val = $freePBXUser["user_id"]; 
     271                                                        $object->name = $freePBXUser["display_name"]
     272                                                        $object->peer = $freePBXUser["peer"]; 
    255273                                                        $object->alt_origination_method = ""; 
    256                                                         $object->voice_mail = $freePBXUser[0]; 
     274                                                        $object->voice_mail = $freePBXUser["user_id"]; 
    257275                                                         
    258276                                                        if($object->add("default","default")) { 
    259                                                                 isymphony_write_to_file($debugLogFile, "Added extension {$freePBXUser[0]}\n"); 
     277                                                                isymphony_write_to_file($debugLogFile, "Added extension {$freePBXUser['user_id']}\n"); 
    260278                                                        } else { 
    261279                                                                isymphony_write_to_file($errorLogFile, "(Add extension)" . $ISERROR . "\n"); 
    262280                                                        } 
    263                                                          
    264                                                 //If extension does exist update it      
    265281                                                } else { 
    266282                                                         
    267283                                                        //Query extension configuration and update values 
    268                                                         if(($object = getISymphonyExtension("default", "default", $freePBXUser[0])) !== false) {               
     284                                                        if(($object = getISymphonyExtension("default", "default", $freePBXUser["user_id"])) !== false) {               
    269285                                                                                                         
    270286                                                                //Check if update needs to occur 
    271                                                                 if(($object->name != $extensionDispalyName) || ($object->voice_mail != $freePBXUser[0]) || ($object->peer != $freePBXDeviceInfo['dial'])) {            
     287                                                                if(($object->name != $freePBXUser["display_name"]) || ($object->voice_mail != $freePBXUser["user_id"]) || ($object->peer != $freePBXUser["peer"])) {           
    272288                                                                                         
    273                                                                         $object->name = $extensionDispalyName
    274                                                                         $object->voice_mail = $freePBXUser[0]; 
    275                                                                         $object->peer = $freePBXDeviceInfo['dial']; 
     289                                                                        $object->name = $freePBXUser["display_name"]
     290                                                                        $object->voice_mail = $freePBXUser["user_id"]; 
     291                                                                        $object->peer = $freePBXUser["peer"]; 
    276292                                                                         
    277293                                                                        if($object->update()) { 
    278                                                                                 isymphony_write_to_file($debugLogFile, "Updated extension {$freePBXUser[0]}\n"); 
     294                                                                                isymphony_write_to_file($debugLogFile, "Updated extension {$freePBXUser['user_id']}\n"); 
    279295                                                                        } else { 
    280296                                                                                isymphony_write_to_file($errorLogFile, "(Update extension)" . $ISERROR. "\n");   
     
    284300                                                                isymphony_write_to_file($errorLogFile, "(Query extension)" . $ISERROR. "\n");  
    285301                                                        } 
    286                                                 }                                
     302                                                } 
     303                                        } 
    287304                                                 
    288                                                 //If profile does not exist add it 
    289                                                 if(!in_array($freePBXUser[0], $iSymphonyProfiles)) { 
    290                                                          
    291                                                         //Check sip and iax for a secret to use as a profile password 
    292                                                         $profilePassword = ""; 
    293                                                         if(($sipInfo = core_devices_getsip($freePBXUser[0])) != null) { 
    294                                                                 $profilePassword = $sipInfo['secret']; 
    295                                                         } else if(($aixInfo = core_devices_getiax2($freePBXUser[0])) != null) { 
    296                                                                 $profilePassword = $aixInfo['secret']; 
    297                                                         } 
    298                                                          
    299                                                         //If no password was found or secret value is blank set to 'secret' 
    300                                                         if($profilePassword == "") { 
    301                                                                 $profilePassword = "secret"; 
    302                                                         } 
    303          
     305                                        //Build array of freePBX extensions to compare to iSymphony list for deletes  
     306                                        $freePBXProfileCheckDeleteArray = array(); 
     307                                        foreach($freePBXProfiles as $freePBXProfile) { 
     308                                                array_push($freePBXProfileCheckDeleteArray, $freePBXProfile["user_id"]); 
     309                                        } 
     310                                                 
     311                                        //Delete appropriate profiles 
     312                                        $deleteProfileArray = array_diff($iSymphonyProfiles, $freePBXProfileCheckDeleteArray); 
     313                                        foreach($deleteProfileArray as $val) { 
     314                                                if(removeISymphonyProfile("default", "default", $val)) { 
     315                                                        isymphony_write_to_file($debugLogFile, "Deleted profile {$val}\n"); 
     316                                                        $iSymphonyProfiles = isymphony_remove_array_item($iSymphonyProfiles, $val); 
     317                                                } else { 
     318                                                        isymphony_write_to_file($errorLogFile, "(Delete profile)" . $ISERROR. "\n"); 
     319                                                } 
     320                                        }        
     321                                                 
     322                                        //Add and update profiles 
     323                                        foreach($freePBXProfiles as $freePBXProfile) { 
     324                         
     325                                                //If profile does not exist add it else update it 
     326                                                if(!in_array($freePBXProfile["user_id"], $iSymphonyProfiles)) { 
     327                                                         
    304328                                                        //Add profile 
    305329                                                        $object = new ISymphonyProfile; 
    306                                                         $object->name = $freePBXUser[0]; 
    307                                                         $object->password = $profilePassword
     330                                                        $object->name = $freePBXProfile["user_id"]; 
     331                                                        $object->password = $freePBXProfile["password"]
    308332                                                        $object->can_view_everyone_directory = "true"; 
    309333                                                         
    310334                                                        if($object->add("default","default")) { 
    311                                                                 isymphony_write_to_file($debugLogFile, "Added profile {$freePBXUser[0]}\n"); 
     335                                                                isymphony_write_to_file($debugLogFile, "Added profile {$freePBXProfile['user_id']}\n"); 
    312336                                                        } else { 
    313337                                                                isymphony_write_to_file($errorLogFile, "(Add profile)" . $ISERROR . "\n"); 
     
    315339                                                 
    316340                                                        //Add extension to profiles managed list 
    317                                                         if(addISymphonyProfileManagedExtension("default","default",$freePBXUser[0],$freePBXUser[0])) { 
    318                                                                 isymphony_write_to_file($debugLogFile, "Added profile managed extension {$freePBXUser[0]}\n"); 
     341                                                        if(addISymphonyProfileManagedExtension("default","default",$freePBXProfile["user_id"],$freePBXProfile["user_id"])) { 
     342                                                                isymphony_write_to_file($debugLogFile, "Added profile managed extension {$freePBXProfile['user_id']}\n"); 
    319343                                                        } else { 
    320344                                                                isymphony_write_to_file($errorLogFile, "(Add profile managed extension)" . $ISERROR . "\n"); 
    321345                                                        } 
     346                                                } else { 
     347                                                         
     348                                                        //Query profile configuration and update values 
     349                                                        if(($object = getISymphonyProfile("default", "default", $freePBXProfile["user_id"])) !== false) {                
     350                                                                                                         
     351                                                                //Check if update needs to occur 
     352                                                                if($object->password != $freePBXProfile["password"]) {           
     353                                                                                         
     354                                                                        $object->password = $freePBXProfile["password"]; 
     355                                                                         
     356                                                                        if($object->update()) { 
     357                                                                                isymphony_write_to_file($debugLogFile, "Updated profile {$freePBXProfile['user_id']}\n"); 
     358                                                                        } else { 
     359                                                                                isymphony_write_to_file($errorLogFile, "(Update profile)" . $ISERROR. "\n");     
     360                                                                        }        
     361                                                                } 
     362                                                        } else { 
     363                                                                isymphony_write_to_file($errorLogFile, "(Query profile)" . $ISERROR. "\n");  
     364                                                        } 
     365                                                }                                                                                                
     366                                        } 
     367                                } else { 
     368                                        isymphony_write_to_file($errorLogFile, "(List extensions/profiles)" . $ISERROR. "\n"); 
     369                                }        
     370                                 
     371                                //Grab list of configured queues from the database       
     372                                $freePBXTempQueues = isymphony_queue_list(); 
     373         
     374                                //Filter list to exclude queues that are not marked for addition 
     375                                $freePBXQueues = array(); 
     376                                foreach($freePBXTempQueues as $freePBXTempQueue) { 
     377                                        if($freePBXTempQueue["add_queue"] == "1") { 
     378                                                array_push($freePBXQueues, $freePBXTempQueue); 
     379                                        } 
     380                                } 
     381         
     382                                //Add, edit and remove queues 
     383                                if(($iSymphonyQueues = getISymphonyQueueList("default", "default")) !== false) { 
     384                                         
     385                                        //Build array of freePBX queues to compare to iSymphony list for deletes  
     386                                        $freePBXQueueCheckDeleteArray = array(); 
     387                                        foreach($freePBXQueues as $freePBXQueue) { 
     388                                                array_push($freePBXQueueCheckDeleteArray, $freePBXQueue["display_name"]); 
     389      &