Code

queue parameter modifcated
[gosa.git] / plugins / admin / ogroups / class_phonequeue.inc
index 2dd49709d9fcbc3f7e546bab02c8eb5ceb4ab8a2..ed2da09e9f5356cc6567d5e481f02a7b05d9616f 100644 (file)
@@ -7,29 +7,29 @@ class phonequeue extends plugin
   var $cn= "";
 
 
-  var $goFonTimeOut             =""; 
-  var $goFonMaxLen              ="";
-  var $goFonAnnounceFrequency   ="";
-  var $goFonDialOption_t        ="";
-  var $goFonDialOption_T        ="";
-  var $goFonDialOption_h        ="";
-  var $goFonAnnounce            ="";
-  var $goFonDialOption_H        ="";
-  var $goFonMusiconHold         ="";
-  var $goFonWelcomeMusic        ="";
+  var $goFonTimeOut             ="5"; 
+  var $goFonMaxLen              ="20";
+  var $goFonAnnounceFrequency   ="60";
+  var $goFonDialOption_t        ="t";
+  var $goFonDialOption_T        ="T";
+  var $goFonDialOption_h        ="h";
+  var $goFonAnnounce            ="gonicus-berlin-welcome";
+  var $goFonDialOption_H        ="H";
+  var $goFonMusiconHold         ="default";
+  var $goFonWelcomeMusic        ="gonicus-berlin-welcome";
   var $goFonQueueReportHold     ="";
-  var $goFonQueueYouAreNext     ="";
-  var $goFonQueueThereAre       ="";
-  var $goFonQueueCallsWaiting   ="";
-  var $goFonQueueThankYou       ="";
-  var $goFonQueueMinutes        =""; 
-  var $goFonQueueSeconds        ="";
-  var $goFonLanguage            ="";
-  var $goFonStrategy            ="";
-  var $goFonAnnounceHoldtime    ="";
+  var $goFonQueueYouAreNext     ="queue-youarenext";
+  var $goFonQueueThereAre       ="queue-therare";
+  var $goFonQueueCallsWaiting   ="queue-callswaiting";
+  var $goFonQueueThankYou       ="queue-thankyou";
+  var $goFonQueueMinutes        ="queue-minutes"; 
+  var $goFonQueueSeconds        ="queue-seconds";
+  var $goFonLanguage            ="queue-holdtime";
+  var $goFonStrategy            ="rrmemory";
+  var $goFonAnnounceHoldtime    ="yes";
   var $telephoneNumber          =array();
   var $goFonQueueMember         =array(); 
-  var $goFonDialOption          ="";
+  var $goFonDialOption          ="tThH";
 
   var $old_phone_numbers        =array();
 
@@ -51,8 +51,10 @@ class phonequeue extends plugin
     /* Save initial account state */
     $this->initially_was_account= $this->is_account;
 
-    $this->telephoneNumber=$this->attrs['telephoneNumber'];
-    unset($this->telephoneNumber['count']); 
+    if(isset($this->attrs['telephoneNumber'])){
+      $this->telephoneNumber=$this->attrs['telephoneNumber'];
+      unset($this->telephoneNumber['count']); 
+    }
 
 
     for($i = 0; $i < strlen($this->goFonDialOption); $i++){
@@ -157,6 +159,9 @@ class phonequeue extends plugin
   function check()
   {
     $message= array();
+  //  if(empty($this->description)){
+  //    $message[] = _("You must specify a description for this queue");
+  //  }
 
     if($this->is_number_used()){
       $message[] = $this->is_number_used();
@@ -167,7 +172,7 @@ class phonequeue extends plugin
     }
 
     if(!((is_numeric($this->goFonTimeOut))||(empty($this->goFonTimeOut)))){
-      $message[] = _("Timeout must be numeric");
+      $message[] = _("Retry must be numeric");
     }
     if(!((is_numeric($this->goFonMaxLen))||(empty($this->goFonMaxLen)))){
       $message[] = _("Queue length must be numeric");
@@ -230,10 +235,13 @@ class phonequeue extends plugin
       
       // Delete old Entries 
       $delete = array();
-      foreach($this->old_phone_numbers as $phone){
-        $delete[]= "DELETE FROM ".$a_SETUP['EXT_TABLE']." WHERE exten='".$phone."';\n";
+      if(is_array($this->old_phone_numbers)){
+        foreach($this->old_phone_numbers as $phone){
+          $delete[]= "DELETE FROM ".$a_SETUP['EXT_TABLE']." WHERE exten='".$phone."';\n";
+        }
       }
-      $delete[]=    "DELETE FROM ".$a_SETUP['QUEUE_TABLE']." WHERE name=\"".$this->attrs['cn'][0]."\"; \n";
+      $delete[]=    "DELETE FROM ".$a_SETUP['EXT_TABLE']."    WHERE exten='".$this->attrs['cn'][0]."';\n";
+      $delete[]=    "DELETE FROM ".$a_SETUP['QUEUE_TABLE']."  WHERE name=\"".$this->attrs['cn'][0]."\"; \n";
       $delete[]=    "DELETE FROM ".$a_SETUP['QUEUE_MEMBER_TABLE']." WHERE queue_name=\"".$this->attrs['cn'][0]."\";\n";
 
       /* Perform queries to delte old entries */
@@ -276,6 +284,12 @@ class phonequeue extends plugin
         
         $prio --;
         $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 ++ ; 
+        $a_ext[$i]['context']  = 'GOsa';
         $a_ext[$i]['exten']    = $num;
         $a_ext[$i]['priority'] = 1;
         $a_ext[$i]['app']      = "Wait";
@@ -311,15 +325,14 @@ class phonequeue extends plugin
           $this->goFonDialOption_H.
           "|".  // Optionalurl egal
           "|".  // announceoverride
-          "|".  // Timeout
-          $this->goFonTimeOut;     
-
-        $i ++ ; 
-        $a_ext[$i]['context']  = 'GOsa';
-        $a_ext[$i]['exten']    = $num;
-        $a_ext[$i]['priority'] = 6;
-        $a_ext[$i]['app']      = "SetVar";
-        $a_ext[$i]['appdata']  = "Queue_Prio=".$prio;
+          "|";  // Timeout
+
+//        $i ++ ; 
+//        $a_ext[$i]['context']  = 'GOsa';
+//        $a_ext[$i]['exten']    = $num;
+//        $a_ext[$i]['priority'] = 6;
+//        $a_ext[$i]['app']      = "SetVar";
+//        $a_ext[$i]['appdata']  = "Queue_Prio=".$prio;
         $i ++ ;
 
         /* Generate Priority Entry */
@@ -329,7 +342,7 @@ class phonequeue extends plugin
         $queue["queue_holdtime"]        = $this->goFonAnnounce;
         $queue["queue_lessthan"]        = "";   
         $queue["announce_round_seconds"]= "";   
-        $queue["retry"]                 = "";
+        $queue["retry"]                 = $this->goFonTimeOut;
         $queue["wrapuptime"]            = "";
         $queue["servicelevel"]          = "";
         $queue["joinempty"]             = "";
@@ -343,7 +356,7 @@ class phonequeue extends plugin
 
         $queue["context"]               = "default";
         $queue["name"]                  = $this->attrs['cn'][0];  
-        $queue["timeout"]               = $this->goFonTimeOut;
+        $queue["timeout"]               = 20; 
         $queue["maxlen"]                = $this->goFonMaxLen;
         $queue["strategy" ]             = $this->goFonStrategy;
         $queue["queue_thankyou"]        = $this->goFonQueueThankYou;   
@@ -504,6 +517,17 @@ class phonequeue extends plugin
       return( sprintf(_("Can't select database %s on %s."),$a_SETUP['DB'],$a_SETUP['SERVER']));
     }
 
+    $tmp = array_flip($this->attributes);
+    foreach(array("goFonDialOption_t","goFonDialOption_T","goFonDialOption_h","goFonDialOption_H") as $val){
+      unset($this->$val);
+      unset($this->attrs[$val]);
+      unset($tmp[$val]);
+    }   
+    foreach(array_flip($tmp) as $key => $val){
+      $tmp2[]=$val;
+    } 
+    $this->attributes = $tmp2;
+
     $i = 0;
     $prio = 11;
 
@@ -522,6 +546,7 @@ class phonequeue extends plugin
     foreach($this->old_phone_numbers as $phone){
       $delete[]= "DELETE FROM ".$a_SETUP['EXT_TABLE']." WHERE exten='".$phone."';\n";
     }
+    $delete[]=    "DELETE FROM ".$a_SETUP['EXT_TABLE']."    WHERE exten='".$this->attrs['cn'][0]."';\n";
     $delete[]=    "DELETE FROM ".$a_SETUP['QUEUE_TABLE']." WHERE name=\"".$this->attrs['cn'][0]."\"; \n";
     $delete[]=    "DELETE FROM ".$a_SETUP['QUEUE_MEMBER_TABLE']." WHERE queue_name=\"".$this->attrs['cn'][0]."\";\n";