Telematics SDK - User Guide  v1.11.0
Making a Voice Call

Please follow below steps to make a voice call

1. Get the PhoneFactory and PhoneManager instances

auto &phoneFactory = PhoneFactory::getInstance();
auto phoneManager = phoneFactory.getPhoneManager();

2. Check if telephony subsystem is ready

bool subSystemsStatus = phoneManager->isSubsystemReady();

2.1 If telephony subsystem is not ready, wait for it to be ready

Telephony subsystems is to make sure that device is ready for services like Phone, SMS and others. if subsystems were not ready, wait for unconditionally.

if(!subSystemsStatus) {
std::future<bool> f = phoneManager->onSubsystemReady();
subSystemsStatus = f.get();

3. Instantiate Phone and call manager

auto phone = phoneManager->getPhone();
std::shared_ptr<ICallManager> callManager = phoneFactory.getCallManager();

4. Initialize phoneId with default value

int phoneId = DEFAULT_PHONE_ID;

5. Instantiate dial call instance - this is optional

std::shared_ptr<DialCallback> dialCb = std::make_shared<DialCallback> ();

5.1 Implement IMakeCallCallback interface to receive response for the dial request optional

class DialCallback : public IMakeCallCallback {
void makeCallResponse(ErrorCode error, std::shared_ptr<ICall> call) override;
void DialCallback::makeCallResponse(ErrorCode error, std::shared_ptr<ICall> call) {
// will be invoked with response of makeCall operation

6. Send a dial request

if(callManager) {
std::string phoneNumber("+18989531755");
auto makeCallStatus = callManager->makeCall(phoneId, phoneNumber, dialCb);
std::cout << "Dial Call Status:" << (int)makeCallStatus << std::endl;