当前位置: 首页>>代码示例>>PHP>>正文


PHP AGI_AsteriskManager::command方法代码示例

本文整理汇总了PHP中AGI_AsteriskManager::command方法的典型用法代码示例。如果您正苦于以下问题:PHP AGI_AsteriskManager::command方法的具体用法?PHP AGI_AsteriskManager::command怎么用?PHP AGI_AsteriskManager::command使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AGI_AsteriskManager的用法示例。


在下文中一共展示了AGI_AsteriskManager::command方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: status_asterisk

 /**
  * Método para compactibilidade com código do snep, aqui há uma melhoria
  * nas consultas simples reutilizando socket onde é possível.
  *
  * @param string $comando - Comando a ser executado
  *
  * @param string $quebra - Para retornar somente as linhas que contenham
  * o conteudo dessa variável
  *
  * @param boolean $tudo - Esse parametro não é usado (?!)
  *
  * @return Dados da consulta
  */
 public function status_asterisk($comando, $quebra, $tudo = False)
 {
     if ($comando != "Agents" && $comando != "Status") {
         $cmd = self::$asterisk->command($comando);
         $retorno = $cmd['data'];
         if ($quebra != "") {
             $ret_quebrado = " ";
             foreach (explode("\n", $cmd['data']) as $line) {
                 if (preg_match("/{$quebra}/", $line)) {
                     $ret_quebrado .= $line;
                     break;
                 }
             }
             return $ret_quebrado;
         } else {
             return $cmd['data'];
         }
     } else {
         // Enviando requisição de status
         self::$asterisk->send_request($comando, array());
         // Enviando esse objeto para cuidar dos responses
         self::$asterisk->wait_event($this);
         return $this->return;
     }
 }
开发者ID:rootzig,项目名称:SNEP,代码行数:38,代码来源:AsteriskInfo.php

示例2: elseif

        echo "0";
    } elseif ($editpin == '') {
        echo "0";
    } else {
        echo "1";
        $fname = explode('<', $callerid);
        $cid = $fname[0];
        $dname = explode('"', $cid);
        $name = $dname[1];
        $sql = "INSERT INTO sip_buddies(name,accountcode,secret,callerid,context,mailbox,nat,host,callgroup,pickupgroup,qualify,allow,videosupport,type,permit,deny,transport,dtmfmode,directmedia,encryption) Values('{$extension}','{$account}','{$secret}','{$callerid}','{$context}','{$mailbox}','{$nat}','{$host}','{$callgroup}','{$pickupgroup}','{$qualify}','{$allow}','{$videosupport}','{$type}','{$permit}','{$deny}','{$transport}','{$dtmfmode}','{$directmedia}','{$encryption}')";
        mysql_query($sql) or die(mysql_error());
        $sql1 = "INSERT INTO claves(clave_nombre,user_edit,user_exten) Values('{$name}','{$editpin}','{$mailbox}')";
        mysql_query($sql1) or die(mysql_error());
        $sql2 = "INSERT INTO voicemail_users(customer_id,context,mailbox,password,fullname,email) Values('{$extension}','default','{$mailbox}','{$extension}','{$name}','{$email}')";
        mysql_query($sql2) or die(mysql_error());
        $file = basename("/etc/asterisk/extensions.conf");
        $text = file_get_contents("/etc/asterisk/extensions.conf");
        $text = str_replace(';;last line extensions', 'exten => ' . ${extension} . ',1,GoSub(subSTDExten,internalcall,1(${EXTEN}))\\r;;last line extensions', $text);
        $text = str_replace(';;last line hints', 'exten => ' . ${extension} . ',hint,SIP/' . ${extension} . '\\r;;last line hints', $text);
        file_put_contents('/etc/asterisk/' . $file, $text);
        $asm = new AGI_AsteriskManager();
        if ($asm->connect('localhost', 'admin', 'managerpwd')) {
            $peer = $asm->command("sip reload");
            sleep(1);
            $peer = $asm->command("dialplan reload");
            sleep(1);
        }
        $asm->disconnect();
        exec("sh /etc/asterisk/rn.sh");
    }
}
开发者ID:antirek,项目名称:DM-AsteriskGUI,代码行数:31,代码来源:addsip.php

示例3: header

<?php 
session_start();
if (!(isset($_SESSION['login']) && $_SESSION['login'] != '')) {
    header("Location: ../index.php");
} else {
    require_once '/var/lib/asterisk/agi-bin/phpagi/phpagi-asmanager.php';
    $asm = new AGI_AsteriskManager();
    if ($asm->connect('localhost', 'admin', 'managerpwd')) {
        $peer = $asm->command("iax2 show peers");
        //print_r($peer);
        preg_match('/\\[(.*)/', $peer['data'], $val);
        //print_r($val);
        $online = explode(",", $val[1]);
        $offline = explode(",", $val[1]);
        $offline = explode("Unmonitored", $offline[1]);
        //echo "ONline: ".$online[0];
        //echo "\noffline: ".$offline[0];
    }
    $asm->disconnect();
    $jsondata['regiax'] = $online[0];
    echo json_encode($jsondata);
}
?>


开发者ID:antirek,项目名称:DM-AsteriskGUI,代码行数:23,代码来源:getregiax.php

示例4: deleteExtensions

 function deleteExtensions()
 {
     $astman = new AGI_AsteriskManager();
     if (!$astman->connect("127.0.0.1", 'admin', obtenerClaveAMIAdmin())) {
         $this->errMsg = "Error connect AGI_AsteriskManager";
         return FALSE;
     }
     $exito = TRUE;
     $this->_DB->beginTransaction();
     // Lista de extensiones a borrar
     $sql = "SELECT id FROM devices WHERE tech = 'sip' OR tech = 'iax2'";
     $recordset = $this->_DB->fetchTable($sql);
     if (!is_array($recordset)) {
         $this->errMsg = $this->_DB->errMsg;
         $exito = FALSE;
     }
     $extlist = array();
     foreach ($recordset as $tupla) {
         $extlist[] = $tupla[0];
     }
     unset($recordset);
     foreach ($extlist as $ext) {
         // Borrar propiedades en base de datos de Asterisk
         foreach (array('AMPUSER', 'DEVICE', 'CW', 'CF', 'CFB', 'CFU') as $family) {
             $r = $astman->command("database deltree {$family}/{$ext}");
             if (!isset($r['Response'])) {
                 $r['Response'] = '';
             }
             if (strtoupper($r['Response']) == 'ERROR') {
                 $this->errMsg = _tr('Could not delete the ASTERISK database');
                 $exito = FALSE;
                 break;
             }
         }
         if (!$exito) {
             break;
         }
     }
     if ($exito) {
         foreach (array("DELETE s FROM sip s INNER JOIN devices d ON s.id=d.id and d.tech='sip'", "DELETE i FROM iax i INNER JOIN devices d ON i.id=d.id and d.tech='iax2'", "DELETE u FROM users u INNER JOIN devices d ON u.extension=d.id and (d.tech='sip' or d.tech='iax2')", "DELETE FROM devices WHERE tech='sip' or tech='iax2'") as $sql) {
             if (!$this->_DB->genQuery($sql)) {
                 $this->errMsg = $this->_DB->errMsg;
                 $exito = FALSE;
                 break;
             }
         }
     }
     // Aplicar cambios a la base de datos
     if (!$exito) {
         $this->_DB->rollBack();
         return FALSE;
     }
     $this->_DB->commit();
     $exito = $this->_recargarAsterisk($astman);
     $astman->disconnect();
     return $exito;
 }
开发者ID:netconstructor,项目名称:elastix-mt-gui,代码行数:57,代码来源:paloSantoExtensionsBatch.class.php

示例5: header

<?php

session_start();
if (!(isset($_SESSION['login']) && $_SESSION['login'] != '')) {
    header("Location: ../index.php");
} else {
    $app = $_GET['app'];
    require_once '/var/lib/asterisk/agi-bin/phpagi/phpagi-asmanager.php';
    $asm = new AGI_AsteriskManager();
    if ($asm->connect('localhost', 'admin', 'managerpwd')) {
        $peer = $asm->command("core show application " . $app);
        $test = preg_replace("/Privilege: Command/s", '', $peer['data']);
        $test1 = preg_replace("/\\n/s", '<br>', $test);
        $test2 = preg_replace("/\\[/s", '<b>[', $test1);
        $test3 = preg_replace("/\\]/s", ']</b>', $test2);
        echo $test3;
    }
    $asm->disconnect();
}
开发者ID:antirek,项目名称:DM-AsteriskGUI,代码行数:19,代码来源:astappinfo.php

示例6: header

<?php 
require_once '/var/lib/asterisk/agi-bin/phpagi/phpagi-asmanager.php';
session_start();
if (!(isset($_SESSION['login']) && $_SESSION['login'] != '')) {
    header("Location: ../index.php");
} else {
    $asm = new AGI_AsteriskManager();
    if ($asm->connect('localhost', 'admin', 'managerpwd')) {
        $peer = $asm->command("core show channels");
        preg_match('/(.*) active call/', $peer['data'], $res);
        //print_r($res);
        $calls = explode(" ", $res[0]);
    }
    $asm->disconnect();
    $jsondata['calls'] = $calls[0];
    echo json_encode($jsondata);
}
?>


开发者ID:antirek,项目名称:DM-AsteriskGUI,代码行数:18,代码来源:getcalls.php

示例7: system

            echo "<div style='display:none'>";
        }
        echo "Executing post apply script <b>" . $amp_conf["POST_RELOAD"] . "</b><pre>";
        system($amp_conf["POST_RELOAD"]);
        echo "</pre>";
        if (!isset($amp_conf["POST_RELOAD_DEBUG"]) || $amp_conf["POST_RELOAD_DEBUG"] != "1" && $amp_conf["POST_RELOAD_DEBUG"] != "true") {
            echo "</div><br>";
        }
        echo "\n\t\t\t<script>\n\t\t\t\tfunction hideWaitBanner()\n\t\t\t\t{\n\t\t\t\t\tdocument.getElementById('idWaitBanner').className = 'clsHidden';\n\t\t\t\t}\n\n\t\t\t\tdocument.getElementById('idWaitBanner').innerHTML = 'Configuration applied';\n\t\t\t\tdocument.getElementById('idWaitBanner').className = 'clsWaitFinishOK';\n\t\t\t\tsetTimeout('hideWaitBanner()',3000);\n\t\t\t</script>\n\t\t";
    }
    $amp_conf = parse_amportal_conf("/etc/amportal.conf");
    $hosts = split(',', $amp_conf['MANAGERHOSTS']);
    foreach ($hosts as $host) {
        $astman = new AGI_AsteriskManager();
        if ($res = $astman->connect($host, $amp_conf["AMPMGRUSER"], $amp_conf["AMPMGRPASS"])) {
            $astman->command("reload");
            $astman->disconnect();
        } else {
            echo "<h3>Cannot connect to Asterisk Manager {$host} with " . $amp_conf["AMPMGRUSER"] . "/" . $amp_conf["AMPMGRPASS"] . "</h3>This module requires access to the Asterisk Manager.  Please ensure Asterisk is running and access to the manager is available.</div>";
            exit;
        }
    }
    $wOpBounce = rtrim($_SERVER['SCRIPT_FILENAME'], $currentFile) . 'bounce_op.sh';
    exec($wOpBounce . '>/dev/null');
    $sql = "UPDATE admin SET value = 'false' WHERE variable = 'need_reload'";
    $result = $db->query($sql);
    if (DB::IsError($result)) {
        die($result->getMessage());
    }
    $need_reload[0] = 'false';
}
开发者ID:shinichi85,项目名称:voiperopen,代码行数:31,代码来源:footer.php

示例8: exec

			<div class="row-fluid">
				<div class="box span12">
					<div class="box-header well">
						<h2><i class="icon-info-sign"></i>System Info</h2>
						<div class="box-icon">
							<!--<a href="#" class="btn btn-setting btn-round"><i class="icon-cog"></i></a>-->
							<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
							<a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
						</div>
					</div>
					<div class="box-content">
						<?php 
require_once '/var/lib/asterisk/agi-bin/phpagi/phpagi-asmanager.php';
$asm = new AGI_AsteriskManager();
if ($asm->connect('localhost', 'admin', 'm4nag3rt3ts')) {
    $peer = $asm->command("core show version");
    //print_r($peer);
    $astv = str_replace("Privilege: Command", "", $peer['data']);
} else {
    $astv = "<div class='alert alert-error' align='center'><b>WARNING ASTERISK IS NOT RUNNING</b></div>";
}
$asm->disconnect();
$specs = exec("cat /proc/version");
//$astv=exec("rasterisk | grep -m1 ','");
$os = exec("cat /etc/issue | grep -m1 '('");
echo "<span class='label label-important'>Your server is Running on:</span><h3><small>" . $specs . "</small></h3>\n\t\t\t\t\t\t\t\t<br><span class='label label-important'>Your Operating System is:</span><br><h3><small>" . $os . "</small></h3>\n\t\t\t\t\t\t\t\t<br><span class='label label-important'>And The Asterisk PBX Version is:</span><br><h3><small>" . $astv . "</small></h3>";
?>
						<div class="clearfix"></div>
					</div>
				</div>
			</div>
开发者ID:antirek,项目名称:DM-AsteriskGUI,代码行数:31,代码来源:main.php

示例9: array

?>
						<div id='appsinfo'></div>
						

                	                </div>

					<div class="tab-pane" id="funcs">
						<p>
							View the Help on the Listed Functions				
						</p>

						<?php 
require_once '/var/lib/asterisk/agi-bin/phpagi/phpagi-asmanager.php';
$asm = new AGI_AsteriskManager();
if ($asm->connect('localhost', 'admin', 'm4nag3rt3ts')) {
    $peer = $asm->command("core show functions");
    $data = array();
    echo "<select id='astfunc' name='astfunc' class='text ui-widget-content ui-corner-all'>";
    foreach (explode("\n", $peer['data']) as $line) {
        $func = explode(" ", $line);
        $astfunc = preg_replace("/\\s/", "", $func[0]);
        echo "<option value='" . $astfunc . "'>" . $func[0] . "</option>";
    }
    echo "</select>";
}
$asm->disconnect();
?>
						<div id='funcinfo'></div>


					</div>
开发者ID:antirek,项目名称:DM-AsteriskGUI,代码行数:31,代码来源:dpgen.php

示例10: die

    $secret = $_GET['secret'];
    $callerid = $_GET['callerid'];
    $context = $_GET['context'];
    $mailbox = $_GET['mailbox'];
    $nat = $_GET['nat'];
    $host = $_GET['host'];
    $callgroup = $_GET['callgroup'];
    $pickupgroup = $_GET['pickupgroup'];
    $qualify = $_GET['qualify'];
    $allow = $_GET['allow'];
    $videosupport = $_GET['videosupport'];
    $type = $_GET['type'];
    $account = $_GET['account'];
    $editpin = $_GET['editpin'];
    $permit = $_GET['permit'];
    $deny = $_GET['deny'];
    $transport = $_GET['transport'];
    $dtmfmode = $_GET['dtmfmode'];
    $directmedia = $_GET['directmedia'];
    $encryption = $_GET['encryption'];
    $sql = "UPDATE sip_buddies SET name='{$extension}', accountcode='{$account}', secret='{$secret}', callerid='{$callerid}', context='{$context}', mailbox='{$mailbox}', nat='{$nat}', host='{$host}', callgroup='{$callgroup}', pickupgroup='{$pickupgroup}', qualify='{$qualify}', allow='{$allow}', videosupport='{$videosupport}', type='{$type}', permit='{$permit}',deny='{$deny}',transport='{$transport}',dtmfmode='{$dtmfmode}',directmedia='{$directmedia}',encryption='{$encryption}' WHERE id='{$id}'";
    mysql_query($sql) or die(mysql_error());
    $sql1 = "UPDATE claves set user_edit='{$editpin}' where user_exten='{$extension}'";
    mysql_query($sql1) or die(mysql_error());
    $asm = new AGI_AsteriskManager();
    if ($asm->connect('localhost', 'admin', 'managerpwd')) {
        $peer = $asm->command("sip reload");
        sleep(1);
    }
    $asm->disconnect();
}
开发者ID:antirek,项目名称:DM-AsteriskGUI,代码行数:31,代码来源:editsip.php

示例11: header

<?php

session_start();
if (!(isset($_SESSION['login']) && $_SESSION['login'] != '')) {
    header("Location: ../index.php");
} else {
    $func = $_GET['func'];
    require_once '/var/lib/asterisk/agi-bin/phpagi/phpagi-asmanager.php';
    $asm = new AGI_AsteriskManager();
    if ($asm->connect('localhost', 'admin', 'managerpwd')) {
        $peer = $asm->command("core show function " . $func);
        $test = preg_replace("/Privilege: Command/s", '', $peer['data']);
        $test1 = preg_replace("/\\n/s", '<br>', $test);
        $test2 = preg_replace("/\\[/s", '<b>[', $test1);
        $test3 = preg_replace("/\\]/s", ']</b>', $test2);
        echo $test3;
    }
    $asm->disconnect();
}
开发者ID:antirek,项目名称:DM-AsteriskGUI,代码行数:19,代码来源:astfuncinfo.php

示例12:

 function AMI_Command($command)
 {
     $astman = new AGI_AsteriskManager();
     $return = false;
     if (!$astman->connect("127.0.0.1", 'admin', obtenerClaveAMIAdmin())) {
         $this->errMsg = "Error connect AGI_AsteriskManager";
         $return = false;
     } else {
         $r = $astman->command($command);
         $return = $r["data"];
         $astman->disconnect();
     }
     return $return;
 }
开发者ID:hardikk,项目名称:HNH,代码行数:14,代码来源:paloSantoMyExtension.class.php

示例13: header

<?php

session_start();
if (!(isset($_SESSION['login']) && $_SESSION['login'] != '')) {
    header("Location: ../index.php");
} else {
    include '../include/loginsql.php';
    require_once '/var/lib/asterisk/agi-bin/phpagi/phpagi-asmanager.php';
    $id = $_GET['id'];
    $sql0 = "Select name from sip_buddies Where id='{$id}'";
    $res = mysql_query($sql0) or die(mysql_error());
    $row = mysql_fetch_assoc($res);
    $name = $row['name'];
    $sql1 = "Delete from sip_buddies where id={$id}";
    mysql_query($sql1) or die(mysql_error());
    $sql2 = "Delete from voicemail_users where customer_id={$name}";
    mysql_query($sql2) or die(mysql_error());
    $file = basename("/etc/asterisk/extensions.conf");
    $text = file_get_contents("/etc/asterisk/extensions.conf");
    $text = str_replace('exten => ' . ${name} . ',1,GoSub(subSTDExten,internalcall,1(${EXTEN}))', '', $text);
    $text = str_replace('exten => ' . ${name} . ',hint,SIP/' . ${name} . '', '', $text);
    file_put_contents('/etc/asterisk/' . $file, $text);
    $asm = new AGI_AsteriskManager();
    if ($asm->connect('localhost', 'admin', 'managerpwd')) {
        $dp = $asm->command("dialplan reload");
        sleep(1);
    }
    $asm->disconnect();
}
开发者ID:antirek,项目名称:DM-AsteriskGUI,代码行数:29,代码来源:delsip.php

示例14: processCallWaiting

 function processCallWaiting($callwaiting, $extension)
 {
     $callwaiting = trim(strtolower($callwaiting));
     $astman = new AGI_AsteriskManager();
     if (!$astman->connect("127.0.0.1", 'admin', obtenerClaveAMIAdmin())) {
         $this->errMsg = "Error connect AGI_AsteriskManager";
     }
     if (preg_match("/^enable/", $callwaiting)) {
         $r = $astman->command("database put CW {$extension} \"ENABLED\"");
         return (bool) strstr($r["data"], "success");
     } else {
         $r = $astman->command("database del CW {$extension}");
         return (bool) strstr($r["data"], "removed") || (bool) strstr($r["data"], "not exist");
     }
     $astman->disconnect();
 }
开发者ID:hardikk,项目名称:HNH,代码行数:16,代码来源:paloSantoExtensionsBatch.class.php

示例15: header

<?php 
session_start();
if (!(isset($_SESSION['login']) && $_SESSION['login'] != '')) {
    header("Location: ../index.php");
} else {
    require_once '/var/lib/asterisk/agi-bin/phpagi/phpagi-asmanager.php';
    $asm = new AGI_AsteriskManager();
    if ($asm->connect('localhost', 'admin', 'managerpwd')) {
        $peer = $asm->command("sip show peers");
        //print_r($peer);
        preg_match('/\\[(.*)/', $peer['data'], $val);
        //print_r($val);
        $online = explode(",", $val[1]);
        $offline = explode(",", $val[1]);
        $offline = explode("Unmonitored", $offline[1]);
        echo "ONline: " . $online[0];
        echo "\noffline: " . $offline[0];
    }
    $asm->disconnect();
    $jsondata['offiax'] = $offline[0];
    echo json_encode($jsondata);
}
?>

开发者ID:antirek,项目名称:DM-AsteriskGUI,代码行数:23,代码来源:getoffiax.php


注:本文中的AGI_AsteriskManager::command方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。