Home » Use Cases

Connect Buyers and Sellers via Secure Calls

In-App Calls - Marketplace - high-level overview

If your ecommerce company is an online marketplace that facilitates the exchange of goods and services between different parties then one of the main challenges your business may be facing is building trust. Whenever buyers and sellers participate in transactions, multiple concerns can arise. It is good practice to make sure that you are minimizing the (both real and perceived) risks for your customers and that they are satisfied with your services in every possible way.

In a typical online marketplace, business owners have little control over how suppliers present their products. There will always be inexperienced sellers who are not industry-savvy enough to know how to create and post suitable images and captivating descriptions aimed at their potential customers.

It is not uncommon that some of the very important details are omitted in listings. Allowing the customer to call the seller through your platform, anonymously and securely, then ask any questions that they might have will help facilitate the completion of the transaction to mutual benefit.

This use case will show you how to implement an in-app calling feature in your online marketplace application.

Process Workflow

User Registration Flow

In-App Calls - Marketplace - user registration flow

Call Flow

In-App Calls - Marketplace - process flow

IMPLEMENTATION STEPS

Steps over SDK

NOTE

In order to use Infobip RTC, you need to have Web and In-App Calls enabled on your account.

  1. First and foremost, include Infobip RTC SDK(s) in your application(s):

  2. Register your users on the Infobip platform over API. Users are registered with their identity – a unique alphanumeric string.
    Once completed, the Infobip platform will return an authorization token. 

Request example:

POST /webrtc/1/token HTTP/1.1
Host: {base_url}
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json
Accept: application/json
{
	"identity":"Alice",
	"displayName":"Alice in Wonderland"
}

Response example:

{
  "token": "3981e92d-141e-48bb-8e10-f751e0b4bfb5",
  "expirationTime": "2019-02-06T11:10:00.123Z"
}
  1. Initiate a call from one registered user towards the other registered user via the call method. Authorization token needs to be supplied that you will have received from the previous response.

Example:

let token = obtainToken(); 
let infobipRTC = new InfobipRTC(token, {});
infobipRTC.connect();

let outgoingCall = infobipRTC.call('Alice');

outgoingCall.on('established', function(event) {
  console.log('Alice answered call!');
  document.getElementById('remoteAudio').srcObject = event.remoteStream;
});

outgoingCall.on('hangup', function(event) {
  console.log('Call is finished!');
});
  1. The other device receives a call.

Example:

let token = obtainToken(); 
let infobipRTC = new InfobipRTC(token, {});
infobipRTC.connect();

infobipRTC.on('incoming-call', function(incomingCallEvent) {
  const incomingCall = incomingCallEvent.incomingCall;
  console.log('Received incoming call from: ' + incomingCall.source().identity);

  incomingCall.on('established', function(event) {
    document.getElementById('remoteAudio').srcObject = event.remoteStream;
  });

  incomingCall.on('hangup', function() {
    console.log('Call is finished!');
  });

  incomingCall.accept(); 
});
PRO TIP

If the called user is not currently online and the call cannot be established over the internet, then you can implement failover calls to GSM network. Initiate a call towards the landline or mobile phone by using the callPhoneNumber method.

Example:

String token = obtainToken();
CallRequest callRequest = new CallRequest(
    token,
    getApplicationContext(),
    "41793026727",
    new DefaultCallEventListener()
);
CallPhoneNumberOptions callPhoneNumberOptions = CallPhoneNumberOptions.builder().from("33755531044").build();

OutgoingCall call = InfobipRTC.callPhoneNumber(callRequest, callPhoneNumberOptions);

Related Products

Reach more customers worldwide with crystal-clear voice and video communications.