2
0

call.php 1015 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. require_once('ESL.php');
  3. $my_company_DID = '2135551212';
  4. $my_company_domain = 'mydomain.com';
  5. $groups = array('default'
  6. , 'support'
  7. , 'billing'
  8. , 'sales'
  9. );
  10. $esl = new ESLconnection('127.0.0.1', '8021', 'ClueCon');
  11. if (is_array($_REQUEST) && !empty($_REQUEST['callee'])) {
  12. $callee = str_replace(array('.', '(', ')', '-', ' '), '', $_REQUEST['callee']);
  13. $callee = ereg_replace('^(1|\+1)?([2-9][0-9]{2}[2-9][0-9]{6})$', '1\2', $callee);
  14. $group = !empty($_REQUEST['group']) ? $_REQUEST['group'] : 'default';
  15. $command_string = "api originate GROUP/$group &transfer($callee LCR)";
  16. echo $command_string;
  17. $res = $esl->sendRecv($command_string);
  18. } else {
  19. echo "<form><br>\n";
  20. echo "Your Number: <input name=\"callee\"><br>\n";
  21. echo "Department: <select name=\"group\">";
  22. foreach ($groups as $group) {
  23. echo "<option value=\"$group\">$group</option>";
  24. }
  25. echo "</select>";
  26. echo "<input type=\"submit\" value=\"Call Me\">";
  27. echo "</form>";
  28. }