mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-25 10:09:21 +00:00
Work on registration provision and reboot so that it works with the Cisco SPA, Yealink, Grandstream phones.
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2013
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2014
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
@@ -45,6 +45,7 @@ else {
|
||||
$rdr = check_str($_GET['rdr']);
|
||||
$profile = check_str($_GET['profile']);
|
||||
$domain = check_str($_GET['domain']);
|
||||
$show = check_str($_GET['show']);
|
||||
$user = check_str($_GET['user']);
|
||||
$agent = check_str($_GET['agent']);
|
||||
|
||||
@@ -79,7 +80,7 @@ else {
|
||||
$command = "sofia profile ".$profile." flush_inbound_reg ".$user." reboot";
|
||||
}
|
||||
else {
|
||||
$command = "lua app.lua event_notify ".$cmd." ".$profile." ".$user." ".$vendor;
|
||||
$command = "lua app.lua event_notify ".$profile." ".$cmd." ".$user." ".$vendor;
|
||||
|
||||
//if ($cmd == "check_sync") {
|
||||
// $command = "sofia profile ".$profile." check_sync ".$user;
|
||||
@@ -100,7 +101,7 @@ else {
|
||||
echo $response;
|
||||
}
|
||||
else {
|
||||
header("Location: status_registrations.php?profile=internal");
|
||||
header("Location: status_registrations.php?profile=".$profile."&show=".$show);
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -173,9 +173,9 @@ require_once "resources/check_auth.php";
|
||||
echo " <td class='".$row_style[$c]."'>".$row['network-port']." </td>\n";
|
||||
echo " <td class='".$row_style[$c]."'>".$row['status']." </td>\n";
|
||||
echo " <td class='".$row_style[$c]."' style='text-align: right;' nowrap='nowrap'>\n";
|
||||
echo " <input type='button' class='btn' value='".$text['button-unregister']."' onclick=\"document.location.href='cmd.php?cmd=unregister&profile=".$sip_profile_name."&user=".$row['user']."&domain=".$row['sip-auth-realm']."&agent=".urlencode($row['agent'])."';\" />\n";
|
||||
echo " <input type='button' class='btn' value='".$text['button-provision']."' onclick=\"document.location.href='cmd.php?cmd=check_sync&profile=".$sip_profile_name."&user=".$row['user']."&domain=".$row['sip-auth-realm']."&agent=".urlencode($row['agent'])."';\" />\n";
|
||||
echo " <input type='button' class='btn' value='".$text['button-reboot']."' onclick=\"document.location.href='cmd.php?cmd=reboot&profile=".$sip_profile_name."&user=".$row['user']."&domain=".$row['sip-auth-realm']."&agent=".urlencode($row['agent'])."';\" onclick=\"\" />\n";
|
||||
echo " <input type='button' class='btn' value='".$text['button-unregister']."' onclick=\"document.location.href='cmd.php?cmd=unregister&profile=".$sip_profile_name."&show=".$show."&user=".$row['user']."&domain=".$row['sip-auth-realm']."&agent=".urlencode($row['agent'])."';\" />\n";
|
||||
echo " <input type='button' class='btn' value='".$text['button-provision']."' onclick=\"document.location.href='cmd.php?cmd=check_sync&profile=".$sip_profile_name."&show=".$show."&user=".$row['user']."&domain=".$row['sip-auth-realm']."&agent=".urlencode($row['agent'])."';\" />\n";
|
||||
echo " <input type='button' class='btn' value='".$text['button-reboot']."' onclick=\"document.location.href='cmd.php?cmd=reboot&profile=".$sip_profile_name."&show=".$show."&user=".$row['user']."&domain=".$row['sip-auth-realm']."&agent=".urlencode($row['agent'])."';\" onclick=\"\" />\n";
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
-- Mark J Crane <markjcrane@fusionpbx.com>
|
||||
|
||||
--define explode
|
||||
function explode ( seperator, str )
|
||||
function explode ( seperator, str )
|
||||
local pos, arr = 0, {}
|
||||
for st, sp in function() return string.find( str, seperator, pos, true ) end do -- for each divider found
|
||||
table.insert( arr, string.sub( str, pos, st-1 ) ) -- attach chars left of current divider
|
||||
@@ -34,14 +34,20 @@
|
||||
end
|
||||
|
||||
--usage
|
||||
--luarun app.lua event_notify reboot 1003@domain.fusionpbx.com yealink
|
||||
--luarun app.lua event_notify internal reboot 1003@domain.fusionpbx.com yealink
|
||||
|
||||
--set the args as variables
|
||||
command = argv[2];
|
||||
profile = argv[3];
|
||||
profile = argv[2];
|
||||
command = argv[3];
|
||||
user = argv[4];
|
||||
vendor = argv[5];
|
||||
|
||||
--log the args
|
||||
--freeswitch.consoleLog("notice", "[event_notify] profile "..profile.."\n");
|
||||
--freeswitch.consoleLog("notice", "[event_notify] command "..command.."\n");
|
||||
--freeswitch.consoleLog("notice", "[event_notify] user "..user.."\n");
|
||||
--freeswitch.consoleLog("notice", "[event_notify] vendor "..vendor.."\n");
|
||||
|
||||
--get the user and domain name from the user argv user@domain
|
||||
user_table = explode("@",user);
|
||||
user = user_table[1];
|
||||
@@ -62,14 +68,14 @@
|
||||
event:addHeader('event-string', 'reboot=true');
|
||||
end
|
||||
if (command == "check_sync") then
|
||||
event:addHeader('event-string', 'check-sync;reboot=false');
|
||||
event:addHeader('event-string', 'reboot=true');
|
||||
end
|
||||
end
|
||||
|
||||
--grandstream
|
||||
if (vendor == "grandstream") then
|
||||
if (command == "reboot") then
|
||||
event:addHeader('event-string', 'reboot=true');
|
||||
event:addHeader('event-string', 'check-sync;reboot=true');
|
||||
end
|
||||
if (command == "check_sync") then
|
||||
event:addHeader('event-string', 'check-sync;reboot=false');
|
||||
@@ -79,7 +85,7 @@
|
||||
--polycom
|
||||
if (vendor == "polycom") then
|
||||
if (command == "reboot") then
|
||||
event:addHeader('event-string', 'reboot=true');
|
||||
event:addHeader('event-string', 'check-sync;reboot=true');
|
||||
end
|
||||
if (command == "check_sync") then
|
||||
event:addHeader('event-string', 'check-sync;reboot=false');
|
||||
@@ -89,7 +95,7 @@
|
||||
--yealink
|
||||
if (vendor == "yealink") then
|
||||
if (command == "reboot") then
|
||||
event:addHeader('event-string', 'reboot=true');
|
||||
event:addHeader('event-string', 'check-sync;reboot=true');
|
||||
end
|
||||
if (command == "check_sync") then
|
||||
event:addHeader('event-string', 'check-sync;reboot=false');
|
||||
@@ -98,7 +104,7 @@
|
||||
--snom
|
||||
if (vendor == "snom") then
|
||||
if (command == "reboot") then
|
||||
event:addHeader('event-string', 'reboot=true');
|
||||
event:addHeader('event-string', 'check-sync;reboot=true');
|
||||
end
|
||||
if (command == "check_sync") then
|
||||
event:addHeader('event-string', 'check-sync;reboot=false');
|
||||
@@ -109,4 +115,4 @@
|
||||
event:fire();
|
||||
|
||||
--log the event
|
||||
freeswitch.consoleLog("notice", "[event_notify] command "..command.." "..user.."@"..domain.." vendor "..tostring(vendor).."\n");
|
||||
freeswitch.consoleLog("notice", "[event_notify] command "..command.." "..user.."@"..domain.." vendor "..tostring(vendor).."\n");
|
||||
|
||||
Reference in New Issue
Block a user