-
Notifications
You must be signed in to change notification settings - Fork 72
/
page.routing.php
121 lines (120 loc) · 4.27 KB
/
page.routing.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?php /* $Id$ */
// License for all code of this FreePBX module can be found in the license file inside the module directory
// Copyright 2006-2015 Schmooze Com Inc.
// Copyright (C) 2005 Ron Hartmann (rhartmann@vercomsystems.com)
if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); }
$request = $_REQUEST;
$request['view'] = !empty($request['view']) ? $request['view'] : '';
$action = isset($request['action'])?$request['action']:'';
$subhead = '';
if(!empty($request['id']) && !empty($request['view']) && $request['view'] == 'form'){
$subhead = _("Edit Route");
} elseif(empty($request['id']) && !empty($request['view']) && $request['view'] == 'form'){
$subhead = _("Add Route");
}
$tabindex = 0;
//
// Use a hash of the value inserted to get rid of duplicates
$dialpattern_insert = array();
$p_idx = 0;
$n_idx = 0;
if ($action == 'populatenpanxx') {
return true;
}
$pageinfo = '<div class="well well-info">';
$pageinfo .= _('This page is used to manage your outbound routing.');
$pageinfo .= '</div>';
switch($request['view']){
case "form":
if(isset($request['id'])){
$extdisplay = $request['id'];
$id = $request['id'];
$route_info = core_routing_get($extdisplay);
$dialpattern_array = core_routing_getroutepatternsbyid($extdisplay);
$trunkpriority = core_routing_getroutetrunksbyid($extdisplay);
$emailInfo = core_routing_getrouteemailbyid($extdisplay);
$routepass = $route_info['password'];
$emergency = $route_info['emergency_route'];
$intracompany = $route_info['intracompany_route'];
$mohsilence = $route_info['mohclass'];
$outcid = $route_info['outcid'];
$outcid_mode = $route_info['outcid_mode'];
$time_group_id = $route_info['time_group_id'];
$time_mode = $route_info['time_mode'];
$timezone = $route_info['timezone'];
$calendar_id = $route_info['calendar_id'];
$calendar_group_id = $route_info['calendar_group_id'];
$route_seq = $route_info['seq'];
$routename = $route_info['name'];
$dest = $route_info['dest'];
$notification_on = $route_info['notification_on'];
$routelist = core_routing_list();
$subhead = sprintf('%s: %s',$subhead,$routename);
$viewinfo = array(
'formAction' => 'editroute',
'extdisplay' => $extdisplay,
'id' => $id,
'route_info' => $route_info,
'dialpattern_array' => $dialpattern_array,
'trunkpriority' => $trunkpriority,
'routepass' => $routepass,
'emergency' => $emergency,
'intracompany' => $intracompany,
'mohsilence' => $mohsilence,
'outcid' => $outcid,
'outcid_mode' => $outcid_mode,
'time_group_id' => $time_group_id,
'time_mode' => $time_mode,
'timezone' => $timezone,
'calendar_id' => $calendar_id,
'calendar_group_id' => $calendar_group_id,
'route_seq' => $route_seq,
'routename' => $routename,
'dest' => $dest,
'notification_on' => $notification_on,
'emailInfo' => $emailInfo,
'hooks' => \FreePBX::Core()->hookTabs($request['display']),
'hooksAdditionalContent' => \FreePBX::Core()->hookAdditionalContent($request['display'])
);
$subhead .= ": ". $routename;
}else{
$sql = "SELECT MAX(`seq`) as max FROM outbound_route_sequence";
$res = \FreePBX::Database()->query($sql)->fetch(\PDO::FETCH_COLUMN);
$route_seq = is_numeric($res) ? $res + 1 : 0;
if (!isset($dialpattern_array)) {
$dialpattern_array = array();
}
$viewinfo = array(
'formAction' => 'addroute',
'route_seq' => $route_seq,
'dialpattern_array' => $dialpattern_array,
'trunkpriority' => $trunkpriority ?? '',
'hooks' => \FreePBX::Core()->hookTabs($request['display']),
);
}
$content = load_view(__DIR__.'/views/routing/form.php', $viewinfo);
$pageinfo = '';
break;
default:
//$pageinfo = '';
$routelist = core_routing_list();
$content = load_view(__DIR__.'/views/routing/grid.php', array('routelist' => $routelist));
break;
}
?>
<div class="container-fluid">
<h1><?php echo _('Outbound Routes')?></h1>
<h3><?php echo $subhead ?></h3>
<?php echo $pageinfo?>
<div class = "display no-border">
<div class="row">
<div class="col-sm-12">
<div class="fpbx-container">
<div class = "display no-border">
<?php echo $content ?>
</div>
</div>
</div>
</div>
</div>
</div>