<html><title>Kannel</title><body bgcolor="#000000" style="COLOR: #ffffff;"><?php
// Description: A PHP script to configure/monitor your kannel server // Notes: I cant get the `log-level` setting to work. I dont know how // it expects the parameter to be named. IF YOU KNOW HOW, OR HAVE ANY // IMPROVEMENTS ON THIS SCRIPT, PLEASE SHARE WITH ME :-) // - Mike: [EMAIL PROTECTED] (T.I.A.) // Config -- set your own settings here -----------------------------------// $paswd_page = "mypass"; // Choose your own... $paswd_admn = "password=admin1"; // From kannel config: `admin-password` $paswd_stat = "password=status1"; // From kannel config: `status-password` $url = "http://localhost:13000"; // PORT# from kannel config: `admin-port` $filePath = "myserver/kannel"; // Path to this file on your www server // ------------------------------------------------------------------------ \\ // Require SSL and password if(($_SERVER['SERVER_PORT']==443 and $_GET['pwd']==$paswd_page)==false){ print "Access forbidden. Go away!<br/>"; exit; } // Links $link_prefix = "https://$filePath/?"; $links = array( "Status" => "c=status.html&pwd=$paswd_page", "Store Status" => "c=store-status.html&pwd=$paswd_page", "Restart" => "c=resume&pwd=$paswd_page", "Shutdown" => "c=shutdown&pwd=$paswd_page", "Resume" => "c=resume&pwd=$paswd_page", "Flush DLR" => "c=flush-dlr&pwd=$paswd_page", "<b>Log-Level:</b>" => "", "Debug" => "c=loglevel&l=0&pwd=$paswd_page", "Information" => "c=loglevel&l=1&pwd=$paswd_page", "Warning" => "c=loglevel&l=2&pwd=$paswd_page", "Error" => "c=loglevel&l=3&pwd=$paswd_page", "Panic" => "c=loglevel&l=4&pwd=$paswd_page" ); // Make links print "<table border='1' width='100%' bgcolor='#ffff00'><tr>\n"; foreach($links as $name => $value){ print "<td><a href='{$link_prefix}{$value}'>$name</a></td>\n"; if($name=="Flush DLR"){print "</tr>\n<tr>";} } print "</tr></table>\n<hr>"; // Function: function kannelCmd($url, $cmd, $password=NULL){ print "Running command: <b>$cmd</b><hr>"; $out = implode ('', file ("$url/$cmd?$password")); echo $out; } function kannelLog($url, $level, $password=NULL){ print "Setting log-level: <b>$level</b><hr>"; $out = implode ('', file ("$url/log-level?loglevel=$level&$password")); echo $out; } // Process switch($_GET['c']){ case "status.html": kannelCmd($url,$_GET['c'],$paswd_stat); break; case "store-status.html": kannelCmd($url,$_GET['c'],$paswd_stat); break; case "loglevel": kannelLog($url,$_GET['l'],$paswd_admn); break; case "suspend"; kannelCmd($url,$_GET['c'],$paswd_admn); break; case "isolate"; kannelCmd($url,$_GET['c'],$paswd_admn); break; case "restart"; kannelCmd($url,$_GET['c'],$paswd_admn); break; case "resume"; kannelCmd($url,$_GET['c'],$paswd_admn); break; case "shutdown"; kannelCmd($url,$_GET['c'],$paswd_admn); break; case "flush-dlr"; kannelCmd($url,$_GET['c'],$paswd_admn); break; // TODO: // case "start-smc"; kannelCmd($url,$_GET['c'],$paswd_admn); break; // case "stop-smc"; kannelCmd($url,$_GET['c'],$paswd_admn); break; default: print "<pre> Use: index.php?c=<command> Status: BETA (sms-id parameter does not work in this PHP script) Kannel HTTP Administration Commands Get the current status of the gateway in a text version. Tells the current state and total number of messages relied and queuing in the system right now. Also lists the total number of smsbox and wapbox connections. No password required, unless status-password set, in which case either that or main admin password must be supplied. not implemented: status.txt ; status.xml ; status status.html Get the current content of the store queue of the gateway in a text version. No password required, unless status-password set, in which case either that or main admin password must be supplied. not implemented: store-status.txt ; store-status ; store-status.xml store-status.html Set Kannel state as 'suspended'. Password required. suspend Set Kannel state as 'isolated'. Password required. isolate Set Kannel state as 'running' if it is suspended or isolated. Password required. resume Bring down the gateway, by setting state to 'shutdown'. After a shutdown is initiated, there is no other chance to resume normal operation. However, 'status' command still works. Password required. If shutdown is sent for a second time, the gateway is forced down, even if it has still messages in queue. shutdown If Kannel state is 'suspended' this will flush all queued DLR messages in the current storage space. Password required. flush-dlr Re-start whole bearerbox, hence all SMSC links. Password required. Beware that you loose the smsbox connections in such a case. restart Set Kannel log-level of log-files while running. This allows you to change the current log-level of the log-files on the fly. 0 Debug; 1 Information; 2 Warning; 3 Error; 4 Panic log-level Re-start a single SMSC link. Password required. Additionally the smsc parameter must be given to identify which smsc-id should be re-started. not implemented: start-smsc Shutdown a single SMSC link. Password required. Additionally the smsc parameter must be given. not implemented: stop-smsc </pre>"; }//switch ?></body></html>
