Changeset 6438
- Timestamp:
- 08/22/08 17:36:04 (5 years ago)
- Files:
-
- contributed_modules/modules/isymphony/functions.inc.php (modified) (6 diffs)
- contributed_modules/modules/isymphony/install.php (modified) (1 diff)
- contributed_modules/modules/isymphony/isymphony-php-library/isymphony.php (modified) (2 diffs)
- contributed_modules/modules/isymphony/isymphony-php-library/library/classes.php (modified) (3 diffs)
- contributed_modules/modules/isymphony/isymphony-php-library/library/property_arrays.php (modified) (2 diffs)
- contributed_modules/modules/isymphony/module.xml (modified) (2 diffs)
- contributed_modules/modules/isymphony/page.isymphony.php (modified) (6 diffs)
- contributed_modules/modules/isymphony/uninstall.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
contributed_modules/modules/isymphony/functions.inc.php
r6242 r6438 4 4 *Author : Michael Yara 5 5 *Created : June 27, 2008 6 *Last Updated : July 28, 20087 *History : 0. 46 *Last Updated : August 22, 2008 7 *History : 0.6 8 8 *Purpose : FreePBX module that automatically updates the iSymphony configuration from the FreePBX configuration. 9 9 *Copyright : 2008 HEHE Enterprises, LLC … … 37 37 } 38 38 39 //If check box GUI element does not exist add it 40 if(!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------------------------------------------------------------------------------------------------------------------ 39 58 function isymphony_get_config($engine) { 40 59 41 global $ext, $ISERROR ;60 global $ext, $ISERROR, $amp_conf; 42 61 43 62 switch($engine) { … … 111 130 112 131 //Connect to iSymphony server to query and submit information 113 if(!iSymphonyConnect()) { 114 isymphony_write_to_file($errorLogFile, $ISERROR. "\n"); 115 } 132 if(iSymphonyConnect()) { 116 133 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"); 192 155 } 193 156 } 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"); 196 180 } 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 207 227 $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 } 216 232 } 217 233 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); 226 239 } 227 240 } 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)) { 241 244 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 } 243 250 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) { 246 264 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)) { 249 267 250 268 //Add extension 251 269 $object = new ISymphonyExtension; 252 $object->extension_val = $freePBXUser[ 0];253 $object->name = $ extensionDispalyName;254 $object->peer = $freePBX DeviceInfo['dial'];270 $object->extension_val = $freePBXUser["user_id"]; 271 $object->name = $freePBXUser["display_name"]; 272 $object->peer = $freePBXUser["peer"]; 255 273 $object->alt_origination_method = ""; 256 $object->voice_mail = $freePBXUser[ 0];274 $object->voice_mail = $freePBXUser["user_id"]; 257 275 258 276 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"); 260 278 } else { 261 279 isymphony_write_to_file($errorLogFile, "(Add extension)" . $ISERROR . "\n"); 262 280 } 263 264 //If extension does exist update it265 281 } else { 266 282 267 283 //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) { 269 285 270 286 //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"])) { 272 288 273 $object->name = $ extensionDispalyName;274 $object->voice_mail = $freePBXUser[ 0];275 $object->peer = $freePBX DeviceInfo['dial'];289 $object->name = $freePBXUser["display_name"]; 290 $object->voice_mail = $freePBXUser["user_id"]; 291 $object->peer = $freePBXUser["peer"]; 276 292 277 293 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"); 279 295 } else { 280 296 isymphony_write_to_file($errorLogFile, "(Update extension)" . $ISERROR. "\n"); … … 284 300 isymphony_write_to_file($errorLogFile, "(Query extension)" . $ISERROR. "\n"); 285 301 } 286 } 302 } 303 } 287 304 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 304 328 //Add profile 305 329 $object = new ISymphonyProfile; 306 $object->name = $freePBX User[0];307 $object->password = $ profilePassword;330 $object->name = $freePBXProfile["user_id"]; 331 $object->password = $freePBXProfile["password"]; 308 332 $object->can_view_everyone_directory = "true"; 309 333 310 334 if($object->add("default","default")) { 311 isymphony_write_to_file($debugLogFile, "Added profile {$freePBX User[0]}\n");335 isymphony_write_to_file($debugLogFile, "Added profile {$freePBXProfile['user_id']}\n"); 312 336 } else { 313 337 isymphony_write_to_file($errorLogFile, "(Add profile)" . $ISERROR . "\n"); … … 315 339 316 340 //Add extension to profiles managed list 317 if(addISymphonyProfileManagedExtension("default","default",$freePBX User[0],$freePBXUser[0])) {318 isymphony_write_to_file($debugLogFile, "Added profile managed extension {$freePBX User[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"); 319 343 } else { 320 344 isymphony_write_to_file($errorLogFile, "(Add profile managed extension)" . $ISERROR . "\n"); 321 345 } 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 } 390 391 //Delete appropriate queues 392 $deleteQueueArray = array_diff($iSymphonyQueues, $freePBXQueueCheckDeleteArray); 393 foreach($deleteQueueArray as $val) { 394 if(removeISymphonyQueue("default", "default", $val)) { 395 isymphony_write_to_file($debugLogFile, "Deleted queue {$val}\n"); 396 $iSymphonyQueues = isymphony_remove_array_item($iSymphonyQueues, $val); 397 } else { 398 isymphony_write_to_file($errorLogFile, "(Delete queue)" . $ISERROR. "\n"); 399 } 400 } 401 402 //Add and update queues 403 foreach($freePBXQueues as $freePBXQueue) { 404 405 //If queue does not exist add it 406 if(!in_array($freePBXQueue["display_name"], $iSymphonyQueues)) { 407 408 //Add queue 409 $object = new ISymphonyQueue; 410 $object->name = $freePBXQueue["display_name"]; 411 $object->queue_val = $freePBXQueue["queue_id"]; 412 $object->extension_val = $freePBXQueue["queue_id"]; 413 $object->context = "from-internal"; 414 415 if($object->add("default","default")) { 416 isymphony_write_to_file($debugLogFile, "Added queue {$freePBXQueue['display_name']}\n"); 417 } else { 418 isymphony_write_to_file($errorLogFile, "(Add queue)" . $ISERROR . "\n"); 419 } 420 421 //If queue does exist update it 422 } else { 423 424 //Query queue configuration and update values 425 if(($object = getISymphonyQueue("default", "default", $freePBXQueue["display_name"])) !== false) { 426 427 //Check if update needs to occur 428 if(($object->name != $freePBXQueue["display_name"]) || ($object->queue_val != $freePBXQueue["queue_id"]) || ($object->extension_val != $freePBXQueue["queue_id"]) || ($object->context != "from-internal")) { 429 430 $object->name = $freePBXQueue["display_name"]; 431 $object->queue_val = $freePBXQueue["queue_id"]; 432 $object->extension_val = $freePBXQueue["queue_id"]; 433 $object->context = "from-internal"; 434 435 if($object->update()) { 436 isymphony_write_to_file($debugLogFile, "Updated queue {$freePBXQueue['display_name']}\n"); 437 } else { 438 isymphony_write_to_file($errorLogFile, "(Update queue)" . $ISERROR. "\n"); 439 } 440 } 441 } else { 442 isymphony_write_to_file($errorLogFile, "(Query queue)" . $ISERROR. "\n"); 443 } 322 444 } 445 } 446 } else { 447 isymphony_write_to_file($errorLogFile, "(List queues)" . $ISERROR. "\n"); 448 } 449 450 //Grab list of configured conference rooms from the database 451 $freePBXTempConferenceRooms = isymphony_conference_room_list(); 452 453 //Filter list to exclude conference rooms that are not marked for addition 454 $freePBXConferenceRooms = array(); 455 foreach($freePBXTempConferenceRooms as $freePBXTempConferenceRoom) { 456 if($freePBXTempConferenceRoom["add_conference_room"] == "1") { 457 array_push($freePBXConferenceRooms, $freePBXTempConferenceRoom); 323 458 } 324 459 } 325 } else { 326 isymphony_write_to_file($errorLogFile, "(List extensions/profiles)" . $ISERROR. "\n"); 327 } 460 461 //Add, edit and remove conference rooms 462 if(($iSymphonyConferenceRooms = getISymphonyConferenceRoomList("default", "default")) !== false) { 463 464 //Build array of freePBX conference rooms to compare to iSymphony list for deletes 465 $freePBXConferenceRoomCheckDeleteArray = array(); 466 foreach($freePBXConferenceRooms as $freePBXConferenceRoom) { 467 array_push($freePBXConferenceRoomCheckDeleteArray, $freePBXConferenceRoom["display_name"]); 468 } 469 470 //Delete appropriate conference rooms 471 $deleteConferenceRoomArray = array_diff($iSymphonyConferenceRooms, $freePBXConferenceRoomCheckDeleteArray); 472 foreach($deleteConferenceRoomArray as $val) { 473 if(removeISymphonyConferenceRoom("default", "default", $val)) { 474 isymphony_write_to_file($debugLogFile, "Deleted conference room {$val}\n"); 475 $iSymphonyConferenceRooms = isymphony_remove_array_item($iSymphonyConferenceRooms, $val); 476 } else { 477 isymphony_write_to_file($errorLogFile, "(Delete conference room)" . $ISERROR. "\n"); 478 } 479 } 480 481 //Add and update conference rooms 482 foreach($freePBXConferenceRooms as $freePBXConferenceRoom) { 483 484 //If conference room does not exist add it 485 if(!in_array($freePBXConferenceRoom["display_name"], $iSymphonyConferenceRooms)) { 486 487 //Add conference room 488 $object = new ISymphonyConferenceRoom; 489 $object->name = $freePBXConferenceRoom["display_name"]; 490 $object->predefined = "true"; 491 $object->room_number = $freePBXConferenceRoom["conference_room_id"]; 492 $object->extension_val = $freePBXConferenceRoom["conference_room_id"]; 493 $object->context = "from-internal"; 494 $object->announce_user_count = "false"; 495 $object->music_on_hold_for_single_user = "false"; 496 $object->exit_room_via_pound = "false"; 497 $object->present_menu_via_star = "false"; 498 $object->announce_user_join_leave = "false"; 499 $object->disable_join_leave_notification = "false"; 500 $object->record = "false"; 501 502 if($object->add("default","default")) { 503 isymphony_write_to_file($debugLogFile, "Added conference room {$freePBXConferenceRoom['display_name']}\n"); 504 } else { 505 isymphony_write_to_file($errorLogFile, "(Add conference room)" . $ISERROR . "\n"); 506 } 507 508 //If conference room does exist update it 509 } else { 510 511 //Query conference room configuration and update values 512 if(($object = getISymphonyConferenceRoom("default", "default", $freePBXConferenceRoom["display_name"])) !== false) { 513 514 //Check if update needs to occur 515 if(($object->name != $freePBXConferenceRoom["display_name"]) || ($object->predefined != "true") || ($object->room_number != $freePBXConferenceRoom["conference_room_id"]) || ($object->extension_val != $freePBXConferenceRoom["conference_room_id"]) || ($object->context != "from-internal")) { 516 517 $object->name = $freePBXConferenceRoom["display_name"]; 518 $object->predefined = "true"; 519 $object->room_number = $freePBXConferenceRoom["conference_room_id"]; 520 $object->extension_val = $freePBXConferenceRoom["conference_room_id"]; 521 $object->context = "from-internal"; 522 523 if($object->update()) { 524 isymphony_write_to_file($debugLogFile, "Updated conference room {$freePBXConferenceRoom['display_name']}\n"); 525 } else { 526 isymphony_write_to_file($errorLogFile, "(Update conference room)" . $ISERROR. "\n"); 527 } 528 } 529 } else { 530 isymphony_write_to_file($errorLogFile, "(Query conference room)" . $ISERROR. "\n"); 531 } 532 } 533 } 534 } else { 535 isymphony_write_to_file($errorLogFile, "(List conference rooms)" . $ISERROR. "\n"); 536 } 537 538 //Close iSymphony connection 539 iSymphonyDisconnect(); 328 540 329 /* 330 * Grab list of configured queues from FreePBX and 331 * compare them to the ones configured in iSymphony. Add, remove, and update 332 * any queues that differ from the FreePBX config. 333 */ 334 if((!function_exists("queues_list")) || (($freePBXQueues = queues_list()) === null)) { 335 $freePBXQueues = array(); 336 } 337 338 if(($iSymphonyQueues = getISymphonyQueueList("default", "default")) !== false) { 339 340 //Build array of freePBX queues to compare to iSymphony list for deletes 341 $freePBXQueueCheckDeleteArray = array(); 342 foreach($freePBXQueues as $freePBXQueue) { 343 array_push($freePBXQueueCheckDeleteArray, ($freePBXQueue[1] == "" ? $freePBXQueue[0] : $freePBXQueue[1])); 344 } 345 346 //Delete appropriate queues 347 $deleteQueueArray = array_diff($iSymphonyQueues, $freePBXQueueCheckDeleteArray); 348 foreach($deleteQueueArray as $val) { 349 if(!removeISymphonyQueue("default", "default", $val)) { 350 isymphony_write_to_file($errorLogFile, "(Delete queue)" . $ISERROR. "\n"); 351 $iSymphonyQueues = isymphony_remove_array_item($iSymphonyQueues, $val); 352 } else { 353 isymphony_write_to_file($debugLogFile, "Deleted extension {$val}\n"); 354 } 355 } 356 357 foreach($freePBXQueues as $freePBXQueue) { 358 359 $queueDispalyName = $freePBXQueue[1] == "" ? $freePBXQueue[0] : $freePBXQueue[1]; 360 361 //If queue does not exist add it 362 if(!in_array($queueDispalyName, $iSymphonyQueues)) { 363 364 //Add queue 365 $object = new ISymphonyQueue; 366 $object->name = $queueDispalyName; 367 $object->queue_val = $freePBXQueue[0]; 368 $object->extension_val = $freePBXQueue[0]; 369 $object->context = "from-internal"; 370 371 if($object->add("default","default")) { 372 isymphony_write_to_file($debugLogFile, "Added queue {$queueDispalyName}\n"); 373 } else { 374 isymphony_write_to_file($errorLogFile, "(Add queue)" . $ISERROR . "\n"); 375 } 376 377 //If queue does exist update it 378 } else { 379 380 //Query queue configuration and update values 381 if(($object = getISymphonyQueue("default", "default", $queueDispalyName)) !== false) { 382 383 //Check if update needs to occur 384 if(($object->name != $queueDispalyName) || ($object->queue_val != $freePBXQueue[0]) || ($object->extension_val != $freePBXQueue[0]) || ($object->context != "from-internal")) { 385 386 $object->name = $queueDispalyName; 387 $object->queue_val = $freePBXQueue[0]; 388 $object->extension_val = $freePBXQueue[0]; 389 $object->context = "from-internal"; 390 391 if($object->update()) { 392 isymphony_write_to_file($debugLogFile, "Updated queue {$queueDispalyName}\n"); 393 } else { 394 isymphony_write_to_file($errorLogFile, "(Update queue)" . $ISERROR. "\n"); 395 } 396 } 397 } else { 398 isymphony_write_to_file($errorLogFile, "(Query queue)" . $ISERROR. "\n"); 399 } 400 } 401 } 402 } else { 403 isymphony_write_to_file($errorLogFile, "(List queues)" . $ISERROR. "\n"); 404 } 405 406 /* 407 * Grab list of configured conference rooms from FreePBX and 408 * compare them to the ones configured in iSymphony. Add, remove, and update 409 * any conference rooms that differ from the FreePBX config. 410 */ 411 if((!function_exists("conferences_list")) || (($freePBXConferenceRooms = conferences_list()) === null)) { 412 $freePBXConferenceRooms = array(); 413 } 414 415 if(($iSymphonyConferenceRooms = getISymphonyConferenceRoomList("default", "default")) !== false) { 416 417 //Build array of freePBX conference rooms to compare to iSymphony list for deletes 418 $freePBXConferenceRoomCheckDeleteArray = array(); 419 foreach($freePBXConferenceRooms as $freePBXConferenceRoom) { 420 array_push($freePBXConferenceRoomCheckDeleteArray, ($freePBXConferenceRoom[1] == "" ? $freePBXConferenceRoom[0] : $freePBXConferenceRoom[1])); 421 } 422 423 //Delete appropriate conference rooms 424 $deleteConferenceRoomArray = array_diff($iSymphonyConferenceRooms, $freePBXConferenceRoomCheckDeleteArray); 425 foreach($deleteConferenceRoomArray as $val) { 426 if(!removeISymphonyConferenceRoom("default", "default", $val)) { 427 isymphony_write_to_file($errorLogFile, "(Delete conference room)" . $ISERROR. "\n"); 428 $iSymphonyConferenceRooms = isymphony_remove_array_item($iSymphonyConferenceRooms, $val); 429 } else { 430 isymphony_write_to_file($debugLogFile, "Deleted conference room {$val}\n"); 431 } 432 } 433 434 foreach($freePBXConferenceRooms as $freePBXConferenceRoom) { 435 436 $conferenceRoomsDispalyName = $freePBXConferenceRoom[1] == "" ? $freePBXConferenceRoom[0] : $freePBXConferenceRoom[1]; 437 438 //If conference room does not exist add it 439 if(!in_array($conferenceRoomsDispalyName, $iSymphonyConferenceRooms)) { 440 441 //Add conference room 442 $object = new ISymphonyConferenceRoom; 443 $object->name = $conferenceRoomsDispalyName; 444 $object->predefined = "true"; 445 $object->room_number = $freePBXConferenceRoom[0]; 446 $object->extension_val = $freePBXConferenceRoom[0]; 447 $object->context = "from-internal"; 448 $object->announce_user_count = "false"; 449 $object->music_on_hold_for_single_user = "false"; 450 $object->exit_room_via_pound = "false"; 451 $object->present_menu_via_star = "false"; 452 $object->announce_user_join_leave = "false"; 453 $object->disable_join_leave_notification = "false"; 454 $object->record = "false"; 455 456 if($object->add("default","default")) { 457 isymphony_write_to_file($debugLogFile, "Added conference room {$conferenceRoomsDispalyName}\n"); 458 } else { 459 isymphony_write_to_file($errorLogFile, "(Add conference room)" . $ISERROR . "\n"); 460 } 461 462 //If conference room does exist update it 463 } else { 464 465 //Query conference room configuration and update values 466 if(($object = getISymphonyConferenceRoom("default", "default", $conferenceRoomsDispalyName)) !== false) { 467 468 //Check if update needs to occur 469 if(($object->name != $conferenceRoomsDispalyName) || ($object->predefined != "true") || ($object->room_number != $freePBXConferenceRoom[0]) || ($object->extension_val != $freePBXConferenceRoom[0]) || ($object->context != "from-internal")) { 470 471 $object->name = $conferenceRoomsDispalyName; 472 $object->predefined = "true"; 473 $object->room_number = $freePBXConferenceRoom[0]; 474 $object->extension_val = $freePBXConferenceRoom[0]; 475 $object->context = "from-internal"; 476 477 if($object->update()) { 478 isymphony_write_to_file($debugLogFile, "Updated conference room {$conferenceRoomsDispalyName}\n"); 479 } else { 480 isymphony_write_to_file($errorLogFile, "(Update conference room)" . $ISERROR. "\n"); 481 } 482 } 483 } else { 484 isymphony_write_to_file($errorLogFile, "(Query conference room)" . $ISERROR. "\n"); 485 } 486 } 487 } 488 } else { 489 isymphony_write_to_file($errorLogFile, "(List conference rooms)" . $ISERROR. "\n"); 490 } 491 492 //Close iSymphony connection 493 iSymphonyDisconnect(); 541 } else { 542 isymphony_write_to_file($errorLogFile, $ISERROR. "\n"); 543 } 494 544 495 545 $runningTimeStop = microtime(true); … … 505 555 } 506 556 557 //iSymphony module API user functions---------------------------------------------------------------------------------------------------------------- 558 function isymphony_user_add($userId, $addExtension, $addProfile, $password, $displayName, $peer) { 559 global $db; 560 $addProfile = $addProfile ? "1" : "0"; 561 $addExtension = $addExtension ? "1" : "0"; 562 $prepStatement = $db->prepare("INSERT INTO isymphony_users (user_id, add_extension, add_profile, password, display_name, peer) VALUES (?, ?, ?, ?, ?, ?)"); 563 $values = array($userId, $addExtension, $addProfile, $password, $displayName, $peer); 564 $db->execute($prepStatement, $values); 565 } 566 567 function isymphony_user_update($userId, $addExtension, $addProfile, $password, $displayName, $peer) { 568 global $db; 569 $addProfile = $addProfile ? "1" : "0"; 570 $addExtension = $addExtension ? "1" : "0"; 571 $prepStatement = $db->prepare("UPDATE isymphony_users SET add_extension = ?, add_profile = ?, password = ?, display_name = ?, peer = ? WHERE user_id = $userId"); 572 $values = array($addExtension, $addProfile, $password, $displayName, $peer); 573 $db->execute($prepStatement, $values); 574 } 575 576 function isymphony_user_del($userId) { 577 global $db; 578 $query = "DELETE FROM isymphony_users WHERE user_id = '$userId'"; 579 $db->query($query); 580 } 581 582 function isymphony_user_list() { 583 global $db; 584 $query = "SELECT * FROM isymphony_users"; 585 $results = sql($query, "getAll", DB_FETCHMODE_ASSOC); 586 if((DB::IsError($results)) || (empty($results))) { 587 return array(); 588 } else { 589 return $results; 590 } 591 } 592 593 function isymphony_user_get($userId) { 594 global $db; 595 $query = "SELECT * FROM isymphony_users WHERE user_id = '$userId'"; 596 $results = sql($query, "getRow", DB_FETCHMODE_ASSOC); 597 if((DB::IsError($results)) || (empty($results))) { 598 return null; 599 } else { 600 return $results; 601 } 602 } 603 604 //iSymphony module API queue functions--------------------------------------------------------------------------------------------------------------- 605 function isymphony_queue_add($queueId, $addQueue, $displayName) { 606 global $db; 607 $addQueue = $addQueue ? "1" : "0"; 608 $prepStatement = $db->prepare("INSERT INTO isymphony_queues (queue_id, add_queue, display_name) VALUES (?, ?, ?)"); 609 $values = array($queueId, $addQueue, $displayName); 610 $db->execute($prepStatement, $values); 611 } 612 613 function isymphony_queue_update($queueId, $addQueue, $displayName) { 614 global $db; 615 $addQueue = $addQueue ? "1" : "0"; 616 $prepStatement = $db->prepare("UPDATE isymphony_queues SET add_queue = ?, display_name = ? WHERE queue_id = $queueId"); 617 $values = array($addQueue, $displayName); 618 $db->execute($prepStatement, $values); 619 } 620 621 function isymphony_queue_del($queueId) { 622 global $db; 623 $query = "DELETE FROM isymphony_queues WHERE queue_id = '$queueId'"; 624 $db->query($query); 625 } 626 627 function isymphony_queue_list() { 628 global $db; 629 $query = "SELECT * FROM isymphony_queues"; 630 $results = sql($query, "getAll", DB_FETCHMODE_ASSOC); 631 if((DB::IsError($results)) || (empty($results))) { 632 return array(); 633 } else { 634 return $results; 635 } 636 } 637 638 function isymphony_queue_get($queueId) { 639 global $db; 640 $query = "SELECT * FROM isymphony_queues WHERE queue_id = '$queueId'"; 641 $results = sql($query, "getRow", DB_FETCHMODE_ASSOC); 642 if((DB::IsError($results)) || (empty($results))) { 643 return null; 644 } else { 645 return $results; 646 } 647 } 648 649 //iSymphony module API conference room functions----------------------------------------------------------------------------------------------------- 650 function isymphony_conference_room_add($conferenceRoomId, $addConferenceRoom, $displayName) { 651 global $db; 652 $addConferenceRoom = $addConferenceRoom ? "1" : "0"; 653 $prepStatement = $db->prepare("INSERT INTO isymphony_conference_rooms (conference_room_id, add_conference_room, display_name) VALUES (?, ?, ?)"); 654 $values = array($conferenceRoomId, $addConferenceRoom, $displayName); 655 $db->execute($prepStatement, $values); 656 } 657 658 function isymphony_conference_room_update($conferenceRoomId, $addConferenceRoom, $displayName) { 659 global $db; 660 $addConferenceRoom = $addConferenceRoom ? "1" : "0"; 661 $prepStatement = $db->prepare("UPDATE isymphony_conference_rooms SET add_conference_room = ?, display_name = ? WHERE conference_room_id = $conferenceRoomId"); 662 $values = array($addConferenceRoom, $displayName); 663 $db->execute($prepStatement, $values); 664 } 665 666 function isymphony_conference_room_del($conferenceRoomId) { 667 global $db; 668 $query = "DELETE FROM isymphony_conference_rooms WHERE conference_room_id = '$conferenceRoomId'"; 669 $db->query($query); 670 } 671 672 function isymphony_conference_room_list() { 673 global $db; 674 $query = "SELECT * FROM isymphony_conference_rooms"; 675 $results = sql($query, "getAll", DB_FETCHMODE_ASSOC); 676 if((DB::IsError($results)) || (empty($results))) { 677 return array(); 678 } else { 679 return $results; 680 } 681 } 682 683 function isymphony_conference_room_get($conferenceRoomId) { 684 global $db; 685 $query = "SELECT * FROM isymphony_conference_rooms WHERE conference_room_id = '$conferenceRoomId'"; 686 $results = sql($query, "getRow", DB_FETCHMODE_ASSOC); 687 if((DB::IsError($results)) || (empty($results))) { 688 return null; 689 } else { 690 return $results; 691 } 692 } 693 694 //Extension/User page hooks-------------------------------------------------------------------------------------------------------------------------- 695 function isymphony_configpageinit($pagename) { 696 global $currentcomponent; 697 698 //Query page state 699 $action = isset($_REQUEST["action"]) ? $_REQUEST["action"] : null; 700 $extdisplay = isset($_REQUEST["extdisplay"]) ? $_REQUEST["extdisplay"] : null; 701 $extension = isset($_REQUEST["extension"]) ? $_REQUEST["extension"] : null; 702 $tech_hardware = isset($_REQUEST["tech_hardware"]) ? $_REQUEST["tech_hardware"] : null; 703 704 //Based on the page state determine if the display or process functions should be added 705 if (($pagename != "users") && ($pagename != "extensions")) { 706 return; 707 } else if ($tech_hardware != null || $pagename == "users") { 708 isymphony_extension_applyhooks(); 709 $currentcomponent->addprocessfunc('isymphony_extension_configprocess', 8); 710 } elseif ($action == "add" || $action == "edit") { 711 $currentcomponent->addprocessfunc('isymphony_extension_configprocess', 8); 712 } elseif ($extdisplay != '') { 713 isymphony_extension_applyhooks(); 714 $currentcomponent->addprocessfunc('isymphony_extension_configprocess', 8); 715 } 716 } 717 718 function isymphony_extension_applyhooks() { 719 global $currentcomponent; 720 $currentcomponent->addguifunc("isymphony_extension_configpageload"); 721 } 722 723 function isymphony_extension_configpageload() { 724 global $currentcomponent; 725 726 //Query page state 727 $action = isset($_REQUEST["action"]) ? $_REQUEST["action"] : null; 728 $display = isset($_REQUEST["display"]) ? $_REQUEST["display"] : null; 729 $extension = isset($_REQUEST["extdisplay"]) ? $_REQUEST["extdisplay"] : null; 730 731 //Attempt to query element if not found set defaults 732 if(($extension !== null) && (($iSymphonyUser = isymphony_user_get($extension)) !== null)) { 733 $added = ($iSymphonyUser["add_extension"] == "1"); 734 $userProfile = ($iSymphonyUser["add_profile"] == "1"); 735 $password = $iSymphonyUser["password"]; 736 737 } else { 738 $added = true; 739 $userProfile = true; 740 $password = "secret"; 741 } 742 743 //Create GIU elements if not on delete page 744 if ($action != "del") { 745 $section = _("iSymphony"); 746 $currentcomponent->addguielem($section, new gui_checkbox("isymphony_add_extension", $added, "Add to iSymphony", "Makes this Extension/User available in iSymphony.", "on", "", "", false)); 747 $currentcomponent->addguielem($section, new gui_checkbox("isymphony_add_profile", $userProfile, "Create Profile", "Creates an iSymphony login profile which is associated with this extension.", "on", "", "", false)); 748 $currentcomponent->addguielem($section, new gui_textbox("isymphony_profile_password", $password, "Profile Password", "Specifies the password to be used for this profile.", "", "", true, "100", false)); 749 } 750 } 751 752 function isymphony_extension_configprocess() { 753 754 //Query page state 755 $action = isset($_REQUEST["action"]) ? $_REQUEST["action"] : null; 756 $ext = isset($_REQUEST["extdisplay"]) ? $_REQUEST["extdisplay"] : null; 757 $extn = isset($_REQUEST["extension"]) ? $_REQUEST["extension"]: null; 758 $name = isset($_REQUEST["name"]) ? $_REQUEST["name"] : null; 759 $extension = ($ext === "") ? $extn : $ext; 760 761 //Determine peer 762 if(isset($_REQUEST["devinfo_dial"]) && ($_REQUEST["devinfo_dial"] != "")) { 763 $peer = $_REQUEST["devinfo_dial"]; 764 } else if (isset($_REQUEST["tech"])){ 765 $peer = strtoupper($_REQUEST["tech"]) . "/" . $extension; 766 } else { 767 $peer = "SIP/$extension"; 768 } 769 770 //Query iSymphony options 771 $addExtension = isset($_REQUEST["isymphony_add_extension"]); 772 $addProfile = isset($_REQUEST["isymphony_add_profile"]); 773 $password = isset($_REQUEST["isymphony_profile_password"]) ? $_REQUEST["isymphony_profile_password"]: null; 774 $password = (($password === null) || (trim($password) == "")) ? "secret" : trim($password); 775 776 //Modify DB 777 if(($extension !== null) && ($extension != "") && ($action !== null)) { 778 779 //Check if this extension needs to be deleted, updated, or added 780 if($action == "del") { 781 isymphony_user_del($extension); 782 } else if(($action == "add") || ($action == "edit") && ($name !== null)) { 783 if(isymphony_user_get($extension) === null) { 784 isymphony_user_add($extension, $addExtension, $addProfile, $password, $name, $peer); 785 } else { 786 isymphony_user_update($extension, $addExtension, $addProfile, $password, $name, $peer); 787 } 788 } 789 } 790 } 791 792 //Queue page hooks----------------------------------------------------------------------------------------------------------------------------------- 793 function isymphony_hook_queues($viewing_itemid, $target_menuid) { 794 795 //Query page state 796 $action = isset($_REQUEST["action"]) ? $_REQUEST["action"] : null; 797 $display = ""; 798 799 //Only hook queues page 800 if(($target_menuid == "queues") && ($action != "delete")) { 801 802 //Query queue info 803 if(($viewing_itemid != null) && ($iSymphonyQueue = isymphony_queue_get($viewing_itemid))) { 804 $checked = ($iSymphonyQueue["add_queue"] == "1") ? "checked" : ""; 805 } else { 806 $checked = "checked"; 807 } 808 809 //Build display 810 $display = " <tr><td colspan=\"2\"><h5>iSymphony<hr></h5></td></tr> 811 <tr> 812 <td><a href=\"#\" class=\"info\">" . _("Add to iSymphony") . "<span>" . _("Makes this queue available in iSymphony") . "</span></a></td> 813 <td><input type=\"checkbox\" name=\"isymphony_add_queue\" id=\"isymphony_add_queue\" value=\"on\" $checked/></td> 814 </tr>"; 815 } 816 817 return $display; 818 } 819 820 function isymphony_hookProcess_queues($viewing_itemid, $request) { 821 822 //Query page state 823 $queue = isset($request["extdisplay"]) ? $request["extdisplay"] : null; 824 $account = isset($request["account"]) ? $request["account"] : null; 825 $action = isset($request["action"]) ? $request["action"] : null; 826 $name = isset($request["name"]) ? $request["name"] : null; 827 $queue = ($queue == null) ? $account : $queue; 828 829 //Query iSymphony option 830 $addQueue = isset($request["isymphony_add_queue"]); 831 832 //Update DB 833 if(($queue != null) && ($queue != "") && ($action != null)) { 834 835 //Check if this queue needs to be deleted, updated, or added 836 if($action == "delete") { 837 isymphony_queue_del($queue); 838 } else if(($action == "add") || ($action == "edit") && ($name !== null)) { 839 if(isymphony_queue_get($queue) === null) { 840 isymphony_queue_add($queue, $addQueue, $name); 841 } else { 842 isymphony_queue_update($queue, $addQueue, $name); 843 } 844 } 845 } 846 } 847 848 //Conference Room page hooks------------------------------------------------------------------------------------------------------------------------- 849 function isymphony_hook_conferences($viewing_itemid, $target_menuid) { 850 851 //Query page state 852 $action = isset($_REQUEST["action"]) ? $_REQUEST["action"] : null; 853 $display = ""; 854 855 //Only hook conferences page 856 if(($target_menuid == "conferences") && ($action != "delete")) { 857 858 //Query conference info 859 if(($viewing_itemid != null) && ($iSymphonyConferenceRoom = isymphony_conference_room_get($viewing_itemid))) { 860 $checked = ($iSymphonyConferenceRoom["add_conference_room"] == "1") ? "checked" : ""; 861 } else { 862 $checked = "checked"; 863 } 864 865 //Build display 866 $display = " <tr><td colspan=\"2\"><h5>iSymphony<hr></h5></td></tr> 867 <tr> 868 <td><a href=\"#\" class=\"info\">" . _("Add to iSymphony") . "<span>" . _("Makes this conference room available in iSymphony") . "</span></a></td> 869 <td><input type=\"checkbox\" name=\"isymphony_add_conference_room\" id=\"isymphony_add_conference_room\" value=\"on\" $checked/></td> 870 </tr>"; 871 } 872 873 return $display; 874 } 875 876 function isymphony_hookProcess_conferences($viewing_itemid, $request) { 877 878 //Query page state 879 $conferenceRoom = isset($request["extdisplay"]) ? $request["extdisplay"] : null; 880 $account = isset($request["account"]) ? $request["account"] : null; 881 $action = isset($request["action"]) ? $request["action"] : null; 882 $name = isset($request["name"]) ? $request["name"] : null; 883 $conferenceRoom = ($conferenceRoom == null) ? $account : $conferenceRoom; 884 885 //Query iSymphony option 886 $addConferenceRoom = isset($request["isymphony_add_conference_room"]); 887 888 //Update DB 889 if(($conferenceRoom != null) && ($conferenceRoom != "") && ($action != null)) { 890 891 //Check if this conference room needs to be deleted, updated, or added 892 if($action == "delete") { 893 isymphony_conference_room_del($conferenceRoom); 894 } else if(($action == "add") || ($action == "edit") && ($name !== null)) { 895 if(isymphony_conference_room_get($conferenceRoom) === null) { 896 isymphony_conference_room_add($conferenceRoom, $addConferenceRoom, $name); 897 } else { 898 isymphony_conference_room_update($conferenceRoom, $addConferenceRoom, $name); 899 } 900 } 901 } 902 } 903 904 //Helper functions----------------------------------------------------------------------------------------------------------------------------------- 507 905 function isymphony_write_to_file($file, $content) { 508 906 if($file) { contributed_modules/modules/isymphony/install.php
r5878 r6438 1 1 <?php 2 /* 3 *Name : install.php 4 *Author : Michael Yara 5 *Created : August 15, 2008 6 *Last Updated : August 19, 2008 7 *History : 0.1 8 *Purpose : Create and populate isymphony tables 9 *Copyright : 2008 HEHE Enterprises, LLC 10 */ 11 12 global $db; 13 14 //Create users table 15 $query = " CREATE TABLE IF NOT EXISTS 16 isymphony_users(isymphony_user_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, 17 user_id VARCHAR(100) UNIQUE NOT NULL, 18 add_extension INTEGER(1), 19 add_profile INTEGER(1), 20 password VARCHAR(100), 21 display_name VARCHAR(100), 22 peer VARCHAR(100))"; 23 24 echo "Creating \"isymphony_users\" Table....<br>"; 25 $results = $db->query($query); 26 if(DB::IsError($results) && ($results->getCode() != DB_ERROR_ALREADY_EXISTS)) { 27 echo "ERROR: could not create table.<br>"; 28 } else { 29 30 //Add users to table 31 echo "Populating table.....<br>"; 32 if((function_exists("core_users_list")) && (($freePBXUsers = core_users_list()) !== null)){ 33 foreach($freePBXUsers as $freePBXUser) { 34 if(function_exists("core_devices_get")) { 35 $freePBXDeviceInfo = core_devices_get($freePBXUser[0]); 36 37 $userId = $freePBXUser[0]; 38 $extensionDisplayName = $freePBXUser[1] == "" ? $freePBXUser[0] : $freePBXUser[1]; 39 $extensionPeer = ($freePBXDeviceInfo['dial'] != "") ? $freePBXDeviceInfo['dial'] : "SIP/$userId"; 40 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); 43 $db->execute($prepStatement, $values); 44 } 45 } 46 } 47 } 48 echo "Done<br>"; 49 50 //Create queues table 51 $query = " CREATE TABLE IF NOT EXISTS 52 isymphony_queues( isymphony_queue_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, 53 queue_id VARCHAR(100) UNIQUE NOT NULL, 54 add_queue INTEGER(1), 55 display_name VARCHAR(100))"; 56 57 echo "Creating \"isymphony_queues\" Table....<br>"; 58 $results = $db->query($query); 59 if(DB::IsError($results) && ($results->getCode() != DB_ERROR_ALREADY_EXISTS)) { 60 echo "ERROR: could not create table.<br>"; 61 } else { 62 //Add queues to table 63 echo "Populating table.....<br>"; 64 if((function_exists("queues_list")) && (($freePBXQueues = queues_list()) !== null)) { 65 foreach($freePBXQueues as $freePBXQueue) { 66 67 $queueId = $freePBXQueue[0]; 68 $queueDispalyName = $freePBXQueue[1] == "" ? $freePBXQueue[0] : $freePBXQueue[1]; 69 70 $prepStatement = $db->prepare("INSERT INTO isymphony_queues (queue_id, add_queue, display_name) VALUES (?, ?, ?)"); 71 $values = array($queueId, 1, $queueDispalyName); 72 $db->execute($prepStatement, $values); 73 } 74 } 75 } 76 echo "Done<br>"; 77 78 //Create conference rooms table 79 $query = " CREATE TABLE IF NOT EXISTS 80 isymphony_conference_rooms( isymphony_conference_room_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, 81 conference_room_id VARCHAR(100) UNIQUE NOT NULL, 82 add_conference_room INTEGER(1), 83 display_name VARCHAR(100))"; 84 85 echo "Creating \"isymphony_conference_rooms\" Table....<br>"; 86 $results = $db->query($query); 87 if(DB::IsError($results) && ($results->getCode() != DB_ERROR_ALREADY_EXISTS)) { 88 echo "ERROR: could not create table.<br>"; 89 } else { 90 //Add rooms to table 91 echo "Populating table.....<br>"; 92 if((function_exists("conferences_list")) && (($freePBXConferenceRooms = conferences_list()) !== null)) { 93 foreach($freePBXConferenceRooms as $freePBXConferenceRoom) { 94 95 $conferenceRoomId = $freePBXConferenceRoom[0]; 96 $conferenceRoomsDispalyName = $freePBXConferenceRoom[1] == "" ? $freePBXConferenceRoom[0] : $freePBXConferenceRoom[1]; 97 98 $prepStatement = $db->prepare("INSERT INTO isymphony_conference_rooms (conference_room_id, add_conference_room, display_name) VALUES (?, ?, ?)"); 99 $values = array($conferenceRoomId, 1, $conferenceRoomsDispalyName); 100 $db->execute($prepStatement, $values); 101 } 102 } 103 } 104 echo "Done<br>"; 2 105 ?> contributed_modules/modules/isymphony/isymphony-php-library/isymphony.php
r5878 r6438 4 4 *Author : Michael Yara 5 5 *Created : June 15, 2008 6 *Last Updated : June 18, 20087 *History : 0. 1 Beta6 *Last Updated : August 22, 2008 7 *History : 0.2 8 8 *Purpose : Contains all functions used to interact with the iSymphony configuration. 9 9 *Copyright : 2008 HEHE Enterprises, LLC … … 42 42 43 43 if(($SOCKET = socket_create(AF_INET, SOCK_STREAM, 0)) && (socket_connect($SOCKET, $HOST, $PORT))) { 44 45 //Check version to modify property arrays if necessary 46 //Modify for 2.1 47 if((($versionResult = getiSymphonyServerVersion()) !== false) && (strstr($versionResult, "2.1") !== false)) { 48 isymphony_modify_property_arrays_2_1(); 49 } 50 44 51 return true; 45 52 } else { contributed_modules/modules/isymphony/isymphony-php-library/library/classes.php
r6359 r6438 4 4 *Author : Michael Yara 5 5 *Created : June 15, 2008 6 *Last Updated : August 11, 20087 *History : 0. 2 Beta6 *Last Updated : August 22, 2008 7 *History : 0.4 8 8 *Purpose : Contains declarations of all property classes. 9 9 *Copyright : 2008 HEHE Enterprises, LLC … … 65 65 * jabber_host: Jabber host name(STRING) 66 66 * jabber_port: Jabber port(INTEGER) 67 * device_user_mode: (BOOLEAN[true or false]) 67 68 * 68 69 * Methods: … … 89 90 var $jabber_host = ""; 90 91 var $jabber_port = ""; 92 var $device_user_mode = ""; 91 93 92 94 //Methods contributed_modules/modules/isymphony/isymphony-php-library/library/property_arrays.php
r5878 r6438 4 4 *Author : Michael Yara 5 5 *Created : June 15, 2008 6 *Last Updated : June 18, 2008 7 *History : 0.1 Beta 8 *Purpose : Contains arrays witch describe all configuration object property names. 6 *Last Updated : August 22, 2008 7 *History : 0.3 8 *Purpose : Contains arrays witch describe all configuration object property names along with functions to modify 9 * the arrays for specific versions of the server. 9 10 *Copyright : 2008 HEHE Enterprises, LLC 10 11 */ … … 24 25 $queuePermissionPropertyArray = array("transfer_to","steal_call"); 25 26 $conferenceRoomPermissionPropertyArray = array("steal_call","transfer_to","originate_to","mute_users","kick_users"); 27 28 29 function isymphony_modify_property_arrays_2_1() { 30 global $locationPropertyArray; 31 array_push($locationPropertyArray, "device_user_mode"); 32 } 26 33 ?> contributed_modules/modules/isymphony/module.xml
r6359 r6438 2 2 <rawname>isymphony</rawname> 3 3 <name>iSymphony</name> 4 <version>0. 6</version>4 <version>0.7</version> 5 5 <type>setup</type> 6 6 <category>Modules</category> … … 17 17 <md5sum>junk</md5sum> 18 18 <changelog> 19 0.7 Added back end database to handle state for extensions/users, profiles queues and conference rooms. 20 Added checkboxes to relevant pages to specify which extensions/users, profiles, queues, and conference rooms should be displayed in iSymphony. 21 Added password field on the extension/user page to specify profile passwords. 22 Added iSymphony sever process state and version display on the FreePBX iSymphony page. 23 Added the ability to reload the iSymphony server from the FreePBX iSymphony page. 24 Added license information display on the FreePBX iSymphony page. 25 Added the ability to activate a license via the FreePBX iSymphony page. 26 Added module debug options to the FreePBX iSymphony page. 27 Added support for Device User Mode configuration while using iSymphony 2.1. 28 Modified description and setup instructions on the FreePBX iSymphony page. 19 29 0.6 Added support for PHP4 in library. 20 30 0.5 Modified core module code to be more efficient. contributed_modules/modules/isymphony/page.isymphony.php
r6150 r6438 4 4 *Author : Michael Yara 5 5 *Created : July 2, 2008 6 *Last Updated : July 23, 20086 *Last Updated : August 22, 2008 7 7 *History : 0.5 8 8 *Purpose : Information page for iSymphony module … … 10 10 */ 11 11 12 $display = "<h2>iSymphony</h2> 12 13 //Turn on debugging if it is requested 14 $debugUrlAddition = ""; 15 $debugMenuAddition = ""; 16 if(($debug = isset($_REQUEST["debug"])) === true) { 17 $debugUrlAddition = "&debug=yes"; 18 $debugMenuAddition = " <tr><td colspan=\"2\"><h5>Module Debug<hr></h5></td></tr> 19 <tr><td><a href=\"/admin/modules/isymphony/debug.txt\" target=\"_blank\">View Debug Log</a></td></tr> 20 <tr><td><a href=\"/admin/modules/isymphony/error.txt\" target=\"_blank\">View Error Log</a></td></tr> 21 <tr><td><a href=\"config.php?type=setup&display=isymphony&showdb=yes$debugUrlAddition\">View Database</a></td></tr>"; 22 } 23 24 //Check to see if the server is running 25 $psOutput = array(); 26 $serverRunning = false; 27 $serverRunningDisplay = ""; 28 exec("ps -auxww | grep java", $psOutput); 29 30 foreach($psOutput as $line) { 31 if(strstr($line, "iSymphonyServer.jar") !== false) { 32 $serverRunning = true; 33 break; 34 } 35 } 36 37 $serverRunningDisplay = $serverRunning ? "<span style=\"color: #00FF00\">Up</span>" : "<span style=\"color: #FF0000\">Down</span>"; 38 39 //Check for a reload action 40 if($serverRunning && iSymphonyConnect() && isset($_REQUEST["isymphony_reload"])) { 41 42 //Reload server and block for 5 secs so server can repopulate 43 reloadISymphonyServer(); 44 sleep(5); 45 } 46 47 //Check for a license activation action 48 $licenseActivationError = ""; 49 if($serverRunning && iSymphonyConnect() && isset($_REQUEST["isymphony_activate_license"]) && isset($_REQUEST["isymphony_license_key"]) && (trim($_REQUEST["isymphony_license_key"]) != "")) { 50 51 if(activateISymphonyLicense("default", "default", trim($_REQUEST["isymphony_license_key"])) === false) { 52 $licenseActivationError = $ISERROR; 53 } 54 55 //Block for 5 secs to let location reload 56 sleep(5); 57 58 //Close iSymphony connection 59 iSymphonyDisconnect(); 60 } 61 62 //Check if a request to show the database was made 63 $databaseDisplay = ""; 64 if($debug && isset($_REQUEST["showdb"])) { 65 66 //Build extensions table 67 $databaseDisplay .= " <table> 68 <tr> 69 <tr><td colspan = \"6\"><h5>Extensions</h5></td></tr> 70 </tr> 71 <tr> 72 <td>User ID   </td> 73 <td>Add Extension   </td> 74 <td>Add Profile   </td> 75 <td>Password   </td> 76 <td>Display Name   </td> 77 <td>Peer   </td> 78 <tr> 79 </tr> 80 <td colspan = \"6\"><hr></td> 81 </tr>"; 82 83 foreach(isymphony_user_list() as $user) { 84 $databaseDisplay .= " <tr> 85 <td>{$user['user_id']}</td> 86 <td>{$user['add_extension']}</td> 87 <td>{$user['add_profile']}</td> 88 <td>{$user['password']}</td> 89 <td>{$user['display_name']}</td> 90 <td>{$user['peer']}</td> 91 </tr>"; 92 } 93 94 $databaseDisplay .= "</table>"; 95 96 //Build queues table 97 $databaseDisplay .= " <table> 98 <tr> 99 <tr><td colspan = \"3\"><h5>Queues</h5></td></tr> 100 </tr> 101 <tr> 102 <td>Queue ID   </td> 103 <td>Add Queue   </td> 104 <td>Display Name   </td> 105 <tr> 106 </tr> 107 <td colspan = \"3\"><hr></td> 108 </tr>"; 109 110 foreach(isymphony_queue_list() as $queue) { 111 $databaseDisplay .= " <tr> 112 <td>{$queue['queue_id']}</td> 113 <td>{$queue['add_queue']}</td> 114 <td>{$queue['display_name']}</td> 115 </tr>"; 116 } 117 118 $databaseDisplay .= "</table>"; 119 120 //Build conference room table 121 $databaseDisplay .= " <table> 122 <tr> 123 <tr><td colspan = \"3\"><h5>Conference Rooms</h5></td></tr> 124 </tr> 125 <tr> 126 <td>Conference Room ID   </td> 127 <td>Add Conference Room   </td> 128 <td>Display Name   </td> 129 <tr> 130 </tr> 131 <td colspan = \"3\"><hr></td> 132 </tr>"; 133 134 foreach(isymphony_conference_room_list() as $conferenceRoom) { 135 $databaseDisplay .= " <tr> 136 <td>{$conferenceRoom['conference_room_id']}</td> 137 <td>{$conferenceRoom['add_conference_room']}</td> 138 <td>{$conferenceRoom['display_name']}</td> 139 </tr>"; 140 } 141 142 $databaseDisplay .= "</table>"; 143 } 144 145 //Connect to iSymphony server to query information 146 if($serverRunning && iSymphonyConnect()) { 147 148 //Get server version 149 if(($versionDisplay = getiSymphonyServerVersion()) === false) { 150 $versionDisplay = ""; 151 } 152 153 //Get licensed to name 154 if(($licensedToDisplay = getISymphonyLicenseName("default", "default")) === false) { 155 $licensedToDisplay = ""; 156 } 157 158 //Get license days 159 if(($licenseTrialDaysDisplay = getISymphonyLicenseTrialDays("default", "default")) === false) { 160 $licenseTrialDaysDisplay = ""; 161 } 162 163 //Get license clients 164 if(($licenseClientsDisplay = getISymphonyLicenseClients("default", "default")) === false) { 165 $licenseClientsDisplay = ""; 166 } 167 168 //Get license queues 169 if(($licenseQueuesDisplay = getISymphonyLicenseQueues("default", "default")) === false) { 170 $licenseQueuesDisplay = ""; 171 } 172 173 //Build action buttons 174 $reloadServerButton = " <form name=\"isymphony_reload_form\" action=\"config.php?type=setup&display=isymphony$debugUrlAddition\" method=\"post\"> 175 <input type=\"Submit\" name=\"isymphony_reload\" value=\"Reload\"> 176 </form>"; 177 $activateLicenseButton = " <form name=\"isymphony_activate_license_form\" action=\"config.php?type=setup&display=isymphony$debugUrlAddition\" method=\"post\"> 178 <input type=\"text\" name=\"isymphony_license_key\"> 179 <input type=\"Submit\" name=\"isymphony_activate_license\" value=\"Activate\"> 180 </form>"; 181 182 //Close iSymphony connection 183 iSymphonyDisconnect(); 184 185 } else { 186 $versionDisplay = ""; 187 $licensedToDisplay = ""; 188 $licenseTrialDaysDisplay = ""; 189 $licenseClientsDisplay = ""; 190 $licenseQueuesDisplay = ""; 191 $reloadServerButton = ""; 192 $activateLicenseButton = ""; 193 } 194 195 //Display license activation error if any 196 if($licenseActivationError != "") { 197 $licenseActivationError = " <span style=\"color: #FF0000\"> 198 An error occurred while activating your license:<br> 199 $licenseActivationError 200 </span>"; 201 } 202 203 $display = "<div class=\"content\"> 204 $licenseActivationError 205 <h2>iSymphony</h2> 206 <table> 207 <tr><td colspan=\"2\"><h5>Server<hr></h5></td></tr> 208 <tr> 209 <td><a href=\"#\" class=\"info\">Status:<span>Displays if the iSymphony server is running.</span></a></td> 210 <td>$serverRunningDisplay</td> 211 </tr> 212 <tr> 213 <td><a href=\"#\" class=\"info\">Version:<span>Displays the version of the iSymphony server.</span></a></td> 214 <td>$versionDisplay</td> 215 </tr> 216 <tr> 217 <td><a href=\"#\" class=\"info\">Reload Server:<span>Reloads the iSymphony server.</span></a>  </td> 218 <td>$reloadServerButton</td> 219 </tr> 220 221 <tr><td colspan=\"2\"><h5>License<hr></h5></td></tr> 222 <tr> 223 <td><a href=\"#\" class=\"info\">Licensed To:<span>Displays the name of the person or company this server is licensed to.</span></a></td> 224 <td>$licensedToDisplay</td> 225 </tr> 226 <tr> 227 <td><a href=\"#\" class=\"info\">Trial Days:<span>Displays the number of remaining license trial days.</span></a></td> 228 <td>$licenseTrialDaysDisplay</td> 229 </tr> 230 <tr> 231 <td><a href=\"#\" class=\"info\">Clients:<span>Displays the number of licensed clients.</span></a></td> 232 <td>$licenseClientsDisplay</td> 233 </tr> 234 <tr> 235 <td><a href=\"#\" class=\"info\">Queues:<span>Displays the number of licensed queues.</span></a></td> 236 <td>$licenseQueuesDisplay</td> 237 </tr> 238 <tr> 239 <td><a href=\"#\" class=\"info\">Activate:<span>Activates a license with a given serial key.</span></a></td> 240 <td>$activateLicenseButton</td> 241 </tr> 242 $debugMenuAddition 243 </table> 244 $databaseDisplay 13 245 <table> 14 246 <tr> … … 16 248 </tr> 17 249 <tr> 18 <td>This module will automatically sync the iSymphony Configuration with the current FreePBX configuration so that you will not have <br> 19 to manually configure Extension, Profiles, Queues, and Conference Rooms in iSymphony. Any time you add, remove, edit an Extension,<br> 20 Queue, or Conference Room in FreePBX the changes will automatically be applied to iSymphony.</td> 250 <td> 251 <p>This module will automatically sync the iSymphony Configuration with the current FreePBX configuration so that you will not have 252 to manually configure Extension, Profiles, Queues, and Conference Rooms in iSymphony. Any time you add, remove, edit an Extension, 253 Queue, or Conference Room in FreePBX the changes will automatically be applied to iSymphony. You can control what elements will be 254 available in iSymphony by using the check boxes in the iSymphony section of the User/Extension, Queue, and Conference Room pages. 255 By default the profile passwords will be set to \"secret\" but they can be modified on the User/Extension page. 256 </p> 257 <p> 258 Dont forget to register at <a href=\"http://www.i9technologies.com/isymphony\">http://www.i9technologies.com/isymphony</a> to get your free Conductor Edition 259 trial license to experience the full features of iSymphony. You will also get a Free Registered Edition license with 5 clients that is yours for life. If you have a license key you can enter it above. 260 </p> 261 <strong>Note: Queues and Conferences are only available in Conductor Edition.</strong> 262 </td> 21 263 </tr> 22 264 <tr> … … 24 266 </tr> 25 267 <tr> 26 <td>1. Open <strong>/etc/amportal.conf</strong></td> 27 </tr> 28 <tr> 29 <td>2. Look for the line <strong>#POST_RELOAD=</strong></td> 30 </tr> 31 <tr> 32 <td>3. Modify it to read <strong>POST_RELOAD=bash /var/www/html/admin/modules/isymphony/post_reload.sh</strong></td> 33 </tr> 34 <tr> 35 <td>4. Make sure that the FreePBX \"Asterisk API\" module is installed and activated.</td> 36 </tr> 37 <tr> 38 <td>5. Go to <a href=\"http://www.i9technologies.com/isymdownloads\">http://www.i9technologies.com/isymdownloads</a> and download iSymphony Server and the User Manual.</td> 39 </tr> 40 <tr> 41 <td>6. Follow the Server Installation instruction in the User Manual. Skip steps 3 and 5 as this module will add the appropriate contexts<br> 268 <td>1. Make sure that the FreePBX \"Asterisk API\" module is installed and activated.</td> 269 </tr> 270 <tr> 271 <td>2. Go <a href=\"http://www.i9technologies.com/isymphony\">here</a> and download the iSymphony Server, Client, and User Manual.</td> 272 </tr> 273 <tr> 274 <td>3. If you are using iSymphony 2.1 or higher skip steps 4, 5, and 6.</td> 275 </tr> 276 <tr> 277 <td>4. Open <strong>/etc/amportal.conf</strong></td> 278 </tr> 279 <tr> 280 <td>5. Look for the line <strong>#POST_RELOAD=</strong></td> 281 </tr> 282 <tr> 283 <td>6. Modify it to read <strong>POST_RELOAD=bash /var/www/html/admin/modules/isymphony/post_reload.sh</strong></td> 284 </tr> 285 <tr> 286 <td>7. Follow the Server Installation instruction in the User Manual. Skip steps 3 and 5 as this module will add the appropriate contexts<br> 42 287 automatically. Also Skip the Administration section in the manual, since this module will automatically configure iSymphony for you, and<br> 43 288 move on to the Client Installation portion when instructed to do so. … … 45 290 </tr> 46 291 <tr> 47 <td>7. Reload your FreePBX configuration so it can sync the iSymphony configuration with FreePBX.</td> 48 </tr> 49 <tr> 50 <td>8. Move on to the iSymphony Client Installation portion of the manual to start using iSymphony.</td> 51 </tr> 52 <tr> 53 <td>9. If you would like to modify the iSymphony profile passwords you can do so through the iSymphony administration<br> 54 interface. Please see the the Server Configuration section under Administration in the manual on how to connect to the iSymphony Administrator.</td> 55 </tr> 56 <tr> 57 <td><br><h5>A Note On Profile Passwords<hr></h5></td> 58 </tr> 59 <tr> 60 <td> 61 This module will create an iSymphony profile for each extension configured in FreePBX.<br> 62 The username for these profiles will be the extension number.<br> 63 The password given to these profiles will be set to the secret value assigned to the<br> 64 extension's device. If no secret value is found the profile's password will default to<br> 65 \"secret\". Once a profile is added to the iSymphony configuration you may change the<br> 66 password from the iSymphony client administration interface. The username and password<br> 67 for the administration interface defaults to \"admin\" and \"secret\" respectively.<br> 68 The administration username and password can be modified from the administration<br> 69 interface as well. 70 </td> 292 <td>8. Reload your FreePBX configuration so it can sync the iSymphony configuration with FreePBX.</td> 293 </tr> 294 <tr> 295 <td>9. Move on to the iSymphony Client Installation portion of the manual to start using iSymphony.</td> 296 </tr> 297 <tr> 298 <td>10. If you would like further modification of the iSymphony Server than this module provides see the the Server Configuration section under<br> 299 Administration in the manual on how to connect to the iSymphony Administrator.</td> 71 300 </tr> 72 301 </table> … … 74 303 <br> 75 304 For more information please visit <a href=\"http://www.i9technologies.com/isymphony\">http://www.i9technologies.com/isymphony</a> 76 "; 305 </div>"; 306 77 307 echo $display; 308 echo "<br>"; 78 309 ?> contributed_modules/modules/isymphony/uninstall.php
r5878 r6438 1 1 <?php 2 /* 3 *Name : uninstall.php 4 *Author : Michael Yara 5 *Created : August 15, 2008 6 *Last Updated : August 15, 2008 7 *History : 0.1 8 *Purpose : Remove iSymphony tables and manager include 9 *Copyright : 2008 HEHE Enterprises, LLC 10 */ 11 12 global $db; 13 14 //Drop users table 15 $query = "DROP TABLE IF EXISTS isymphony_users"; 16 echo "Removing \"isymphony_users\" Table....<br>"; 17 $results = $db->query($query); 18 if(DB::IsError($results)) { 19 echo "ERROR: could not remove table.<br>"; 20 } 21 22 //Drop queues table 23 $query = "DROP TABLE IF EXISTS isymphony_queues"; 24 echo "Removing \"isymphony_queues\" Table....<br>"; 25 $results = $db->query($query); 26 if(DB::IsError($results)) { 27 echo "ERROR: could not remove table.<br>"; 28 } 29 30 //Drop conference rooms table 31 $query = "DROP TABLE IF EXISTS isymphony_conference_rooms"; 32 echo "Removing \"isymphony_conference_rooms\" Table....<br>"; 33 $results = $db->query($query); 34 if(DB::IsError($results)) { 35 echo "ERROR: could not remove table.<br>"; 36 } 37 38 //Remove manager entry 39 $query = "DELETE FROM manager WHERE name = 'isymphony'"; 40 echo "Removing manager entry....<br>"; 41 $results = $db->query($query); 42 if(DB::IsError($results)) { 43 echo "ERROR: could not remove manager entry.<br>"; 44 } 2 45 ?>
