Пример #1
0
 function checkPeerStatus($groupid, $peers)
 {
     global $config;
     $curChans =& astercc::getCurChan($groupid);
     #print_r($curChans);exit;
     $status = array();
     while ($curChans->fetchInto($list)) {
         //print_r($list);exit;
         // 检查src或者dst是否在peers里
         if ($_SESSION['curuser']['billingfield'] == 'accountcode') {
             if (astercc::array_exist($list['accountcode'], $peers)) {
                 $status[$list['accountcode']] = $list;
                 $status[$list['accountcode']]['direction'] = 'outbound';
             }
         } else {
             if (astercc::array_exist($list['src'], $peers) || astercc::array_exist($list['dst'], $peers)) {
                 $status[$list['src']] = $list;
                 $status[$list['src']]['direction'] = 'outbound';
             } else {
                 // 使用srcchan作为src
                 if (ereg("\\/(.*)-", $list['srcchan'], $myAry)) {
                     $status[$myAry[1]] = $list;
                     $status[$myAry[1]]['direction'] = 'outbound';
                 }
             }
         }
         $status[$list['dst']] = $list;
         $status[$list['dst']]['direction'] = 'inbound';
     }
     return $status;
 }