forked from Nethram/callblaster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demoCall.php
58 lines (43 loc) · 1.3 KB
/
demoCall.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
<?php
/**
* @file
*
* All Callblaster code is released under the GNU General Public License.
* See COPYRIGHT.txt and LICENSE.txt.
*
*....................
* www.nethram.com
*/
?>
<html>
<h2>Demo Call</h2>
<?php
require_once 'config.php';
if($_REQUEST['action']=='Get Demo Call')
{
$file = $_REQUEST['file'];
?>
<form method="post" action="demoCall.php">
<input type="hidden" name="file" value="<?php echo $file; ?>"/>
<input type="text" name="phone" placeholder="Enter phone number without + with country code Eg: 11234567890" size="80" /><br><br>
<input type="submit" name="action" value="Call" />
</form>
<?php
}
if($_REQUEST['action']=="Call")
{
$phone=$_REQUEST['phone'];
$file = $basepath."audio/".$_REQUEST['file'];
$exten = pathinfo($file);
$exten = '.'.$exten['extension'];
$fileName= $basepath."audio/".basename($file, $exten);
$callFile = "Channel: SIP/$phone\n";
$callFile .= "Application: Playback\n";
$callFile .= "CallerID: $caller_id\n";
$callFile .= "Data: $fileName\n";
file_put_contents("/tmp/demoCall.call",$callFile);
exec("cp /tmp/demoCall.call /var/spool/asterisk/outgoing/demoCall.call");
echo "<script type='text/javascript'>alert('Call initiated'); window.location='audioFile.php';</script>";
}
?>
</html>