當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。