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


PHP AGI_AsteriskManager类代码示例

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


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

示例1: AsteriskManagerAPI

 function AsteriskManagerAPI($action, $parameters, $return_data = false)
 {
     global $arrLang;
     $astman_host = "127.0.0.1";
     $astman_user = 'admin';
     $astman_pwrd = obtenerClaveAMIAdmin();
     $astman = new AGI_AsteriskManager();
     $astman->pagi = new dummy_pagi();
     if (!$astman->connect("{$astman_host}", "{$astman_user}", "{$astman_pwrd}")) {
         $this->errMsg = _tr("Error when connecting to Asterisk Manager");
     } else {
         $salida = $astman->send_request($action, $parameters);
         $astman->disconnect();
         if (strtoupper($salida["Response"]) != "ERROR") {
             if ($return_data) {
                 return $salida;
             } else {
                 return explode("\n", $salida["Response"]);
             }
         } else {
             return false;
         }
     }
     return false;
 }
开发者ID:hardikk,项目名称:HNH,代码行数:25,代码来源:paloSantoControlPanel.class.php

示例2: getInstance

 /**
  * Get the instance
  *
  * @throws OSS_Asterisk_AMI_ConnectionException
  * @return AGI_AsteriskManager
  */
 public function getInstance()
 {
     if ($this->_instance === null) {
         $conf = $this->getOptions();
         if (!class_exists('AGI_AsteriskManager')) {
             require_once 'phpagi-asmanager.php';
         }
         $this->_instance = new AGI_AsteriskManager();
         if (!$this->_instance->connect($conf["host"], $conf["username"], $conf["secret"])) {
             throw new OSS_Asterisk_AMI_ConnectionException('Could not connect to the Asterisk server ' . $conf['host']);
         }
     }
     return $this->_instance;
 }
开发者ID:opensolutions,项目名称:oss-framework,代码行数:20,代码来源:AsteriskMI.php

示例3: AsteriskManager_Originate

 function AsteriskManager_Originate($host, $user, $password, $command_data)
 {
     global $arrLang;
     $astman = new AGI_AsteriskManager();
     if (!$astman->connect("{$host}", "{$user}", "{$password}")) {
         $this->errMsg = $arrLang["Error when connecting to Asterisk Manager"];
     } else {
         $parameters = $this->Originate($command_data['origen'], $command_data['destino'], $command_data['channel'], $command_data['description']);
         $salida = $astman->send_request('Originate', $parameters);
         $astman->disconnect();
         if (strtoupper($salida["Response"]) != "ERROR") {
             return explode("\n", $salida["Response"]);
         } else {
             return false;
         }
     }
     return false;
 }
开发者ID:hardikk,项目名称:HNH,代码行数:18,代码来源:paloSantoRecordings.class.php

示例4: callback_engine

function callback_engine(&$A2B, $server, $username, $secret, $AmiVars, $destination, $tariff) {

    $A2B -> cardnumber = $AmiVars[4];

    if ($A2B -> callingcard_ivr_authenticate_light ($error_msg))
    {
	$RateEngine = new RateEngine();
	$RateEngine -> webui = 0;

//	LOOKUP RATE : FIND A RATE FOR THIS DESTINATION
	$A2B -> agiconfig['accountcode'] = $A2B -> cardnumber;
	$A2B -> agiconfig['use_dnid'] = 1;
	$A2B -> agiconfig['say_timetocall'] = 0;
	$A2B -> extension = $A2B -> dnid = $A2B -> destination = $destination;

	$resfindrate = $RateEngine->rate_engine_findrates($A2B, $destination, $tariff);

//	IF FIND RATE
	if ($resfindrate!=0)
	{
	    $res_all_calcultimeout = $RateEngine->rate_engine_all_calcultimeout($A2B, $A2B->credit);
	    if ($res_all_calcultimeout)
	    {
		$ast = new AGI_AsteriskManager();
		$res = $ast -> connect($server, $username, $secret);
		if (!$res) return -4;
//		MAKE THE CALL
		$res = $RateEngine->rate_engine_performcall(false, $destination, $A2B, 8, $AmiVars, $ast);
		$ast -> disconnect();
		if ($res !== false) return $res;
		else return -2; // not enough free trunk for make call
	    }
	    else return -3; // not have enough credit to call you back
	}
	else return -1; // no route to call back your phonenumber
    }
    else return -1; // ERROR MESSAGE IS CONFIGURE BY THE callingcard_ivr_authenticate_light
}
开发者ID:nixonch,项目名称:a2billing,代码行数:38,代码来源:callback_daemon.php

示例5: get_agent_status

function get_agent_status($queue, $agent)
{
    global $queue_members;
    # Connect to AGI
    $asm = new AGI_AsteriskManager();
    $asm->connect();
    # Add event handlers to retrieve the answer
    $asm->add_event_handler('queuestatuscomplete', 'Aastra_asm_event_queues_Asterisk');
    $asm->add_event_handler('queuemember', 'Aastra_asm_event_agents_Asterisk');
    # Retrieve info
    while (!$queue_members) {
        $asm->QueueStatus();
        $count++;
        if ($count == 10) {
            break;
        }
    }
    # Get info for the given queue
    $status['Logged'] = False;
    $status['Paused'] = False;
    foreach ($queue_members as $agent_a) {
        if ($agent_a['Queue'] == $queue && $agent_a['Location'] == 'Local/' . $agent . '@from-queue/n' or $agent_a['Queue'] == $queue && $agent_a['Location'] == 'Local/' . $agent . '@from-internal/n') {
            $status['Logged'] = True;
            if ($agent_a['Paused'] == '1') {
                $status['Paused'] = True;
            }
            $status['Type'] = $agent_a['Membership'];
            $status['CallsTaken'] = $agent_a['CallsTaken'];
            $status['LastCall'] = $agent_a['LastCall'];
            break;
        }
        # Get Penalty
        $penalty = $asm->database_get('QPENALTY', $queue . '/agents/' . $agent);
        if ($penalty == '') {
            $penalty = '0';
        }
        $status['Penalty'] = $penalty;
    }
    # Disconnect properly
    $asm->disconnect();
    # Return Status
    return $status;
}
开发者ID:jamesrusso,项目名称:Aastra_Scripts,代码行数:43,代码来源:queues.php

示例6: set_language

//
$bootstrap_settings['amportal_conf_initialized'] = false;
$amp_conf =& $freepbx_conf->parse_amportal_conf("/etc/amportal.conf", $amp_conf);
// set the language so local module languages take
set_language();
$asterisk_conf =& $freepbx_conf->get_asterisk_conf();
$bootstrap_settings['amportal_conf_initialized'] = true;
//connect to cdrdb if requestes
if ($bootstrap_settings['cdrdb']) {
    $dsn = array('phptype' => $amp_conf['CDRDBTYPE'] ? $amp_conf['CDRDBTYPE'] : $amp_conf['AMPDBENGINE'], 'hostspec' => $amp_conf['CDRDBHOST'] ? $amp_conf['CDRDBHOST'] : $amp_conf['AMPDBHOST'], 'username' => $amp_conf['CDRDBUSER'] ? $amp_conf['CDRDBUSER'] : $amp_conf['AMPDBUSER'], 'password' => $amp_conf['CDRDBPASS'] ? $amp_conf['CDRDBPASS'] : $amp_conf['AMPDBPASS'], 'port' => $amp_conf['CDRDBPORT'] ? $amp_conf['CDRDBPORT'] : '3306', 'database' => $amp_conf['CDRDBNAME'] ? $amp_conf['CDRDBNAME'] : 'asteriskcdrdb');
    $cdrdb = DB::connect($dsn);
}
$bootstrap_settings['astman_connected'] = false;
if (!$bootstrap_settings['skip_astman']) {
    require_once $dirname . '/libraries/php-asmanager.php';
    $astman = new AGI_AsteriskManager($bootstrap_settings['astman_config'], $bootstrap_settings['astman_options']);
    // attempt to connect to asterisk manager proxy
    if (!$amp_conf["ASTMANAGERPROXYPORT"] || !($res = $astman->connect($amp_conf["ASTMANAGERHOST"] . ":" . $amp_conf["ASTMANAGERPROXYPORT"], $amp_conf["AMPMGRUSER"], $amp_conf["AMPMGRPASS"], $bootstrap_settings['astman_events']))) {
        // attempt to connect directly to asterisk, if no proxy or if proxy failed
        if (!($res = $astman->connect($amp_conf["ASTMANAGERHOST"] . ":" . $amp_conf["ASTMANAGERPORT"], $amp_conf["AMPMGRUSER"], $amp_conf["AMPMGRPASS"], $bootstrap_settings['astman_events']))) {
            // couldn't connect at all
            unset($astman);
            freepbx_log(FPBX_LOG_CRITICAL, "Connection attmempt to AMI failed");
        } else {
            $bootstrap_settings['astman_connected'] = true;
        }
    }
} else {
    $bootstrap_settings['astman_connected'] = true;
}
//Because BMO was moved upward we have to inject this lower
开发者ID:ntadmin,项目名称:framework,代码行数:31,代码来源:bootstrap.php

示例7: 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

示例8: 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

示例9: unset

<?php

require_once 'lib/Smarty.class.php';
require_once 'lib/smarty-gettext.php';
require_once "lib/php-asmanager.php";
require_once "lib/functions.inc.php";
require_once "config.php";
unset($AgentAccount);
session_start();
$smarty = new Smarty();
$smarty->register->block('t', 'smarty_translate');
$ami = new AGI_AsteriskManager();
$res = $ami->connect($ami_host, $ami_user, $ami_secret);
ini_set('display_errors', 'no');
ini_set('register_globals', 'yes');
ini_set('short_open_tag', 'yes');
$AgentsEntry = array();
$QueueParams = array();
$QueueMember = array();
$QueueEntry = array();
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
if ($_REQUEST['button'] == 'Submit') {
    $out = "<pre>" . shell_exec('/usr/sbin/asterisk -rx "show queues"') . "</pre>";
    echo $out;
}
/*
Перед началом работы агент регистрируется, воодя свой номер и пинкод
开发者ID:Open-Source-GIS,项目名称:lynks-ajax-panel,代码行数:31,代码来源:extensions-realtime.php

示例10: getpost_ifset

**/
include '../lib/agent.defines.php';
include '../lib/agent.module.access.php';
include '../lib/regular_express.inc';
include '../lib/phpagi/phpagi-asmanager.php';
include '../lib/agent.smarty.php';
$FG_DEBUG = 0;
getpost_ifset(array('action', 'atmenu'));
if (!has_rights(ACX_CUSTOMER)) {
    Header("HTTP/1.0 401 Unauthorized");
    Header("Location: PP_error.php?c=accessdenied");
    die;
}
$DBHandle = DbConnect();
if ($action == "reload") {
    $as = new AGI_AsteriskManager();
    // && CONNECTING  connect($server=NULL, $username=NULL, $secret=NULL)
    $res = $as->connect(MANAGER_HOST, MANAGER_USERNAME, MANAGER_SECRET);
    if ($res) {
        if ($atmenu == "sipfriend") {
            $res = $as->Command('sip reload');
        } else {
            $res = $as->Command('iax2 reload');
        }
        $actiondone = 1;
        // && DISCONNECTING
        $as->disconnect();
    } else {
        $error_msg = "</br><center><b><font color=red>" . gettext("Cannot connect to the asterisk manager!<br>Please check your manager configuration.") . "</font></b></center>";
    }
} else {
开发者ID:pearlvoip,项目名称:a2billing,代码行数:31,代码来源:CC_generate_friend_file.php

示例11: AGI_AsteriskManager

<?php

require_once '../admin/libraries/php-asmanager.php';
$astman = new AGI_AsteriskManager();
// attempt to connect to asterisk manager proxy
if (!($res = $astman->connect('127.0.0.1:5038', 'username', 'password', 'off'))) {
    // couldn't connect at all
    unset($astman);
    $_SESSION['ari_error'] = _("ARI does not appear to have access to the Asterisk Manager.") . " ({$errno})<br>" . _("Check the ARI 'main.conf.php' configuration file to set the Asterisk Manager Account.") . "<br>" . _("Check /etc/asterisk/manager.conf for a proper Asterisk Manager Account") . "<br>" . _("make sure [general] enabled = yes and a 'permit=' line for localhost or the webserver.");
}
$extensions = array(8250, 8298, 12076605342, 12075052482, 12074162828, 12074781320);
foreach ($extensions as $ext) {
    $inputs = array('Channel' => 'local/' . $ext . '@from-internal', 'Exten' => $ext, 'Context' => 'from-internal', 'Priority' => '1', 'Timeout' => NULL, 'CallerID' => 'OMG', 'Variable' => '', 'Account' => NULL, 'Application' => 'playback', 'Data' => 'hello-world', 'Async' => 1);
    /* Arguments to Originate: channel, extension, context, priority, timeout, callerid, variable, account, application, data */
    $status = $astman->Originate($inputs);
    var_dump($status);
}
开发者ID:bangordailynews,项目名称:FreePBX,代码行数:17,代码来源:callme.php

示例12: define

define('DEBUG_CONF', 1);
$host = A2Billing::instance()->set_def_conf($manager_section, 'host', 'localhost');
$uname = A2Billing::instance()->set_def_conf($manager_section, 'username', 'a2billing');
$password = A2Billing::instance()->set_def_conf($manager_section, 'secret', '');
if ($verbose > 2) {
    echo "Starting manager-eventd.\n";
}
$num_tries = 0;
while ($num_tries < 10) {
    $num_tries++;
    $dbh = A2Billing::DBHandle();
    if (!$dbh) {
        echo "Cannot connect to database, exiting..";
        break;
    }
    $as = new AGI_AsteriskManager();
    if ($verbose < 2) {
        $as->nolog = true;
    } else {
        if ($verbose > 3) {
            $as->debug = true;
        }
    }
    // && CONNECTING  connect($server=NULL, $username=NULL, $secret=NULL)
    $res = $as->connect($host, $uname, $password);
    if (!$res) {
        echo str_params(_("Cannot connect to asterisk manager @%1. Please check manager configuration...\n"), array($host), 1);
        sleep(60);
        continue;
    }
    if ($verbose > 2) {
开发者ID:sayemk,项目名称:a2billing,代码行数:31,代码来源:manager-eventd.php

示例13: Aastra_send_userevent_Asterisk

function Aastra_send_userevent_Asterisk($event, $data, $asm = NULL)
{
    # Connect to AGI if needed
    if ($asm == NULL) {
        $as = new AGI_AsteriskManager();
        $res = $as->connect();
    } else {
        $as = $asm;
    }
    # Send request
    $res = $as->UserEvent($event, $data);
    # Disconnect properly
    if ($asm == NULL) {
        $as->disconnect();
    }
}
开发者ID:jamesrusso,项目名称:Aastra_Scripts,代码行数:16,代码来源:AastraAsterisk.php

示例14: get_param

    //if(strlen($b)==6){
    //	$b='78452'.$b;
    //}
    $context = get_param($a);
    $manager->Originate('SIP/' . $a, $b, $context, '1', '', '', '20000', 'SIP/' . $b, 'tTr', '', 'Async', '');
    $manager->disconnect();
}
if (isset($_GET['spy']) and isset($_GET['a']) and isset($_GET['b']) and isset($_GET['type'])) {
    print_r($_GET);
    $a = $_GET['a'];
    $b = $_GET['b'];
    echo $type = $_GET['type'];
    //$a= номер экстеншна
    //$b= канал который будем слушать
    include 'phpagi/phpagi.php';
    $manager = new AGI_AsteriskManager();
    $manager->connect();
    //if(strlen($b)==6){
    //	$b='78452'.$b;
    //}
    //$context=get_param($a);
    /*
    	$manager->Originate(
    'SIP/'.$a,
    '',
    '',
    '1',
    'ChanSpy',
    $b.',qx',
    '',
    '',
开发者ID:vovax3m,项目名称:serverside,代码行数:31,代码来源:call.php

示例15: Header

include '../lib/phpagi/phpagi-asmanager.php';
include '../lib/admin.smarty.php';
if (!has_rights(ACX_MAINTENANCE)) {
    Header("HTTP/1.0 401 Unauthorized");
    Header("Location: PP_error.php?c=accessdenied");
    die;
}
check_demo_mode_intro();
// #### HEADER SECTION
$smarty->display('main.tpl');
?>
<br>
<center>

<?php 
$astman = new AGI_AsteriskManager();
$res = $astman->connect(MANAGER_HOST, MANAGER_USERNAME, MANAGER_SECRET);
/* $Id: page.parking.php 2243 2006-08-12 17:13:17Z p_lindheimer $ */
//Copyright (C) 2006 Astrogen LLC
//
//This program is free software; you can redistribute it and/or
//modify it under the terms of the GNU General Public License
//as published by the Free Software Foundation; either version 2
//of the License, or (at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.
$dispnum = 'asteriskinfo';
//used for switch on config.php
开发者ID:saydulk,项目名称:a2billing,代码行数:31,代码来源:A2B_asteriskinfo.php


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