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


PHP AGI_AsteriskManager::database_put方法代码示例

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


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

示例1: Aastra_manage_userinfo_Asterisk

function Aastra_manage_userinfo_Asterisk($user, $action, $array = NULL)
{
    # Translate user if needed
    $user = Aastra_get_userdevice_Asterisk($user);
    # Connect to AGI
    $as = new AGI_AsteriskManager();
    $res = $as->connect();
    # Process action
    switch ($action) {
        # Read database
        case 'get':
            # No answer
            $return = array();
            # Cell Phone
            $get = $as->database_get('AMPUSER', $user . '/info/cell');
            if ($get) {
                $return['cell'] = $get;
            }
            # Home phone
            $get = $as->database_get('AMPUSER', $user . '/info/home');
            if ($get) {
                $return['home'] = $get;
            }
            # Other phone
            $get = $as->database_get('AMPUSER', $user . '/info/other');
            if ($get) {
                $return['other'] = $get;
            }
            break;
            # Set values
        # Set values
        case 'set':
            # Cell phone
            if ($array['cell']) {
                $res = $as->database_put('AMPUSER', $user . '/info/cell', $array['cell']);
            } else {
                $res = $as->database_del('AMPUSER', $user . '/info/cell');
            }
            # Home phone
            if ($array['home']) {
                $res = $as->database_put('AMPUSER', $user . '/info/home', $array['home']);
            } else {
                $res = $as->database_del('AMPUSER', $user . '/info/home');
            }
            # Cell phone
            if ($array['other']) {
                $res = $as->database_put('AMPUSER', $user . '/info/other', $array['other']);
            } else {
                $res = $as->database_del('AMPUSER', $user . '/info/other');
            }
            # Return
            $return = $array;
            break;
    }
    # Disconnect properly
    $as->disconnect();
    # Return
    return $return;
}
开发者ID:jamesrusso,项目名称:Aastra_Scripts,代码行数:59,代码来源:AastraAsterisk.php

示例2: foreach

$userresults = $db->getAll($sql, DB_FETCHMODE_ASSOC);
if (DB::IsError($userresults)) {
    $userresults = null;
}
$sql = "SELECT * FROM devices";
$devresults = $db->getAll($sql, DB_FETCHMODE_ASSOC);
if (DB::IsError($devresults)) {
    $devresults = null;
}
//add details to astdb
$astman = new AGI_AsteriskManager();
if ($res = $astman->connect("127.0.0.1", $amp_conf["AMPMGRUSER"], $amp_conf["AMPMGRPASS"])) {
    $astman->database_deltree("AMPUSER");
    foreach ($userresults as $usr) {
        extract($usr);
        $astman->database_put("AMPUSER", $extension . "/password", $password);
        $astman->database_put("AMPUSER", $extension . "/ringtimer", $ringtimer);
        $astman->database_put("AMPUSER", $extension . "/noanswer", $noasnwer);
        $astman->database_put("AMPUSER", $extension . "/recording", $recording);
        $astman->database_put("AMPUSER", $extension . "/outboundcid", "\"" . $outboundcid . "\"");
        $astman->database_put("AMPUSER", $extension . "/cidname", "\"" . $name . "\"");
    }
    $astman->database_deltree("DEVICE");
    foreach ($devresults as $dev) {
        extract($dev);
        $astman->database_put("DEVICE", $id . "/dial", $dial);
        $astman->database_put("DEVICE", $id . "/type", $devicetype);
        $astman->database_put("DEVICE", $id . "/user", $user);
        $astman->database_put("AMPUSER", $user . "/device", $id);
        //voicemail symlink
        exec("rm -f /var/spool/asterisk/voicemail/device/" . $id);
开发者ID:powerpbx,项目名称:framework,代码行数:31,代码来源:default_devices_users.php

示例3: substr

                            }
                        }
                        $sql = "UPDATE zap SET data = '" . $extension . "@device' WHERE id = '" . $extension . "' AND keyword = 'mailbox' LIMIT 1";
                        $resu = $db->query($sql);
                    }
                }
            }
            $name = substr($name, 0, strcspn($name, '<'));
            $name = rtrim($name, "\" ");
            $name = ltrim($name, "\" ");
            $recording = "out=" . $record_out . "|in=" . $record_in;
            $sql = "INSERT INTO users (extension,password,name,voicemail,ringtimer,noanswer,recording,outboundcid) values (\"{$extension}\",\"\",\"{$name}\",\"\",\"15\",\"\",\"{$recording}\",\"{$outboundcid}\")";
            $insertresults = $db->query($sql);
            if (DB::IsError($insertresult)) {
                die($insertresults->getMessage());
            }
            out("Creating a device for existing extension " . $extension);
            $sql = "INSERT INTO devices (id,tech,dial,devicetype,user,description) values (\"{$extension}\",\"{$tech}\",\"{$dial}\",\"fixed\",\"{$extension}\",\"{$name}\")";
            $insertresults = $db->query($sql);
            if (DB::IsError($insertresult)) {
                die($insertresults->getMessage());
            }
            out("Mapping user " . $extension . " to device " . $extension);
            $astman->database_put("AMPUSER", $extension . "/device", "\"" . $extension . "\"");
            $astman->database_put("DEVICE", $extension . "/user", "\"" . $extension . "\"");
        }
    }
} else {
    fatal("Cannot connect to Asterisk Manager with " . $amp_conf["AMPMGRUSER"] . "/" . $amp_conf["AMPMGRPASS"]);
}
out("..OK");
开发者ID:powerpbx,项目名称:framework,代码行数:31,代码来源:upgrade_devices_users.php

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


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