-
Notifications
You must be signed in to change notification settings - Fork 26
/
callblaster.php
75 lines (57 loc) · 1.84 KB
/
callblaster.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/php
<?php
/**
* @file
*
* All Callblaster code is released under the GNU General Public License.
* See COPYRIGHT.txt and LICENSE.txt.
*
*....................
* www.nethram.com
*/
require('connection.php');
require($agipath.'phpagi.php');
error_reporting(E_ALL);
$agi = new AGI();
$dbid = $agi->get_variable("dbid");
$dbid=$dbid['data'];
$userNumber = $agi->get_variable("userNumber");
$userNumber = $userNumber['data'];
$audio = $agi->get_variable("userAudio");
if($audio=='')
$audio=$welcomeSound;
else
$audio = $basepath."audio/".$audio['data'];
$msg = date("r",time()). " -- Call in progress -- Number:$userNumber -- Audio:$audio\n";
file_put_contents($basepath."logs/callLog.txt",$msg,FILE_APPEND);
$query = "update logs set status='Connected' where autoID='$dbid'";
$result = mysql_query($query) or die("Database Error");
$keys="Nil";
$count=0;
do
{
if($count>2)break;
$result = $agi->get_data("$audio",5000,1);
$keys = $result['result'];
if($keys=="1" or $keys=="2") break;
$count++;
}while(($keys!=1 and $keys!=2));
$query = "update logs set options='$keys' where autoID='$dbid'";
$result = mysql_query($query) or die("Database Error");
$msg = date("r",time()). " -- User pressed $keys -- Number:$userNumber -- Audio:$audio\n";
file_put_contents($basepath."logs/callLog.txt",$msg,FILE_APPEND);
if($keys==1 or $keys=="1")
{
$agi->exec_goto($context_1,$exten_1,$priority_1);
$query = "update logs set status='Transferred' where autoID='$dbid'";
$result = mysql_query($query) or die("Database Error");
}
if($keys==2 or $keys=="2")
{
$agi->exec_goto($context_2,$exten_2,$priority_2);
$query = "update logs set status='Transferred' where autoID='$dbid'";
$result = mysql_query($query) or die("Database Error");
}
$query = "update logs set status='Completed' where autoID='$dbid'";
$result = mysql_query($query) or die("Database Error");
?>