[asterisk-users] Click to Dial
adriano ghezzi
adriano.ghezzi at gmail.com
Thu Jul 24 17:59:30 CDT 2008
this simple php script do whatr you need
should be called by your user pc with url ike
http://ip_your_Asterisk_host/chiama_ora.php?INT=xx&NOME=yy&NUMERO=xxx&CONTESTO=xxx
if you are interested I have developped a complete phonebook
integrated wwith asterisk
the main functions are
- multiple listings user/company
incoming calls lookup in listings and pop up to user plsu
tracking,recording, reporting
outgoing call reservation time & date with tracking
etc...
hope this help
<?php
---------------
parameters to send via request
INT = extension
NOME = called name
NUMERO = called number
CONTESTO = sterisk contexts to be used
******************************************************************************/
//MUST BE CUSTOMIZED
define("CALL_PREFIX","0");
//controllo parametri
if ( !isset($_REQUEST['INT']) )
{
die("chiama errore : interno non prevenuto");
}
else
$interno=$_REQUEST['INT'];
if ( isset($_REQUEST['NOME']) )
$nome=$_REQUEST['NOME'];
else
$nome="";
if ( !isset($_REQUEST['NUMERO']) )
{
die("chiama errore : NUMERO non prevenuto");
}
else
$numero=$_REQUEST['NUMERO'];
if ( !isset($_REQUEST['CONTESTO']) )
{
die("chiama errore : contesto non prevenuto");
}
else
$contesto=$_REQUEST['CONTESTO'];
//impostazione valori
$strChannel = "SIP/$interno";
$strExten = CALL_PREFIX .$numero;
$delay=0;
$strContext = $contesto;
$strHost = "localhost";
$strUser = "admin";
$strSecret = "amp111";
$strWaitTime = "05";
$strPriority = "1";
$strMaxRetry = "3";
$strCallerId = "ATTIVA:$nome";
$oSocket = fsockopen($strHost, 5038, $errnum, $errdesc) or
die("Connection to host failed");
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: $strExten\r\n");
fputs($oSocket, "Context: $strContext\r\n");
fputs($oSocket, "Priority: $strPriority\r\n\r\n");
fputs($oSocket, "Action: Logoff\r\n\r\n");
stream_set_blocking($oSocket,0);
$out='';
while (!feof($oSocket)) {
$out .= fgets($oSocket, 128);
}
fclose($oSocket);
print $out;
?>
More information about the asterisk-users
mailing list