mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Force close port (#6870)
* force close profile sip ports * create force_close_port function * force close profile sip ports
This commit is contained in:
@@ -50,6 +50,26 @@
|
||||
$profile_name = $database->select($sql, $parameters, 'column');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//get the port from sip profile name
|
||||
$sql = "select sip_profile_setting_value from v_sip_profile_settings ";
|
||||
$sql .= "where sip_profile_uuid = (select sip_profile_uuid from v_sip_profiles where sip_profile_name = :profile_name limit 1) ";
|
||||
$sql .= "and sip_profile_setting_name = 'sip-port' ";
|
||||
$sql .= "and sip_profile_setting_enabled = 'true' ";
|
||||
$sql .= "limit 1";
|
||||
$parameters['profile_name'] = $profile;
|
||||
$profile_port = $database->select($sql, $parameters, 'column');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//get the tls port from sip profile name
|
||||
$sql = "select sip_profile_setting_value from v_sip_profile_settings ";
|
||||
$sql .= "where sip_profile_uuid = (select sip_profile_uuid from v_sip_profiles where sip_profile_name = :profile_name limit 1) ";
|
||||
$sql .= "and sip_profile_setting_name = 'tls-sip-port' ";
|
||||
$sql .= "and sip_profile_setting_enabled = 'true' ";
|
||||
$sql .= "limit 1";
|
||||
$parameters['profile_name'] = $profile;
|
||||
$profile_tls_port = $database->select($sql, $parameters, 'column');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//validate the gateway
|
||||
if (!empty($_GET['gateway']) && is_uuid($_GET['gateway'])) {
|
||||
$gateway_name = $_GET['gateway'];
|
||||
@@ -62,6 +82,9 @@
|
||||
break;
|
||||
case "start":
|
||||
$command = "sofia profile '".$profile_name."' start";
|
||||
//ensure there are no stuck ports before trying to start the profile
|
||||
force_close_port($profile_port);
|
||||
force_close_port($profile_tls_port);
|
||||
break;
|
||||
case "stop":
|
||||
$command = "sofia profile '".$profile_name."' stop";
|
||||
|
||||
Reference in New Issue
Block a user