Click to Dial or php API to dial from asterisk
copy the below code to a file (click2call.php) to the webdirectory.
executes as : http://ipaddress/click2call.php??exten=SIP/100&number=9899338979
n”;
} else {
fputs($oSocket, “Action: loginrn”);
fputs($oSocket, “Events: offrn”);
fputs($oSocket, “Username: $strUserrn”);
fputs($oSocket, “Secret: $strSecretrnrn”);
fputs($oSocket, “Action: originatern”);
fputs($oSocket, “Channel: $strChannelrn”);
fputs($oSocket, “WaitTime: $strWaitTimern”);
fputs($oSocket, “CallerId: $strCallerIdrn”);
fputs($oSocket, “Exten: $numberrn”);
fputs($oSocket, “Context: $strContextrn”);
fputs($oSocket, “Priority: $strPriorityrnrn”);
fputs($oSocket, “Action: Logoffrnrn”);
sleep(2);
fclose($oSocket);
}
echo “Extension $strChannel should be calling $number.” ;
else :
exit() ;
endif ;
?>
} else {
fputs($oSocket, “Action: loginrn”);
fputs($oSocket, “Events: offrn”);
fputs($oSocket, “Username: $strUserrn”);
fputs($oSocket, “Secret: $strSecretrnrn”);
fputs($oSocket, “Action: originatern”);
fputs($oSocket, “Channel: $strChannelrn”);
fputs($oSocket, “WaitTime: $strWaitTimern”);
fputs($oSocket, “CallerId: $strCallerIdrn”);
fputs($oSocket, “Exten: $numberrn”);
fputs($oSocket, “Context: $strContextrn”);
fputs($oSocket, “Priority: $strPriorityrnrn”);
fputs($oSocket, “Action: Logoffrnrn”);
sleep(2);
fclose($oSocket);
}
echo “Extension $strChannel should be calling $number.” ;
else :
exit() ;
endif ;
?>