Molti pensano che il sistema “Click to Call” sara’ la nuova fontiera della pubblicita’, mah, di sicuro e’ un modo veloce per connettere un visitatore del nostro sito a noi, vediamo come.


// Copyright 2006 Baldwin Technology Solutions, Inc.
// Requires Asterisk, Apache, and PHP. Place this file
// onto your apache server and call the URL like so
// http://yourapacheserver/clicktocall.php?number=15185551234
// A page will display that it is calling your extension and
// what number it is calling.
// On the callerid on the phone it will show cc15185551234

#Host dove e' installato asterisk
$strHost = "127.0.0.1";

#La login per la connessione al manager ( in /etc/asterisk/manager.conf)
$strUser = "admin";

#La password dell'account manager
$strSecret = "amp111";

#Specificare dove si desidera ricevere la chiamata
#e.g. SIP/XXX, IAX2/XXXX, ZAP/XXXX, etc
$strChannel = "SIP/502";

#specificare il contesto
$strContext = "from-internal";

#Specificare il timeout
$strWaitTime = "30";

#Priorita
$strPriority = "1";

#numero massimo di tentativi
$strMaxRetry = "2";

$number=strtolower($_REQUEST['number']);
$pos=strpos ($number,"local");
if ($number == null) :
exit() ;
endif ;
if ($pos===false) :
$errno=0 ;
$errstr=0 ;
$strCallerId = "Web Call <$number>“;
$oSocket = fsockopen (”localhost”, 5038, &$errno, &$errstr, 20);
if (!$oSocket) {
echo “$errstr ($errno)
\n”;
} else {
fputs($oSocket, “Action: login\r\n”);
fputs($oSocket, “Events: off\r\n”);
fputs($oSocket, “Username: $strUser\r\n”);
fputs($oSocket, “Secret: $strSecret\r\n\r\n”);
fputs($oSocket, “Action: originate\r\n”);
fputs($oSocket, “Channel: $strChannel\r\n”);
fputs($oSocket, “WaitTime: $strWaitTime\r\n”);
fputs($oSocket, “CallerId: $strCallerId\r\n”);
fputs($oSocket, “Exten: $number\r\n”);
fputs($oSocket, “Context: $strContext\r\n”);
fputs($oSocket, “Priority: $strPriority\r\n\r\n”);
fputs($oSocket, “Action: Logoff\r\n\r\n”);
sleep(2);
fclose($oSocket);
}
echo “Extension $strChannel should be calling $number.” ;
else :
exit() ;
endif ;
?>

This post has no comment.