Categories
BT Java Web21C

BT’s Java SDK part two: making phone calls

Yesterday we saw how easy it is to send text messages using the SDK, so now let’s try making a phone call.

Imagine you’re implementing a customer support system where people can submit a problem report along with their phone number, and you want to have the appropriate person ring them to help resolve their fault. Your system does whatever magic is required to find who that appropriate person is, then uses the Web21C SDK to set up the call:

package com.kerrybuckley.sdk;

import com.bt.sdk.thirdpartycall.ThirdPartyCall;

public class ThirdPartyCallDemo {
    public static void main(String[] args) {
        new ThirdPartyCallDemo().makeCall("tel:+447700900123",
                "tel:+441214960391");
    }
    
    public void makeCall(String engineerPhoneNo, String customerPhoneNo) {
        ThirdPartyCall tpc = new ThirdPartyCall(customerPhoneNo,
                engineerPhoneNo);
        tpc.startCall();
    }
}

The ThirdPartyCall constructor on line 12 takes two arguments, callee and caller. When the call is connected using startCall(), the caller’s phone (the engineer, in our example) rings first. Once they pick up, the callee’s phone starts ringing, and the call between the two is connected as though it had been made directly (although neither party sees the other’s caller ID).

Leave a Reply