Make the Grandstream use the lua event notify script, and add the sip profile name.

This commit is contained in:
Mark Crane
2014-06-10 03:32:35 +00:00
parent 8f3579f0d1
commit 4118edd666
2 changed files with 16 additions and 12 deletions

View File

@@ -43,6 +43,7 @@ else {
//set the variables
$cmd = check_str($_GET['cmd']);
$rdr = check_str($_GET['rdr']);
$profile = check_str($_GET['profile']);
$domain = check_str($_GET['domain']);
$user = check_str($_GET['user']);
$agent = check_str($_GET['agent']);
@@ -73,18 +74,21 @@ else {
//create the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
//lua
//$command = "api luarun app.lua event_notify ".$cmd." ".$user." ".$domain." ".$vendor;
//reboot
if ($cmd == "reboot") {
$command = "api sofia profile internal flush_inbound_reg ".$user." reboot";
//prepare the command
if ($vendor == "grandstream") {
$command = "lua app.lua event_notify ".$cmd." ".$profile." ".$user." ".$vendor;
}
//check_sync
if ($cmd == "check_sync") {
$command = "api sofia profile internal check_sync ".$user;
else {
if ($cmd == "reboot") {
$command = "sofia profile ".$profile." flush_inbound_reg ".$user." reboot";
}
if ($cmd == "check_sync") {
$command = "sofia profile ".$profile." check_sync ".$user;
}
}
//send the command
$response = event_socket_request($fp, $command);
$response = event_socket_request($fp, "api ".$command);
$response = event_socket_request($fp, "api log notice ".$command);
//show the response
$_SESSION['message'] = $text['label-event']." ".ucwords($cmd)."     ".$text['label-response'].$response;
//close the connection

View File

@@ -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-2012
Portions created by the Initial Developer are Copyright (C) 2008-2014
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -210,8 +210,8 @@ require_once "resources/check_auth.php";
//echo " <td class='".$row_style[$c]."'>&nbsp;".$row['mwi-account']."&nbsp;</td>\n";
echo " <td class='".$row_style[$c]."'>&nbsp;".$row['status']."&nbsp;</td>\n";
echo " <td class='".$row_style[$c]."' align='right'>\n";
echo " <input type='button' class='btn' value='".$text['button-reboot']."' onclick=\"document.location.href='cmd.php?cmd=reboot&user=".$row['user']."&domain=".$row['sip-auth-realm']."&agent=".urlencode($row['agent'])."';\" />\n";
echo " <input type='button' class='btn' value='".$text['button-check_sync']."' onclick=\"document.location.href='cmd.php?cmd=check_sync&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'])."';\" />\n";
echo " <input type='button' class='btn' value='".$text['button-check_sync']."' 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 " </td>\n";
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }