root/contributed_modules/modules/isymphony/isymphony-php-library/isymphony.php

Revision 7772, 62.0 kB (checked in by seanmh, 3 years ago)

1.0.0 Added backward compatibility support for 2.0 rev 1104.

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

Line 
1 <?php
2 /*
3  *Name         : isymphony.php
4  *Author       : Michael Yara
5  *Created      : June 15, 2008
6  *Last Updated : May 27, 2009
7  *History      : 0.4
8  *Purpose      : Contains all functions used to interact with the iSymphony configuration.
9  *Copyright    : 2008 HEHE Enterprises, LLC
10  */
11
12 //Build include path
13 $inc_path = __FILE__;
14 $pos = strrpos($inc_path, "/");
15 $inc_path = substr($inc_path, 0, $pos) . "/";
16
17 //Include Configuration
18 include($inc_path . "/configuration.php");
19
20 //Include Libraries
21 include($inc_path . "/library/navigation.php");
22 include($inc_path . "/library/helper.php");
23 include($inc_path . "/library/classes.php");
24 include($inc_path . "/library/property_arrays.php");
25
26 //Global Variables
27 $SOCKET = null;
28 $ISERROR = "";
29
30 //Tracker variables for improved running time
31 $IN_LOCATION = false;
32 $IN_TENNAT = false;
33
34 //Connection methods-------------------------------------------------------------------------------
35 /*###############################################
36  * Initializes connection to iSymphony server
37  * Takes: nothing
38  * Returns: true if successful or an error message if not
39  */
40 function iSymphonyConnect() {
41  
42   global $SOCKET, $ISERROR, $HOST, $PORT, $TIMEOUT;
43  
44   //Initiate socket
45   set_time_limit($TIMEOUT);
46  
47   if(($SOCKET = socket_create(AF_INET, SOCK_STREAM, 0)) && (socket_connect($SOCKET, $HOST, $PORT))) {   
48    
49     //Check version and revision number to modify property arrays if necessary
50     if((($versionResult = getiSymphonyServerVersion()) !== false) && (($revisionResult = getiSymphonyServerRevision()) !== false)) {
51      
52       //Modify for 2.1
53       if((strstr($versionResult, "2.1") !== false)) {
54        
55         //Modify for rev 1493 and above
56         if($revisionResult >= 1493) {
57           isymphony_modify_property_arrays_2_1_1493();
58        
59         //Modify for rev 1489 through 1493
60         } else if($revisionResult >= 1489) {
61           isymphony_modify_property_arrays_2_1_1489();
62          
63         //Modify for post rev 1489 
64         } else {
65           isymphony_modify_property_arrays_2_1();
66         }
67       }
68     }
69     return true;
70   } else {
71     $ISERROR = "Could not connect to server: " . socket_strerror(socket_last_error());
72     return false;
73   }
74 }
75
76 /*###############################################
77  * Disconnects from iSymphony server
78  * Takes: nothing
79  * Returns: nothing
80  */
81 function iSymphonyDisconnect() {
82  
83   global $SOCKET, $IN_LOCATION, $IN_TENNAT;
84  
85   $IN_LOCATION = false;
86   $IN_TENNAT = false;
87  
88   if(($SOCKET !== null) && ($SOCKET)) {
89     sendAndRecive("exit");
90     socket_close($SOCKET);
91   }
92 }
93
94 //List methods-------------------------------------------------------------------------------------
95 /*###############################################
96  * Gets list of locations
97  * Takes: nothing
98  * Returns: array containing the names of the locations
99  */
100 function getISymphonyLocationList() {
101
102   //Move to server mode
103   if(!moveToServer()) {
104     return false;
105   }
106  
107   //Get location list
108   return checkAndSetErrorList("list locations");
109 }
110
111 /*###############################################
112  * Gets list of tenants for a given location
113  * Takes: location name
114  * Returns: array containing the names of the tenants
115  */
116 function getISymphonyTenantList($location) {
117
118   //Move to location mode
119   if(!moveToLocation($location)) {
120     return false;
121   }
122  
123   //Get tenant list
124   return checkAndSetErrorList("list tenants");
125 }
126
127
128 /*###############################################
129  * Gets list of extensions for a given tenant
130  * Takes: location name, tenant name
131  * Returns: array containing the names of the extensions
132  */
133 function getISymphonyExtensionList($location, $tenant) {
134
135   //Move to tenant mode
136   if(!moveToTenant($location, $tenant)) {
137     return false;
138   }
139  
140   //Get extension list
141   return checkAndSetErrorList("list extensions");
142 }
143
144 /*###############################################
145  * Gets list of profiles for a given tenant
146  * Takes: location name, tenant name
147  * Returns: array containing the names of the profiles
148  */
149 function getISymphonyProfileList($location, $tenant) {
150
151   //Move to tenant mode
152   if(!moveToTenant($location, $tenant)) {
153     return false;
154   }
155  
156   //Get profile list
157   return checkAndSetErrorList("list profiles");
158 }
159
160 /*###############################################
161  * Gets list of queues for a given tenant
162  * Takes: location name, tenant name
163  * Returns: array containing the names of the queues
164  */
165 function getISymphonyQueueList($location, $tenant) {
166
167   //Move to tenant mode
168   if(!moveToTenant($location, $tenant)) {
169     return false;
170   }
171  
172   //Get queue list
173   return checkAndSetErrorList("list queues");
174 }
175
176 /*###############################################
177  * Gets list of conference rooms for a given tenant
178  * Takes: location name, tenant name
179  * Returns: array containing the names of the conference rooms
180  */
181 function getISymphonyConferenceRoomList($location, $tenant) {
182
183   //Move to tenant mode
184   if(!moveToTenant($location, $tenant)) {
185     return false;
186   }
187  
188   //Get conference room list
189   return checkAndSetErrorList("list meetme");
190 }
191
192 /*###############################################
193  * Gets list of statuses for a given tenant
194  * Takes: location name, tenant name
195  * Returns: array containing the names of the statuses
196  */
197 function getISymphonyStatusList($location, $tenant) {
198
199   //Move to tenant mode
200   if(!moveToTenant($location, $tenant)) {
201     return false;
202   }
203  
204   //Get status list
205   return checkAndSetErrorList("list statuses");
206 }
207
208 /*###############################################
209  * Gets list of permission groups for a given tenant
210  * Takes: location name, tenant name
211  * Returns: array containing the names of the permission groups
212  */
213 function getISymphonyPermissionGroupList($location, $tenant) {
214
215   //Move to tenant mode
216   if(!moveToTenant($location, $tenant)) {
217     return false;
218   }
219  
220   //Get permission group list
221   return checkAndSetErrorList("list permgroups");
222 }
223
224 /*###############################################
225  * Gets list of remote extension permissions of a specified extension group
226  * Takes: location name, tenant name, permission group name
227  * Returns: array containing the names of the extensions included in the permission list 
228  */
229 function getISymphonyPermissionGroupRemoteExtensionPermissionList($location, $tenant, $group) {
230
231   //Move to permission group mode
232   if(!moveToPermissionGroup($location, $tenant, $group)) {
233     return false;
234   }
235  
236   //Get permission group remote extension permission list
237   return checkAndSetErrorList("list remote");
238 }
239
240 /*###############################################
241  * Gets list of queue permissions of a specified extension group
242  * Takes: location name, tenant name, permission group name
243  * Returns: array containing the names of the queues included in the permission list 
244  */
245 function getISymphonyPermissionGroupQueuePermissionList($location, $tenant, $group) {
246
247   //Move to permission group mode
248   if(!moveToPermissionGroup($location, $tenant, $group)) {
249     return false;
250   }
251  
252   //Get permission group queue permission list
253   return checkAndSetErrorList("list queue");
254 }
255
256 /*###############################################
257  * Gets list of conference room permissions of a specified extension group
258  * Takes: location name, tenant name, permission group name
259  * Returns: array containing the names of the conference rooms included in the permission list 
260  */
261 function getISymphonyPermissionGroupConferenceRoomPermissionList($location, $tenant, $group) {
262
263   //Move to permission group mode
264   if(!moveToPermissionGroup($location, $tenant, $group)) {
265     return false;
266   }
267  
268   //Get permission group conference room permission list
269   return checkAndSetErrorList("list meetme");
270 }
271
272 /*###############################################
273  * Gets list of remote extension permission overrides of a specified profile
274  * Takes: location name, tenant name, profile name
275  * Returns: array containing the names of the extensions included in the permission list 
276  */
277 function getISymphonyOverrideRemoteExtensionPermissionList($location, $tenant, $profile) {
278
279   //Move to profile mode
280   if(!moveToProfile($location, $tenant, $profile)) {
281     return false;
282   }
283  
284   //Get override remote extension permission list
285   return checkAndSetErrorList("list remote");
286 }
287
288 /*###############################################
289  * Gets list of queue permission overrides of a specified profile
290  * Takes: location name, tenant name, profile name
291  * Returns: array containing the names of the queues included in the permission list 
292  */
293 function getISymphonyOverrideQueuePermissionList($location, $tenant, $profile) {
294
295   //Move to profile mode
296   if(!moveToProfile($location, $tenant, $profile)) {
297     return false;
298   }
299  
300   //Get override queue permission list
301   return checkAndSetErrorList("list queue");
302 }
303
304 /*###############################################
305  * Gets list of conference room permission overrides of a specified profile
306  * Takes: location name, tenant name, profile name
307  * Returns: array containing the names of the conference rooms included in the permission list 
308  */
309 function getISymphonyOverrideConferenceRoomPermissionList($location, $tenant, $profile) {
310
311   //Move to profile mode
312   if(!moveToProfile($location, $tenant, $profile)) {
313     return false;
314   }
315  
316   //Get override conference room permission list
317   return checkAndSetErrorList("list meetme");
318 }
319
320 /*###############################################
321  * Gets list of profile's managed extensions
322  * Takes: location name, tenant name, profile name
323  * Returns: array containing the extensions managed by the specified profile 
324  */
325 function getISymphonyProfileExtensionList($location, $tenant, $profile) {
326
327   //Move to profile mode
328   if(!moveToProfile($location, $tenant, $profile)) {
329     return false;
330   }
331  
332   //Get extension list
333   return checkAndSetErrorList("list extensions");
334 }
335
336 /*###############################################
337  * Gets list of permission group members
338  * Takes: location name, tenant name, permission group name
339  * Returns: array containing the permission group's member's 
340  */
341 function getISymphonyPermissionGroupMemberList($location, $tenant, $group) {
342
343   //Move to permission group mode
344   if(!moveToPermissionGroup($location, $tenant, $group)) {
345     return false;
346   }
347  
348   //Get member list
349   return checkAndSetErrorList("list members");
350 }
351
352 //Property class query methods---------------------------------------------------------------------
353 /*###############################################
354  * Gets an object that represents the servers properties
355  * Takes: nothing
356  * Returns: an ISymphonyServer object or false if error occurred 
357  */
358 function getISymphonyServer() {
359  
360   global $serverPropertyArray, $ISERROR;
361  
362   //Move to server mode
363   if(!moveToServer()) {
364     return false;
365   }
366  
367   //Get list of properties
368   if(($propertyArray = checkAndSetErrorList("view")) !== false) {
369    
370     //Convert return array to associative array
371     $propertyArray = convertPropertyArray($propertyArray);
372
373     //Create object from properties
374     $object = new ISymphonyServer;
375    
376     //Set properties of object
377     foreach($serverPropertyArray as $val) {
378      
379       //Check if key exists in the associative array if it dose modify object if not set error and return false
380       if(array_key_exists($val, $propertyArray)) {
381         $object->$val = $propertyArray[$val];
382       } else {
383         $ISERROR = "Error: property \"$val\" was not provided by the server.";
384         return false;
385       }
386     }   
387  
388     return $object;
389   } else {
390     return false;
391   }
392  }
393  
394 /*###############################################
395  * Gets an object that represents a location's properties
396  * Takes: location name
397  * Returns: an ISymphonyLocation object or false if error occurred 
398  */
399 function getISymphonyLocation($location) {
400  
401   global $locationPropertyArray, $ISERROR;
402  
403   //Move to location mode
404   if(!moveToLocation($location)) {
405     return false;
406   }
407  
408   //Get list of properties
409   if(($propertyArray = checkAndSetErrorList("view")) !== false) {
410    
411     //Convert return array to associative array
412     $propertyArray = convertPropertyArray($propertyArray);
413
414     //Create object from properties
415     $object = new ISymphonyLocation;
416    
417     //Set mode attributes
418     if(array_key_exists("name", $propertyArray)) {
419       $object->original_name = $propertyArray["name"];
420     } else {
421       $ISERROR = "Error: mode property \"name\" was not provided by the server.";
422       return false;
423     }
424    
425     //Set properties of object
426     foreach($locationPropertyArray as $val) {
427      
428       //Check if key exists in the associative array if it dose modify object if not set error and return false
429       if(array_key_exists($val, $propertyArray)) {
430         $object->$val = $propertyArray[$val];
431       } else {
432         $ISERROR = "Error: property \"$val\" was not provided by the server.";
433         return false;
434       }
435     }   
436  
437     return $object;
438   } else {
439     return false;
440   }
441  }
442  
443 /*###############################################
444  * Gets an object that represents a tenant's properties
445  * Takes: location name, tenant name
446  * Returns: an ISymphonyTenant object or false if error occurred 
447  */
448 function getISymphonyTenant($location, $tenant) {
449  
450   global $tenantPropertyArray, $ISERROR;
451  
452   //Move to tenant mode
453   if(!moveToTenant($location, $tenant)) {
454     return false;
455   }
456  
457   //Get list of properties
458   if(($propertyArray = checkAndSetErrorList("view")) !== false) {
459    
460     //Convert return array to associative array
461     $propertyArray = convertPropertyArray($propertyArray);
462
463     //Create object from properties
464     $object = new ISymphonyTenant;
465    
466     //Set mode attributes
467     if(array_key_exists("name", $propertyArray)) {
468       $object->mode_location = $location;
469       $object->original_name = $propertyArray["name"];
470     } else {
471       $ISERROR = "Error: mode property \"name\" was not provided by the server.";
472       return false;
473     }
474    
475     //Set properties of object
476     foreach($tenantPropertyArray as $val) {
477      
478       //Check if key exists in the associative array if it dose modify object if not set error and return false
479       if(array_key_exists($val, $propertyArray)) {
480         $object->$val = $propertyArray[$val];
481       } else {
482         $ISERROR = "Error: property \"$val\" was not provided by the server.";
483         return false;
484       }
485     }   
486  
487     return $object;
488   } else {
489     return false;
490   }
491  }
492  
493 /*###############################################
494  * Gets an object that represents an extensions's properties
495  * Takes: location name, tenant name, extension name
496  * Returns: an ISymphonyExtension object or false if error occurred 
497  */
498 function getISymphonyExtension($location, $tenant, $extension) {
499  
500   global $extensionPropertyArray, $ISERROR;
501  
502   //Move to extension mode
503   if(!moveToExtension($location, $tenant, $extension)) {
504     return false;
505   }
506  
507   //Get list of properties
508   if(($propertyArray = checkAndSetErrorList("view")) !== false) {
509    
510     //Convert return array to associative array
511     $propertyArray = convertPropertyArray($propertyArray);
512
513     //Create object from properties
514     $object = new ISymphonyExtension;
515    
516     //Set mode attributes
517     if(array_key_exists("name", $propertyArray)) {
518       $object->mode_location = $location;
519       $object->mode_tenant = $tenant;
520       $object->original_extension_val = $propertyArray["extension_val"];
521     } else {
522       $ISERROR = "Error: mode property \"name\" was not provided by the server.";
523       return false;
524     }
525        
526     //Set properties of object
527     foreach($extensionPropertyArray as $val) {
528            
529       //Check if key exists in the associative array if it dose modify object if not set error and return false
530       if(array_key_exists($val, $propertyArray)) {
531         $object->$val = $propertyArray[$val];
532       } else {
533         $ISERROR = "Error: property \"$val\" was not provided by the server.";
534         return false;
535       }
536     }   
537  
538     return $object;
539   } else {
540     return false;
541   }
542  }
543  
544 /*###############################################
545  * Gets an object that represents a profiles's properties
546  * Takes: location name, tenant name, profile name
547  * Returns: an ISymphonyProfile object or false if error occurred 
548  */
549 function getISymphonyProfile($location, $tenant, $profile) {
550  
551   global $profilePropertyArray, $ISERROR;
552  
553   //Move to profile mode
554   if(!moveToProfile($location, $tenant, $profile)) {
555     return false;
556   }
557  
558   //Get list of properties
559   if(($propertyArray = checkAndSetErrorList("view")) !== false) {
560    
561     //Convert return array to associative array
562     $propertyArray = convertPropertyArray($propertyArray);
563
564     //Create object from properties
565     $object = new ISymphonyProfile;
566    
567     //Set mode attributes
568     if(array_key_exists("name", $propertyArray)) {
569       $object->mode_location = $location;
570       $object->mode_tenant = $tenant;
571       $object->original_name = $propertyArray["name"];
572     } else {
573       $ISERROR = "Error: mode property \"name\" was not provided by the server.";
574       return false;
575     }
576        
577     //Set properties of object
578     foreach($profilePropertyArray as $val) {
579            
580       //Check if key exists in the associative array if it dose modify object if not set error and return false
581       if(array_key_exists($val, $propertyArray)) {
582         $object->$val = $propertyArray[$val];
583       } else {
584         $ISERROR = "Error: property \"$val\" was not provided by the server.";
585         return false;
586       }
587     }   
588  
589     return $object;
590   } else {
591     return false;
592   }
593 } 
594
595 /*###############################################
596  * Gets an object that represents a queues's properties
597  * Takes: location name, tenant name, queue name
598  * Returns: an ISymphonyQueue object or false if error occurred 
599  */
600 function getISymphonyQueue($location, $tenant, $queue) {
601  
602   global $queuePropertyArray, $ISERROR;
603  
604   //Move to queue mode
605   if(!moveToQueue($location, $tenant, $queue)) {
606     return false;
607   }
608  
609   //Get list of properties
610   if(($propertyArray = checkAndSetErrorList("view")) !== false) {
611    
612     //Convert return array to associative array
613     $propertyArray = convertPropertyArray($propertyArray);
614
615     //Create object from properties
616     $object = new ISymphonyQueue;
617    
618     //Set mode attributes
619     if(array_key_exists("name", $propertyArray)) {
620       $object->mode_location = $location;
621       $object->mode_tenant = $tenant;
622       $object->original_name = $propertyArray["name"];
623     } else {
624       $ISERROR = "Error: mode property \"name\" was not provided by the server.";
625       return false;
626     }
627        
628     //Set properties of object
629     foreach($queuePropertyArray as $val) {
630            
631       //Check if key exists in the associative array if it dose modify object if not set error and return false
632       if(array_key_exists($val, $propertyArray)) {
633         $object->$val = $propertyArray[$val];
634       } else {
635         $ISERROR = "Error: property \"$val\" was not provided by the server.";
636         return false;
637       }
638     }   
639  
640     return $object;
641   } else {
642     return false;
643   }
644 } 
645
646 /*###############################################
647  * Gets an object that represents a conference room's properties
648  * Takes: location name, tenant name, room name
649  * Returns: an ISymphonyConferenceRoom object or false if error occurred 
650  */
651 function getISymphonyConferenceRoom($location, $tenant, $room) {
652  
653   global $conferenceRoomPropertyArray, $ISERROR;
654  
655   //Move to conference room mode
656   if(!moveToConferenceRoom($location, $tenant, $room)) {
657     return false;
658   }
659  
660   //Get list of properties
661   if(($propertyArray = checkAndSetErrorList("view")) !== false) {
662    
663     //Convert return array to associative array
664     $propertyArray = convertPropertyArray($propertyArray);
665
666     //Create object from properties
667     $object = new ISymphonyConferenceRoom;
668    
669     //Set mode attributes
670     if(array_key_exists("name", $propertyArray)) {
671       $object->mode_location = $location;
672       $object->mode_tenant = $tenant;
673       $object->original_name = $propertyArray["name"];
674     } else {
675       $ISERROR = "Error: mode property \"name\" was not provided by the server.";
676       return false;
677     }
678        
679     //Set properties of object
680     foreach($conferenceRoomPropertyArray as $val) {
681            
682       //Check if key exists in the associative array if it dose modify object if not set error and return false
683       if(array_key_exists($val, $propertyArray)) {
684         $object->$val = $propertyArray[$val];
685       } else {
686         $ISERROR = "Error: property \"$val\" was not provided by the server.";
687         return false;
688       }
689     }   
690  
691     return $object;
692   } else {
693     return false;
694   }
695 } 
696
697 /*###############################################
698  * Gets an object that represents a permission groups's properties
699  * Takes: location name, tenant name, group name
700  * Returns: an ISymphonyPermissionGroup object or false if error occurred 
701  */
702 function getISymphonyPermissionGroup($location, $tenant, $group) {
703  
704   global $permissionGroupPropertyArray, $ISERROR;
705  
706   //Move to permission group mode
707   if(!moveToPermissionGroup($location, $tenant, $group)) {
708     return false;
709   }
710  
711   //Get list of properties
712   if(($propertyArray = checkAndSetErrorList("view")) !== false) {
713    
714     //Convert return array to associative array
715     $propertyArray = convertPropertyArray($propertyArray);
716
717     //Create object from properties
718     $object = new ISymphonyPermissionGroup;
719    
720     //Set mode attributes
721     if(array_key_exists("name", $propertyArray)) {
722       $object->mode_location = $location;
723       $object->mode_tenant = $tenant;
724       $object->original_name = $propertyArray["name"];
725     } else {
726       $ISERROR = "Error: mode property \"name\" was not provided by the server.";
727       return false;
728     }
729        
730     //Set properties of object
731     foreach($permissionGroupPropertyArray as $val) {
732            
733       //Check if key exists in the associative array if it dose modify object if not set error and return false
734       if(array_key_exists($val, $propertyArray)) {
735         $object->$val = $propertyArray[$val];
736       } else {
737         $ISERROR = "Error: property \"$val\" was not provided by the server.";
738         return false;
739       }
740     }   
741  
742     return $object;
743   } else {
744     return false;
745   }
746 } 
747
748 /*###############################################
749  * Gets an object that represents a status's properties
750  * Takes: location name, tenant name, status name
751  * Returns: an ISymphonyStatus object or false if error occurred 
752  */
753 function getISymphonyStatus($location, $tenant, $status) {
754  
755   global $statusPropertyArray, $ISERROR;
756  
757   //Move to status mode
758   if(!moveToStatus($location, $tenant, $status)) {
759     return false;
760   }
761  
762   //Get list of properties
763   if(($propertyArray = checkAndSetErrorList("view")) !== false) {
764    
765     //Convert return array to associative array
766     $propertyArray = convertPropertyArray($propertyArray);
767
768     //Create object from properties
769     $object = new ISymphonyStatus;
770    
771     //Set mode attributes
772     if(array_key_exists("name", $propertyArray)) {
773       $object->mode_location = $location;
774       $object->mode_tenant = $tenant;
775       $object->original_name = $propertyArray["name"];
776     } else {
777       $ISERROR = "Error: mode property \"name\" was not provided by the server.";
778       return false;
779     }
780        
781     //Set properties of object
782     foreach($statusPropertyArray as $val) {
783            
784       //Check if key exists in the associative array if it dose modify object if not set error and return false
785       if(array_key_exists($val, $propertyArray)) {
786         $object->$val = $propertyArray[$val];
787       } else {
788         $ISERROR = "Error: property \"$val\" was not provided by the server.";
789         return false;
790       }
791     }   
792  
793     return $object;
794   } else {
795     return false;
796   }
797 }  
798
799 /*###############################################
800  * Gets an object that represents the default local permissions
801  * Takes: nothing
802  * Returns: an ISymphonyDefaultLocalPermission object or false if error occurred 
803  */
804 function getISymphonyDefaultLocalPermissions() {
805  
806   global $localPermissionPropertyArray, $ISERROR;
807  
808   //Move to default local permission mode
809   if(!moveToDefaultLocalPermission()) {
810     return false;
811   }
812  
813   //Get list of properties
814   if(($propertyArray = checkAndSetErrorList("view")) !== false) {
815    
816     //Convert return array to associative array
817     $propertyArray = convertPropertyArray($propertyArray);
818
819     //Create object from properties
820     $object = new ISymphonyDefaultLocalPermission;
821            
822     //Set properties of object
823     foreach($localPermissionPropertyArray as $val) {
824            
825       //Check if key exists in the associative array if it dose modify object if not set error and return false
826       if(array_key_exists($val, $propertyArray)) {
827         $object->$val = $propertyArray[$val];
828       } else {
829         $ISERROR = "Error: property \"$val\" was not provided by the server.";
830         return false;
831       }
832     }   
833  
834     return $object;
835   } else {
836     return false;
837   }
838 } 
839
840 /*###############################################
841  * Gets an object that represents the default remote permissions
842  * Takes: nothing
843  * Returns: an ISymphonyDefaultRemotePermission object or false if error occurred 
844  */
845 function getISymphonyDefaultRemotePermissions() {
846  
847   global $remotePermissionPropertyArray, $ISERROR;
848  
849   //Move to default remote permission mode
850   if(!moveToDefaultRemotePermission()) {
851     return false;
852   }
853    
854   //Get list of properties
855   if(($propertyArray = checkAndSetErrorList("view")) !== false) {
856    
857     //Convert return array to associative array
858     $propertyArray = convertPropertyArray($propertyArray);
859
860     //Create object from properties
861     $object = new ISymphonyDefaultRemotePermission;
862            
863     //Set properties of object
864     foreach($remotePermissionPropertyArray as $val) {
865            
866       //Check if key exists in the associative array if it dose modify object if not set error and return false
867       if(array_key_exists($val, $propertyArray)) {
868         $object->$val = $propertyArray[$val];
869       } else {
870         $ISERROR = "Error: property \"$val\" was not provided by the server.";
871         return false;
872       }
873     }   
874  
875     return $object;
876   } else {
877     return false;
878   }
879 }
880
881 /*###############################################
882  * Gets an object that represents the default park permissions
883  * Takes: nothing
884  * Returns: an ISymphonyDefaultParkPermission object or false if error occurred 
885  */
886 function getISymphonyDefaultParkPermissions() {
887  
888   global $parkPermissionPropertyArray, $ISERROR;
889  
890   //Move to default park permission mode
891   if(!moveToDefaultParkPermission()) {
892     return false;
893   }
894  
895   //Get list of properties
896   if(($propertyArray = checkAndSetErrorList("view")) !== false) {
897    
898     //Convert return array to associative array
899     $propertyArray = convertPropertyArray($propertyArray);
900
901     //Create object from properties
902     $object = new ISymphonyDefaultParkPermission;
903            
904     //Set properties of object
905     foreach($parkPermissionPropertyArray as $val) {
906            
907       //Check if key exists in the associative array if it dose modify object if not set error and return false
908       if(array_key_exists($val, $propertyArray)) {
909         $object->$val = $propertyArray[$val];
910       } else {
911         $ISERROR = "Error: property \"$val\" was not provided by the server.";
912         return false;
913       }
914     }   
915  
916     return $object;
917   } else {
918     return false;
919   }
920 } 
921
922 /*###############################################
923  * Gets an object that represents the default queue permissions
924  * Takes: nothing
925  * Returns: an ISymphonyDefaultQueuePermission object or false if error occurred 
926  */
927 function getISymphonyDefaultQueuePermissions() {
928  
929   global $queuePermissionPropertyArray, $ISERROR;
930  
931   //Move to default queue permission mode
932   if(!moveToDefaultQueuePermission()) {
933     return false;
934   }
935    
936   //Get list of properties
937   if(($propertyArray = checkAndSetErrorList("view")) !== false) {
938    
939     //Convert return array to associative array
940     $propertyArray = convertPropertyArray($propertyArray);
941
942     //Create object from properties
943     $object = new ISymphonyDefaultQueuePermission;
944            
945     //Set properties of object
946     foreach($queuePermissionPropertyArray as $val) {
947            
948       //Check if key exists in the associative array if it dose modify object if not set error and return false
949       if(array_key_exists($val, $propertyArray)) {
950         $object->$val = $propertyArray[$val];
951       } else {
952         $ISERROR = "Error: property \"$val\" was not provided by the server.";
953         return false;
954       }
955     }   
956  
957     return $object;
958   } else {
959     return false;
960   }
961 } 
962
963 /*###############################################
964  * Gets an object that represents the default conference room permissions
965  * Takes: nothing
966  * Returns: an ISymphonyDefaultConferenceRoomPermission object or false if error occurred 
967  */
968 function getISymphonyDefaultConferenceRoomPermissions() {
969  
970   global $conferenceRoomPermissionPropertyArray, $ISERROR;
971  
972   //Move to default conference room permission mode
973   if(!moveToDefaultConferenceRoomPermission()) {
974     return false;
975   }
976    
977   //Get list of properties
978   if(($propertyArray = checkAndSetErrorList("view")) !== false) {
979    
980     //Convert return array to associative array
981     $propertyArray = convertPropertyArray($propertyArray);
982
983     //Create object from properties
984     $object = new ISymphonyDefaultConferenceRoomPermission;
985            
986     //Set properties of object
987     foreach($conferenceRoomPermissionPropertyArray as $val) {
988            
989       //Check if key exists in the associative array if it dose modify object if not set error and return false
990       if(array_key_exists($val, $propertyArray)) {
991         $object->$val = $propertyArray[$val];
992       } else {
993         $ISERROR = "Error: property \"$val\" was not provided by the server.";
994         return false;
995       }
996     }   
997  
998     return $object;
999   } else {
1000     return false;
1001   }
1002 } 
1003
1004 /*###############################################
1005  * Gets an object that represents a group's local permissions
1006  * Takes: location name, tenant name, group name
1007  * Returns: an ISymphonyGroupLocalPermission object or false if error occurred 
1008  */
1009 function getISymphonyGroupLocalPermissions($location, $tenant, $group) {
1010  
1011   global $localPermissionPropertyArray, $ISERROR;
1012  
1013   //Move to local permission mode
1014   if(!moveToLocalGroupPermission($location, $tenant, $group)) {
1015     return false;
1016   }
1017    
1018   //Get list of properties
1019   if(($propertyArray = checkAndSetErrorList("view")) !== false) {
1020    
1021     //Convert return array to associative array
1022     $propertyArray = convertPropertyArray($propertyArray);
1023
1024     //Create object from properties
1025     $object = new ISymphonyGroupLocalPermission;
1026        
1027     //Set mode properties
1028     $object->mode_location = $location;
1029     $object->mode_tenant = $tenant;
1030     $object->mode_group = $group;
1031      
1032     //Set properties of object
1033     foreach($localPermissionPropertyArray as $val) {
1034            
1035       //Check if key exists in the associative array if it dose modify object if not set error and return false
1036       if(array_key_exists($val, $propertyArray)) {
1037         $object->$val = $propertyArray[$val];
1038       } else {
1039         $ISERROR = "Error: property \"$val\" was not provided by the server.";
1040         return false;
1041       }
1042     }   
1043  
1044     return $object;
1045   } else {
1046     return false;
1047   }
1048 }
1049
1050 /*###############################################
1051  * Gets an object that represents a group's park permissions
1052  * Takes: location name, tenant name, group name
1053  * Returns: an ISymphonyGroupParkPermission object or false if error occurred 
1054  */
1055 function getISymphonyGroupParkPermissions($location, $tenant, $group) {
1056  
1057   global $parkPermissionPropertyArray, $ISERROR;
1058  
1059   //Move to local permission mode
1060   if(!moveToParkGroupPermission($location, $tenant, $group)) {
1061     return false;
1062   }
1063    
1064   //Get list of properties
1065   if(($propertyArray = checkAndSetErrorList("view")) !== false) {
1066    
1067     //Convert return array to associative array
1068     $propertyArray = convertPropertyArray($propertyArray);
1069
1070     //Create object from properties
1071     $object = new ISymphonyGroupParkPermission;
1072        
1073     //Set mode properties
1074     $object->mode_location = $location;
1075     $object->mode_tenant = $tenant;
1076     $object->mode_group = $group;
1077      
1078     //Set properties of object
1079     foreach($parkPermissionPropertyArray as $val) {
1080            
1081       //Check if key exists in the associative array if it dose modify object if not set error and return false
1082       if(array_key_exists($val, $propertyArray)) {
1083         $object->$val = $propertyArray[$val];
1084       } else {
1085         $ISERROR = "Error: property \"$val\" was not provided by the server.";
1086         return false;
1087       }
1088     }   
1089  
1090     return $object;
1091   } else {
1092     return false;
1093   }
1094 }
1095
1096 /*###############################################
1097  * Gets an object that represents a group remote extension permission set
1098  * Takes: location name, tenant name, group name, extension name
1099  * Returns: an ISymphonyGroupRemotePermission object or false if error occurred 
1100  */
1101 function getISymphonyGroupRemotePermissions($location, $tenant, $group, $extension) {
1102  
1103   global $remotePermissionPropertyArray, $ISERROR;
1104  
1105   //Move to remote permission mode
1106   if(!moveToRemoteGroupPermission($location, $tenant, $group, $extension)) {
1107     return false;
1108   }
1109    
1110   //Get list of properties
1111   if(($propertyArray = checkAndSetErrorList("view")) !== false) {
1112    
1113     //Convert return array to associative array
1114     $propertyArray = convertPropertyArray($propertyArray);
1115
1116     //Create object from properties
1117     $object = new ISymphonyGroupRemotePermission;
1118        
1119     //Set mode properties
1120     $object->mode_location = $location;
1121     $object->mode_tenant = $tenant;
1122     $object->mode_group = $group;
1123     $object->mode_extension = $extension;
1124      
1125     //Set properties of object
1126     foreach($remotePermissionPropertyArray as $val) {
1127            
1128       //Check if key exists in the associative array if it dose modify object if not set error and return false
1129       if(array_key_exists($val, $propertyArray)) {
1130         $object->$val = $propertyArray[$val];
1131       } else {
1132         $ISERROR = "Error: property \"$val\" was not provided by the server.";
1133         return false;
1134       }
1135     }   
1136  
1137     return $object;
1138   } else {
1139     return false;
1140   }
1141 }
1142
1143 /*###############################################
1144  * Gets an object that represents a group queue permission set
1145  * Takes: location name, tenant name, group name, queue name
1146  * Returns: an ISymphonyGroupQueuePermission object or false if error occurred 
1147  */
1148 function getISymphonyGroupQueuePermissions($location, $tenant, $group, $queue) {
1149  
1150   global $queuePermissionPropertyArray, $ISERROR;
1151  
1152   //Move to queue permission mode
1153   if(!moveToQueueGroupPermission($location, $tenant, $group, $queue)) {
1154     return false;
1155   }
1156    
1157   //Get list of properties
1158   if(($propertyArray = checkAndSetErrorList("view")) !== false) {
1159    
1160     //Convert return array to associative array
1161     $propertyArray = convertPropertyArray($propertyArray);
1162
1163     //Create object from properties
1164     $object = new ISymphonyGroupQueuePermission;
1165        
1166     //Set mode properties
1167     $object->mode_location = $location;
1168     $object->mode_tenant = $tenant;
1169     $object->mode_group = $group;
1170     $object->mode_queue = $queue;
1171      
1172     //Set properties of object
1173     foreach($queuePermissionPropertyArray as $val) {
1174            
1175       //Check if key exists in the associative array if it dose modify object if not set error and return false
1176       if(array_key_exists($val, $propertyArray)) {
1177         $object->$val = $propertyArray[$val];
1178       } else {
1179         $ISERROR = "Error: property \"$val\" was not provided by the server.";
1180         return false;
1181       }
1182     }   
1183  
1184     return $object;
1185   } else {
1186     return false;
1187   }
1188 } 
1189
1190 /*###############################################
1191  * Gets an object that represents a group conference room permission set
1192  * Takes: location name, tenant name, group name, room name
1193  * Returns: an ISymphonyGroupConferenceRoomPermission object or false if error occurred 
1194  */
1195 function getISymphonyGroupConferenceRoomPermissions($location, $tenant, $group, $room) {
1196  
1197   global $conferenceRoomPermissionPropertyArray, $ISERROR;
1198  
1199   //Move to conference room permission mode
1200   if(!moveToConferenceRoomGroupPermission($location, $tenant, $group, $room)) {
1201     return false;
1202   }
1203    
1204   //Get list of properties
1205   if(($propertyArray = checkAndSetErrorList("view")) !== false) {
1206    
1207     //Convert return array to associative array
1208     $propertyArray = convertPropertyArray($propertyArray);
1209
1210     //Create object from properties
1211     $object = new ISymphonyGroupConferenceRoomPermission;
1212        
1213     //Set mode properties
1214     $object->mode_location = $location;
1215     $object->mode_tenant = $tenant;
1216     $object->mode_group = $group;
1217     $object->mode_room = $room;
1218      
1219     //Set properties of object
1220     foreach($conferenceRoomPermissionPropertyArray as $val) {
1221            
1222       //Check if key exists in the associative array if it dose modify object if not set error and return false
1223       if(array_key_exists($val, $propertyArray)) {
1224         $object->$val = $propertyArray[$val];
1225       } else {
1226         $ISERROR = "Error: property \"$val\" was not provided by the server.";
1227         return false;
1228       }
1229     }   
1230  
1231     return $object;
1232   } else {
1233     return false;
1234   }
1235 } 
1236
1237 /*###############################################
1238  * Gets an object that represents a profiles's local override permissions
1239  * Takes: location name, tenant name, profile name
1240  * Returns: an ISymphonyOverrideLocalPermission object or false if error occurred 
1241  */
1242 function getISymphonyOverrideLocalPermissions($location, $tenant, $profile) {
1243  
1244   global $localPermissionPropertyArray, $ISERROR;
1245  
1246   //Move to local permission mode
1247   if(!moveToLocalOverridePermission($location, $tenant, $profile)) {
1248     return false;
1249   }
1250    
1251   //Get list of properties
1252   if(($propertyArray = checkAndSetErrorList("view")) !== false) {
1253    
1254     //Convert return array to associative array
1255     $propertyArray = convertPropertyArray($propertyArray);
1256
1257     //Create object from properties
1258     $object = new ISymphonyOverrideLocalPermission;
1259        
1260     //Set mode properties
1261     $object->mode_location = $location;
1262     $object->mode_tenant = $tenant;
1263     $object->mode_profile = $profile;
1264      
1265     //Set properties of object
1266     foreach($localPermissionPropertyArray as $val) {
1267            
1268       //Check if key exists in the associative array if it dose modify object if not set error and return false
1269       if(array_key_exists($val, $propertyArray)) {
1270         $object->$val = $propertyArray[$val];
1271       } else {
1272         $ISERROR = "Error: property \"$val\" was not provided by the server.";
1273         return false;
1274       }
1275     }   
1276  
1277     return $object;
1278   } else {
1279     return false;
1280   }
1281 }
1282
1283 /*###############################################
1284  * Gets an object that represents a profiles's park override permissions
1285  * Takes: location name, tenant name, profile name
1286  * Returns: an ISymphonyOverrideParkPermission object or false if error occurred 
1287  */
1288 function getISymphonyOverrideParkPermissions($location, $tenant, $profile) {
1289  
1290   global $parkPermissionPropertyArray, $ISERROR;
1291  
1292   //Move to park permission mode
1293   if(!moveToParkOverridePermission($location, $tenant, $profile)) {
1294     return false;
1295   }
1296  
1297   //Get list of properties
1298   if(($propertyArray = checkAndSetErrorList("view")) !== false) {
1299    
1300     //Convert return array to associative array
1301     $propertyArray = convertPropertyArray($propertyArray);
1302
1303     //Create object from properties
1304     $object = new ISymphonyOverrideParkPermission;
1305        
1306     //Set mode properties
1307     $object->mode_location = $location;
1308     $object->mode_tenant = $tenant;
1309     $object->mode_profile = $profile;
1310      
1311     //Set properties of object
1312     foreach($parkPermissionPropertyArray as $val) {
1313            
1314       //Check if key exists in the associative array if it dose modify object if not set error and return false
1315       if(array_key_exists($val, $propertyArray)) {
1316         $object->$val = $propertyArray[$val];
1317       } else {
1318         $ISERROR = "Error: property \"$val\" was not provided by the server.";
1319         return false;
1320       }
1321     }   
1322  
1323     return $object;
1324   } else {
1325     return false;
1326   }
1327 }
1328
1329 /*###############################################
1330  * Gets an object that represents a profile's remote extension permission set
1331  * Takes: location name, tenant name, profile name, extension name
1332  * Returns: an ISymphonyOverrideRemotePermission object or false if error occurred 
1333  */
1334 function getISymphonyOverrideRemotePermissions($location, $tenant, $profile, $extension) {
1335  
1336   global $remotePermissionPropertyArray, $ISERROR;
1337  
1338   //Move to remote permission mode
1339   if(!moveToRemoteOverridePermission($location, $tenant, $profile, $extension)) {
1340     return false;
1341   }
1342    
1343   //Get list of properties
1344   if(($propertyArray = checkAndSetErrorList("view")) !== false) {
1345    
1346     //Convert return array to associative array
1347     $propertyArray = convertPropertyArray($propertyArray);
1348
1349     //Create object from properties
1350     $object = new ISymphonyOverrideRemotePermission;
1351        
1352     //Set mode properties
1353     $object->mode_location = $location;
1354     $object->mode_tenant = $tenant;
1355     $object->mode_profile = $profile;
1356     $object->mode_extension = $extension;
1357      
1358     //Set properties of object
1359     foreach($remotePermissionPropertyArray as $val) {
1360            
1361       //Check if key exists in the associative array if it dose modify object if not set error and return false
1362       if(array_key_exists($val, $propertyArray)) {
1363         $object->$val = $propertyArray[$val];
1364       } else {
1365         $ISERROR = "Error: property \"$val\" was not provided by the server.";
1366         return false;
1367       }
1368     }   
1369  
1370     return $object;
1371   } else {
1372     return false;
1373   }
1374 }
1375
1376 /*###############################################
1377  * Gets an object that represents a profile's queue permission set
1378  * Takes: location name, tenant name, profile name, queue name
1379  * Returns: an ISymphonyOverrideQueuePermission object or false if error occurred 
1380  */
1381 function getISymphonyOverrideQueuePermissions($location, $tenant, $profile, $queue) {
1382  
1383   global $queuePermissionPropertyArray, $ISERROR;
1384  
1385   //Move to queue permission mode
1386   if(!moveToQueueOverridePermission($location, $tenant, $profile, $queue)) {
1387     return false;
1388   }
1389    
1390   //Get list of properties
1391   if(($propertyArray = checkAndSetErrorList("view")) !== false) {
1392    
1393     //Convert return array to associative array
1394     $propertyArray = convertPropertyArray($propertyArray);
1395
1396     //Create object from properties
1397     $object = new ISymphonyOverrideQueuePermission;
1398        
1399     //Set mode properties
1400     $object->mode_location = $location;
1401     $object->mode_tenant = $tenant;
1402     $object->mode_profile = $profile;
1403     $object->mode_queue = $queue;
1404      
1405     //Set properties of object
1406     foreach($queuePermissionPropertyArray as $val) {
1407            
1408       //Check if key exists in the associative array if it dose modify object if not set error and return false
1409       if(array_key_exists($val, $propertyArray)) {
1410         $object->$val = $propertyArray[$val];
1411       } else {
1412         $ISERROR = "Error: property \"$val\" was not provided by the server.";
1413         return false;
1414       }
1415     }   
1416  
1417     return $object;
1418   } else {
1419     return false;
1420   }
1421 } 
1422
1423 /*###############################################
1424  * Gets an object that represents a profile's conference room permission set
1425  * Takes: location name, tenant name, profile name, conference room name
1426  * Returns: an ISymphonyOverrideQueuePermission object or false if error occurred 
1427  */
1428 function getISymphonyOverrideConferenceRoomPermissions($location, $tenant, $profile, $room) {
1429  
1430   global $queuePermissionPropertyArray, $ISERROR;
1431  
1432   //Move to conference room permission mode
1433   if(!moveToConferenceRoomOverridePermission($location, $tenant, $profile, $room)) {
1434     return false;
1435   }
1436  
1437   //Get list of properties
1438   if(($propertyArray = checkAndSetErrorList("view")) !== false) {
1439    
1440     //Convert return array to associative array
1441     $propertyArray = convertPropertyArray($propertyArray);
1442
1443     //Create object from properties
1444     $object = new ISymphonyOverrideConferenceRoomPermission;
1445        
1446     //Set mode properties
1447     $object->mode_location = $location;
1448     $object->mode_tenant = $tenant;
1449     $object->mode_profile = $profile;
1450     $object->mode_room = $room;
1451      
1452     //Set properties of object
1453     foreach($queuePermissionPropertyArray as $val) {
1454            
1455       //Check if key exists in the associative array if it dose modify object if not set error and return false
1456       if(array_key_exists($val, $propertyArray)) {
1457         $object->$val = $propertyArray[$val];
1458       } else {
1459         $ISERROR = "Error: property \"$val\" was not provided by the server.";
1460         return false;
1461       }
1462     }   
1463  
1464     return $object;
1465   } else {
1466     return false;
1467   }
1468 }
1469
1470 //Remove methods-----------------------------------------------------------------------------------
1471 /*###############################################
1472  * Removes a location
1473  * Takes: location name
1474  * Returns: true if successful or false if error occurred 
1475  */
1476 function removeISymphonyLocation($location) {
1477  
1478   //Move to server mode
1479   if(!moveToServer()) {
1480     return false;
1481   }
1482  
1483   //Remove element
1484   return checkAndSetErrorNone("remove location $location");
1485 }
1486
1487 /*###############################################
1488  * Removes a tenant
1489  * Takes: location name, tenant name
1490  * Returns: true if successful or false if error occurred 
1491  */
1492 function removeISymphonyTenant($location, $tenant) {
1493  
1494   //Move to location mode
1495   if(!moveToLocation($location)) {
1496     return false;
1497   }
1498  
1499   //Remove element
1500   return checkAndSetErrorNone("remove tenant $tenant");
1501 }
1502
1503 /*###############################################
1504  * Removes an extension
1505  * Takes: location name, tenant name, extension name
1506  * Returns: true if successful or false if error occurred 
1507  */
1508 function removeISymphonyExtension($location, $tenant, $extension) {
1509  
1510   //Move to tenant mode
1511   if(!moveToTenant($location, $tenant)) {
1512     return false;
1513   }
1514  
1515   //Remove element
1516   return checkAndSetErrorNone("remove extension $extension");
1517 }
1518
1519 /*###############################################
1520  * Removes a profile
1521  * Takes: location name, tenant name, profile name
1522  * Returns: true if successful or false if error occurred 
1523  */
1524 function removeISymphonyProfile($location, $tenant, $profile) {
1525  
1526   //Move to tenant mode
1527   if(!moveToTenant($location, $tenant)) {
1528     return false;
1529   }
1530  
1531   //Remove element
1532   return checkAndSetErrorNone("remove profile $profile");
1533 }
1534
1535 /*###############################################
1536  * Removes a queue
1537  * Takes: location name, tenant name, queue name
1538  * Returns: true if successful or false if error occurred 
1539  */
1540 function removeISymphonyQueue($location, $tenant, $queue) {
1541  
1542   //Move to tenant mode
1543   if(!moveToTenant($location, $tenant)) {
1544     return false;
1545   }
1546  
1547   //Remove element
1548   return checkAndSetErrorNone("remove queue $queue");
1549 }
1550
1551 /*###############################################
1552  * Removes a conference room
1553  * Takes: location name, tenant name, room name
1554  * Returns: true if successful or false if error occurred 
1555  */
1556 function removeISymphonyConferenceRoom($location, $tenant, $room) {
1557  
1558   //Move to tenant mode
1559   if(!moveToTenant($location, $tenant)) {
1560     return false;
1561   }
1562  
1563   //Remove element
1564   return checkAndSetErrorNone("remove meetme $room");
1565 }
1566
1567 /*###############################################
1568  * Removes a status
1569  * Takes: location name, tenant name, status name
1570  * Returns: true if successful or false if error occurred 
1571  */
1572 function removeISymphonyStatus($location, $tenant, $status) {
1573  
1574   //Move to tenant mode
1575   if(!moveToTenant($location, $tenant)) {
1576     return false;
1577   }
1578  
1579   //Remove element
1580   return checkAndSetErrorNone("remove status $status");
1581 }
1582
1583 /*###############################################
1584  * Removes a permission group
1585  * Takes: location name, tenant name, group name
1586  * Returns: true if successful or false if error occurred 
1587  */
1588 function removeISymphonyPermissionGroup($location, $tenant, $group) {
1589  
1590   //Move to tenant mode
1591   if(!moveToTenant($location, $tenant)) {
1592     return false;
1593   }
1594  
1595   //Remove element
1596   return checkAndSetErrorNone("remove permgroup $group");
1597 }
1598
1599 /*###############################################
1600  * Removes a group remote permission
1601  * Takes: location name, tenant name, group name, extension name
1602  * Returns: true if successful or false if error occurred 
1603  */
1604 function removeISymphonyGroupRemotePermission($location, $tenant, $group, $extension) {
1605  
1606   //Move to permission group mode
1607   if(!moveToPermissionGroup($location, $tenant, $group)) {
1608     return false;
1609   }
1610  
1611   //Remove element
1612   return checkAndSetErrorNone("remove remote $extension");
1613 }
1614
1615 /*###############################################
1616  * Removes a group queue permission
1617  * Takes: location name, tenant name, group name, queue name
1618  * Returns: true if successful or false if error occurred 
1619  */
1620 function removeISymphonyGroupQueuePermission($location, $tenant, $group, $queue) {
1621  
1622   //Move to permission group mode
1623   if(!moveToPermissionGroup($location, $tenant, $group)) {
1624     return false;
1625   }
1626  
1627   //Remove element
1628   return checkAndSetErrorNone("remove queue $queue");
1629 }
1630
1631 /*###############################################
1632  * Removes a group conference room permission
1633  * Takes: location name, tenant name, group name, room name
1634  * Returns: true if successful or false if error occurred 
1635  */
1636 function removeISymphonyGroupConferenceRoomPermission($location, $tenant, $group, $room) {
1637  
1638   //Move to permission group mode
1639   if(!moveToPermissionGroup($location, $tenant, $group)) {
1640     return false;
1641   }
1642  
1643   //Remove element
1644   return checkAndSetErrorNone("remove meetme $room");
1645 }
1646
1647 /*###############################################
1648  * Removes a profile override remote permission
1649  * Takes: location name, tenant name, profile name, extension name
1650  * Returns: true if successful or false if error occurred 
1651  */
1652 function removeISymphonyOverrideRemotePermission($location, $tenant, $profile, $extension) {
1653  
1654   //Move to profile mode
1655   if(!moveToProfile($location, $tenant, $profile)) {
1656     return false;
1657   }
1658  
1659   //Remove element
1660   return checkAndSetErrorNone("remove remote $extension");
1661 }
1662
1663 /*###############################################
1664  * Removes a profile override queue permission
1665  * Takes: location name, tenant name, profile name, queue name
1666  * Returns: true if successful or false if error occurred 
1667  */
1668 function removeISymphonyOverrideQueuePermission($location, $tenant, $profile, $queue) {
1669  
1670   //Move to profile mode
1671   if(!moveToProfile($location, $tenant, $profile)) {
1672     return false;
1673   }
1674  
1675   //Remove element
1676   return checkAndSetErrorNone("remove queue $queue");
1677 }
1678
1679 /*###############################################
1680  * Removes a profile override conference room permission
1681  * Takes: location name, tenant name, profile name, queue name
1682  * Returns: true if successful or false if error occurred 
1683  */
1684 function removeISymphonyOverrideConferenceRoomPermission($location, $tenant, $profile, $room) {
1685  
1686   //Move to profile mode
1687   if(!moveToProfile($location, $tenant, $profile)) {
1688     return false;
1689   }
1690  
1691   //Remove element
1692   return checkAndSetErrorNone("remove meetme $room");
1693 }
1694
1695 //License methods-----------------------------------------------------------------------------------
1696 /*###############################################
1697  * Activates a tenant license
1698  * Takes: location name, tenant name, serial
1699  * Returns: true if successful or false if error occurred 
1700  */
1701 function activateISymphonyLicense($location, $tenant, $serial) {
1702  
1703   //Move to tenant mode
1704   if(!moveToTenant($location, $tenant)) {
1705     return false;
1706   }
1707  
1708   //Activate license
1709   return checkAndSetErrorNone("license activate $serial");
1710 } 
1711
1712 /*###############################################
1713  * Gets a name associated with a license
1714  * Takes: location name, tenant name
1715  * Returns: the license name if successful or false if error occurred 
1716  */
1717 function getISymphonyLicenseName($location, $tenant) {
1718  
1719   //Move to tenant mode
1720   if(!moveToTenant($location, $tenant)) {
1721     return false;
1722   }
1723  
1724   //Query license info
1725   return checkAndSetErrorString("license name");
1726 } 
1727
1728 /*###############################################
1729  * Gets the number of clients of a licenses
1730  * Takes: location name, tenant name
1731  * Returns: the number of clients if successful or false if error occurred 
1732  */
1733 function getISymphonyLicenseClients($location, $tenant) {
1734  
1735   //Move to tenant mode
1736   if(!moveToTenant($location, $tenant)) {
1737     return false;
1738   }
1739  
1740   //Query license info
1741   return checkAndSetErrorString("license clients");
1742 } 
1743
1744 /*###############################################
1745  * Gets the number of queues of a licenses
1746  * Takes: location name, tenant name
1747  * Returns: the number of queues if successful or false if error occurred 
1748  */
1749 function getISymphonyLicenseQueues($location, $tenant) {
1750  
1751   //Move to tenant mode
1752   if(!moveToTenant($location, $tenant)) {
1753     return false;
1754   }
1755  
1756   //Query license info
1757   return checkAndSetErrorString("license queues");
1758 }
1759
1760 /*###############################################
1761  * Gets the number of trial days left of a licenses
1762  * Takes: location name, tenant name
1763  * Returns: the number of trial days left if successful or false if error occurred 
1764  */
1765 function getISymphonyLicenseTrialDays($location, $tenant) {
1766  
1767   //Move to tenant mode
1768   if(!moveToTenant($location, $tenant)) {
1769     return false;
1770   }
1771  
1772   //Query license info
1773   return checkAndSetErrorString("license days");
1774 }
1775  
1776 //User status methods------------------------------------------------------------------------------
1777 /*###############################################
1778  * Sets an extension's status
1779  * Takes: location name, tenant name, extension name, status
1780  * Returns: true if successful or false if error occurred 
1781  */
1782 function setISymphonyExtensionStatus($location, $tenant, $extension, $status) {
1783  
1784   //Move to extension mode
1785   if(!moveToExtension($location, $tenant, $extension)) {
1786     return false;
1787   }
1788  
1789   //Set status
1790   return checkAndSetErrorNone("userstatus $status");
1791 } 
1792
1793 /*###############################################
1794  * Sets an extension's status note
1795  * Takes: location name, tenant name, extension name, note
1796  * Returns: true if successful or false if error occurred 
1797  */
1798 function setISymphonyExtensionNote($location, $tenant, $extension, $note) {
1799  
1800   //Move to extension mode
1801   if(!moveToExtension($location, $tenant, $extension)) {
1802     return false;
1803   }
1804  
1805   //Set note
1806   return checkAndSetErrorNone("note $note"); 
1807 } 
1808
1809 /*###############################################
1810  * Sets an extension's return time
1811  * Takes: location name, tenant name, extension name, time(unix time stamp)
1812  * Returns: true if successful or false if error occurred 
1813  */
1814 function setISymphonyExtensionReturnTime($location, $tenant, $extension, $returntime) {
1815  
1816   //Move to extension mode
1817   if(!moveToExtension($location, $tenant, $extension)) {
1818     return false;
1819   }
1820  
1821   //Set return time
1822   return checkAndSetErrorNone("returntime $returntime"); 
1823 } 
1824
1825 /*###############################################
1826  * Gets an extension's status
1827  * Takes: location name, tenant name, extension name
1828  * Returns: the status name if successful or false if error occurred 
1829  */
1830 function getISymphonyExtensionStatus($location, $tenant, $extension) {
1831  
1832   //Move to extension mode
1833   if(!moveToExtension($location, $tenant, $extension)) {
1834     return false;
1835   }
1836  
1837   //Get status
1838   return checkAndSetErrorString("query userstatus");
1839 }
1840
1841 /*###############################################
1842  * Gets an extension's status note
1843  * Takes: location name, tenant name, extension name
1844  * Returns: the note if successful or false if error occurred 
1845  */
1846 function getISymphonyExtensionNote($location, $tenant, $extension) {
1847  
1848   //Move to extension mode
1849   if(!moveToExtension($location, $tenant, $extension)) {
1850     return false;
1851   }
1852  
1853   //Get note
1854   return checkAndSetErrorString("query note");
1855 }
1856
1857 /*###############################################
1858  * Gets an extension's returnTime
1859  * Takes: location name, tenant name, extension name
1860  * Returns: the return time as a unix time stamp if successful or false if error occurred 
1861  */
1862 function getISymphonyExtensionReturnTime($location, $tenant, $extension) {
1863  
1864   //Move to extension mode
1865   if(!moveToExtension($location, $tenant, $extension)) {
1866     return false;
1867   }
1868  
1869   //Get return time
1870   return checkAndSetErrorString("query returntime");
1871 }
1872
1873 //Profile managed extension methods----------------------------------------------------------------
1874 /*###############################################
1875  * Adds an extension to a profile's managed list
1876  * Takes: location name, tenant name, profile name, extension name
1877  * Returns: true if successful or false if error occurred 
1878  */
1879 function addISymphonyProfileManagedExtension($location, $tenant, $profile, $extension) {
1880  
1881   //Move to profile mode
1882   if(!moveToProfile($location, $tenant, $profile)) {
1883     return false;
1884   }
1885  
1886   //Add managed extension
1887   return checkAndSetErrorNone("add extension $extension");
1888 }
1889
1890 /*###############################################
1891  * Removes an extension from a profile's managed list
1892  * Takes: location name, tenant name, profile name, extension name
1893  * Returns: true if successful or false if error occurred 
1894  */
1895 function removeISymphonyProfileManagedExtension($location, $tenant, $profile, $extension) {
1896  
1897   //Move to profile mode
1898   if(!moveToProfile($location, $tenant, $profile)) {
1899     return false;
1900   }
1901  
1902   //Add managed extension
1903   return checkAndSetErrorNone("remove extension $extension");
1904 }
1905
1906 //Permission group member methods------------------------------------------------------------------
1907 /*###############################################
1908  * Adds a profile to a permission group's member list
1909  * Takes: location name, tenant name, permission group name, profile name
1910  * Returns: true if successful or false if error occurred 
1911  */
1912 function addISymphonyPermissionGroupMember($location, $tenant, $group, $profile) {
1913  
1914   //Move to permission group mode
1915   if(!moveToPermissionGroup($location, $tenant, $group)) {
1916     return false;
1917   }
1918  
1919   //Add member
1920   return checkAndSetErrorNone("add member $profile");
1921 }
1922
1923 /*###############################################
1924  * Removes a profile from a permission group's member list
1925  * Takes: location name, tenant name, permission group name, profile name
1926  * Returns: true if successful or false if error occurred 
1927  */
1928 function removeISymphonyPermissionGroupMember($location, $tenant, $group, $profile) {
1929  
1930   //Move to permission group mode
1931   if(!moveToPermissionGroup($location, $tenant, $group)) {
1932     return false;
1933   }
1934  
1935   //Remove member
1936   return checkAndSetErrorNone("remove member $profile");
1937 }
1938
1939 //Server methods-----------------------------------------------------------------------------------
1940 /*###############################################
1941  * Gets the server version
1942  * Takes: nothing
1943  * Returns: server version if successful or false if error occurred 
1944  */
1945 function getiSymphonyServerVersion() {
1946  
1947   //Move to server mode
1948   if(!moveToServer()) {
1949     return false;
1950   }
1951  
1952   //Get server version
1953   return checkAndSetErrorString("version");
1954 }
1955
1956 /*###############################################
1957  * Gets the server revision
1958  * Takes: nothing
1959  * Returns: server revision if successful or false if error occurred 
1960  */
1961 function getiSymphonyServerRevision() {
1962  
1963   if(($serverVersion = getiSymphonyServerVersion()) === false) {
1964     return false;
1965   }
1966  
1967   //Parse our server revision number from server version
1968   $serverRevison = ereg_replace("[^0-9]+", '', substr($serverVersion, strpos($serverVersion, "rev")));
1969  
1970   //If revision number is not numeric something went wrong in the parsing. If so return false.
1971   if(!is_numeric($serverRevison)) {
1972     $ISERROR = "Error: Parsed server version was non numeric.";
1973     return false;
1974   }
1975  
1976   return $serverRevison;
1977 }
1978
1979 /*###############################################
1980  * Shutdown the iSymphony server
1981  * Takes: nothing
1982  * Returns: nothing
1983  */
1984 function shutdownISymphonyServer() {
1985  
1986   //Move to server mode
1987   if(!moveToServer()) {
1988     return false;
1989   }
1990  
1991   //Shutdown server
1992   sendAndRecive("shutdown");
1993 }
1994
1995 /*###############################################
1996  * Reload the iSymphony server
1997  * Takes: nothing
1998  * Returns: nothing
1999  */
2000 function reloadISymphonyServer() {
2001  
2002   //Move to server mode
2003   if(!moveToServer()) {
2004     return false;
2005   }
2006  
2007   //Reload server
2008   sendAndRecive("reload");
2009 }
2010
2011 /*###############################################
2012  * Reload a location
2013  * Takes: location name
2014  * Returns: true if successful or false if error occurred
2015  */
2016 function reloadISymphonyLocation($location) {
2017  
2018   //Move to location mode
2019   if(!moveToLocation($location)) {
2020     return false;
2021   }
2022  
2023   //Reload location
2024   return checkAndSetErrorNone("reload");
2025 }
2026
2027 /*###############################################
2028  * Gets a locations Asterisk connection status
2029  * Takes: location name
2030  * Returns: connection status if successful or false if error occurred 
2031  */
2032 function getiSymphonyLocationConnectionStatus($location) {
2033  
2034   //Move to location mode
2035   if(!moveToLocation($location)) {
2036     return false;
2037   }
2038  
2039   //Reload location
2040   return checkAndSetErrorString("connection");
2041 }
2042
2043 //Permission override activation methods-----------------------------------------------------------
2044 /*###############################################
2045  * Activates a profile's local permission overrides
2046  * Takes: location name, tenant name, profile name
2047  * Returns: true if successful or false if error occurred
2048  */
2049 function activateISymphonyLocalOverridePermissions($location, $tenant, $profile) {
2050  
2051   //Move to profile mode
2052   if(!moveToProfile($location, $tenant, $profile)) {
2053     return false;
2054   }
2055  
2056   //Reload location
2057   return checkAndSetErrorNone("activate local");
2058 }
2059
2060 /*###############################################
2061  * Deactivates a profile's local permission overrides
2062  * Takes: location name, tenant name, profile name
2063  * Returns: true if successful or false if error occurred
2064  */
2065 function deactivateISymphonyLocalOverridePermissions($location, $tenant, $profile) {
2066  
2067   //Move to profile mode
2068   if(!moveToProfile($location, $tenant, $profile)) {
2069     return false;
2070   }
2071  
2072   //Reload location
2073   return checkAndSetErrorNone("deactivate local");
2074 }
2075
2076 /*###############################################
2077  * Activates a profile's park permission overrides
2078  * Takes: location name, tenant name, profile name
2079  * Returns: true if successful or false if error occurred
2080  */
2081 function activateISymphonyParkOverridePermissions($location, $tenant, $profile) {
2082  
2083   //Move to profile mode
2084   if(!moveToProfile($location, $tenant, $profile)) {
2085     return false;
2086   }
2087  
2088   //Reload location
2089   return checkAndSetErrorNone("activate park");
2090 }
2091
2092 /*###############################################
2093  * Deactivates a profile's park permission overrides
2094  * Takes: location name, tenant name, profile name
2095  * Returns: true if successful or false if error occurred
2096  */
2097 function deactivateISymphonyParkOverridePermissions($location, $tenant, $profile) {
2098  
2099   //Move to profile mode
2100   if(!moveToProfile($location, $tenant, $profile)) {
2101     return false;
2102   }
2103  
2104   //Reload location
2105   return checkAndSetErrorNone("deactivate park");
2106 }
2107 ?>
Note: See TracBrowser for help on using the browser.