function ast_status($comando, $quebra, $tudo = False) { require_once "AsteriskInfo.php"; $astinfo = new AsteriskInfo(); return $astinfo->status_asterisk($comando, $quebra, $tudo); }
protected function ramalInfo($ramal) { if ($ramal['tec'] == 'SIP') { $astinfo = new AsteriskInfo(); $info = $astinfo->status_asterisk("sip show peer {$ramal['num']}", "", True); $return = null; $return = array(); if (preg_match("/(\\d+)/", $info, $matches)) { $return['ramal'] = $matches[0]; } else { $return['ramal'] = $this->view->translate('Undefined'); } $return['tipo'] = 'SIP'; $tmp = substr($info, strpos($info, 'Addr->IP'), +35); if (preg_match("#[0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}# ", $tmp, $matches)) { $return['ip'] = $matches[0]; } else { $return['ip'] = $this->view->translate('Undefined'); } $tmp = substr($info, strpos($info, 'Status'), +40); if (preg_match("#\\((.*?)\\)#", $tmp, $matches)) { $return['delay'] = $matches[0]; } else { $return['delay'] = '---'; } $tmp = substr($info, strpos($info, 'Codecs'), +50); if (preg_match("#\\((.*?)\\)#", $tmp, $matches)) { $return['codec'] = $matches[0]; $return['codec'] = str_replace(")", "", $return['codec']); $return['codec'] = str_replace("(", "", $return['codec']); $return['codec'] = str_replace("|", ", ", $return['codec']); } else { $return['codec'] = '---'; } return $return; } }