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:
We will discuss the implementation framework for the first three methodologies as documentation for Lead Assist is separately available.
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.
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:
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 ?
Add on Automations:
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" } ] }
Write an if() statement where the status of first leg == “completed” and second leg ==! ”Completed”, then trigger SMS or Whats API with desired content.
For SMS, Exotel itself has its own infrastructure to provide you with SMS functionality. You can make use of Exotel 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.
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" } }
In the “Body” parameter, you can pass the nature of Emergency and audio URL received from Passthru.
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.
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.
Setting up the flow builder
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:
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 |
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.
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.
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 |
Reverse Call flow logic
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:
Food Aggregator Scenarios:
There are three SKUs under this solution:
Contributed By:
Last modified Date
November 20th, 2023