Exemplo n.º 1
0
/** parking_check_extensions
 * Short extension registry callback
 * Long callback that checks for conflicts in extensions that are passed to it
 * or if passed boolean true, list all the extensions generated by this module.
 */
function parking_check_extensions($exten = true)
{
    $extenlist = array();
    if (is_array($exten) && empty($exten)) {
        return $extenlist;
    }
    $lots = parking_get('all');
    foreach ($lots as $id => $lot) {
        $parkext = $lot['parkext'];
        $parkpos1 = $lot['parkpos'];
        $parkpos2 = $parkpos1 + $lot['numslots'] - 1;
        if (!is_array($exten) || in_array($parkext, $exten)) {
            $extenlist[$parkext]['description'] = sprintf(_("ParkPlus: ParkCall %s"), $lot['name']);
            $extenlist[$parkext]['status'] = _('INUSE');
            $extenlist[$parkext]['edit_url'] = 'config.php?display=parking&id=' . $id;
        }
        for ($thisexten = $parkpos1; $thisexten <= $parkpos2; $thisexten++) {
            if (is_array($exten) && !in_array($thisexten, $exten)) {
                continue;
            }
            $extenlist[$thisexten]['description'] = sprintf(_("ParkPlus: PickupSlot %s"), $lot['name']);
            $extenlist[$thisexten]['status'] = _('INUSE');
            $extenlist[$thisexten]['edit_url'] = 'config.php?display=parking&id=' . $id;
        }
    }
    return $extenlist;
}
Exemplo n.º 2
0
                    <td>' . _("nn") . ':</td>
                    <td>' . _("Park Yourself into lot nn") . '</td>
                </tr>
            </table>
            ', _("Example Usage"));
?>
<ul class="nav nav-tabs">
  <li class="active"><a data-toggle="tab" href="#parksettings"><?php 
echo _("Parking Settings");
?>
</a></li>
  <li><a data-toggle="tab" href="#parkinfo"><?php 
echo _("Parking Help");
?>
</a></li>
</ul>
<div class="display">
	<div class="tab-content">
	  <div id="parkinfo" class="tab-pane">
	    <?php 
echo $extendedhelp;
?>
	  </div>
	  <div id="parksettings" class="tab-pane active">
	    <?php 
echo parking_views('lot', parking_get('default'));
?>
	  </div>
	</div>
</div>
Exemplo n.º 3
0
 public function genConfig()
 {
     global $version;
     if (function_exists('parkpro_get_config')) {
         return null;
     }
     if (version_compare($version, '12', 'ge')) {
         $lot = parking_get();
         $parkpos1 = $lot['parkpos'];
         $parkpos2 = $parkpos1 + $lot['numslots'] - 1;
         $park_context = 'default';
         $hint_context = 'parkedcalls';
         $conf['res_parking.conf'][$park_context] = array('parkext' => $lot['parkext'], 'parkpos' => $parkpos1 . "-" . $parkpos2, 'context' => $hint_context, 'parkingtime' => $lot['parkingtime'], 'comebacktoorigin' => 'no', 'parkedplay' => $lot['parkedplay'], 'courtesytone' => 'beep', 'parkedcalltransfers' => $lot['parkedcalltransfers'], 'parkedcallreparking' => $lot['parkedcallreparking'], 'parkedmusicclass' => $lot['parkedmusicclass'], 'findslot' => $lot['findslot']);
         return $conf;
     }
 }
Exemplo n.º 4
0
<?php

if (!defined('FREEPBX_IS_AUTH')) {
    die('No direct script access allowed');
}
//  License for all code of this FreePBX module can be found in the license file inside the module directory
//  Copyright 2015 Sangoma Technologies.
//
$parking_defaults = array("name" => "Lot Name", "type" => "public", "parkext" => "", "parkpos" => "", "numslots" => 4, "parkingtime" => 45, "parkedmusicclass" => "default", "generatehints" => "yes", "generatefc" => "yes", "findslot" => "first", "parkedplay" => "both", "parkedcalltransfers" => "caller", "parkedcallreparking" => "caller", "alertinfo" => "", "cidpp" => "", "autocidpp" => "", "announcement_id" => null, "comebacktoorigin" => "yes", "dest" => "");
$all_pl['lots'] = parking_get('all');
$heading = parking_views('header', $all_pl);
switch ($_REQUEST['action']) {
    case 'modify':
    case 'update':
        $data = parking_get($_REQUEST['id']) ? parking_get($_REQUEST['id']) : parking_get('default');
        $content = parking_views('lot', $data);
        break;
    case 'add':
        $content = parking_views('lot', $parking_defaults);
        break;
    default:
        $mc = \module_functions::create();
        $o = parking_views($action, $data);
        if (!$o) {
            $m = "paging";
            $d = $mc->getinfo($m);
            $data['modules']['paging'] = $d[$m]['status'] == "2" ? TRUE : FALSE;
            $m = "pagingpro";
            $data['modules']['pagingpro'] = $d[$m]['status'] == "2" ? TRUE : FALSE;
            $m = "parkpro";
            $d = $mc->getinfo($m);
Exemplo n.º 5
0
/** parking_get_config
 * Short dialplan generation for this module
 * Long dialplan generation as well as population of conf_classes etc
 * that this module is responsible for.
 */
function parking_get_config($engine)
{
    global $db;
    global $amp_conf;
    global $ext;
    // is this the best way to pass this?
    global $asterisk_conf;
    global $core_conf;
    global $version;
    switch ($engine) {
        case "asterisk":
            // Some contexts used throughout:
            //
            $por = 'park-orphan-routing';
            $ph = 'park-hints';
            $pd = 'park-dial';
            $lot = parking_get();
            parking_generate_parked_call();
            parking_generate_parkedcallstimeout();
            parking_generate_park_dial($pd, $por, $lot);
            //--------------------------------------
            // End Here if there is a parkpro module
            //
            if (function_exists('parkpro_get_config')) {
                return true;
            }
            $fcc = new featurecode('parking', 'parkedcall');
            $parkfetch_code = $fcc->getCodeActive();
            unset($fcc);
            $fcc = new featurecode('parking', 'parkto');
            $parkto_code = $fcc->getCodeActive();
            unset($fcc);
            // Need to setup featurecode.conf configuration for the parking lot:
            //
            $parkpos1 = $lot['parkpos'];
            $parkpos2 = $parkpos1 + $lot['numslots'] - 1;
            // A bit confusing, park_context is when we call to park which seems to want 'default' from various testing
            // hint_context is basically the actual context thus what we set in config file and what we point hints at
            //
            $park_context = 'default';
            $hint_context = 'parkedcalls';
            if (version_compare($version, '12', 'lt')) {
                $core_conf->addFeatureGeneral('parkext', $lot['parkext']);
                $core_conf->addFeatureGeneral('parkpos', $parkpos1 . "-" . $parkpos2);
                $core_conf->addFeatureGeneral('context', $hint_context);
                $core_conf->addFeatureGeneral('parkext_exclusive', 'no');
                $core_conf->addFeatureGeneral('parkingtime', $lot['parkingtime']);
                $core_conf->addFeatureGeneral('comebacktoorigin', 'no');
                //Set this to no as we can manage our own internal comebacktoorigin
                $core_conf->addFeatureGeneral('parkedplay', $lot['parkedplay']);
                $core_conf->addFeatureGeneral('courtesytone', 'beep');
                $core_conf->addFeatureGeneral('parkedcalltransfers', $lot['parkedcalltransfers']);
                $core_conf->addFeatureGeneral('parkedcallreparking', $lot['parkedcallreparking']);
                $core_conf->addFeatureGeneral('parkedmusicclass', $lot['parkedmusicclass']);
                $core_conf->addFeatureGeneral('findslot', $lot['findslot']);
            }
            $ext->addInclude('from-internal-additional', $ph);
            $ext->addInclude($ph, $hint_context, $lot['name']);
            // Each lot needs a routing table to handle orphaned calls in the event
            // that the call were to timeout if they were routed to return to
            // originator, we route them to the ${PLOT} previously set
            if ($lot['comebacktoorigin'] == 'yes') {
                // If they haven't provided a destination then we need to make a context to
                // handle orphaned calls, we'll require destinations but this is a stop gap
                // to be nice to cusotmers and broken systems.
                //
                if (!$lot['dest']) {
                    $ext->add($por, $lot['parkext'], '', new ext_noop('ERROR: No Alternate Destination Available for Orphaned Call'));
                    $ext->add($por, $lot['parkext'], '', new ext_playback('sorry&an-error-has-occured'));
                    $ext->add($por, $lot['parkext'], '', new ext_hangup(''));
                } else {
                    $ext->add($por, $lot['parkext'], '', new ext_goto($lot['dest']));
                }
            }
            // Setup the specific items to do in the park-return-routing context for each lot, we will deal
            // with the per slot routing to this extension in the per slot loop below
            //
            parking_generate_sub_return_routing($lot, $pd, $parkpos1, $parkpos2);
            // Now we have to create the hints and the specific parking slots for picking up the calls since
            // we do not use the dynamic generated ParkedCall()
            //
            $hv_all = '';
            $finalh = array();
            for ($slot = $parkpos1; $slot <= $parkpos2; $slot++) {
                $ext->add($ph, $slot, '', new ext_macro('parked-call', $slot . ',' . ($lot['type'] == 'public' ? $park_context : '${CHANNEL(parkinglot)}')));
                if ($lot['generatehints'] == 'yes') {
                    $hv = "park:{$slot}@{$hint_context}";
                    $hv_all .= $hv . '&';
                    $ext->addHint($ph, $slot, $hv);
                    $finalh[] = "park:" . $slot . "@" . $hint_context;
                }
            }
            $hv_all = rtrim($hv_all, '&');
            if ($parkfetch_code != '') {
                $ext->add($ph, $parkfetch_code, '', new ext_macro('parked-call', ',' . $park_context));
                $ext->add($ph, $parkfetch_code . $lot['parkext'], '', new ext_macro('parked-call', ',' . $park_context));
                if ($lot['generatehints'] == 'yes') {
                    $ext->addHint($ph, $parkfetch_code, $hv_all);
                    $ext->addHint($ph, $parkfetch_code . $lot['parkext'], $hv_all);
                    if (!empty($finalh)) {
                        $ext->add($ph, '_' . $parkfetch_code . 'X.', '', new ext_macro('parked-call', ',' . $park_context));
                        $ext->addHint($ph, '_' . $parkfetch_code . 'X.', implode("&", $finalh));
                    }
                }
            }
            if ($parkto_code != '') {
                $id = 'app-parking';
                $ext->addInclude('from-internal-additional', $id);
                // Add the include to from-internal
                $ext->add($id, $parkto_code, '', new \ext_goto('1', $lot['parkext'], 'from-internal'));
            }
            if ($lot['autocidpp'] == 'exten' || $lot['autocidpp'] == 'name') {
                parking_generate_sub_park_user($lot);
            }
            break;
    }
}
Exemplo n.º 6
0
 /**
  * @verb GET
  * @returns - the default parking lot
  * @uri /parking
  */
 function get_parking($params)
 {
     $lot = parking_get('default');
     return $lot ? $lot : false;
 }