]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
adding click to call similar to the perl example
authorRaymond Chandler <intralanman@freeswitch.org>
Wed, 18 Feb 2009 00:00:30 +0000 (00:00 +0000)
committerRaymond Chandler <intralanman@freeswitch.org>
Wed, 18 Feb 2009 00:00:30 +0000 (00:00 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12126 d0543943-73ff-0310-b7d9-9358b9ac24b2

scripts/call.php [new file with mode: 0644]

diff --git a/scripts/call.php b/scripts/call.php
new file mode 100644 (file)
index 0000000..6783ebb
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+require_once('ESL.php');
+$my_company_DID = '2135551212';
+$my_company_domain = 'mydomain.com';
+
+$groups = array('default'
+    , 'support'
+    , 'billing'
+    , 'sales'
+);
+
+
+$esl = new ESLconnection('192.168.86.254', '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>";
+}