diff options
author | cookie <cookie@29ba0400-6e00-0410-a75a-ca02368028f8> | 2006-11-29 17:09:25 +0000 |
---|---|---|
committer | cookie <cookie@29ba0400-6e00-0410-a75a-ca02368028f8> | 2006-11-29 17:09:25 +0000 |
commit | 30876a0a85897125854226112d8de7f19a707dad (patch) | |
tree | 0e9dc32d8e596096b817242746e66a0f48f0d909 /www-ssl/inc/funktion_cron.php | |
parent | f8fbc9c0cf182963e92a176dd84c569b00ab42f5 (diff) |
cron joby aufgereumt
git-svn-id: svn://svn.cccv.de/engel-system@181 29ba0400-6e00-0410-a75a-ca02368028f8
Diffstat (limited to 'www-ssl/inc/funktion_cron.php')
-rwxr-xr-x | www-ssl/inc/funktion_cron.php | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/www-ssl/inc/funktion_cron.php b/www-ssl/inc/funktion_cron.php new file mode 100755 index 00000000..d2afa70b --- /dev/null +++ b/www-ssl/inc/funktion_cron.php @@ -0,0 +1,100 @@ +<?PHP + +function UID2DECT($UID) +{ + global $con; + $SQL = "SELECT DECT FROM `User` WHERE UID='$UID'"; + $Erg = mysql_query($SQL, $con); + return mysql_result($Erg, 0); +} +function RID2Room($RID) +{ + global $con; + $SQL = "SELECT Name FROM `Room` WHERE RID='$RID'"; + $Erg = mysql_query($SQL, $con); + return mysql_result($Erg, 0); +} + +function TID2Engeltype($TID) +{ + global $con; + $SQL = "SELECT Name FROM `EngelType` WHERE TID='$TID'"; + $Erg = mysql_query($SQL, $con); + return mysql_result($Erg, 0); +} + + +function DialNumberIAX( $DECTnumber, $Time, $RID, $TID) +{ + global $IAXenable, $IAXcontent, $IAXserver, $AnrufDelay; + + //Parameter verarbeiten + $TimeH = substr( $Time, 11, 2); + $TimeM = substr( $Time, 14, 2); + $TimeM = substr( $Time, 14, 2) + $AnrufDelay; + if( $TimeM < 0 ) + { + $TimeM += 60; + $TimeH -= 1; + } + if( $TimeH < 0 ) + $TimeH += 24; + + if( strlen( $TimeH) == 1) + $TimeH = "0".$TimeH; + + // IAX file Schareiebn + $CallFile = "/tmp/call_". date("Ymd_His"). "_$DECTnumber"; + + if( $IAXenable) + { + $file = fopen( $CallFile, 'w' ); + if( $file != FALSE) + { + fputs( $file, "Channel: IAX2/$IAXserver/Engelserver@$IAXcontent\n"); + fputs( $file, "Callerid: $IAXcontent\n"); + fputs( $file, "Context: $IAXcontent\n"); + fputs( $file, "Extension: s\n"); + fputs( $file, "MaxRetries: 3\n"); + fputs( $file, "RetryTime: 10\n"); + fputs( $file, "SetVar: TimeH=$TimeH\n"); + fputs( $file, "SetVar: TimeM=$TimeM\n"); + fputs( $file, "SetVar: DECTnumber=$DECTnumber\n"); + fputs( $file, "SetVar: Room=". RID2Room( $RID). "\n"); + fputs( $file, "SetVar: Engeltype=". TID2Engeltype( $TID). "\n"); + fclose($file); + system( "cat $CallFile"); + system( "chmod 777 $CallFile"); + system( "mv $CallFile /var/spool/asterisk/outgoing"); + } + } + else + echo "IAX is disable\n"; +} + +function DialNumberModem( $DECTnumber, $Time) +{ + global $AnrufDelay; + + //Parameter verarbeiten + $TimeH = substr( $Time, 11, 2); + $TimeM = substr( $Time, 14, 2); + $TimeM = substr( $Time, 14, 2) + $AnrufDelay; + if( $TimeM < 0 ) + { + $TimeM += 60; + $TimeH -= 1; + } + if( $TimeH < 0 ) + $TimeH += 24; + + if( strlen( $TimeH) == 1) + $TimeH = "0".$TimeH; + + SetWackeup( $DECTnumber, $TimeH, $TimeM); +} + +return 0; + +?> + |