if (isset($gresults)) { foreach ($gresults as $gresult) { echo "<li><a id=\"" . ($extdisplay == 'GRP-' . $gresult[0] ? 'current' : '') . "\" href=\"config.php?display=" . urlencode($dispnum) . "&extdisplay=" . urlencode("GRP-" . $gresult[0]) . "\">" . $gresult[1] . " ({$gresult[0]})</a></li>"; } } ?> </ul></div> <div class="content"> <?php if ($action == 'delGRP') { echo '<br><h3>' . _("VMBlast Group") . ' ' . $account . ' ' . _("deleted") . '!</h3><br><br><br><br><br><br><br><br>'; } else { if ($extdisplay) { // We need to populate grplist with the existing extension list. $thisgrp = vmblast_get(ltrim($extdisplay, 'GRP-')); $grplist = $thisgrp['grplist']; $description = $thisgrp['description']; $audio_label = $thisgrp['audio_label']; $password = $thisgrp['password']; $default_group = $thisgrp['default_group']; unset($thisgrp); $delButton = "\n\t\t\t<form name=delete action=\"{$_SERVER['PHP_SELF']}\" method=POST>\n\t\t\t\t<input type=\"hidden\" name=\"display\" value=\"{$dispnum}\">\n\t\t\t\t<input type=\"hidden\" name=\"account\" value=\"" . ltrim($extdisplay, 'GRP-') . "\">\n\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"delGRP\">\n\t\t\t\t<input type=submit value=\"" . _("Delete Group") . "\">\n\t\t\t</form>"; echo "<h2>" . _("VMBlast Group") . ": " . ltrim($extdisplay, 'GRP-') . "</h2>"; echo "<p>" . $delButton . "</p>"; $usage_list = framework_display_destination_usage(vmblast_getdest(ltrim($extdisplay, 'GRP-'))); if (!empty($usage_list)) { ?> <a href="#" class="info"><?php echo $usage_list['text']; ?>
<?php // License for all code of this FreePBX module can be found in the license file inside the module directory // Copyright 2015 Sangoma Technologies. // extract($request, EXTR_SKIP); if ($extdisplay != '') { // We need to populate grplist with the existing extension list. $thisgrp = vmblast_get($extdisplay); $grplist = $thisgrp['grplist']; $description = $thisgrp['description']; $audio_label = $thisgrp['audio_label']; $password = $thisgrp['password']; $default_group = $thisgrp['default_group']; unset($thisgrp); $usage_list = framework_display_destination_usage(vmblast_getdest($extdisplay)); if (!empty($usage_list)) { $usagehtml = '<div class="well">'; $usagehtml .= '<h3>' . $usage_list['text'] . '</h3>'; $usagehtml .= '<p>' . $usage_list['tooltip'] . '</p>'; $usagehtml .= '</div>'; } $delURL = '?display=vmblast&action=delGRP&account=' . $extdisplay; } else { $grplist = array(); $strategy = ''; $ringing = ''; $delURL = ''; } if (function_exists('recordings_list')) { $tresults = recordings_list();
function vmblast_get_config($engine) { global $ext; // is this the best way to pass this? switch ($engine) { case "asterisk": $ext->addInclude('from-internal-additional', 'vmblast-grp'); $contextname = 'vmblast-grp'; $vmlist = vmblast_list(); if (function_exists('recordings_list')) { $recordings_installed = true; $got_recordings = false; } else { $recordings_installed = false; } if (is_array($vmlist)) { foreach ($vmlist as $item) { $grpnum = ltrim($item['0']); $grp = vmblast_get($grpnum); $grplist = $grp['grplist']; $ext->add($contextname, $grpnum, '', new ext_macro('user-callerid')); $ext->add($contextname, $grpnum, '', new ext_answer('')); $ext->add($contextname, $grpnum, '', new ext_wait('1')); if (isset($grp['password']) && trim($grp['password']) != "" && ctype_digit(trim($grp['password']))) { $ext->add($contextname, $grpnum, '', new ext_authenticate($grp['password'])); } $ext->add($contextname, $grpnum, '', new ext_setvar('GRPLIST', '')); foreach ($grplist as $exten) { $ext->add($contextname, $grpnum, '', new ext_macro('get-vmcontext', $exten)); $ext->add($contextname, $grpnum, '', new ext_setvar('GRPLIST', '${GRPLIST}&' . $exten . '@${VMCONTEXT}')); } // Add a message and confirmation so they know what group they are in // if ($grp['audio_label'] == -2) { $ext->add($contextname, $grpnum, '', new ext_goto('1', '1', 'app-vmblast')); } elseif ($grp['audio_label'] == -1 || !$recordings_installed) { $ext->add($contextname, $grpnum, '', new ext_setvar('DIGITS', $grpnum)); $ext->add($contextname, $grpnum, '', new ext_goto('digits', 'vmblast', 'app-vmblast')); } else { if (!$got_recordings) { $recordings = recordings_list(); $got_recordings = true; $recording_hash = array(); foreach ($recordings as $recording) { $recording_hash[$recording[0]] = $recording[2]; } } if (isset($recording_hash[$grp['audio_label']])) { $ext->add($contextname, $grpnum, '', new ext_setvar('VMBMSG', $recording_hash[$grp['audio_label']])); $ext->add($contextname, $grpnum, '', new ext_goto('msg', 'vmblast', 'app-vmblast')); } else { $ext->add($contextname, $grpnum, '', new ext_setvar('DIGITS', $grpnum)); $ext->add($contextname, $grpnum, '', new ext_goto('digits', 'vmblast', 'app-vmblast')); } } } $contextname = 'app-vmblast'; $ext->add($contextname, 'vmblast', 'digits', new ext_execif('$["${DIGITS}" != ""]', 'SayDigits', '${DIGITS}')); $ext->add($contextname, 'vmblast', 'msg', new ext_execif('$["${VMBMSG}" != ""]', 'Background', '${VMBMSG}')); $ext->add($contextname, 'vmblast', '', new ext_background('if-correct-press&digits/1')); $ext->add($contextname, 'vmblast', '', new ext_waitexten('20')); $ext->add($contextname, 'vmblast', '', new ext_playback('sorry-youre-having-problems&goodbye')); $ext->add($contextname, 'vmblast', '', new ext_hangup('')); $ext->add($contextname, '1', '', new ext_vm('${GRPLIST:1},s')); $ext->add($contextname, '1', '', new ext_hangup('')); } break; } }