Search code examples
javatwilio

Twilio call phone number masking


We need to connect two customers using voice - but we need to hide customer phone number from each other. We decide to use next approach - masked phone numbers by twilio

Question is:

  1. We connect two customers using twilio number. Can we use same number for another call or it is 'busy' until call is completed?
  2. If it is 'busy' can we buy for example 20 phone numbers and get available each time we need to make call?

Not related but why there is no possibility to buy Ukrainian phone number.

Thanks a lot in advance for any help.


Solution

  • Let me first answer your specific questions below :

    1. Twilio numbers can be called as often as you wish while there is already an ongoing call in place. In other words Twilio should never play a fast busy if not explicitly programmed by you .

    2. N/A since its not busy .

    Coming back to your use case , there are multiple companies who have built Masked Numbers Use case on Twilio and there are multiple strategies that one could use to optimise the number of phone-numbers to use and for association ( permanent or temporary ) of phone numbers to a consumer-producer relation . I would recommend having a look at

    PS: Since this question was not about strategies for implementation , I have put more details .

    Update for OP's question in the comment below

    Example :

    producer      twilio-masking-number                    consumer
    aaa                xxx                                   bbb
    ccc                xxx                                   ddd
    

    Above is an example association that you might store. In TwiML response for incoming call , check the incoming number . If it is aaa , then destination is bbb , return a TwiML like the one below

    <?xml version="1.0" encoding="UTF-8"?>
    <Response>
        <Dial callerId="+xxx">
            <Number>+bbb</Number>
        </Dial>
    </Response>
    

    If the incoming number is is bbb , then destination is aaa , return a TwiML like the one below

    <?xml version="1.0" encoding="UTF-8"?>
    <Response>
        <Dial callerId="+xxx">
            <Number>+aaa</Number>
        </Dial>
    </Response>
    

    This way the callerID for all interactions between aaa and bbb will be 'xxx' , hence masking the original phone numbers .

    Here's a high level flow diagram

    enter image description here