Click-To-Call example using the Voice Conversations API

Click-to-Call allows your audience, whether it includes website visitors, newsletter recipients, existing or potential customers and users, to click or scan an object, submit their name and phone number to a web-form, and receive an immediate toll-free call from one of your company’s representatives.

Click-to-Call can be included on your online and offline assets. Online can be used as an object (image, button), while offline as a scannable image (QR code, scannable image, scannable link).

You can combine Click-to-Call with prerecorded voice messages that your users, representatives, existing or potential customers, will hear while waiting to be connected.

Through Click-to-Call the client submits a phone number requirement, web form. Next, the company's representative is called by a predefined number through the appropriate Voice resource and notified by a predefined voice message that connecting with a client is imminent. In the final step, the client receives a call from the representative's phone number through the Routee API.

Example of a Click-to-Call Dial plan:

Your Header should contain authorization and content type:

KEYVALUE
AuthorizationBearer {access_token}
Content-Typeapplication/json

An example request is shown below:

curl -X POST  
-H "Authorization:Bearer e6c6531c-4083-481e-b7a3-05be2ff41f59"  
-H "Content-Type:application/json"  
-d '{  
   "from":"+306988888888",
   "to":{  
      "phone":"+306911111111"
   },
   "dialPlan":{  
     "verbs":[
        {
           "type":"SAY",
           "message":{
              "language":"en-US",
              "gender":"male",
              "text":"You have an incoming call from your website. We will connect you shortly. Please hang on to your phone."
           }
        },
        {
           "type":"DIAL",
           "from":"+6911111111",
           "hangupDelay":"15",
           "to":{
              "phone":"+306988888888"
           }
        }
     ]
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://connect.routee.net/voice/conversation",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{  \n   \"from\":\"+306988888888\",\n   \"to\":{  \n      \"phone\":\"+306911111111\"\n   },\n   \"dialPlan\":{  \n     \"verbs\":[\n        {\n           \"type\":\"SAY\",\n           \"message\":{\n              \"language\":\"en-US\",\n              \"gender\":\"male\",\n              \"text\":\"You have an incoming call from your website. We will connect you shortly. Please hang on to your phone.\"\n           }\n        },\n        {\n           \"type\":\"DIAL\",\n           \"from\":\"+6911111111\",\n           \"hangupDelay\":\"15\",\n           \"to\":{\n              \"phone\":\"+306988888888\"\n           }\n        }\n     ]\n   }\n}",
  CURLOPT_HTTPHEADER => array(
    "authorization: Bearer f591c3f7-bcf0-42f5-bef4-cf84e6ad3f03",
    "cache-control: no-cache",
    "content-type: application/json"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Congratulations! You have just set your Click-To-Call application.