|
|
@ -5,14 +5,20 @@ function UID2DECT($UID)
|
|
|
|
global $con;
|
|
|
|
global $con;
|
|
|
|
$SQL = "SELECT DECT FROM `User` WHERE UID='$UID'";
|
|
|
|
$SQL = "SELECT DECT FROM `User` WHERE UID='$UID'";
|
|
|
|
$Erg = mysql_query($SQL, $con);
|
|
|
|
$Erg = mysql_query($SQL, $con);
|
|
|
|
|
|
|
|
if( mysql_num_rows( $Erg) == 1)
|
|
|
|
return mysql_result($Erg, 0);
|
|
|
|
return mysql_result($Erg, 0);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function RID2Room($RID)
|
|
|
|
function RID2Room($RID)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
global $con;
|
|
|
|
global $con;
|
|
|
|
$SQL = "SELECT Name FROM `Room` WHERE RID='$RID'";
|
|
|
|
$SQL = "SELECT Name FROM `Room` WHERE RID='$RID'";
|
|
|
|
$Erg = mysql_query($SQL, $con);
|
|
|
|
$Erg = mysql_query($SQL, $con);
|
|
|
|
|
|
|
|
if( mysql_num_rows( $Erg) == 1)
|
|
|
|
return mysql_result($Erg, 0);
|
|
|
|
return mysql_result($Erg, 0);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function TID2Engeltype($TID)
|
|
|
|
function TID2Engeltype($TID)
|
|
|
@ -20,7 +26,10 @@ function TID2Engeltype($TID)
|
|
|
|
global $con;
|
|
|
|
global $con;
|
|
|
|
$SQL = "SELECT Name FROM `EngelType` WHERE TID='$TID'";
|
|
|
|
$SQL = "SELECT Name FROM `EngelType` WHERE TID='$TID'";
|
|
|
|
$Erg = mysql_query($SQL, $con);
|
|
|
|
$Erg = mysql_query($SQL, $con);
|
|
|
|
|
|
|
|
if( mysql_num_rows( $Erg) == 1)
|
|
|
|
return mysql_result($Erg, 0);
|
|
|
|
return mysql_result($Erg, 0);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -44,6 +53,8 @@ function DialNumberIAX( $DECTnumber, $Time, $RID, $TID)
|
|
|
|
$TimeH = "0".$TimeH;
|
|
|
|
$TimeH = "0".$TimeH;
|
|
|
|
|
|
|
|
|
|
|
|
if( $IAXenable)
|
|
|
|
if( $IAXenable)
|
|
|
|
|
|
|
|
{ $Message="die-nee shisht beh-kinned , in where-neegin me-nooten . . . your shift beginns in a few minutes";
|
|
|
|
|
|
|
|
if (isset($SetHttpIAX))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$post_data = array();
|
|
|
|
$post_data = array();
|
|
|
|
$post_data['code'] = "89o8eu9cg4";
|
|
|
|
$post_data['code'] = "89o8eu9cg4";
|
|
|
@ -69,9 +80,9 @@ function DialNumberIAX( $DECTnumber, $Time, $RID, $TID)
|
|
|
|
$result = curl_exec($ch);
|
|
|
|
$result = curl_exec($ch);
|
|
|
|
echo curl_error($ch);
|
|
|
|
echo curl_error($ch);
|
|
|
|
curl_close($ch);
|
|
|
|
curl_close($ch);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
/*
|
|
|
|
{
|
|
|
|
// IAX file Schareiebn
|
|
|
|
// IAX file Schareiebn
|
|
|
|
$CallFile = "/tmp/call_". date("Ymd_His"). "_$DECTnumber";
|
|
|
|
$CallFile = "/tmp/call_". date("Ymd_His"). "_$DECTnumber";
|
|
|
|
|
|
|
|
|
|
|
@ -79,21 +90,26 @@ function DialNumberIAX( $DECTnumber, $Time, $RID, $TID)
|
|
|
|
$file = fopen( $CallFile, 'w' );
|
|
|
|
$file = fopen( $CallFile, 'w' );
|
|
|
|
if( $file != FALSE)
|
|
|
|
if( $file != FALSE)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
fputs( $file, "Channel: IAX2/$IAXserver/Engelserver@$IAXcontent\n");
|
|
|
|
fputs( $file, "Channel: SIP/$DECTnumber@$IAXserver\n"); //Ziel nummer
|
|
|
|
fputs( $file, "Callerid: $IAXcontent\n");
|
|
|
|
fputs( $file, "Callerid: Engelserver\n");
|
|
|
|
fputs( $file, "Context: $IAXcontent\n");
|
|
|
|
// fputs( $file, "Callerid: $IAXcontent\n");
|
|
|
|
|
|
|
|
// fputs( $file, "Context: $DECTnumber@$IAXserver\n");
|
|
|
|
fputs( $file, "Extension: s\n");
|
|
|
|
fputs( $file, "Extension: s\n");
|
|
|
|
fputs( $file, "MaxRetries: 3\n");
|
|
|
|
fputs( $file, "MaxRetries: 1\n");
|
|
|
|
fputs( $file, "RetryTime: 10\n");
|
|
|
|
fputs( $file, "RetryTime: 10\n");
|
|
|
|
fputs( $file, "SetVar: TimeH=$TimeH\n");
|
|
|
|
fputs( $file, "SetVar: msg=$Message\n");
|
|
|
|
fputs( $file, "SetVar: TimeM=$TimeM\n");
|
|
|
|
// fputs( $file, "SetVar: TimeH=$TimeH\n");
|
|
|
|
fputs( $file, "SetVar: DECTnumber=$DECTnumber\n");
|
|
|
|
// fputs( $file, "SetVar: TimeM=$TimeM\n");
|
|
|
|
fputs( $file, "SetVar: Room=". RID2Room( $RID). "\n");
|
|
|
|
// fputs( $file, "SetVar: DECTnumber=$DECTnumber\n");
|
|
|
|
fputs( $file, "SetVar: Engeltype=". TID2Engeltype( $TID). "\n");
|
|
|
|
// fputs( $file, "SetVar: Room=". RID2Room( $RID). "\n");
|
|
|
|
|
|
|
|
// fputs( $file, "SetVar: Engeltype=". TID2Engeltype( $TID). "\n");
|
|
|
|
fclose($file);
|
|
|
|
fclose($file);
|
|
|
|
system( "chmod 777 $CallFile");
|
|
|
|
system( "chmod 777 $CallFile");
|
|
|
|
system( "mv $CallFile /var/spool/asterisk/outgoing");
|
|
|
|
system( "mv $CallFile /var/spool/asterisk/outgoing");
|
|
|
|
}*/
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
echo "error: $CallFile not created";
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
if($DebugDECT) echo "IAX is disable\n";
|
|
|
|
if($DebugDECT) echo "IAX is disable\n";
|
|
|
|