Code

Added option to select asterisk extensions delimiter
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 4 May 2012 16:02:05 +0000 (16:02 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 4 May 2012 16:02:05 +0000 (16:02 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6@21146 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/gofon/gofon/phoneaccount/class_phoneAccount.inc

index 703fba380c34f3a62812e88314cfc9e5c171cd8c..b4f4dede09b12f06af36c6ecc8284ccfe41e9470 100644 (file)
@@ -7,6 +7,8 @@ class phoneAccount extends plugin
   var $plDescription= "This does something";
   var $plIcon       = "plugins/gofon/images/phoneAccount.png";
 
+  var $delimiter = "|";
+
   /* Attributes */
   var $telephoneNumber        = array();
   var $goFonHardware          = "automatic";
@@ -57,6 +59,8 @@ class phoneAccount extends plugin
   {
     plugin::plugin ($config, $dn, $parent);
 
+    $this->delimiter = $config->get_cfg_value("asteriskParameterDelimiter","|");
+
     /* Assemble phone numbers */
     if (isset($this->attrs['telephoneNumber'])){
       for ($i= 0; $i<$this->attrs['telephoneNumber']['count']; $i++){
@@ -926,9 +930,9 @@ class phoneAccount extends plugin
       // Get selected Macro Parameter and create parameter entry 
       if(isset($this->macroarray[$this->macro])){
         foreach($this->macroarray[$this->macro] as $key => $val ){
-          $s_parameter .= $val['choosen']."|";
+          $s_parameter .= $val['choosen'].$this->delimiter;
         }
-        $s_parameter = preg_replace("/\|$/","",$s_parameter);
+        $s_parameter = rtrim($s_parameter, $this->delimiter);
       }
 
       $i = 0; 
@@ -938,7 +942,7 @@ class phoneAccount extends plugin
         $EXT[$i]['exten']   = $this->uid;
         $EXT[$i]['priority']= 1;
         $EXT[$i]['app']     = "Goto";
-        $EXT[$i]['appdata'] = $newnums[$i_new_key]."|1";
+        $EXT[$i]['appdata'] = $newnums[$i_new_key].$this->delimiter."1";
         $i ++;
       }
 
@@ -964,10 +968,10 @@ class phoneAccount extends plugin
           $macroname = preg_replace("/,.*$/","",$this->macro);        
           $macroname = preg_replace("/^.*=/","",$macroname);        
           $s_app = "Macro";$macroname;
-          $s_par = $macroname."|".$s_parameter; 
+          $s_par = $macroname.$this->delimiter.$s_parameter; 
         }else{
           $s_app = "Dial";
-          $s_par = 'SIP/'.$this->uid."|20|r";
+          $s_par = 'SIP/'.$this->uid.$this->delimiter."20".$this->delimiter."r";
         }
 
         $EXT[$i]['context'] = 'GOsa';