- Fix SCCP

- Fix SIP
This commit is contained in:
PhantomVl 2019-09-25 11:10:51 +03:00
parent 859d15e140
commit e4e720a182
7 changed files with 351 additions and 229 deletions

View file

@ -677,7 +677,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$res = $this->srvinterface->sccp_core_commands(array('cmd' => 'sccp_reload'));
// $res = $this->srvinterface->sccp_core_commands(array('cmd' => 'restart_phone'));
$msg = 'Config Saved: ' . $res['Response'] . '. Info :' . $res['data'];
$msg = '<p>Config Saved: ' . $res['Response'] . ".</p> <p>Info :" . $res['data']."</p>";
// needreload();
// !TODO!: It is necessary in the future to check, and replace all server responses on correct messages. Use _(msg)
return array('status' => true, 'message' => $msg, 'reload' => true);
@ -1934,6 +1934,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$dev_ext_config = $this->dbinterface->get_db_SccpTableData("SccpDevice", array('name' => $dev_id, 'fields'=>'sip_ext'));
$data_value = array_merge($data_value, $dev_ext_config);
$data_tmp = explode(';',$dev_ext_config['sip_lines']);
$data_value['sbind']=array();
foreach ($data_tmp as $value) {
$tmp_line = explode(',',$value);
switch ($tmp_line[0]) {

View file

@ -80,6 +80,7 @@ class sipconfigs {
$tmp_bind_ip = !empty($tmp_sipsetigs['bindaddr']) ? $tmp_sipsetigs['bindaddr'] : $tmp_bind_ip;
*/
$tmp_binds = is_array($tmp_binds) ? $tmp_binds: array();
$result = array();
foreach($tmp_binds as $f_protocol => $f_bind) {
foreach($f_bind as $f_ip => $f_port) {
if (($f_ip == '0.0.0.0') || ($f_ip == '[::]')) {

View file

@ -1,4 +1,5 @@
$(document).ready(function () {
$('.sortable').sortable({
update: function (event, ui) {
// console.log(ui.item.find('input').val(), ui.item.index())
@ -82,9 +83,9 @@ $(document).ready(function () {
success: function (data) {
if (data.status === true) {
if (data.message) {
alert(data.message);
bs_alert(data.message);
} else {
alert('Data Save');
bs_alert('Data Save');
}
} else {
if (Array.isArray(data.message)) {
@ -122,7 +123,7 @@ $(document).ready(function () {
success: function (data) {
if (data.status === true) {
if (data.message) {
alert(data.message);
var old_style = bs_alert(data.message, data.reload);
}
if (data.table_reload === true) {
$('table').bootstrapTable('refresh');
@ -139,7 +140,8 @@ $(document).ready(function () {
if (data.search != null) {
location.search = data.search;
}
if (data.reload === true) {
// if (data.reload === true ) {
if (data.reload === true && old_style ===true ) {
location.reload();
}
@ -200,12 +202,12 @@ $(document).ready(function () {
// console.log(data);
if (data.status === true) {
if (data.message) {
alert(data.message);
var old_style = bs_alert(data.message, data.reload);
}
if (data.table_reload === true) {
$('table').bootstrapTable('refresh');
}
if (data.reload === true) {
if (data.reload === true && old_style === true ) {
location.reload();
}
} else {
@ -524,7 +526,6 @@ $(document).ready(function () {
});
$('.sccp_update').on('click', function (e) {
// console.log($(this).data('id'));
@ -635,6 +636,7 @@ $(document).ready(function () {
}
}
if (dev_cmd !== '') {
$.ajax({
type: 'POST',
url: 'ajax.php?module=sccp_manager&command=' + dev_cmd,
@ -643,12 +645,12 @@ $(document).ready(function () {
// console.log(data);
if (data.status === true) {
if (data.message) {
alert(data.message);
var old_style = bs_alert(data.message, data.reload);
}
if (data.table_reload === true) {
$('table').bootstrapTable('refresh');
}
if (data.reload === true) {
if (data.reload === true && old_style === true) {
location.reload();
}
} else {
@ -658,10 +660,10 @@ $(document).ready(function () {
});
} else {
if (data.message) {
alert(data.message);
bs_alert(data.message);
} else {
if (data) {
alert(data);
bs_alert(data);
}
}
}
@ -669,6 +671,7 @@ $(document).ready(function () {
}
});
}
});
@ -677,6 +680,7 @@ $(document).ready(function () {
// console.log($('#update-sccp-phone').find(':selected').data('val'));
});
});
@ -747,7 +751,7 @@ $("table").on("post-body.bs.table", function () {
});
toggle_reload_button("show");
} else {
alert(data.message);
bs_alert(data.message);
}
});
}
@ -850,7 +854,9 @@ function del_dynamic_table(pe, pclass, vdefault) {
$(this).remove();
});
} else {
curRow.find('input:text').each(function(){$(this).val('')});
curRow.find('input:text').each(function () {
$(this).val('')
});
}
}
@ -995,7 +1001,29 @@ String.prototype.hex2bin = function()
return unescape(result);
}
*/
function bs_test() {
// alert('asasasasas');
window.location.reload(false);
}
function bs_alert(data, reload)
{
if (document.getElementById('hwalert') === null) {
alert(data);
return true; // Old style
} else {
var modal = $("#hwalert");
modal.find('.modal-title').text('Success operation ');
modal.find('.modal-body').text(data);
if (typeof reload != "undefined") {
if (reload === true) {
$("#hwalert").on('hidden.bs.modal', bs_test);
}
}
$("#hwalert").modal('show');
return false;
}
}
function hex2bin(hex)
{
var bytes = [], str;
@ -1006,3 +1034,12 @@ function hex2bin(hex)
return String.fromCharCode.apply(String, bytes);
}
function sleep(milliseconds) {
var start = new Date().getTime();
for (var i = 0; i < 1e7; i++) {
if ((new Date().getTime() - start) > milliseconds) {
break;
}
}
}

View file

@ -51,3 +51,22 @@ if (empty($spage->class_error)) {
</div>
</div>
</div>
<!-- Modal alerts-->
<div class="modal" id="hwalert" tabindex="-1" role="dialog" aria-labelledby="lhwalert">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- End Modal alerts-->

View file

@ -52,3 +52,22 @@ if (empty($spage->class_error)) {
</div>
</div>
</div>
<!-- Modal alerts-->
<div class="modal" id="hwalert" tabindex="-1" role="dialog" aria-labelledby="lhwalert">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- End Modal alerts-->

View file

@ -40,3 +40,22 @@ $spage = FreePBX::create()->Sccp_manager;
</div>
</div>
</div>
<!-- Modal alerts-->
<div class="modal" id="hwalert" tabindex="-1" role="dialog" aria-labelledby="lhwalert">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- End Modal alerts-->

View file

@ -902,7 +902,33 @@ foreach ($items as $child) {
echo '<!-- END '.$child->label.' -->';
}
if ($child['type'] == 'MINFO' ) {
$res_n = (string)$child ->name;
$res_id = $npref.$res_n;
if (empty($child->class)) {
$child->class = 'form-control';
}
echo '<!-- Begin '.$child->label.' -->';
?>
<div class="modal fade malert" tabindex="-1" role="dialog" id="<?php echo $res_id;?>" aria-labelledby="<?php echo $res_n;?>">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">Modal title</h4>
</div>
<div class="modal-body">
<p>One fine body&hellip;</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<?php
echo '<!-- END '.$child->label.' -->';
}
}
?>