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


PHP AGI_AsteriskManager::database_get方法代码示例

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


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

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

示例2: Aastra_get_bulk_callerid_Asterisk

function Aastra_get_bulk_callerid_Asterisk($array)
{
    global $ASTERISK_LOCATION;
    global $AA_FREEPBX_MODE;
    global $language;
    # Try in the config file first
    $sip_array = Aastra_readINIfile($ASTERISK_LOCATION . 'sip_additional.conf', ';', '=');
    # Connect to AGI
    $as = new AGI_AsteriskManager();
    $res = $as->connect();
    # Process all the extensions
    foreach ($array as $key => $value) {
        # No name by default
        $name = '';
        # Extension exists?
        if ($sip_array[$value['number']] == NULL) {
            if ($AA_FREEPBX_MODE == '1') {
                $name = Aastra_get_label('Unknown', $language);
            }
        } else {
            # FreePBX old school
            if (!strstr($sip_array[$value['number']]['callerid'], 'device')) {
                # Retrieve the value
                $temp = explode(" <", $sip_array[$value['number']]['callerid'], 2);
                $number = $temp[0];
            }
        }
        # Still not found
        if ($name == '') {
            # Get value in the database
            $name = $as->database_get('AMPUSER', $value['number'] . '/cidname');
        }
        # Complete caller ID
        $array[$key]['name'] = $name;
    }
    # Disconnect properly
    $as->disconnect();
    # Return Caller ID
    return $array;
}
开发者ID:jamesrusso,项目名称:Aastra_Scripts,代码行数:40,代码来源:AastraAsterisk.php

示例3: setrobstatus

function setrobstatus($account, $incomingvalue, $mode)
{
    require_once 'common/php-asmanager.php';
    $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"])) {
            if ($mode == "write") {
                if ($incomingvalue == "Never") {
                    $astman->database_del("ROBCHECK", $account);
                }
                if ($incomingvalue == "Always") {
                    $astman->database_put("ROBCHECK", $account, "ENABLED");
                }
                $robstatus = null;
            }
            if ($mode == "read") {
                $existrobstatus = $astman->database_get("ROBCHECK", $account);
                if ($existrobstatus) {
                    $robstatus = "Always";
                } else {
                    $robstatus = "Never";
                }
            }
            $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;
        }
    }
    return $robstatus;
}
开发者ID:shinichi85,项目名称:voiperopen,代码行数:33,代码来源:functions.php

示例4: get_agent_status

function get_agent_status($queue, $agent)
{
    global $queue_members;
    $queue_members = '';
    # Transcode for device and user mode
    $agent = Aastra_get_userdevice_Asterisk($agent);
    # Connect to AGI
    $asm = new AGI_AsteriskManager();
    $asm->connect();
    # Add event handlers to retrieve the answer
    $asm->add_event_handler('queuestatuscomplete', 'asm_event_queues');
    $asm->add_event_handler('queuemember', 'asm_event_agents');
    # Retrieve info
    $count = 0;
    while (!$queue_members) {
        $asm->QueueStatus();
        $count++;
        if ($count == 10) {
            break;
        }
    }
    # Process info
    if ($queue != '') {
        # 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['CallsTaken'] = $agent_a['CallsTaken'];
                $status['LastCall'] = $agent_a['LastCall'];
                break;
            }
        }
        # Get agent type
        $db = Aastra_connect_freePBX_db_Asterisk();
        $sql = "SELECT id FROM queues_details WHERE data LIKE 'Local/" . $agent . "@%' AND id=" . $queue;
        $result = $db->query($sql);
        if (sizeof($result->fetchRow(DB_FETCHMODE_ARRAY)) > 0) {
            $status['Type'] = 'static';
        } else {
            $status['Type'] = 'dynamic';
        }
        # Get Penalty
        $penalty = $asm->database_get('QPENALTY', $queue . '/agents/' . $agent);
        if ($penalty == '') {
            $penalty = '0';
        }
        $status['Penalty'] = $penalty;
    } else {
        # Get info for all the queues for the agent
        foreach ($queue_members as $agent_a) {
            # Dynamic agents are using from-queue context, static agents are using from-internal
            if ($agent_a['Location'] == 'Local/' . $agent . '@from-queue/n' or $agent_a['Location'] == 'Local/' . $agent . '@from-internal/n') {
                $status[$agent_a['Queue']]['Status'] = 1;
                if ($agent_a['Paused'] == '1') {
                    $status[$agent_a['Queue']]['Status'] = 2;
                }
                $status[$agent_a['Queue']]['Membership'] = $agent_a['Membership'];
            }
        }
    }
    # Disconnect properly
    $asm->disconnect();
    # Return Status
    return $status;
}
开发者ID:jamesrusso,项目名称:Aastra_Scripts,代码行数:70,代码来源:agent.php


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