Commit 4b500395 authored by Kulya's avatar Kulya 😊

sip_reg_period_to_10

parent 1b26165d
...@@ -90,6 +90,9 @@ die(); ...@@ -90,6 +90,9 @@ die();
function doCommandAjax($cmd,$r){ function doCommandAjax($cmd,$r){
switch ($cmd) { switch ($cmd) {
case 'addNewMohFile':
return addNewMohFile($r);
break;
case 'removeInroute': case 'removeInroute':
return removeInroute($r); return removeInroute($r);
break; break;
...@@ -665,8 +668,12 @@ function saveQueue($data,$r=true){ ...@@ -665,8 +668,12 @@ function saveQueue($data,$r=true){
} }
} }
$music = (!empty($data["music"])) ? $data["music"] : false;
if(empty($music) && !empty($oQueue["music"])) { $music = $oQueue["music"]; } elseif(empty($music)) {$music = 'default';}
$strategy = (!empty($data["strategy"])) ? $data["strategy"] : false; $strategy = (!empty($data["strategy"])) ? $data["strategy"] : false;
if(empty($strategy) && !empty($oQueue["strategy"])) { $strategy = $oQueue["strategy"]; } else {$strategy = 'ringall';} if(empty($strategy) && !empty($oQueue["strategy"])) { $strategy = $oQueue["strategy"]; } elseif(empty($strategy)) {$strategy = 'ringall';}
$agentannounce_id = (!empty($data["agentannounce_id"])) ? $data["agentannounce_id"] : (!empty($oQueue["agentannounce_id"])) ? $oQueue["agentannounce_id"] : NULL; $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; $joinannounce_id = (!empty($data["joinannounce_id"])) ? $data["joinannounce_id"] : (!empty($oQueue["joinannounce_id"])) ? $oQueue["joinannounce_id"] : NULL;
...@@ -713,7 +720,7 @@ function saveQueue($data,$r=true){ ...@@ -713,7 +720,7 @@ function saveQueue($data,$r=true){
$fields[] = [$account,'autopausebusy',(!empty($oQueue["autopausebusy"])) ? $oQueue["autopausebusy"] : 'no',0]; $fields[] = [$account,'autopausebusy',(!empty($oQueue["autopausebusy"])) ? $oQueue["autopausebusy"] : 'no',0];
$fields[] = [$account,'autopauseunavail',(!empty($oQueue["autopauseunavail"])) ? $oQueue["autopauseunavail"] : 'no',0]; $fields[] = [$account,'autopauseunavail',(!empty($oQueue["autopauseunavail"])) ? $oQueue["autopauseunavail"] : 'no',0];
$fields[] = [$account,'music',(!empty($oQueue["music"])) ? $oQueue["music"] : 'default',0]; $fields[] = [$account,'music',$music,0];
//there can be multiple members //there can be multiple members
...@@ -834,3 +841,67 @@ function makeMembers($members){ ...@@ -834,3 +841,67 @@ function makeMembers($members){
return $members; return $members;
} }
function addNewMohFile( $r=[] ) {
if(empty($r["arfile"])){
return false;
}
global $db,$astman,$amp_conf;
$arFile = $r["arfile"];
$mohdir = '/var/lib/asterisk/moh/';
$uniqName = $arFile["time"];
$newMohDir = $mohdir.$uniqName;
$newMohFileName = $newMohDir."/".$uniqName;
$newMohFile = $newMohFileName.".".$arFile["ext"];
if(!is_dir($newMohDir)){
mkdir($newMohDir,0777);
}
if(!empty($arFile["filepath"]) && file_exists($arFile["filepath"])){
$origFile = $arFile["filepath"];
// copy($arFile["filepath"],$newMohFile);
}
$media = \FreePBX::Media(); //\FreePBX::Music()->Media;
// $media = $fbxMusic->Media();
$media->load($origFile);
$arCodecs = ["alaw","ulaw","g722","wav"];
foreach($arCodecs as $codec) {
$fmpath = $newMohFileName.".".$codec;
if(!file_exists($fmpath)) {
$media->convert($fmpath);
}
}
$db = \FreePBX::Database();
$sql = "INSERT INTO music (`category`, `type`, `application`, `format`) VALUES ('".$uniqName."', 'files', '', '')";
$ob = $db->query($sql);
return $db->lastInsertId();
}
function addCategoryById( $id, $name, $type ) {
$name = iconv("UTF-8", "ISO-8859-1//TRANSLIT", $name);
$name = preg_replace("/\s+|'+|`+|\\+|\/+|\"+|<+|>+|\?+|\*|\.+|&+|\|/","",$name);
$name = basename($name);
$cat = $this->getCategoryByName($name);
if(!empty($cat)) {
$this->message = array(
"type" => "danger",
"message" => _("Category Already Exists")
);
return;
}
$sql = "INSERT INTO music (`id`, `category`, `type`) VALUES (?, ?,?)";
$sth = $this->db->prepare($sql);
$sth->execute(array($id,$name,$type));
if(!file_exists($this->mohpath . "/" . $name)) {
mkdir($this->mohpath . "/" . $name);
}
needreload();
}
\ No newline at end of file
...@@ -28,6 +28,12 @@ document, html, body { ...@@ -28,6 +28,12 @@ document, html, body {
width:100%; width:100%;
font-family: "OpenSans-Semibold","Helvetica Neue",Arial,Helvetica,sans-serif !important; font-family: "OpenSans-Semibold","Helvetica Neue",Arial,Helvetica,sans-serif !important;
} }
.alvcontainer{
padding:0 !important;
margin:0 !important;
width: 100% !important;
height: 100% !important;
}
.afilelabel { .afilelabel {
/* width: 250px; */ /* width: 250px; */
height: 40px; height: 40px;
...@@ -70,6 +76,7 @@ document, html, body { ...@@ -70,6 +76,7 @@ document, html, body {
} }
#alv_mainblock{ #alv_mainblock{
padding-top: 50px; padding-top: 50px;
height: 100%;
} }
.alv_topmenu a.active { .alv_topmenu a.active {
font-weight: bold; font-weight: bold;
...@@ -83,6 +90,7 @@ document, html, body { ...@@ -83,6 +90,7 @@ document, html, body {
.alv_topmenu{ .alv_topmenu{
display: inline-flex; display: inline-flex;
box-shadow: 0 6px 15px -15px #000; box-shadow: 0 6px 15px -15px #000;
margin:auto !important;
} }
.alv_topmenu:hover { .alv_topmenu:hover {
background-color: #ececff; background-color: #ececff;
......
...@@ -33,6 +33,13 @@ var delOneDid = function(cid,did,me){ ...@@ -33,6 +33,13 @@ var delOneDid = function(cid,did,me){
}); });
}; };
var loadAlovoiceSounds = function(){
loadAloVoiceInfo("alovoice_soundfiles_list",function(sounds){
console.log("--== get sounds RES:",sounds);
});
}
var loadAlVOperators = function(destination_code){ var loadAlVOperators = function(destination_code){
$("#destination_code_container").html('<span>Загрузка...</span>'); $("#destination_code_container").html('<span>Загрузка...</span>');
loadAloVoiceInfo("alovoice_get_operators_nums",function(operators){ loadAloVoiceInfo("alovoice_get_operators_nums",function(operators){
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
$().ready(() => { $().ready(() => {
window.getAllStrateges = function () { window.getAllStrateges = function () {
return [ return [
{ {
...@@ -87,12 +88,15 @@ $().ready(() => { ...@@ -87,12 +88,15 @@ $().ready(() => {
console.log("--===Each goto:",key, value); console.log("--===Each goto:",key, value);
gotosOpts += '<option value="'+key+'"'+seltxt+'>'+value+'</option>'; gotosOpts += '<option value="'+key+'"'+seltxt+'>'+value+'</option>';
}); });
// console.log("--===Loaded gotosOpts:",gotosOpts);
// window.getAllGotos().forEach(function(elm){ loadAloVoiceInfo("alovoice_soundfiles_list",function(sounds){
// var seltxt = (elm.select) ? " seleted" : ""; console.log("--== get sounds RES:",sounds);
// gotosOpts += '<option value="'+elm.value+'"'+seltxt+'>'+elm.title+'</option>';
// }); var soundsOpts = '';
$.each( sounds, function( key, value ) {
var seltxt = (typeof queue_music != 'undefined' && queue_music==key) ? " seleted" : "";
soundsOpts += '<option value="'+key+'"'+seltxt+'>'+value.title+'</option>';
});
var strategyOpts = ''; var strategyOpts = '';
window.getAllStrateges().forEach(function(elm){ window.getAllStrateges().forEach(function(elm){
...@@ -133,6 +137,12 @@ $().ready(() => { ...@@ -133,6 +137,12 @@ $().ready(() => {
+strategyOpts +strategyOpts
+'</select>' +'</select>'
+'<h2 class="swal2-title">Музыка в ожидании: </h2> '
+'<select id="music" class="swal2-select row mx-0">'
+soundsOpts
+'</select>'
+'<h2 class="swal2-title">Все время ожидание в очереди (сек): </h2> ' +'<h2 class="swal2-title">Все время ожидание в очереди (сек): </h2> '
+'<input id="queue_maxwait" class="swal2-input row mx-0" type="number" value="0"> <small>0 - Неограничено</small>' +'<input id="queue_maxwait" class="swal2-input row mx-0" type="number" value="0"> <small>0 - Неограничено</small>'
...@@ -153,14 +163,16 @@ $().ready(() => { ...@@ -153,14 +163,16 @@ $().ready(() => {
var final_destination = $('#final_destination').val(); var final_destination = $('#final_destination').val();
var queue_destination_code = $('#queue_destination_code').val(); var queue_destination_code = $('#queue_destination_code').val();
var queue_strategy = $('#queue_strategy').val(); var queue_strategy = $('#queue_strategy').val();
var music = $('#music').val();
console.log("Queue SAVEing Params:",queuenum, final_destination, queue_destination_code, queue_strategy ); console.log("Queue SAVEing Params:",queuenum, final_destination, queue_destination_code, queue_strategy, music );
doAloVoiceCmd('saveQueue', { doAloVoiceCmd('saveQueue', {
account: queuenum, account: queuenum,
goto: final_destination, goto: final_destination,
queue_destination_code: queue_destination_code, queue_destination_code: queue_destination_code,
strategy: queue_strategy strategy: queue_strategy,
music: music
}, function() { }, function() {
uiLoadingEnd(); uiLoadingEnd();
// alert(queuenum + ' успешно добавлен! ' + queue); // alert(queuenum + ' успешно добавлен! ' + queue);
...@@ -169,6 +181,7 @@ $().ready(() => { ...@@ -169,6 +181,7 @@ $().ready(() => {
} }
}); });
}); });
});
}) })
/** /**
......
...@@ -10,6 +10,10 @@ ...@@ -10,6 +10,10 @@
position: absolute; position: absolute;
width: 100%; width: 100%;
left: 0; left: 0;
height: calc(100% - 50px);
}
.queues_incontent{
height: calc(100% - 40px);
} }
.queues_agent_icon { .queues_agent_icon {
position: absolute; position: absolute;
...@@ -19,16 +23,24 @@ ...@@ -19,16 +23,24 @@
width: 22px; width: 22px;
height: 22px; height: 22px;
} }
#footer_panel{
width:100%;
}
</style> </style>
<div class="queues_content px-2 pt-5"> <div class="queues_content px-2">
<!-- <div class="row" > <!-- <div class="row" > pt-5 border
<h3 class="h3 card-body text-center">Звонки</h3> <h3 class="h3 card-body text-center">Звонки</h3>
</div> --> </div> -->
<div class="row p-1 bg-light border"> <div class="row p-1 bg-light queues_incontent">
<div class="col-8"> <div class="col-8">
<div id="agents"></div> <div id="agents"></div>
<div>
</div>
<div class="col-4" id="queues"></div>
</div>
<div id="footer_panel">
<button type="button" class="btn btn-outline-info" id="queues_update"> <button type="button" class="btn btn-outline-info" id="queues_update">
<i data-feather="rotate-ccw" class="w-2 h-2" width="0.7em" height="0.7em"></i> Обновить <i data-feather="rotate-ccw" class="w-2 h-2" width="0.7em" height="0.7em"></i> Обновить
</button> </button>
...@@ -36,9 +48,6 @@ ...@@ -36,9 +48,6 @@
<i data-feather="plus" class="w-2 h-2" width="0.7em" height="0.7em"></i> Добавить очередь <i data-feather="plus" class="w-2 h-2" width="0.7em" height="0.7em"></i> Добавить очередь
</button> </button>
</div> </div>
</div>
<div class="col-4" id="queues"></div>
</div>
</div> </div>
......
...@@ -143,11 +143,18 @@ function addNewSoundAccount(){ ...@@ -143,11 +143,18 @@ function addNewSoundAccount(){
var soundName = $("#alv_sound_name").val(); var soundName = $("#alv_sound_name").val();
if(!soundName){ alert("No Name sound"); return true; } if(!soundName){ alert("No Name sound"); return true; }
var saveElements = window.uploadedarfile; var saveElements = window.uploadedarfile;
loadAloVoiceInfo({
"cmd": "addNewMohFile",
"arfile": window.uploadedarfile,
},function(res){
console.log("Save RES MOH: ",res);
if(typeof res != 'undefined' && res){
saveElements["restmethod"] = "savealovoiceonesound"; saveElements["restmethod"] = "savealovoiceonesound";
saveElements["title"] = soundName; saveElements["title"] = soundName;
saveElements["moh_id"] = res;
loadAloVoiceInfo(saveElements,function(res){ loadAloVoiceInfo(saveElements,function(res){
console.log("Save RES: ",res); console.log("Save RES: ",res);
...@@ -167,5 +174,9 @@ function addNewSoundAccount(){ ...@@ -167,5 +174,9 @@ function addNewSoundAccount(){
} }
}); });
}
});
} }
</script> </script>
\ No newline at end of file
...@@ -14,6 +14,7 @@ class AloVoiceActions ...@@ -14,6 +14,7 @@ class AloVoiceActions
private $options; private $options;
private $client; private $client;
private $configs; private $configs;
private $mohdir;
public function __construct($config,$conn=false) { public function __construct($config,$conn=false) {
//$config = ALVC::getConfigs(); //$config = ALVC::getConfigs();
...@@ -41,6 +42,7 @@ class AloVoiceActions ...@@ -41,6 +42,7 @@ class AloVoiceActions
} }
$this->configs = $config; $this->configs = $config;
$this->mohdir = "/var/lib/asterisk/moh/";
} }
public function doAction() { public function doAction() {
...@@ -816,6 +818,9 @@ class AloVoiceActions ...@@ -816,6 +818,9 @@ class AloVoiceActions
public function getAlovoiceSaveSound($arfile=false){ public function getAlovoiceSaveSound($arfile=false){
unset($arfile["restmethod"]); unset($arfile["restmethod"]);
$mohdir = $this->mohdir;
$soundsDir = ALVC::getSoundsPath(); $soundsDir = ALVC::getSoundsPath();
$soundsJSON = $soundsDir.'sounds.json'; $soundsJSON = $soundsDir.'sounds.json';
$arSounds = []; $arSounds = [];
......
...@@ -1702,7 +1702,7 @@ AppGUID=00DE6AE6-4E26-EB11-ACBB-6D762EC99F4D ...@@ -1702,7 +1702,7 @@ AppGUID=00DE6AE6-4E26-EB11-ACBB-6D762EC99F4D
Mailbox= Mailbox=
PhoneNumber= PhoneNumber=
MWI=1 MWI=1
RegisterPeriod=600 RegisterPeriod=10
ConnectionType=0 ConnectionType=0
NoFallback=0 NoFallback=0
Alias=0 Alias=0
......
...@@ -1483,6 +1483,10 @@ sessid: 40512ed0288d707e78dc4f7ef25214ef ...@@ -1483,6 +1483,10 @@ sessid: 40512ed0288d707e78dc4f7ef25214ef
return $alvActions->getAlovoiceSaveSound($r); return $alvActions->getAlovoiceSaveSound($r);
} }
private function alovoice_soundfiles_list($r=false) {
$alvActions = new AloVoiceActions($this->config);
return $alvActions->getAlovoiceSoundsList();
}
private function alovoice_sounds_list($r=false) { private function alovoice_sounds_list($r=false) {
$alvActions = new AloVoiceActions($this->config); $alvActions = new AloVoiceActions($this->config);
return $alvActions->getAlovoiceSounds(); return $alvActions->getAlovoiceSounds();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment