×

Number Masking using Flow Builder and Call API’s

Lead Assist & 1 more
  • Lead Assist
  • Voice
Last Mile Delivery & 1 more
  • Last Mile Delivery
  • Marketplace
customer call & 6 more
  • customer call
  • Last Mile Delivery
  • Lead Assist
  • lead management
  • Number Masking
  • Sales calls
  • Virtual Numbers
24650 views

Overview

Number Masking or call masking is the best way for businesses to safeguard their customers’ identity, and prevent misuse of sensitive information, enabled by anonymization of customer’s phone number. This solution allows you to connect two parties without revealing either party’s phone number. The number being revealed is the one from Exotel’s inventory, which is called Virtual Number associated for a transaction between two parties.

Through Exotel, Number Masking can be achieved in multiple ways. The method depends on the nature of your business, the call flow logic and platform. We will explain which scenarios are best suited for a particular case. Here are some of the ways to implement Number masking:

  • Click to Call API
  • Based on Caller Number
  • Based on the Pin number
  • Lead Assist 

We will discuss the implementation framework for the first three methodologies as documentation for Lead Assist is separately available.

Click to Call API

Exotel provides an API for calls where specifying the phone number of  A (caller) and B (callee) will connect them over a phone call. This API first calls the A number (caller), once A picks up the call another call is made to B (callee) resulting in a bridge. The resultant Caller Id  will be the Virtual Number provided by Exotel, hence actual phone number is masked. 

Pre-requisites (applicable to all methods)

  • An active Exotel account.
  • Outbound calling enabled for your Exotel account (reach out to your account manager or hello@exotel.com).
  • Integration to be completed by the customer development team using API Documentation.
  • Calls should be made to non DND numbers only. Please check with account manager for more information.

How it works? Option 1 (If execs have a smartphone)

Outgoing Call API Through CRM/App portal

How It Works

Step 1: You pass the numbers and Virtual Number to be connected to the Click to Call API in a POST request. The numbers are passed as A-party or B-party numbers which are the two distinct sides of the conversation (for example: buyers and sellers). Apart from the parties’ numbers you can also pass other desired parameters like:

  • CustomField: which can be any alphanumeric string and helps you identify call.
  • StatusCallback: a callback url to receive metadata post call completion.
  • StatusCallbackEvents: pass is as terminal
  • Request params should be in form data
  • StatusCallbackEvents : json or multipart as desired
POST

https://<your_api_key>:<your_api_token><subdomain>/v1/Accounts/<your_sid>/Calls/connect.json

curl --location --request POST 'https://<your_api_key>
:<your_api_token><subdomain>
/v1/Accounts/<your_sid>
/Calls/connect' 
--form 'From="xxx62799"' 
--form 'To="xxx089"' 
--form 'CallerId="xxx180604797"' 
--form 'StatusCallback="https://webhook.site/08ffbd71-e873-4bxx"' 
--form 'StatusCallbackEvents[0]="terminal"' 
--form 'StatusCallbackContentType="application/json"'

Step 2: In response to this request, Exotel will now place a call connecting both the parties via a Virtual Number.

{
  "Call": {
    "Sid": "c5797dcbaaeed7678c4062a4a3ed2f8a",
    "ParentCallSid": null,
    "DateCreated": "2017-03-03 10:48:33",
    "DateUpdated": "2017-03-03 10:48:33",
    "AccountSid": "Exotel",
    "To": "0XXXXX38847",
    "From": "0XXXXX30240",
    "PhoneNumberSid": "0XXXXXX4890",
    "Status": "in-progress",
    "StartTime": "2017-03-03 10:48:33",
    "EndTime": null,
    "Duration": null,
    "Price": null,
    "Direction": "outbound-api",
    "AnsweredBy": null,
    "ForwardedFrom": null,
    "CallerName": null,
    "Uri": "/v1/Accounts/Exotel/Calls.json/c5797dcbaaeed7678c4062a4a3ed2f8a",
    "RecordingUrl": null
  }
}
{
  "CallSid": "492205107c5fb48f4ac25d1f77759339",
  "EventType": "terminal",
  "DateCreated": "2019-04-08 03:17:59",
  "DateUpdated": "2019-04-08 03:18:35",
  "Status": "no-answer",
  "To": "+91886799XXXX",
  "From": "+91941374XXXX",
  "PhoneNumberSid": "0113083XXXX",
  "StartTime": "2019-04-08 03:17:59",
  "EndTime": "2019-04-08 03:18:36",
  "Direction": "outbound-api",
  "RecordingUrl": "https://s3-ap-southeast-1.amazonaws.com/exotelrecordings/<your_sid>/xxdewfcwsdw.mp3",
  "ConversationDuration": 32,
  "Legs": [
    {
      "OnCallDuration": 41,
      "Status": "completed"
    },
    {
      "OnCallDuration": 32,
      "Status": "completed"
    }
  ]
}

Where does this solution fit ?

  • To enable calling in CRMs like Zoho, Pipedrive, Zendesk, Salesforce etc for Sales and Support team.
  • Mobile apps used by field agents for calling.

Add on Automations:

  • Send an automated SMS in case of unanswered calls
  • Send a follow up Whats app message.
  • Connecting receiver back to same caller in case of inbound call.

Steps for setting up Automation:

Refer to Statuscallback payload and see the status provided for both the parties under legs parameter:

"Legs": [
    {
      "OnCallDuration": 41,
      "Status": "completed"
    },
    {
      "OnCallDuration": 0,
      "Status": "no-answer"
    }
  ]
}

For SMS, Exotel itself has its own infrastructure to provide you with SMS functionality. You can make use of Ex​​otel SMS API and send Emergency text along with audio URL (hospital alerts) or a dynamic text in case of other scenarios.

For Whats app, you can integrate APIs of Whats app resellers like GupShup, Infobip,  ValueFirst etc. Please get in touch with your Whats app service provider to get access to their APIs. For the purpose of understanding, we will make use of the GupShup API.

Integrating SMS API

Based on above logic, you can invoke SMS API as follows:

curl -X POST https://<your_api_key>:<your_api_token><subdomain>/v1/Accounts/<your_sid>/Sms/send
-d "From=0XXXXXX4890"
-d "To=XXXXX30240"
-d "Body=Hello World!"
-d "DltEntityId=<your_id>"
-d "DltTemplateId=<template_id>"
-d "SmsType=<transactional>"
{
  "SMSMessage": {
    "Sid": "0f477d60517e6e6a0f6d9a7e9af8630e",
    "AccountSid": "Exotel",
    "From": "0XXXXXX4890/WEBDEV",
    "To": "0XXXXX30240",
    "DateCreated": "2017-03-03 14:14:20",
    "DateUpdated": "2017-03-03 14:14:20",
    "DateSent": null,
    "Body": "Hello World!",
    "Direction": "outbound-api",
    "Uri": "/v1/Accounts/Exotel/Sms/Messages.json/0f477d60517e6e6a0f6d9a7e9af8630e",
    "ApiVersion": null,
    "Price": null,
    "Status": "queued"
    "DetailedStatusCode": "21010"
    "DetailedStatus": "PENDING_TO_OPERATOR"   
  }
}

Integrating WhatsApp API

Exotel does not provide Whats app service hence you can integrate APIs of Whats app resellers like GupShup, Infobip,  ValueFirst etc. Please get in touch with your Whats app service provider to get access to their APIs. For the purpose of understanding, we will make use of the GupShup API.

curl --location --request GET 'https://media.smsgupshup.com/GatewayAPI/rest?method=SendMessage&format=jso
n&userid=<gupshup_user_id>&password=<gupshup_account_pwd>&send_to=<phone_number>&v=1.1&auth_scheme=plain&
msg_type=HSM&msg=There is an emergency for Heart Patient. Here are the condition details:<recording_url>&
isTemplate=true'
{
  "response": {
        "id": "4346061160655278347-94984840088419718",
        "phone": "918699649964",
        "details": "",
        "status": "success"
    }
}

Connecting receiver to the caller 

Refer to the Statuscallback parameters, store the “From” & “To” parameters in your database. The next steps from here will be the same as implementing “Caller based masking” described below in 2.1. 

Caller based masking

In the click to call scenario, both agent and customer receive an incoming call from the Virtual number. What if we can implement Number masking where the caller dials the Virtual number and gets connected to the desired receiver ? 

The above logic is possible using Exotel Call flow builder. Caller dials into a predefined Virtual number, flow builder captures the caller number and sends a GET request to your endpoint with caller number. Based on this query, your endpoint should return a phone number in response in text/plain format. Once​​ the number is returned, Exotel will start dialling the customer number.

How it works? (Single leg call)using Smart phones

Setting up the flow builder

  • Applets required: Greeting, Connect and Passthru
  • A GET webhook to be developed by your tech team for returning phone numbers and storing real time call logs.

Flow builder diagram

Flow builder diagram

Setting up “Connect” applet

Once you arrange the applets in the sequence as per the diagram, look for DialWhom → Primary Url in Connect applet, and configure your webhook:

Dial Whom

Sample GET request params:

https://webhook.site/08ffbd71-e873-4bc0-90c6-b206112f422a?CallFrom=07709562799&CallSid=066b197844c030d6737dac19cca6157p&CallStatus=in-progress&CallTo=07314853246&CallType=call-attempt&Created=Sun, 25 Jul 2021 14:56:12&CurrentTime=2021-07-25 14:56:14&DialCallDuration=0&DialWhomNumber=&Direction=incoming&EndTime=1970-01-01 05:30:00&From=07709562799&StartTime=2021-07-25 14:56:12&To=07314853246&flow_id=383431&tenant_id=53926

  • Based on the From parameter, return a phone number in response. 
  • For testing, you can create dummy webhooks on https://designer.mocky.io/design

Setting up “Passthru” applet

A Passthru applet allows communication between Exotel database and your database to send and receive data through a web service. Here Exotel makes a GET request to your webservice and sends data in the form of a query string.

Sample payload: Incomplete call

https://webhook.site/08ffbd71-e873-4bc0-90c6-b206112f422a?CallFrom=077095xxxx&CallSid=0e50bc001da69c238b55b56a0a1c157e&CallTo=07314853246&CallType=client-hangup&Created=Wed, 14 Jul 2021 15:36:22&CurrentTime=2021-07-14 15:36:43&DialCallDuration=0&DialCallStatus=canceled&DialWhomNumber=07995679243&Direction=incoming&EndTime=1970-01-01 05:30:00&ForwardedFrom=null&From=0770956xx&Legs[0][Number]=07995679xx&Legs[0][Type]=single&Legs[0][OnCallDuration]=0&Legs[0][CauseCode]=RING_TIMEOUT&Legs[0][Cause]=1003&OutgoingPhoneNumber=07314853246&ProcessStatus=null&StartTime=2021-07-14 15:36:22&To=07314853246&flow_id=383431&tenant_id=53926

You can read more about actual payload sent by Exotel here: Working with Passthru

Sample Payload: Completed call

https://webhook.site/08ffbd71-e873-4bc0-90c6-b206112f422a?CallFrom=0770956xxx&CallSid=3edd4e59486d063b46403496ad3e157e&CallTo=07314853246&CallType=completed&Created=Wed, 14 Jul 2021 15:40:07&CurrentTime=2021-07-14 15:40:55&DialCallDuration=40&DialCallStatus=completed&DialWhomNumber=0799567xxxx&Direction=incoming&EndTime=1970-01-01 05:30:00&ForwardedFrom=null&From=077095627xx&Legs[0][Number]=07995679243&Legs[0][Type]=single&Legs[0][OnCallDuration]=31&Legs[0][CauseCode]=NORMAL_CLEARING&Legs[0][Cause]=16&OutgoingPhoneNumber=07314853246&ProcessStatus=null&RecordingAvailableBy=Wed, 14 Jul 2021 15:45:55&RecordingUrl=https://s3-ap-southeast-1.amazonaws.com/exotelrecordings/skillstreet/3edd4e59486d063b46403496xxx3e157e.mp3&StartTime=2021-07-14 15:40:07&To=07314853246&flow_id=383431&tenant_id=53926

Before hosting an endpoint in your server, you can also create a dummy endpoint through freemium websites  like https://beeceptor.com/, https://pipedream.com/, https://webhook.site/ etc.

Reverse Call flow logic

In case a customer calls back, you can store “From” and “DialWhomNumber” in your database and return the phone number based on whoever is calling.

Pin based Number 

This methodology is more suitable where the phone number of the calling party is unknown. We only know who the customer is here. For example, in case of logistics, we may not know which delivery person will be assigned towards the shipment, hence mapping the customer phone number against a Pin (order id) can solve this.

The above logic is possible using Exotel Call flow builder. Caller dials into a predefined Virtual number, enters the pin,  flow builder captures the pin number and sends a GET request to your endpoint with pin number. Based on this query, your endpoint should return a phone number in response in text/plain format. Once​​ the number is returned, Exotel will start dialling the customer number. 

Flow Diagram

Flow Builder Diagram

Flow Builder Diagram

 Setting up “Connect” applet

The steps are the same as mentioned in 2.2 above. 

Sample GET request params:

https://webhook.site/08ffbd71-e873-4bc0-90c6-b206112f422a?CallFrom=07709562799&CallSid=c39894edd8a85d7fd95dbf5fdb65157g&CallTo=07314853246&CallType=call-attempt&Created=Fri, 16 Jul 2021 18:24:05&CurrentTime=2021-07-16 18:24:12&DialCallDuration=0&DialCallStatus=null&DialWhomNumber=&Direction=incoming&EndTime=1970-01-01 05:30:00&ForwardedFrom=null&From=07709562799&ProcessStatus=null&RecordingUrl=null&StartTime=2021-07-16 18:24:05&To=07314853246&digits="568"&flow_id=383431&tenant_id=53926

  • Based on the digits parameter, return a phone number in response. 
  • For testing, you can create dummy webhooks on https://designer.mocky.io/design

Reverse Call flow logic

  • Use the Passthru configuration as mentioned in 2.3
  • In case a customer calls back, you can store “From” and “DialWhomNumber” in your database and return the phone number based on whoever is calling.

 

Case Study

  • Ekart Case Study - How Exotel helps Ekart connect their delivery agents and customers while maintaining privacy and offering superior communication
  • Swiggy case study - How Swiggy streamline its operations to improve customer experience and safeguard customer privacy

Industry Application

Number Masking is used by many companies involved in Last Mile Delivery of their services. Primary application being marketplaces order fulfillment process and food aggregators delivering food from restaurants.

Marketplaces Scenarios:

  • CxDx - Customer & Delivery Executive
  • CxBx - Customer & Business (Sales/Support)

Food Aggregator Scenarios:

  • CxDx - Customer & Delivery Executive
  • CxRx - Customer & Restaurant
  • RxDx - Restaurant & Delivery Executive
  • CxBx - Customer & Business (Support)

Number Masking Pricing

There are three SKUs under this solution: 

  • Software Rentals: This is monthly fixed charge for availing the Exotels services
  • Call Charges: Normal call charges, charged at pulse rate (where pulse can be 30s, 60s, or any other agreed upon value)
  • Virtual number rental: Based on the plan selected, Virtual number rental will be applicable. You can read more about pricing plans here: https://exotel.com/pricing/

Contributed By:

Last modified Date

November 20th, 2023