Skip to content

Instantly share code, notes, and snippets.

@cloudvoxcode
Created August 6, 2009 21:47
Show Gist options
  • Save cloudvoxcode/163587 to your computer and use it in GitHub Desktop.
Save cloudvoxcode/163587 to your computer and use it in GitHub Desktop.
Receive phone call with PHP
#!/usr/bin/php -q
<?php
# Cloudvox - answer and control a phone call using PHP
# Place and receive phone calls via open API: http://cloudvox.com/
# Learn about call scripting, Asterisk/AGI, voice apps: http://help.cloudvox.com/
require('phpagi.php');
set_time_limit(30);
$AGI = new AGI();
$AGI->answer();
$AGI->exec("Swift", "\"Thank you for calling Cloudvox. Enter a 6 digit number.\"");
$AGI->exec("Read", 'pin||6|skip|2|10');
$pin = $AGI->get_variable("pin");
$AGI->exec("Swift", "\"You entered .\"");
$AGI->exec("SayDigits", $pin);
?>
# default: off
# description: xinetd to accept Cloudvox connection to PHP FastAGI server
# more or try it: http://help.cloudvox.com/
service cloudvox
{
socket_type = stream
type = UNLISTED
user = root
group = nobody
log_on_failure += USERID HOST
port = 4573
wait = no
protocol = tcp
bind = 0.0.0.0
disable = no
server = /full/path/to/cloudvox-example-call-in.php
# examples:
# server = /home/sally/cloudvox-example-call-in.php
# Note: PHP script must have correct path to PHP, and be executable (chmod +x)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment