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


PHP FreePBX::Findmefollow方法代码示例

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


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

示例1: findmefollow_get_config

function findmefollow_get_config($engine)
{
    global $ext;
    // is this the best way to pass this?
    global $amp_conf;
    global $astman;
    switch ($engine) {
        case "asterisk":
            if ($amp_conf['USEDEVSTATE']) {
                $ext->addGlobal('FMDEVSTATE', 'TRUE');
            }
            $fcc = new featurecode('findmefollow', 'fmf_toggle');
            $fmf_code = $fcc->getCodeActive();
            unset($fcc);
            if ($fmf_code != '') {
                findmefollow_fmf_toggle($fmf_code);
            }
            $ext->addInclude('from-internal-additional', 'ext-findmefollow');
            $ext->addInclude('from-internal-additional', 'fmgrps');
            $contextname = 'ext-findmefollow';
            $grpcontextname = 'fmgrps';
            // Before creating all the contexts, let's make a list of hints if needed
            //
            if ($amp_conf['USEDEVSTATE'] && $fmf_code != '') {
                $ext->add($contextname, "_" . $fmf_code . 'X.', '', new ext_goto("1", $fmf_code, "app-fmf-toggle"));
                $ext->addHint($contextname, "_" . $fmf_code . 'X.', "Custom:FOLLOWME" . '${EXTEN:' . strlen($fmf_code) . '}');
            }
            $groups = FreePBX::Findmefollow()->getAllFollowmes();
            $dial_options = FreePBX::Config()->get("DIAL_OPTIONS");
            foreach ($groups as $grp) {
                $grpnum = $grp['grpnum'];
                $strategy = $grp['strategy'];
                $grptime = $grp['grptime'];
                $grplist = $grp['grplist'];
                $postdest = $grp['postdest'];
                $grppre = isset($grp['grppre']) ? $grp['grppre'] : '';
                $annmsg_id = $grp['annmsg_id'];
                $dring = $grp['dring'];
                $needsconf = $grp['needsconf'];
                $remotealert_id = $grp['remotealert_id'];
                $toolate_id = $grp['toolate_id'];
                $ringing = $grp['ringing'];
                $pre_ring = $grp['pre_ring'];
                $astman->database_put("AMPUSER", $grpnum . "/followme/grppre", isset($grppre) ? $grppre : '');
                $astman->database_put("AMPUSER", $grpnum . "/followme/dring", isset($dring) ? $dring : '');
                $astman->database_put("AMPUSER", $grpnum . "/followme/strategy", isset($strategy) ? $strategy : '');
                $astman->database_put("AMPUSER", $grpnum . "/followme/annmsg", !empty($annmsg_id) ? recordings_get_file($annmsg_id) : '');
                $astman->database_put("AMPUSER", $grpnum . "/followme/remotealertmsg", !empty($remotealert_id) ? recordings_get_file($remotealert_id) : '');
                $astman->database_put("AMPUSER", $grpnum . "/followme/toolatemsg", !empty($toolate_id) ? recordings_get_file($toolate_id) : '');
                $astman->database_put("AMPUSER", $grpnum . "/followme/postdest", $postdest);
                $astman->database_put("AMPUSER", $grpnum . "/followme/ringing", $ringing);
                // Create the confirm target
                $len = strlen($grpnum) + 4;
                $remotealert = empty($remotealert_id) ? '' : recordings_get_file($remotealert_id);
                $toolate = empty($toolate_id) ? '' : recordings_get_file($toolate_id);
                if ($ringing == 'Ring' || empty($ringing)) {
                    $dialopts = '${DIAL_OPTIONS}';
                } else {
                    // We need the DIAL_OPTIONS variable
                    $dialopts = "m({$ringing})" . str_replace('r', '', $dial_options);
                }
                //These two have to be here because of how they function in the dialplan.
                //Dont try to make them dynamic, we really can't do that
                $len = strlen($grpnum) + 4;
                $ext->add($grpcontextname, "_RG-" . $grpnum . ".", '', new ext_macro('dial', '${DB(AMPUSER/' . $grpnum . '/followme/grptime)},' . $dialopts . 'M(confirm^${remotealert}^${toolate}^${grpnum}),${EXTEN:' . $len . '}'), 1, 1);
                $ext->add($contextname, $grpnum, '', new ext_gotoif('$[${DB_EXISTS(AMPUSER/${EXTEN}/followme/ddial)} != 1 | "${DB(AMPUSER/${EXTEN}/followme/ddial)}" = "EXTENSION" ]', 'ext-local,${EXTEN},1', 'followme-check,${EXTEN},1'));
            }
            $ext->add($grpcontextname, "_RG-X.", '', new ext_nocdr(''));
            // Direct target to Follow-Me come here bypassing the followme/ddial conditional check
            //
            $ext->add($contextname, '_FMX.', '', new ext_goto('FMCID', '${EXTEN:2}', 'followme-check'));
            $contextname = 'followme-check';
            $ext->add($contextname, '_X.', 'FMCID', new ext_gosub('1', '${EXTEN}', 'followme-sub'));
            $ext->add($contextname, '_X.', '', new ext_noop('Should never get here'));
            $ext->add($contextname, '_X.', '', new ext_hangup());
            $contextname = 'followme-sub';
            $ext->add($contextname, '_X.', '', new ext_macro('user-callerid'));
            $ext->add($contextname, '_X.', '', new ext_set('DIAL_OPTIONS', '${DIAL_OPTIONS}I'));
            $ext->add($contextname, '_X.', '', new ext_set('CONNECTEDLINE(num,i)', '${EXTEN}'));
            $cidnameval = '${DB(AMPUSER/${EXTEN}/cidname)}';
            if ($amp_conf['AST_FUNC_PRESENCE_STATE'] && $amp_conf['CONNECTEDLINE_PRESENCESTATE']) {
                $ext->add($contextname, '_X.', '', new ext_gosub('1', 's', 'sub-presencestate-display', '${EXTEN}'));
                $cidnameval .= '${PRESENCESTATE_DISPLAY}';
            }
            $ext->add($contextname, '_X.', '', new ext_set('CONNECTEDLINE(name)', $cidnameval));
            $ext->add($contextname, '_X.', '', new ext_set('FM_DIALSTATUS', '${EXTENSION_STATE(${EXTEN}@ext-local)}'));
            $ext->add($contextname, '_X.', '', new ext_set('__EXTTOCALL', '${EXTEN}'));
            $ext->add($contextname, '_X.', '', new ext_set('__PICKUPMARK', '${EXTEN}'));
            // block voicemail until phone is answered at which point a macro should be called on the answering
            // line to clear this flag so that subsequent transfers can occur, if already set by a the caller
            // then don't change.
            //
            $ext->add($contextname, '_X.', '', new ext_macro('blkvm-setifempty'));
            $ext->add($contextname, '_X.', '', new ext_gotoif('$["${GOSUB_RETVAL}" = "TRUE"]', 'skipov'));
            $ext->add($contextname, '_X.', '', new ext_macro('blkvm-set', 'reset'));
            $ext->add($contextname, '_X.', '', new ext_setvar('__NODEST', ''));
            // Remember if NODEST was set later, but clear it in case the call is answered so that subsequent
            // transfers work.
            //
            $ext->add($contextname, '_X.', 'skipov', new ext_setvar('RRNODEST', '${NODEST}'));
//.........这里部分代码省略.........
开发者ID:ringfreejohn,项目名称:pbxframework,代码行数:101,代码来源:functions.inc.php


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