freeswitch/scripts/call.php
Raymond Chandler 85529d1aa2 now it'll work for other people too ;-)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12127 d0543943-73ff-0310-b7d9-9358b9ac24b2
2009-02-18 00:02:11 +00:00

32 lines
1015 B
PHP

<?php
require_once('ESL.php');
$my_company_DID = '2135551212';
$my_company_domain = 'mydomain.com';
$groups = array('default'
, 'support'
, 'billing'
, 'sales'
);
$esl = new ESLconnection('127.0.0.1', '8021', 'ClueCon');
if (is_array($_REQUEST) && !empty($_REQUEST['callee'])) {
$callee = str_replace(array('.', '(', ')', '-', ' '), '', $_REQUEST['callee']);
$callee = ereg_replace('^(1|\+1)?([2-9][0-9]{2}[2-9][0-9]{6})$', '1\2', $callee);
$group = !empty($_REQUEST['group']) ? $_REQUEST['group'] : 'default';
$command_string = "api originate GROUP/$group &transfer($callee LCR)";
echo $command_string;
$res = $esl->sendRecv($command_string);
} else {
echo "<form><br>\n";
echo "Your Number: <input name=\"callee\"><br>\n";
echo "Department: <select name=\"group\">";
foreach ($groups as $group) {
echo "<option value=\"$group\">$group</option>";
}
echo "</select>";
echo "<input type=\"submit\" value=\"Call Me\">";
echo "</form>";
}