Ticket #3562: functions.inc.php.queue.diff

File functions.inc.php.queue.diff, 1.2 kB (added by francesco_r, 3 years ago)
  • functions.inc.php

    old new  
    3434 
    3535  function generate_queues_additional($ast_version) { 
    3636 
     37    global $amp_conf; 
     38    global $astman; 
     39    global $chan_dahdi; 
    3740    global $db; 
    3841 
    3942    $additional = ""; 
     
    115118      // Now pull out all the memebers, one line for each 
    116119      // 
    117120      foreach ($members as $member) { 
    118         $output .= "member=".$member."\n"; 
     121        if ($amp_conf['QUEUESTATEINTERFACE'] == 'true') { 
     122          if ($astman != null) { 
     123            $local_exten = preg_replace("/[^0-9#\,*]/", "", $member); 
     124            $user = substr($local_exten, 0, -2); 
     125            $true_device = $astman->database_get("AMPUSER",$user."/device"); 
     126            $state_interface = $astman->database_get("DEVICE",$true_device."/dial"); 
     127            if ($chan_dahdi && substr($state_interface, 0, 4) === 'ZAP/') { 
     128              $state_interface = 'DAHDI/' . substr($state_interface, 4); 
     129            } 
     130            $output .= "member=".$member.",,".$state_interface."\n"; 
     131          } else { 
     132            die_freepbx("No open connection to asterisk manager, can not access object."); 
     133          } 
     134        } else { 
     135          $output .= "member=".$member."\n"; 
     136        } 
    119137      } 
    120138      $output .= $additional."\n"; 
    121139    }