-
Notifications
You must be signed in to change notification settings - Fork 7
Application Calls Android App
The Application Calls Showcase App demonstrates the use of the Infobip RTC Android SDK. It highlights features like:
- making an application call that gets connected to a dialog,
- making an application call that gets connected to a conference,
- utilizing the camera video and screen sharing capabilities,
- managing the audio quality and the input audio device, and more.
For developers seeking seamless integration, code samples are readily available in Kotlin for Android.
The prerequisite to running any Showcase Apps is running the Token App, available in both Node.js and Java.
Token App - Node.js: Guidance
Create config.json
file in the ./token/node
project directory, and fill it with data:
{
"HTTP_PORT": 8080,
"INFOBIP_API_HOST": "api.infobip.com",
"INFOBIP_RTC_TOKEN_PATH": "/webrtc/1/token",
"INFOBIP_API_KEY": "YOUR_API_KEY"
}
Then in the ./token/node
project directory:
- install needed dependencies by running:
npm install
- start the application by running:
npm start
Token App - Java: Guidance
Export the INFOBIP_API_KEY
environment variable and set it to your Infobip API key.
In the ./token/java
project directory, start the application by running:
mvn spring-boot:run
Running the Calls API Showcase App is essential for enabling the full functionality of the Application Calls Showcase App.
Calls API Showcase App - Node.js: Guidance
Ensure that you have Node.js installed on your computer.
Before running the Calls API Showcase App, create a config.json
file in the ./calls-api-showcase/node
directory and
populate it with the following data:
{
"HTTP_PORT": 8090,
"INFOBIP_API_HOST": "api.infobip.com",
"INFOBIP_API_KEY": "YOUR_API_KEY"
}
To enable a phone call scenario while running the application, provide the additional argument
--phone-number={phone-number}
in the command line. Replace {phone-number}
with the specific phone number to which
you want the call to be made.
In the project directory ./calls-api-showcase/node
:
- install the required dependencies by running:
npm install
- start the application by running:
npm run start -- --phone-number={phone-number}
Calls API Showcase App - Java: Guidance
Ensure that you have a version of Java 17 installed on your system.
Before running the Calls API Showcase app, configure the application.yml
file in the
./calls-api-showcase/java/src/main/resources
directory as follows:
server.port: ${HTTP_PORT:8090}
infobip:
api-host: ${INFOBIP_API_HOST:api.infobip.com}
api-key: ${INFOBIP_API_KEY:YOUR_API_KEY}
phone-number: ${PHONE_NUMBER:YOUR_PHONE_NUMBER}
In order to run the Java Calls API Showcase app, navigate to ./calls-api-showcase/java
and
issue the following command:
mvn spring-boot:run
After successfully running the app, access it by opening a localhost URL in your web browser: http://localhost:8090.
To configure the Calls Application with a Webhook URL as explained in the next step, the Calls API Showcase App should be exposed to the public Internet. The easiest way to achieve this is through ngrok. Run the following command in your terminal to obtain a public URL:
ngrok http 8090
Actions made on calls, conferences and dialogs using the Calls API trigger one or several events. These events are sent to your exposed webhook. A definition of a webhook exposed by your application to receive these events is included in a corresponding subscription.
For more information on creating a new API configuration and setting up subscriptions, please refer to the
Calls documentation. Note that the minimal
set of required events to subscribe to, ensuring the Calls API Showcase App functions as expected, includes the
following events: CALL_RECEIVED
, CALL_ESTABLISHED
, CALL_FINISHED
, CALL_FAILED
, and SAY_FINISHED
.
As mentioned, when creating a subscription you will be asked to define a notification profile and its corresponding
webhook URL. If you have chosen to use ngrok
as previously
described, your webhook URL will follow this format: https://${your-ngrok-id}.ngrok-free.app/event
. Ensure that you
replace ${your-ngrok-id}
with the unique ID obtained via ngrok http 8090
.
Note that the creation of the WebRTC push configuration is NOT required if your mobile app will only support making the outbound calls and is not expected to receive inbound calls.
In order to enable push notifications, it is necessary to create a WebRTC push configuration. For more information on the creation of a push configuration, please refer to the corresponding API documentation.
Once you have a push configuration id
, make sure to edit the Config.kt
file replacing the PUSH_CONFIG_ID
with
the correct one:
const val PUSH_CONFIG_ID = "YOUR_PUSH_CONFIG_ID"
Finally, add your google-services.json
to the ./android/audio-and-video-calls/kotlin/app
folder to enable the
receiving of notifications about incoming calls.
Before running the Application Calls Showcase App, make sure to edit the Config.kt
file. Please note that the
YOUR_CALLS_CONFIGURATION_ID
should be the one previously obtained by following this step:
const val CALLS_CONFIGURATION_ID = "YOUR_CALLS_CONFIGURATION_ID"
You can run the Showcase App on an Android emulator.
There is known issue with receiving push notifications for incoming calls on subsequent runs on emulator. To address this, it is recommended to wipe data on your emulator before running the app again.
Alternatively, it is possible to run the Showcase App on a physical mobile device. In this case, please consult a guide on exposing the localhost endpoints to the public Internet using ngrok.