Work on registration provision and reboot so that it works with the Cisco SPA, Yealink, Grandstream phones.
This commit is contained in:
parent
b9f44fb80f
commit
b372c94269
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
The Initial Developer of the Original Code is
|
The Initial Developer of the Original Code is
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
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.
|
the Initial Developer. All Rights Reserved.
|
||||||
|
|
||||||
Contributor(s):
|
Contributor(s):
|
||||||
|
|
@ -45,6 +45,7 @@ else {
|
||||||
$rdr = check_str($_GET['rdr']);
|
$rdr = check_str($_GET['rdr']);
|
||||||
$profile = check_str($_GET['profile']);
|
$profile = check_str($_GET['profile']);
|
||||||
$domain = check_str($_GET['domain']);
|
$domain = check_str($_GET['domain']);
|
||||||
|
$show = check_str($_GET['show']);
|
||||||
$user = check_str($_GET['user']);
|
$user = check_str($_GET['user']);
|
||||||
$agent = check_str($_GET['agent']);
|
$agent = check_str($_GET['agent']);
|
||||||
|
|
||||||
|
|
@ -79,7 +80,7 @@ else {
|
||||||
$command = "sofia profile ".$profile." flush_inbound_reg ".$user." reboot";
|
$command = "sofia profile ".$profile." flush_inbound_reg ".$user." reboot";
|
||||||
}
|
}
|
||||||
else {
|
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") {
|
//if ($cmd == "check_sync") {
|
||||||
// $command = "sofia profile ".$profile." check_sync ".$user;
|
// $command = "sofia profile ".$profile." check_sync ".$user;
|
||||||
|
|
@ -100,7 +101,7 @@ else {
|
||||||
echo $response;
|
echo $response;
|
||||||
}
|
}
|
||||||
else {
|
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['network-port']." </td>\n";
|
||||||
echo " <td class='".$row_style[$c]."'>".$row['status']." </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 " <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-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."&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."&user=".$row['user']."&domain=".$row['sip-auth-realm']."&agent=".urlencode($row['agent'])."';\" onclick=\"\" />\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 " </td>\n";
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
if ($c==0) { $c=1; } else { $c=0; }
|
if ($c==0) { $c=1; } else { $c=0; }
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
-- Mark J Crane <markjcrane@fusionpbx.com>
|
-- Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
|
|
||||||
--define explode
|
--define explode
|
||||||
function explode ( seperator, str )
|
function explode ( seperator, str )
|
||||||
local pos, arr = 0, {}
|
local pos, arr = 0, {}
|
||||||
for st, sp in function() return string.find( str, seperator, pos, true ) end do -- for each divider found
|
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
|
table.insert( arr, string.sub( str, pos, st-1 ) ) -- attach chars left of current divider
|
||||||
|
|
@ -34,14 +34,20 @@
|
||||||
end
|
end
|
||||||
|
|
||||||
--usage
|
--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
|
--set the args as variables
|
||||||
command = argv[2];
|
profile = argv[2];
|
||||||
profile = argv[3];
|
command = argv[3];
|
||||||
user = argv[4];
|
user = argv[4];
|
||||||
vendor = argv[5];
|
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
|
--get the user and domain name from the user argv user@domain
|
||||||
user_table = explode("@",user);
|
user_table = explode("@",user);
|
||||||
user = user_table[1];
|
user = user_table[1];
|
||||||
|
|
@ -62,14 +68,14 @@
|
||||||
event:addHeader('event-string', 'reboot=true');
|
event:addHeader('event-string', 'reboot=true');
|
||||||
end
|
end
|
||||||
if (command == "check_sync") then
|
if (command == "check_sync") then
|
||||||
event:addHeader('event-string', 'check-sync;reboot=false');
|
event:addHeader('event-string', 'reboot=true');
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--grandstream
|
--grandstream
|
||||||
if (vendor == "grandstream") then
|
if (vendor == "grandstream") then
|
||||||
if (command == "reboot") then
|
if (command == "reboot") then
|
||||||
event:addHeader('event-string', 'reboot=true');
|
event:addHeader('event-string', 'check-sync;reboot=true');
|
||||||
end
|
end
|
||||||
if (command == "check_sync") then
|
if (command == "check_sync") then
|
||||||
event:addHeader('event-string', 'check-sync;reboot=false');
|
event:addHeader('event-string', 'check-sync;reboot=false');
|
||||||
|
|
@ -79,7 +85,7 @@
|
||||||
--polycom
|
--polycom
|
||||||
if (vendor == "polycom") then
|
if (vendor == "polycom") then
|
||||||
if (command == "reboot") then
|
if (command == "reboot") then
|
||||||
event:addHeader('event-string', 'reboot=true');
|
event:addHeader('event-string', 'check-sync;reboot=true');
|
||||||
end
|
end
|
||||||
if (command == "check_sync") then
|
if (command == "check_sync") then
|
||||||
event:addHeader('event-string', 'check-sync;reboot=false');
|
event:addHeader('event-string', 'check-sync;reboot=false');
|
||||||
|
|
@ -89,7 +95,7 @@
|
||||||
--yealink
|
--yealink
|
||||||
if (vendor == "yealink") then
|
if (vendor == "yealink") then
|
||||||
if (command == "reboot") then
|
if (command == "reboot") then
|
||||||
event:addHeader('event-string', 'reboot=true');
|
event:addHeader('event-string', 'check-sync;reboot=true');
|
||||||
end
|
end
|
||||||
if (command == "check_sync") then
|
if (command == "check_sync") then
|
||||||
event:addHeader('event-string', 'check-sync;reboot=false');
|
event:addHeader('event-string', 'check-sync;reboot=false');
|
||||||
|
|
@ -98,7 +104,7 @@
|
||||||
--snom
|
--snom
|
||||||
if (vendor == "snom") then
|
if (vendor == "snom") then
|
||||||
if (command == "reboot") then
|
if (command == "reboot") then
|
||||||
event:addHeader('event-string', 'reboot=true');
|
event:addHeader('event-string', 'check-sync;reboot=true');
|
||||||
end
|
end
|
||||||
if (command == "check_sync") then
|
if (command == "check_sync") then
|
||||||
event:addHeader('event-string', 'check-sync;reboot=false');
|
event:addHeader('event-string', 'check-sync;reboot=false');
|
||||||
|
|
@ -109,4 +115,4 @@
|
||||||
event:fire();
|
event:fire();
|
||||||
|
|
||||||
--log the event
|
--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");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue