Asterisk Click To Call script

We use WHMCS as our client management software. We use Asterisk and FOP2 for our phone lines.

The other day I thought it would be cool to update WHMCS so that someone could click a link to call clients. I updated the HTML of the client profile to link to the attached script. The script uses the Asterisk AMI interface to connect the user phone and then pass the phone number through.

Script is attached..
clickToCall.txt

There is an array within the file (line 40) which maps WHMCS userID’s to their extensions..

$users = array( "4" => "272", "5" => "228", "6" => "290", "3" => "250", "11" => "240" );

To call the script use..

click-to-call.php?staffID=&txtphonenumber=&txtclient=

On our WHMCS system, we use a 8 character client ID. Using Asterisk with SuperFecta, we are able to reach into the WHMCS database to retrieve the clientID for display on the phones. This is another post, but thought I would mention it since the WHMCS clientName is the clientID for us. This creates really clean call logs that can be easily linked back to our clients. In the event a client calls and is not in the system we simply add their previously unknown number in the client contacts pane.