DIDForSale Voice API, lets you create a Click on Call Application in your website. With the Sample code and DIDForSale API, you can create a simple Click to Call form, ask the user to enter a phone number and click on call me now button. Code will call DIDForSale Voice API and will dial the customers number. Once the customer pick up the call, he will be connected to the agent.

Why should I have Click to Call Button?

  • Your customer is visiting your website and they want to talk to someone right now, in placing of calling your business line, going through IVR and wait in queue, she chooses your agent to call her.
  • This is another way to connect the customer to the right person. Great way to increase the sales.
  • Customer can not to dial out long distance number.

How Click to Call Works:

  • In this example, user will see the form. Type in their phone number with country code and click on call me now button.
  • PHP code will take the number, call the DIDForSale API to complete the call.
  • Code will call the API and post the following information in JSON format.
  • ‘from’ => $CALLERID, ‘to’ => $to, ‘apikey’ => $APIKEY.
  • DIDForSale voice application will call the “TO” Number first.
  • Once the person pick up the call, then call will be connected to the caller ID number immediately. This caller id number can be main business number or direct line to an agent or even a call queue in the call center.

What Do you need to use Click to Call Feature to Work with DIDForSale Voice API:

  • You need an account with DIDForSale Signup for Free Account.
  • By default your account is allowed to call all over USA and Canada. If you need to call international locations, contact your account rep.
  • And API Key, so that our system can authenticate your application to complete the call on your behalf.

Can I get a new local phone to be used for Click to Call:

Yes, you purchase new number from anywhere in USA, UK and Canada. That number can be connected to your PBX with SIP Trunking service.

Once you have a working account, you can build your own application to connect with your customers. Here is sample PHP code to build your own Click to Call Application.

<?php
   session_name("CALL");
   session_start();
   $APIKEY="YOUR_API_KEY";
   $CALLERID="19499300360";
   if(isset($_POST['callme'])){
    if (!isset($_SESSION["date_mail"]) || (time()-$_SESSION["date_mail"]) > 20) // Put a limit how many SMS some one can received. For now set to 120 seconds. 
    {   
        $_SESSION["date_mail"]=time();
    }   
        else
    {   
        sleep(3);
        echo gettext("Sorry This number has been called Recently. Please wait 2 minutes before you try again!");
        exit();
    } 
      $BASEURL="https://api.didforsale.com/didforsaleapi/index.php/api/V2/CallTermination";
      $to = $_POST[phonenumber]; 
      $data = json_encode(array('from' => $CALLERID, 'to' => $to, 'apikey' => $APIKEY));
   }
   $ch = curl_init($BASEURL);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
   curl_setopt($ch, CURLOPT_POST, TRUE);
   curl_setopt($ch, CURLOPT_HEADER, FALSE);
   curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
   curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
   curl_exec($ch);
   curl_close($ch);
?>
<center>
</h1>Simple Click to Call Application</h1>
<form name="authform" method="post" action"<?php echo $_SERVER['PHP_SELF']?>" >
  <table id="phone">
    <tr><td>Phonenumber:</td><td><input type="text" name="phonenumber" maxlength="11" id="phonenumber" /></td></tr>
  </table>
  <input type="Submit" name="callme" value="Call Me" />
</form>
</center>

Want to build more complicated Voice Application? Check out Developer Kit. There you can find more documentation to build Voice or SMS applications.