Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AmiBX
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bitrix
AmiBX
Commits
cf61be32
Commit
cf61be32
authored
Apr 19, 2022
by
Kulya
😊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first routeng added
parent
883eebf7
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
1965 additions
and
39 deletions
+1965
-39
command.php
command.php
+256
-1
inroutes.php
template/inroutes.php
+225
-0
footer_queues.js
template/js/footer_queues.js
+145
-32
footer_queues_orig.js
template/js/footer_queues_orig.js
+1242
-0
trunks.php
template/trunks.php
+45
-3
AloVoiceActions.php
vendor/alovoice/src/AloVoiceActions.php
+39
-1
AloVoiceConnector.php
vendor/alovoice/src/AloVoiceConnector.php
+1
-0
AloVoiceRest.php
vendor/alovoice/src/AloVoiceRest.php
+12
-2
No files found.
command.php
View file @
cf61be32
...
...
@@ -90,6 +90,21 @@ die();
function
doCommandAjax
(
$cmd
,
$r
){
switch
(
$cmd
)
{
case
'removeInroute'
:
return
removeInroute
(
$r
);
break
;
case
'saveInroute'
:
return
saveInroute
(
$r
);
break
;
case
'loadDestinationsList'
:
return
loadDestinationsList
(
$r
);
break
;
case
'loadTrunksList'
:
return
loadTrunksList
(
$r
);
break
;
case
'loadInroutesList'
:
return
loadInroutesList
(
$r
);
break
;
case
'saveAudioFile'
:
return
saveAudioFile
(
$r
);
break
;
...
...
@@ -108,6 +123,9 @@ function doCommandAjax($cmd,$r){
case
'addNewQueue'
:
return
addNewQueue
(
$r
);
break
;
case
'saveQueue'
:
return
saveQueue
(
$r
);
break
;
case
'getQueue'
:
return
getQueue
(
$r
[
'queue'
]);
break
;
...
...
@@ -149,6 +167,239 @@ function doCommandAjax($cmd,$r){
function
removeInroute
(
$r
=
[]){
if
(
empty
(
$r
[
"extension"
])
||
empty
(
$r
[
"cidnum"
])
)
{
return
[
"error"
=>
"Мало данных"
];
}
$extension
=
(
$r
[
"extension"
]
==
"Все"
)
?
""
:
$r
[
"extension"
];
$cidnum
=
(
$r
[
"cidnum"
]
==
"Все"
)
?
""
:
$r
[
"cidnum"
];
$db
=
\FreePBX
::
Database
();
$sql
=
"DELETE FROM incoming WHERE cidnum = '"
.
$cidnum
.
"' AND extension = '"
.
$extension
.
"'"
;
$res
=
$db
->
query
(
$sql
);
exec
(
"fwconsole reload"
);
return
true
;
}
function
saveInroute
(
$r
=
[]){
/*
extension // did
cidnum
mohclass
destination
delay_answer // 0
description
*/
// "app-blackhole,hangup,1",
// "ext-local,vms1098,1",
// timeconditions,1,1
// from-did-direct,2424,1
// ext-queues,99999,1
// ext-group,99998,1
if
(
empty
(
$r
[
"extension"
])
||
empty
(
$r
[
"cidnum"
])
||
empty
(
$r
[
"destination"
])
)
{
return
[
"error"
=>
"Мало данных"
];
}
$destination
=
''
;
if
(
!
empty
(
$r
[
"destination_code"
])){
if
(
$r
[
"destination"
]
==
"ext-queues"
){
$destination
=
$r
[
"destination"
]
.
','
.
$r
[
"destination_code"
]
.
',1'
;
}
if
(
$r
[
"destination"
]
==
"from-did-direct"
){
$destination
=
$r
[
"destination"
]
.
','
.
$r
[
"destination_code"
]
.
',1'
;
}
if
(
$r
[
"destination"
]
==
"timeconditions"
){
$destination
=
$r
[
"destination"
]
.
',1,1'
;
}
}
elseif
(
$r
[
"destination"
]
==
"timeconditions"
){
$destination
=
$r
[
"destination_code"
]
.
',1,1'
;
}
elseif
(
$r
[
"destination"
]
==
"hangup"
){
$destination
=
'app-blackhole,hangup,1'
;
}
elseif
(
$r
[
"destination"
]
==
"vm"
){
$destination
=
'ext-local,vms1098,1'
;
}
if
(
empty
(
$destination
)){
return
[
"error"
=>
"Направление не верная"
];
}
$did_vars
=
[
"extension"
=>
(
$r
[
"extension"
]
==
"Все"
)
?
""
:
$r
[
"extension"
],
"cidnum"
=>
(
$r
[
"cidnum"
]
==
"Все"
)
?
""
:
$r
[
"cidnum"
],
"mohclass"
=>
"default"
,
"destination"
=>
$destination
,
"delay_answer"
=>
0
,
"description"
=>
(
!
empty
(
$r
[
"description"
]))
?
$r
[
"description"
]
:
""
,
];
$res
=
\FreePBX
::
Core
()
->
createUpdateDID
(
$did_vars
);
if
(
!
empty
(
$res
)){
exec
(
"fwconsole reload"
);
}
return
[
"query"
=>
$r
,
"ardid"
=>
$did_vars
,
"save_res"
=>
$res
];
}
function
loadDestinationsList
(
$r
=
[]){
$destTitle
=
[];
$destTitle
[
"from-did-direct"
]
=
'Внут.номер'
;
$destTitle
[
"ext-queues"
]
=
'Очередь'
;
// $destTitle["ext-group"] = 'Группа';
$destTitle
[
"timeconditions"
]
=
'Правила по времени'
;
$destTitle
[
"vm"
]
=
'Голосовая почта'
;
$destTitle
[
"hangup"
]
=
'Завершить звонок'
;
return
$destTitle
;
}
function
loadInroutesList
(
$r
=
[]){
$arInroutes
=
[];
$db
=
\FreePBX
::
Database
();
$sql
=
"SELECT * FROM incoming ORDER BY extension,cidnum"
;
$ob
=
$db
->
query
(
$sql
,
\PDO
::
FETCH_ASSOC
);
if
(
$ob
->
rowCount
()){
$dbInroutes
=
$ob
->
fetchAll
();
}
foreach
(
$dbInroutes
as
$route
){
$arDest
=
explode
(
","
,
$route
[
'destination'
]);
$destTitle
=
''
;
if
(
!
empty
(
$arDest
[
0
])
&&
$arDest
[
0
]
==
"from-did-direct"
){
$destTitle
=
'Внут.номер'
;
}
if
(
!
empty
(
$arDest
[
0
])
&&
$arDest
[
0
]
==
"ext-queues"
){
$destTitle
=
'Очередь'
;
}
if
(
!
empty
(
$arDest
[
0
])
&&
$arDest
[
0
]
==
"ext-group"
){
$destTitle
=
'Группа'
;
}
if
(
!
empty
(
$arDest
[
0
])
&&
$arDest
[
0
]
==
"timeconditions"
){
$destTitle
=
'Правила по времени'
;
}
$arInroutes
[]
=
[
// 'id' => $route[''],
'name'
=>
$route
[
'description'
],
'route_cid'
=>
(
!
empty
(
$route
[
'cidnum'
]))
?
$route
[
'cidnum'
]
:
"Все"
,
'route_did'
=>
(
!
empty
(
$route
[
'extension'
]))
?
$route
[
'extension'
]
:
"Все"
,
'route_goto'
=>
$destTitle
.
" ("
.
$arDest
[
1
]
.
")"
,
'route_goto_code'
=>
$route
[
'destination'
],
'route_moh'
=>
$route
[
'mohclass'
]
];
}
$arHeaders
=
[
'name'
=>
'Название'
,
'route_cid'
=>
'Кто звонит'
,
'route_did'
=>
'Куда звонит'
,
'route_goto'
=>
'Назначение'
,
'route_moh'
=>
'Мелодия в ожидании'
,
];
$arReturn
=
[
'headers'
=>
$arHeaders
,
'datas'
=>
$arInroutes
,
];
return
$arReturn
;
}
function
loadTrunksList
(
$r
=
[]){
// TODO: $assoc default to true, eventually..
//outcid keepcid maxchans
// $trunks = \FreePBX::Core()->listTrunks();
$db
=
\FreePBX
::
Database
();
$sql
=
"SELECT `trunkid` , `tech` , `outcid`, `name`, `keepcid`, `maxchans`, `channelid` , `disabled` FROM `trunks` ORDER BY `trunkid`"
;
$ob
=
$db
->
query
(
$sql
,
\PDO
::
FETCH_ASSOC
);
$dbTrunks
=
[];
if
(
$ob
->
rowCount
()){
$dbTrunks
=
$ob
->
fetchAll
();
}
// $unique_trunks = array();
// foreach ($trunks as $trunk) {
// $trunk_id = "OUT_".$trunk['trunkid'];
// $disabled = $trunk['disabled'];
// if($disabled=="off"){ continue; }
// $tech = strtoupper($trunk['tech']);
// switch ($tech) {
// case 'IAX':
// $dialstring = 'IAX2/'.$trunk['channelid'];
// break;
// case 'CUSTOM':
// $dialstring = 'AMP:'.$trunk['channelid'];
// break;
// default:
// $dialstring = $tech.'/'.$trunk['channelid'];
// break;
// }
// $unique_trunks[] = array($trunk_id, $dialstring, $disabled);
// }
// $arTrunks = array();
foreach
(
$dbTrunks
as
$trunk
)
{
$arTrunks
[
$trunk
[
"trunkid"
]]
=
[
'id'
=>
$trunk
[
"trunkid"
],
'type'
=>
$trunk
[
"tech"
],
'name'
=>
$trunk
[
"name"
],
'number'
=>
(
!
empty
(
$trunk
[
"outcid"
]))
?
$trunk
[
"outcid"
]
:
"_"
,
'maxchannels'
=>
(
!
empty
(
$trunk
[
"maxchans"
]))
?
$trunk
[
"maxchans"
]
:
"-"
,
'status'
=>
(
!
empty
(
$trunk
[
"disabled"
])
&&
$trunk
[
"disabled"
]
==
"on"
)
?
"On"
:
"Off"
,
// 'globalvar' => $trunk[0], //OUT_4
];
}
$arHeaders
=
[
'id'
=>
'ID'
,
'name'
=>
'Название'
,
'type'
=>
'Тип'
,
'number'
=>
'Номер'
,
'maxchannels'
=>
'Максимум линий'
,
'status'
=>
'Статус'
,
];
$arReturn
=
[
'headers'
=>
$arHeaders
,
'datas'
=>
$arTrunks
,
'test'
=>
$rawTest
,
];
return
$arReturn
;
}
function
restartWork
(){
return
true
;
}
...
...
@@ -385,6 +636,10 @@ function saveQueue($data,$r=true){
if
(
empty
(
$goto
))
{
$goto
=
(
!
empty
(
$oQueue
[
"goto"
]))
?
$oQueue
[
"goto"
]
:
"app-blackhole,hangup,1"
;
}
$strategy
=
(
!
empty
(
$data
[
"strategy"
]))
?
$data
[
"strategy"
]
:
false
;
if
(
empty
(
$strategy
)
&&
!
empty
(
$oQueue
[
"strategy"
]))
{
$strategy
=
$oQueue
[
"strategy"
];
}
else
{
$strategy
=
'ringall'
;}
$agentannounce_id
=
(
!
empty
(
$data
[
"agentannounce_id"
]))
?
$data
[
"agentannounce_id"
]
:
(
!
empty
(
$oQueue
[
"agentannounce_id"
]))
?
$oQueue
[
"agentannounce_id"
]
:
NULL
;
$joinannounce_id
=
(
!
empty
(
$data
[
"joinannounce_id"
]))
?
$data
[
"joinannounce_id"
]
:
(
!
empty
(
$oQueue
[
"joinannounce_id"
]))
?
$oQueue
[
"joinannounce_id"
]
:
NULL
;
$maxwait
=
(
!
empty
(
$data
[
"maxwait"
]))
?
$data
[
"maxwait"
]
:
(
!
empty
(
$oQueue
[
"maxwait"
]))
?
$oQueue
[
"maxwait"
]
:
""
;
...
...
@@ -399,7 +654,7 @@ function saveQueue($data,$r=true){
$fields
[]
=
[
$account
,
'maxlen'
,(
!
empty
(
$oQueue
[
"maxlen"
]))
?
$oQueue
[
"maxlen"
]
:
'0'
,
0
];
$fields
[]
=
[
$account
,
'joinempty'
,(
!
empty
(
$oQueue
[
"joinempty"
]))
?
$oQueue
[
"joinempty"
]
:
'yes'
,
0
];
$fields
[]
=
[
$account
,
'leavewhenempty'
,(
!
empty
(
$oQueue
[
"leavewhenempty"
]))
?
$oQueue
[
"leavewhenempty"
]
:
'no'
,
0
];
$fields
[]
=
[
$account
,
'strategy'
,
(
!
empty
(
$oQueue
[
"strategy"
]))
?
$oQueue
[
"strategy"
]
:
'ringall'
,
0
];
$fields
[]
=
[
$account
,
'strategy'
,
$strategy
,
0
];
$fields
[]
=
[
$account
,
'timeout'
,(
!
empty
(
$oQueue
[
"timeout"
]))
?
$oQueue
[
"timeout"
]
:
'15'
,
0
];
$fields
[]
=
[
$account
,
'retry'
,(
!
empty
(
$oQueue
[
"retry"
]))
?
$oQueue
[
"retry"
]
:
'5'
,
0
];
$fields
[]
=
[
$account
,
'wrapuptime'
,(
!
empty
(
$oQueue
[
"wrapuptime"
]))
?
$oQueue
[
"wrapuptime"
]
:
'0'
,
0
];
...
...
template/inroutes.php
0 → 100644
View file @
cf61be32
<?php
namespace
AloVoice
;
?>
<style>
.alv_table_lines
.nowrp
{
white-space
:
nowrap
;
}
.loadingline
{
display
:
none
;
}
</style>
<center>
<h3
class=
"h3 card-body"
>
Входящие звонки
</h3>
<div
class=
"loadingline"
></div>
<a
href=
"#"
onClick=
"addNewinRoute()"
id=
"inroute_add_button"
class=
"btn btn-primary title_line_button"
><i
class=
"fa fa-plus"
></i>
Добавить
</a>
</center>
<br/>
<table
class=
"table"
id=
"stats_block_table"
>
<thead>
<tr
id=
"inroutes_table_header"
></tr>
</thead>
<tbody
id=
"inroutes_table_body"
>
</tbody>
</table>
<script>
var
delOneDid
=
function
(
cid
,
did
,
me
){
if
(
typeof
me
!=
'
undefined
'
){
$
(
me
).
html
(
'
<i class="fa fa-spinner fa-spin"></i> Удаление...
'
);
}
doAloVoiceCmd
(
'
removeInroute
'
,
{
"
cidnum
"
:
cid
,
"
extension
"
:
did
},
function
(
res
)
{
console
.
log
(
"
--== DEL inROUTE RES:
"
,
res
);
$
(
"
#inroutes-tab
"
).
click
();
});
};
var
loadAlVOperators
=
function
(
destination_code
){
$
(
"
#destination_code_container
"
).
html
(
'
<span>Загрузка...</span>
'
);
loadAloVoiceInfo
(
"
alovoice_get_operators_nums
"
,
function
(
operators
){
$
(
"
#destination_code_container
"
).
html
(
''
);
$
(
"
#destination_code_container
"
).
append
(
'
<select id="inrt_destination_code" class="form-control inrouteinp"></select>
'
);
$
.
each
(
operators
,
function
(
num
,
operator
)
{
var
selexttxt
=
(
typeof
destination_code
!=
'
undefined
'
&&
destination_code
==
num
)
?
'
selected
'
:
''
;
$
(
"
#inrt_destination_code
"
).
append
(
'
<option value="
'
+
num
+
'
"
'
+
selexttxt
+
'
>
'
+
num
+
'
-
'
+
operator
.
NAME
+
'
'
+
operator
.
LAST_NAME
+
'
</option>
'
);
});
});
}
var
loadAlVQueues
=
function
(
destination_code
){
$
(
"
#destination_code_container
"
).
html
(
'
<span>Загрузка...</span>
'
);
loadAloVoiceInfo
(
"
alovoice_get_allqueues
"
,
function
(
queues
){
console
.
log
(
"
--== Loaded All QUEUEs:
"
,
queues
);
$
(
"
#destination_code_container
"
).
html
(
''
);
$
(
"
#destination_code_container
"
).
append
(
'
<select id="inrt_destination_code" class="form-control inrouteinp"></select>
'
);
$
.
each
(
queues
,
function
(
queue
,
strategy
)
{
var
selexttxt
=
(
typeof
destination_code
!=
'
undefined
'
&&
destination_code
==
queue
)
?
'
selected
'
:
''
;
$
(
"
#inrt_destination_code
"
).
append
(
'
<option value="
'
+
queue
+
'
"
'
+
selexttxt
+
'
>
'
+
queue
+
'
-
'
+
strategy
+
'
</option>
'
);
});
});
}
var
route_destination_change
=
function
(
me
){
var
route_dest
=
$
(
me
).
val
();
console
.
log
(
"
--== Changed dest:
"
,
route_dest
);
if
(
route_dest
==
"
from-did-direct
"
){
loadAlVOperators
();
}
if
(
route_dest
==
"
ext-queues
"
){
loadAlVQueues
();
}
if
(
route_dest
==
"
timeconditions
"
){
$
(
"
#destination_code_container
"
).
html
(
""
);
}
if
(
route_dest
==
"
hangup
"
){
$
(
"
#destination_code_container
"
).
html
(
""
);
}
}
var
addNewinRoute
=
function
(
vars
){
console
.
log
(
"
Begin adding inRoute ........
"
);
var
nowTime
=
Math
.
round
(
new
Date
().
getTime
()
/
1000
);
var
description
=
(
typeof
vars
!=
'
undefined
'
&&
typeof
vars
.
description
!=
'
undefined
'
&&
vars
.
description
.
length
>
2
)
?
vars
.
description
:
'
Все
'
+
nowTime
;
var
extension
=
(
typeof
vars
!=
'
undefined
'
&&
typeof
vars
.
extension
!=
'
undefined
'
&&
vars
.
extension
.
length
)
?
vars
.
extension
:
'
Все
'
;
var
cidnum
=
(
typeof
vars
!=
'
undefined
'
&&
typeof
vars
.
cidnum
!=
'
undefined
'
&&
vars
.
cidnum
.
length
)
?
vars
.
cidnum
:
'
Все
'
;
var
mohclass
=
(
typeof
vars
!=
'
undefined
'
&&
typeof
vars
.
mohclass
!=
'
undefined
'
&&
vars
.
mohclass
.
length
)
?
vars
.
mohclass
:
'
default
'
;
var
destination
=
(
typeof
vars
!=
'
undefined
'
&&
typeof
vars
.
destination
!=
'
undefined
'
&&
vars
.
destination
.
length
)
?
vars
.
destination
:
'
default
'
;
var
destination_code
=
(
typeof
vars
!=
'
undefined
'
&&
typeof
vars
.
destination_code
!=
'
undefined
'
)
?
vars
.
destination_code
:
''
;
doAloVoiceCmd
(
'
loadDestinationsList
'
,
{},
function
(
dests
)
{
console
.
log
(
"
--===Loaded Dests:
"
,
dests
);
var
allDestsTxt
=
'
<option value="">Выберите направление...</option>
'
;
$
.
each
(
dests
,
function
(
key
,
value
)
{
var
seltxt
=
(
destination
==
value
)
?
'
selected
'
:
''
;
allDestsTxt
+=
'
<option value="
'
+
key
+
'
"
'
+
seltxt
+
'
>
'
+
value
+
'
</option>
'
;
});
aloModal
({
label
:
"
Добавить входящий маршрут
"
,
body
:
'
<form>
'
+
'
<div class="form-group">
'
+
'
<input type="text" class="form-control inrouteinp" id="inrt_description" placeholder="Введите названия" value="
'
+
description
+
'
">
'
+
'
</div>
'
+
'
<div class="form-row">
'
+
'
<div class="col form-group">
'
+
'
<label>Звонок на: (DID)</label>
'
+
'
<input type="text" class="form-control inrouteinp" id="inrt_extension" value="
'
+
extension
+
'
">
'
+
'
</div>
'
+
'
<div class="col form-group">
'
+
'
<label>Кто звонит (CallerID)</label>
'
+
'
<input type="text" class="form-control inrouteinp" id="inrt_cidnum" value="
'
+
cidnum
+
'
">
'
+
'
</div>
'
+
'
</div>
'
+
'
<div class="form-group">
'
+
'
<label>Мелодия в ожидании</label>
'
+
'
<input type="text" class="form-control inrouteinp" id="inrt_mohclass" value="
'
+
mohclass
+
'
" disabled>
'
+
'
</div>
'
+
'
<div class="form-group">
'
+
'
<label>Направление</label>
'
+
'
<select class="form-control inrouteinp" id="inrt_destination" onChange="route_destination_change(this)">
'
+
allDestsTxt
+
'
</select>
'
+
'
</div>
'
+
'
<div class="form-group" id="destination_code_container"></div>
'
// +'
<
div
class
=
"
form-group
"
>
'
// +
'
<
label
for
=
"
alv_sound_file
"
class
=
"
btn btn-primary afilelabel
"
>
Выберите
файл
записи
-
*
.
mp3
<
/label>'
// +'
<
input
type
=
"
file
"
class
=
"
sound-file-input myfileinput
"
id
=
"
alv_sound_file
"
name
=
"
alv_sound_file
"
required
accept
=
"
.mp3
"
onChange
=
"
doUpload(this)
"
>
'
// +
'
<
/div>'
+
'
</form>
'
,
btn
:
"
Сохранить
"
,
nohide
:
true
,
callback
:
function
(){
var
saveElements
=
{};
saveElements
[
"
cmd
"
]
=
"
saveInroute
"
;
$
(
"
.inrouteinp
"
).
each
(
function
(){
var
inRouteInpId
=
$
(
this
).
attr
(
'
id
'
);
var
inRouteInpCode
=
inRouteInpId
.
substr
(
5
);
var
inRouteInpVal
=
$
(
this
).
val
();
saveElements
[
inRouteInpCode
]
=
inRouteInpVal
;
});
console
.
log
(
"
TEST saveElements:
"
,
saveElements
);
$
(
"
#alvModalFooter
"
).
html
(
'
<i class="fa fa-spinner fa-spin"></i> Сохранение...
'
);
// $("#modalCloseBtn").attr("disabled",true);
// $("#alvModalSendBtn").attr("disabled",true);
loadAloVoiceInfo
(
saveElements
,
function
(
res
){
console
.
log
(
"
Save RES:
"
,
res
);
$
(
'
#alvModal
'
).
modal
(
'
hide
'
);
$
(
"
#inroutes-tab
"
).
click
();
});
}
});
});
};
var
afterLoadPage
=
function
(){
var
isHeadered
=
false
;
var
inroutesUpdate
=
function
(){
doAloVoiceCmd
(
'
loadInroutesList
'
,
{},
function
(
res
)
{
console
.
log
(
"
AloVoice Trunks RES:
"
,
res
);
if
(
!
isHeadered
){
if
(
typeof
res
.
headers
!=
'
undefined
'
){
isHeadered
=
true
;
$
(
"
#inroutes_table_header
"
).
html
(
''
);
$
.
each
(
res
.
headers
,
function
(
key
,
value
)
{
console
.
log
(
"
Each Header:
"
,
key
,
value
);
$
(
"
#inroutes_table_header
"
).
append
(
'
<th id="hd_
'
+
key
+
'
">
'
+
value
+
'
</th>
'
);
});
}
}
if
(
typeof
res
.
datas
!=
'
undefined
'
){
$
(
"
#inroutes_table_body
"
).
html
(
''
);
$
.
each
(
res
.
datas
,
function
(
irkey
,
inroute
)
{
console
.
log
(
"
Each Trunk:
"
,
inroute
);
/*
'name' => 'Название',
'route_cid' => 'Кто звонит',
'route_did' => 'Куда звонит',
'route_goto' => 'Назначение',
'route_moh' => 'Мелодия в ожидании',
*/
var
lineHTML
=
'
<tr class="alv_table_lines" id="inroute_
'
+
irkey
+
'
_" data-cid="
'
+
inroute
.
route_cid
+
'
" data-did="
'
+
inroute
.
route_cid
+
'
">
'
+
'
<td class="nowrp" > <span>
'
+
inroute
.
name
+
'
</span></td>
'
+
'
<td class="nowrp" > <b>
'
+
inroute
.
route_cid
+
'
</b></td>
'
+
'
<td class="nowrp" >
'
+
inroute
.
route_did
+
'
</td>
'
+
'
<td class="nowrp" >
'
+
inroute
.
route_goto
+
'
</td>
'
+
'
<td class="nowrp" >
'
+
inroute
.
route_moh
+
'
</td>
'
+
'
<td class="nowrp" ><a href="#" onClick="delOneDid(
\'
'
+
inroute
.
route_cid
+
'
\'
,
\'
'
+
inroute
.
route_did
+
'
\'
,this);"><i class="fa fa-trash"></i> Удалить</a></td>
'
+
'
</tr>
'
;
$
(
"
#inroutes_table_body
"
).
append
(
lineHTML
);
});
}
//setTimeout(donglesUpdate,100000);
});
}
inroutesUpdate
();
};
</script>
\ No newline at end of file
template/js/footer_queues.js
View file @
cf61be32
...
...
@@ -4,6 +4,70 @@
$
().
ready
(()
=>
{
window
.
getAllStrateges
=
function
()
{
return
[
{
title
:
"
Звонят все
"
,
value
:
"
ringall
"
,
select
:
true
},
{
title
:
"
Линейный
"
,
value
:
"
linear
"
,
},
{
title
:
"
Самому не занятому
"
,
value
:
"
leastrecent
"
,
},
{
title
:
"
Случайному
"
,
value
:
"
random
"
,
},
// {
// title: lng.strategy.rrmemory,
// value: "rrmemory",
// },
// {
// title: lng.strategy.rrordered,
// value: "rrordered",
// },
// {
// title: lng.strategy.wrandom,
// value: "wrandom",
// }
];
}
window
.
getAllGotos
=
function
()
{
var
result
=
[
// {
// title: "Не выбрано",
// value: "",
// },
{
title
:
"
Завершить звонок
"
,
value
:
"
app-blackhole,hangup,1
"
,
select
:
true
},
{
title
:
"
Голосовая почта
"
,
value
:
"
ext-local,vms1098,1
"
,
},
];
// res = res.map(function(d) {
// return {
// title: "Очередь: " + d[0],
// value: "ext-queues," + d[0] + ",1",
// };
// });
// result = [...result, ...res];
return
result
;
}
feather
.
replace
()
setWindowFunction
(
'
removeAgent
'
,
removeAgent
)
...
...
@@ -11,38 +75,75 @@ $().ready(() => {
setWindowFunction
(
'
addAgent
'
,
addAgent
)
$
(
'
#queues_add
'
).
on
(
'
click
'
,
function
()
{
var
currGoto
=
''
;
var
gotosOpts
=
''
;
window
.
getAllGotos
().
forEach
(
function
(
elm
){
var
seltxt
=
(
elm
.
select
)
?
"
seleted
"
:
""
;
gotosOpts
+=
'
<option value="
'
+
elm
.
value
+
'
"
'
+
seltxt
+
'
>
'
+
elm
.
title
+
'
</option>
'
;
});
var
strategyOpts
=
''
;
window
.
getAllStrateges
().
forEach
(
function
(
elm
){
var
seltxt
=
(
elm
.
select
)
?
"
seleted
"
:
""
;
strategyOpts
+=
'
<option value="
'
+
elm
.
value
+
'
"
'
+
seltxt
+
'
>
'
+
elm
.
title
+
'
</option>
'
;
});
swal
.
fire
({
title
:
'
Введите номер очереди
'
,
input
:
'
text
'
,
inputAttributes
:
{
autocapitalize
:
'
off
'
,
placeholder
:
'
Номер очереди
'
,
id
:
'
add_queue_inp
'
,
},
preConfirm
:
(
val
)
=>
{
if
(
!
val
)
{
Swal
.
showValidationMessage
(
`Введите номер очереди`
)
return
false
;
}
if
(
val
.
replace
(
/
\d
+/g
,
''
))
{
showCancelButton
:
true
,
cancelButtonText
:
'
Отмена
'
,
preConfirm
:
()
=>
{
var
queuenum
=
$
(
'
#add_queue_inp
'
).
val
();
var
final_destination
=
$
(
'
#final_destination
'
).
val
();
var
queue_strategy
=
$
(
'
#queue_strategy
'
).
val
();
var
queuenum
=
queuenum
.
replace
(
/
\D
+/g
,
''
);
console
.
log
(
"
Queue Params:
"
,
queuenum
,
final_destination
,
queue_strategy
);
if
(
queuenum
&&
(
queuenum
<
6000
||
queuenum
>
6999
))
{
Swal
.
showValidationMessage
(
`Некорректный номер очереди`
`Некорректный номер очереди
! <br>требуется от 6000 до 6999
`
)
return
false
;
}
return
true
;
},
showCancelButton
:
true
,
cancelButtonText
:
'
Отмена
'
,
html
:
''
+
'
<input id="add_queue_inp" class="swal2-input row mx-0" type="text">
'
+
'
<div class="row"></div>
'
+
'
<h2 class="swal2-title">Направление при не ответе: </h2>
'
+
'
<select id="final_destination" class="swal2-select row mx-0">
'
+
gotosOpts
+
'
</select>
'
+
'
<h2 class="swal2-title">Правила приёма звонок: </h2>
'
+
'
<select id="queue_strategy" class="swal2-select row mx-0">
'
+
strategyOpts
+
'
</select>
'
,
}).
then
((
result
)
=>
{
if
(
result
.
isConfirmed
)
{
var
val
=
$
(
'
#add_queue_inp
'
).
val
();
uiLoading
();
var
queuenum
=
$
(
'
#add_queue_inp
'
).
val
();
var
final_destination
=
$
(
'
#final_destination
'
).
val
();
var
queue_strategy
=
$
(
'
#queue_strategy
'
).
val
();
console
.
log
(
"
Queue SAVEing Params:
"
,
queuenum
,
final_destination
,
queue_strategy
);
doAloVoiceCmd
(
'
saveQueue
'
,
{
account
:
queuenum
,
goto
:
final_destination
,
strategy
:
queue_strategy
},
function
()
{
uiLoadingEnd
();
// alert(queuenum + ' успешно добавлен! ' + queue);
});
if
(
val
)
{
addNewQueue
(
val
);
}
}
});
})
...
...
@@ -142,8 +243,11 @@ $().ready(() => {
window
.
uiLoadingEnd
=
function
()
{
$
(
'
.app-loading
'
).
remove
();
$
(
"
#queues-tab
"
).
click
();
}
window
.
addNewQueue
=
function
(
queue
)
{
uiLoading
();
doAloVoiceCmd
(
'
addNewQueue
'
,
{
...
...
@@ -154,15 +258,24 @@ $().ready(() => {
});
}
window
.
removeQueue
=
function
(
queue
)
{
swal
.
fire
({
title
:
'
Удалить очередь
'
+
queue
,
html
:
"
Вы точно хотите удалить очередь:
"
+
queue
,
// backdrop: 'rgb(0 0 0 / 0%)'
showCancelButton
:
true
,
cancelButtonText
:
'
Отмена
'
,
confirmButtonText
:
'
удалить
'
,
}).
then
(
function
(
result
)
{
console
.
log
(
"
Test Remove Queue confirming:
"
,
result
.
isConfirmed
);
if
(
result
.
isConfirmed
)
{
uiLoading
();
doAloVoiceCmd
(
'
removeQueue
'
,
{
queue
:
queue
,
},
function
()
{
doAloVoiceCmd
(
'
removeQueue
'
,
{
queue
:
queue
},
function
()
{
uiLoadingEnd
();
$
(
'
[queue-nav]:first
'
).
trigger
(
'
click
'
);
alert
(
'
Очередь
'
+
queue
+
'
удалена
'
);
});
}
});
}
function
createMembersList
(
list
)
{
var
div
=
$
(
'
<form class="" style="max-height: 300px;max-height: calc(60vh - 100px);" />
'
);
...
...
template/js/footer_queues_orig.js
0 → 100644
View file @
cf61be32
This diff is collapsed.
Click to expand it.
template/trunks.php
View file @
cf61be32
...
...
@@ -76,8 +76,8 @@ var afterLoadPage = function(){
*/
var
trunksUpdate
=
function
(){
//if(updatingTm == true){ return; }
loadAloVoiceInfo
(
"
alovoice_trunks_list
"
,
function
(
res
){
doAloVoiceCmd
(
'
loadTrunksList
'
,
{},
function
(
res
)
{
console
.
log
(
"
AloVoice Trunks RES:
"
,
res
);
if
(
!
isHeadered
){
...
...
@@ -109,7 +109,7 @@ var afterLoadPage = function(){
+
'
<td>
'
+
trunk
.
number
+
'
</td>
'
+
'
<td>
'
+
trunk
.
maxchannels
+
'
</td>
'
+
'
<td>
'
+
status
+
'
</td>
'
+
'
<td class="nowrp" ><a href="#" onClick="updateOneTrunk(
\'
'
+
trunk
.
id
+
'
\'
);"><i class="fa fa-money"></i>
Проверить
</a></td>
'
+
'
<td class="nowrp" ><a href="#" onClick="updateOneTrunk(
\'
'
+
trunk
.
id
+
'
\'
);"><i class="fa fa-money"></i>
Настройки
</a></td>
'
+
'
</tr>
'
;
$
(
"
#alvtrunks_table_body
"
).
append
(
lineHTML
);
...
...
@@ -118,6 +118,48 @@ var afterLoadPage = function(){
//setTimeout(donglesUpdate,100000);
});
// loadAloVoiceInfo("alovoice_trunks_list",function(res){
// console.log("AloVoice Trunks RES:",res);
// if(!isHeadered){
// if(typeof res.headers != 'undefined' ){
// isHeadered = true;
// $("#alvtrunks_table_header").html('');
// $.each( res.headers, function( key, value ) {
// console.log("Each Header:",key, value);
// $("#alvtrunks_table_header").append('
<
th
id
=
"
hd_'+key+'
"
>
'
+value+
'
<
/th>'
)
;
// });
// }
// }
// if(typeof res.datas != 'undefined' ){
// $("#alvtrunks_table_body").html('');
// $.each( res.datas, function( tkey, trunk ) {
// console.log("Each Trunk:",trunk);
// /*var statusLine = (val.datas[2]=="free") ? '
<
span
style
=
"
color:green;
"
>
'
+val.datas[2]+
'
<
/span>' : val.datas
[
2
]
;
// var statusLine = (statusLine=="dialing") ? '
<
span
style
=
"
color:yellow;
"
>
'
+statusLine+
'
<
/span>' : statusLine;
// var statusLine = (statusLine=="outgoing") ? '
<
span
style
=
"
color:blue;
"
>
'
+statusLine+
'
<
/span>' : statusLine;
// //var statusLine = (val.datas[2]=="dialing") ? '
<
span
style
=
"
color:yellow;
"
>
'
+val.datas[2]+
'
<
/span>' : val.datas
[
2
]
;
// */
// let status = (trunk.status == 'On') ? '
<
span
class
=
"
active_tg_status badge badge-success
"
>
Активный
<
/span>' : '<span class="off_tg_status badge badge-secondary">Выключен</
span
>
'
;
// var lineHTML =
'
<
tr
class
=
"
alv_table_lines
"
id
=
"
trk_line_'+trunk.id+'
"
data
-
device
=
"
'+trunk.type+'
"
data
-
numcode
=
"
'+trunk.name+'
"
>
'
// +
'
<
td
class
=
"
nowrp
"
>
<
span
>
'
+trunk.id+
'
<
/span></
td
>
'
// +
'
<
td
class
=
"
nowrp
"
>
<
b
>
'
+trunk.name+
'
<
/b></
td
>
'
// +
'
<
td
class
=
"
nowrp
"
>
'
+trunk.type +
'
<
/td>'
// +'
<
td
>
'
+trunk.number+
'
<
/td>'
// +'
<
td
>
'
+trunk.maxchannels+
'
<
/td>'
// +'
<
td
>
'
+status+
'
<
/td>'
// +'
<
td
class
=
"
nowrp
"
><
a
href
=
"
#
"
onClick
=
"
updateOneTrunk(
\
''+trunk.id+'
\
');
"
><
i
class
=
"
fa fa-money
"
><
/i> Проверить</
a
><
/td>'
// +'
<
/tr>';
// $("#alvtrunks_table_body").append(lineHTML);
// });
// }
// //setTimeout(donglesUpdate,100000);
// });
}
trunksUpdate
();
...
...
vendor/alovoice/src/AloVoiceActions.php
View file @
cf61be32
...
...
@@ -189,7 +189,45 @@ class AloVoiceActions
return
false
;
}
public
function
getAlovoiceOperators
(){
public
function
getAlovoiceOperatorsNums
(
$r
=
false
){
$bxOnlineUsers
=
BxRest
::
call
(
"user.get"
,
array
(
'UF_PHONE_INNER'
=>
'_%'
,
//'IS_ONLINE' => 'Y',
));
$bxPhoneUsers
=
array
();
if
(
!
empty
(
$bxOnlineUsers
[
"result"
])){
foreach
(
$bxOnlineUsers
[
"result"
]
as
$bxonUser
){
$bxPhoneUsers
[
$bxonUser
[
"UF_PHONE_INNER"
]]
=
$bxonUser
;
}
}
return
$bxPhoneUsers
;
}
public
function
getAlovoiceAllQueues
(
$r
=
false
){
$arQueues
=
[];
$doCmds
=
$this
->
runAsteriskAction
([
'queues'
=>
new
\PAMI\Message\Action\QueueStatusAction
(),
]);
if
(
!
empty
(
$doCmds
[
'queues'
])){
$QueueStatusEvents
=
$doCmds
[
'queues'
]
->
getEvents
();
foreach
(
$QueueStatusEvents
as
$qevnt
){
$qKeys
=
$qevnt
->
getKeys
();
if
(
!
empty
(
$qKeys
[
"queue"
])
&&
$qKeys
[
"queue"
]
!=
"default"
){
$arQueues
[
$qKeys
[
"queue"
]]
=
$qKeys
[
"strategy"
];
// $arQueues[$qKeys["queue"]] = $qKeys;
// $arQueues[] = $qKeys["queue"];
}
}
}
return
$arQueues
;
}
public
function
getAlovoiceOperators
(
$r
=
false
){
$doCmds
=
$this
->
runAsteriskAction
([
'dnds'
=>
new
\PAMI\Message\Action\CommandAction
(
'database show DND'
),
...
...
vendor/alovoice/src/AloVoiceConnector.php
View file @
cf61be32
...
...
@@ -1189,6 +1189,7 @@ class AloVoiceConnector
"dashboard"
=>
array
(
"name"
=>
"АлоВойс"
,
"perms"
=>
"all"
),
"queues"
=>
array
(
"name"
=>
"Звонки"
,
"perms"
=>
"all"
),
// "chdongles" => array( "name" => "GSM линии", "perms" => "admin"),
"inroutes"
=>
array
(
"name"
=>
"Входящие"
,
"perms"
=>
"admin"
),
"trunks"
=>
array
(
"name"
=>
"Линии"
,
"perms"
=>
"admin"
),
"peers"
=>
array
(
"name"
=>
"Внут.номера"
,
"perms"
=>
"admin"
),
// "stats" => array( "name" => "Статистика агентов", "perms" => "all"),
...
...
vendor/alovoice/src/AloVoiceRest.php
View file @
cf61be32
...
...
@@ -1436,9 +1436,19 @@ sessid: 40512ed0288d707e78dc4f7ef25214ef
return
$alvActions
->
doDndToggle
(
$r
);
}
private
function
alovoice_get_operators_nums
(
$r
=
false
)
{
$alvActions
=
new
AloVoiceActions
(
$this
->
config
);
return
$alvActions
->
getAlovoiceOperatorsNums
(
$r
);
}
private
function
alovoice_get_allqueues
(
$r
=
false
)
{
$alvActions
=
new
AloVoiceActions
(
$this
->
config
);
return
$alvActions
->
getAlovoiceAllQueues
(
$r
);
}
private
function
alovoice_get_operators
(
$r
=
false
)
{
$alvActions
=
new
AloVoiceActions
(
$this
->
config
);
return
$alvActions
->
getAlovoiceOperators
();
return
$alvActions
->
getAlovoiceOperators
(
$r
);
}
private
function
alovoice_peers_list
(
$r
=
false
)
{
...
...
@@ -1478,7 +1488,7 @@ sessid: 40512ed0288d707e78dc4f7ef25214ef
return
$alvActions
->
getAlovoiceSounds
();
}
private
function
alovoice_
trunk
s_list
(
$r
=
false
)
{
private
function
alovoice_
line
s_list
(
$r
=
false
)
{
$alvActions
=
new
AloVoiceActions
(
$this
->
config
);
return
$alvActions
->
getAlovoiceTrunks
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment