[Asterisk-Users] "click to dial extension number" functionality ?

marek cervenka cervajs at fpf.slu.cz
Fri Feb 25 11:29:12 MST 2005


>> By any web-user (ms explorer) to be able to call from a web-page to a 
>> certain number/extension connected to one specific asterisk.

maybe this php script help you (switch caller/called and modify Exten:)

--originate.php--
<?php
# configuration
$astip="192.168.0.1";
$astmanager="test";
$astpassword="isbest";
$mancmd="";
$wrets="";
$tech="SIP";
?>

<br>
<form action="originate.php" method="get">
CALLER<input type="text" name="caller" size="8" maxlength="18">
CALLED<input type="text" name="called" size="30" maxlength="30">
<input type="submit" value="submit">
</form>
<br>

<?php
if ( ( isset($_GET['caller'] )) && ( $_GET['caller'] != "" ) &&
      ( isset($_GET['called'] )) && ( $_GET['called'] != "" ) )
{
  $called = $_GET['called'];
  $caller = $_GET['caller'];

  $socket = fsockopen($astip,"5038", $errno, $errstr);

  fputs($socket, "Action: Login\r\n");
  fputs($socket, "UserName: $astmanager\r\n");
  fputs($socket, "Secret: $astpassword\r\n\r\n");

  fputs($socket, "Action: Originate\r\n");
  fputs($socket, "Channel: $tech/$caller\r\n");
  fputs($socket, "Context: $caller\r\n");
  fputs($socket, "Exten: $called\r\n");
  fputs($socket, "Priority: 1\r\n");
  fputs($socket, "Callerid: $caller\r\n\r\n");

  fputs($socket, "Action: Logoff\r\n\r\n");

  while (!feof($socket)) {
  $wrets .= fread($socket, 8192);
  }
  fclose($socket);

  echo "<pre>";
  echo <<<ASTERISKMANAGEREND
  $wrets
ASTERISKMANAGEREND;
  echo "</pre>";
}
?>



---------------------------------------
Marek Cervenka
Centrum Vypocetni Techniky
CVT 		- http://cvt.fpf.slu.cz
FPF SLU OPAVA 	- http://www.fpf.slu.cz
LCNA 		- http://lcna.slu.cz
=======================================




More information about the asterisk-users mailing list