diff --git a/plugins/admin/ogroups/class_phonequeue.inc b/plugins/admin/ogroups/class_phonequeue.inc
index c5fb59f7e3ff720560ef8297eea19773daefac64..c7f61c946901f3b32fd880e1f93226eba7fe698c 100644 (file)
{
$SQL = array();
-
+
+ if(!isset($_SESSION['config']->data['SERVERS']['FON'])){
+ return(_("There is currently no asterisk server defined. Possibly you are missing a server that handles the asterisk management (goFonServer).\nYour Settings can't be saved to asterisk Database."));
+ return(false);
+ }
+
// Get Configuration for Mysql database Server
$a_SETUP = $_SESSION['config']->data['SERVERS']['FON'];
$s_parameter ="";
$i = 0;
$queueuser =array();
foreach($this->parent->by_object['ogroup']->memberList as $member){
- if(in_array("goFonAccount",$member['objectClass'])){
- $i ++ ;
- $queueuser[$i]['queue_name'] = $this->attrs['cn'][0];
- $queueuser[$i]['interface'] = "SIP/".$member['uid'][0];
- $queueuser[$i]['penalty'] = 1;
+ if(isset($member['objectClass'])){
+ if(in_array("goFonAccount",$member['objectClass'])){
+ $i ++ ;
+ $queueuser[$i]['queue_name'] = $this->attrs['cn'][0];
+ $queueuser[$i]['interface'] = "SIP/".$member['uid'][0];
+ $queueuser[$i]['penalty'] = 1;
+ }
}
}
$queueusers=0;
foreach($this->parent->by_object['ogroup']->memberList as $member){
- if(in_array("goFonAccount",$member['objectClass'])){
- $queueusers++;
+ if(isset($member['objectClass'])){
+ if(in_array("goFonAccount",$member['objectClass'])){
+ $queueusers++;
+ }
}
}
$i = 0;
+
+ $i_insert_only_once = false;
+
foreach($this->telephoneNumber as $num){
// If there are no member in a Queue
// A Queue is not deleted directly, it is stored until the o group is deleted
- $a_ext[$i]['context'] = 'GOsa';
- $a_ext[$i]['exten'] = $this->attrs['cn'][0];
- $a_ext[$i]['priority'] = 1;
- $a_ext[$i]['app'] = "Goto";
- $a_ext[$i]['appdata'] = $num."|1";
- $i ++ ;
+ if($i_insert_only_once == false){
+ $i_insert_only_once = true;
+ $a_ext[$i]['context'] = 'GOsa';
+ $a_ext[$i]['exten'] = $this->attrs['cn'][0];
+ $a_ext[$i]['priority'] = 1;
+ $a_ext[$i]['app'] = "Goto";
+ $a_ext[$i]['appdata'] = $num."|1";
+ $i ++ ;
+ }
if($queueusers == 0){
$a_ext[$i]['context'] = 'GOsa';
}
}
+ @mysql_close($r_con);
return(false);
}