本文整理汇总了PHP中FreePBX::Soundlang方法的典型用法代码示例。如果您正苦于以下问题:PHP FreePBX::Soundlang方法的具体用法?PHP FreePBX::Soundlang怎么用?PHP FreePBX::Soundlang使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FreePBX
的用法示例。
在下文中一共展示了FreePBX::Soundlang方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: soundlang_hookGet_config
function soundlang_hookGet_config($engine)
{
global $core_conf;
switch ($engine) {
case "asterisk":
if (isset($core_conf) && is_a($core_conf, "core_conf")) {
$language = FreePBX::Soundlang()->getLanguage();
if ($language != "") {
$core_conf->addSipGeneral('language', $language);
$core_conf->addIaxGeneral('language', $language);
}
}
break;
}
}
示例2: languages_hook_core
function languages_hook_core($viewing_itemid, $target_menuid)
{
$request = $_REQUEST;
$extension = isset($request['extension']) ? $request['extension'] : '';
$cidnum = isset($request['cidnum']) ? $request['cidnum'] : '';
$extdisplay = isset($request['extdisplay']) ? $request['extdisplay'] : '';
$action = isset($request['action']) ? $request['action'] : '';
$language = isset($request['language']) ? $request['language'] : '';
//set $extension,$cidnum if we dont already have them
if (!$extension && !$cidnum) {
$opts = explode('/', $extdisplay);
$extension = $opts['0'];
$cidnum = isset($opts['1']) ? $opts['1'] : '';
} else {
$extension = $extension;
$cidnum = $cidnum;
}
//update if we have enough info
if ($action == 'edtIncoming' || ($extension != '' || $cidnum != '') && $language != '') {
languages_incoming_update($language = $language, $extension, $cidnum);
}
if ($action == 'delIncoming') {
languages_incoming_delete($extension, $cidnum);
}
$html = '';
if ($target_menuid == 'did') {
$html .= '
<!--Language-->
<div class="element-container">
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="form-group">
<div class="col-md-3">
<label class="control-label" for="language">' . _("Language") . '</label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="language"></i>
</div>
<div class="col-md-9">
';
$language = languages_incoming_get($extension, $cidnum);
if (FreePBX::Modules()->moduleHasMethod('Soundlang', 'getLanguages')) {
$languages = FreePBX::Soundlang()->getLanguages();
$html .= '<select class="form-control" id="language" name="language">';
$html .= '<option value=""' . ($language == "" ? "SELECTED" : "") . '>' . _("Default") . '</option>';
foreach ($languages as $key => $val) {
$html .= '<option value="' . $key . '"' . ($language == $key ? "SELECTED" : "") . '>' . $val . '</option>';
}
$html .= '</select>';
} else {
$html .= '<input type="text" class="form-control" id="language" name="language" value="' . $language . '">';
}
$html .= '
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<span id="language-help" class="help-block fpbx-help-block">' . _("Allows you to set the language for this DID.") . '</span>
</div>
</div>
</div>
<!--END Language-->
';
}
return $html;
}
示例3: out
}
out(_("OK"));
} else {
out(_("already exists"));
}
sql('DELETE FROM recordings WHERE displayname = "__invalid"');
$freepbx_conf =& freepbx_conf::create();
if ($freepbx_conf->conf_setting_exists('AMPPLAYKEY')) {
$freepbx_conf->remove_conf_setting('AMPPLAYKEY');
}
$dir = FreePBX::Config()->get("ASTVARLIBDIR") . "/sounds";
$sql = "SELECT * FROM recordings";
$sth = FreePBX::Database()->prepare($sql);
$sth->execute();
$recordings = $sth->fetchAll(\PDO::FETCH_ASSOC);
$default = FreePBX::Soundlang()->getLanguage();
if (!file_exists($dir . "/" . $default . "/custom")) {
mkdir($dir . "/" . $default . "/custom", 0777, true);
}
foreach ($recordings as $recording) {
$files = explode("&", $recording['filename']);
$filenames = array();
foreach ($files as $file) {
//move all custom files to the default language first
if (preg_match("/^custom\\/(.*)/", $file, $matches)) {
foreach (glob($dir . "/custom/" . $matches[1] . ".*") as $f) {
$ff = basename($f);
rename($f, $dir . "/" . $default . "/custom/" . $ff);
}
$filenames[] = $file;
//if any files are using languages then remove the language since Asterisk does this for us
示例4: _
</div>
<div class="element-container">
<div class="row">
<div class="col-md-3">
<label class="control-label" for="language"><?php
echo _("Language Code");
?>
</label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="language"></i>
</div>
<div class="col-md-9">
<?php
if (\FreePBX::Modules()->checkStatus("soundlang")) {
?>
<?php
$langs = \FreePBX::Soundlang()->getLanguages();
$langs = is_array($langs) ? $langs : array();
?>
<select name="language" class="form-control">
<option value=""><?php
echo _("Default");
?>
</option>
<?php
foreach ($langs as $key => $lang) {
?>
<option value="<?php
echo $key;
?>
" <?php
echo $language == $key ? "selected" : "";
示例5: recordings_get_config
//.........这里部分代码省略.........
$ext->add($appcontext, $fcode, '', new ext_macro('user-callerid'));
$ext->add($appcontext, $fcode, '', new ext_wait('2'));
$ext->add($appcontext, $fcode, '', new ext_macro('systemrecording', 'docheck,' . $item['filename'] . $fcode_pass));
//$ext->add($appcontext, $fcode, '', new ext_macro('hangup'));
}
}
}
// moved from modules/core to modules/recordings
// since it really belongs here and not there
// also provides direct access to $recordings_save_path
// which removes a hard-coded value in the macro
$context = 'systemrecording-gui';
$exten = 'dorecord';
$ext->add($context, $exten, '', new ext_record('${RECFILE}.wav,,,k'));
$ext->add($context, 'h', '', new ext_system('touch ${RECFILE}.finished'));
$ext->add($context, 'h', 'exit', new ext_hangup());
$context = 'macro-systemrecording';
$ext->add($context, 's', '', new ext_gotoif('$["${ARG2}" = ""]', 'invalid'));
$ext->add($context, 's', '', new ext_setvar('TMPLANG', '${CHANNEL(language)}'));
$ext->add($context, 's', '', new ext_setvar('RECFILE', '${TMPLANG}/${ARG2}'));
$ext->add($context, 's', '', new ext_setvar('LISTEN', 'docheck'));
$ext->add($context, 's', '', new ext_execif('$["${ARG3}" != ""]', 'Authenticate', '${ARG3}'));
$ext->add($context, 's', '', new ext_goto(1, '${ARG1}'));
$exten = 'dorecord';
// Delete all versions of the current sound file (does not consider languages though
// otherwise you might have some versions that are not re-recorded
//
$ext->add($context, $exten, '', new ext_setvar('TMPRECFILE', '${RECFILE}-TMP'));
$ext->add($context, $exten, '', new ext_background('say-temp-msg-prs-pound,,${CHANNEL(language)}'));
$ext->add($context, $exten, '', new ext_record('${TMPRECFILE}.wav,,,k'));
$ext->add($context, $exten, '', new ext_setvar('LISTEN', 'dochecknolanguage'));
$ext->add($context, $exten, '', new ext_goto(1, 'confmenu'));
$exten = 'dochecknolanguage';
$ext->add($context, $exten, '', new ext_playback('beep'));
$ext->add($context, $exten, 'dc_start', new ext_background('${TMPRECFILE},m,,macro-systemrecording'));
$ext->add($context, $exten, '', new ext_wait(1));
$ext->add($context, $exten, '', new ext_goto(1, 'confmenu'));
$exten = 'docheck';
$ext->add($context, $exten, '', new ext_playback('beep'));
$ext->add($context, $exten, 'dc_start', new ext_background('${RECFILE},m,${CHANNEL(language)},macro-systemrecording'));
$ext->add($context, $exten, '', new ext_wait(1));
$ext->add($context, $exten, '', new ext_goto(1, 'confmenu'));
$exten = 'confmenu';
$ext->add($context, $exten, '', new ext_background('to-listen-to-it&press-1&to-accept-recording&press-2&to-rerecord-it&press-star&language&press-3,m,${CHANNEL(language)},macro-systemrecording'));
$ext->add($context, $exten, '', new ext_read('RECRESULT', '', 1, '', '', 4));
$ext->add($context, $exten, '', new ext_gotoif('$["x${RECRESULT}"="x*"]', 'dorecord,1'));
$ext->add($context, $exten, '', new ext_gotoif('$["x${RECRESULT}"="x1"]', '${LISTEN},2'));
$ext->add($context, $exten, '', new ext_gotoif('$["x${RECRESULT}"="x2"]', 'doaccept,1'));
$ext->add($context, $exten, '', new ext_gotoif('$["x${RECRESULT}"="x3"]', 'switchlang,1'));
$ext->add($context, $exten, '', new ext_goto(1));
$exten = 'doaccept';
$ext->add($context, $exten, '', new ext_setvar('EXISTS', '${STAT(e,${ASTVARLIBDIR}/sounds/${TMPRECFILE}.wav)}'));
$ext->add($context, $exten, '', new ext_noop('${EXISTS}'));
$ext->add($context, $exten, '', new ext_gotoif('$["${EXISTS}" != "1"]', 'exit'));
$ext->add($context, $exten, '', new ext_system('touch ${ASTVARLIBDIR}/sounds/${RECFILE}.finished'));
$ext->add($context, $exten, '', new ext_gotoif('$["x${TMPRECFILE}"="x"]', 'exit'));
$ext->add($context, $exten, '', new ext_system('mv ${ASTVARLIBDIR}/sounds/${TMPRECFILE}.wav ${ASTVARLIBDIR}/sounds/${RECFILE}.wav'));
$ext->add($context, $exten, '', new ext_setvar('TMPRECFILE', '${RECFILE}'));
$ext->add($context, $exten, 'exit', new ext_playback('auth-thankyou'));
$ext->add($context, $exten, '', new ext_goto(1, 'confmenu'));
$exten = 'switchlang';
$ext->add($context, $exten, '', new ext_playback('language&is-set-to'));
$ext->add($context, $exten, '', new ext_sayalpha('${TMPLANG}'));
$ext->add($context, $exten, '', new ext_playback('after-the-tone'));
$langs = \FreePBX::Soundlang()->getLanguages();
$c = 1;
foreach ($langs as $l => $d) {
$ext->add($context, $exten, '', new ext_background('press-' . $c));
$ext->add($context, $exten, '', new ext_sayalpha($l));
$c++;
}
$ext->add($context, $exten, '', new ext_playback('beep'));
$ext->add($context, $exten, '', new ext_read('LANGRESULT', '', 1, '', '', 4));
$c = 1;
foreach ($langs as $l => $d) {
$ext->add($context, $exten, '', new ext_execif('$["x${LANGRESULT}"="x' . $c . '"]', 'Set', 'TMPLANG=' . $l));
$c++;
}
$ext->add($context, $exten, '', new ext_setvar('RECFILE', '${TMPLANG}/${ARG2}'));
$ext->add($context, $exten, '', new ext_playback('language&is-set-to'));
$ext->add($context, $exten, '', new ext_sayalpha('${TMPLANG}'));
$ext->add($context, $exten, '', new ext_goto(1, 'confmenu'));
$exten = 'invalid';
$ext->add($context, $exten, '', new ext_playback('pm-invalid-option'));
$ext->add($context, $exten, '', new ext_hangup());
$ext->add($context, '1', '', new ext_goto('dc_start', '${LISTEN}'));
$ext->add($context, '2', '', new ext_goto(1, 'doaccept'));
$ext->add($context, '3', '', new ext_goto(1, 'switchlang'));
$ext->add($context, '*', '', new ext_goto(1, 'dorecord'));
$ext->add($context, 't', '', new ext_playback('goodbye'));
$ext->add($context, 't', '', new ext_hangup());
$ext->add($context, 'i', '', new ext_playback('pm-invalid-option'));
$ext->add($context, 'i', '', new ext_goto(1, 'confmenu'));
$ext->add($context, 'h', '', new ext_system('touch ${ASTVARLIBDIR}/sounds/${RECFILE}.finished'));
$ext->add($context, 'h', '', new ext_gotoif('$["x${TMPRECFILE}"="x"]', 'exit'));
$ext->add($context, 'h', '', new ext_system('mv ${ASTVARLIBDIR}/sounds/${TMPRECFILE}.wav ${ASTVARLIBDIR}/sounds/${CHANNEL(language)}/${RECFILE}.wav'));
$ext->add($context, 'h', 'exit', new ext_hangup());
break;
}
}
示例6:
<?php
// License for all code of this FreePBX module can be found in the license file inside the module directory
// Copyright 2013 Schmooze Com Inc.
//
$soundlang = FreePBX::Soundlang();
echo $soundlang->myShowPage();
示例7: _
echo _("Language");
?>
</label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="language"></i>
</div>
<div class="col-md-9">
<?php
if (\FreePBX::Modules()->checkStatus("soundlang")) {
?>
<select class="form-control" id="language" name="language">
<option value=""><?php
echo _("Inherit");
?>
</option>
<?php
foreach (\FreePBX::Soundlang()->getLanguages() as $key => $value) {
$selected = $language == $key ? 'SELECTED' : '';
?>
<option value="<?php
echo $key;
?>
" <?php
echo $selected;
?>
><?php
echo $value;
?>
</option>
<?php
}
?>