Browse Source

3pcc introduced

Jiri Kuthan 23 years ago
parent
commit
626301905e
2 changed files with 106 additions and 0 deletions
  1. 40 0
      examples/web_im/click_to_dial.html
  2. 66 0
      examples/web_im/click_to_dial.php

+ 40 - 0
examples/web_im/click_to_dial.html

@@ -0,0 +1,40 @@
+<html>
+<!-- $Id$ -->
+<header>
+<title>
+Click-To-Dial
+</title>
+</header>
+
+<body>
+<h1>
+Click-To-Dial (using REFER)
+</h1>
+
+<i>Unfortunately, this example does not work. The reason is use of
+REFER for third-party call-control has not been standardized due
+to resistance of proponents of B2BUA use (which is somewhat bloated
+and not always operational).
+</i>
+
+<form method=POST action=click_to_dial.php>
+<table>
+<tr>
+<td>
+Caller's SIP Address
+<td>
+<input name=caller>
+<tr>
+<td>
+Callee's SIP Address
+<td>
+<input name=callee>
+<tr>
+<td>Click to dial
+<td>
+<input type=submit value=now>
+</table>
+</form>
+
+
+</body>

+ 66 - 0
examples/web_im/click_to_dial.php

@@ -0,0 +1,66 @@
+<html>
+<!-- $Id$ -->
+<header>
+<title>
+Click-To-Dial
+</title>
+</header>
+
+<body>
+<h1>
+Click-To-Dial
+</h1>
+
+<?php
+
+/* config values */
+$web_contact="sip:[email protected]";
+$fifo="/tmp/ser_fifo";
+$signature="web_test_0.0.0";
+
+/* open reply fifo */
+$myfilename="webfifo_".rand();
+$mypath="/tmp/".$myfilename;
+
+echo "Initiating your request...<p>";
+
+/* open fifo now */
+$fifo_handle=fopen( $fifo, "w" );
+if (!$fifo_handle) {
+    exit ("Sorry -- cannot open fifo: ".$fifo);
+}
+
+/* construct FIFO command */
+$fifo_cmd=":t_uac:".$myfilename."\n".
+    "REFER\n".$caller."\n".
+    "p-version: ".$signature."\n".
+    "Contact: ".$web_contact."\n".
+    "Refered-By: ".$web_contact."\n".
+	"Refer-To: ".$callee."\n".
+    "\n". /* EoHeader */
+    ".\n\n"; /* EoFifoRequest */
+
+/* create fifo for replies */
+system("mkfifo -m 666 ".$mypath );
+
+/* write fifo command */
+if (fwrite( $fifo_handle, $fifo_cmd)==-1) {
+    unlink($mypath);
+    fclose($fifo_handle);
+    exit("Sorry -- fifo writing error");
+}
+fclose($fifo_handle);
+
+/* read output now */
+if (readfile( $mypath )==-1) {
+    unlink($mypath);
+	exit("Sorry -- fifo reading error");
+}
+unlink($mypath);
+echo "<p>Thank you for using click-to-dial<p>";
+
+?>
+
+</body>
+</html>
+