Place a call
To start the call after pressing the START CALL button fill the body of the startCall method inside Mainctivity class:
@SuppressLint("MissingPermission")
fun startCall() {
client.serverCall("PHONE_NUMBER", null, object : NexmoRequestListener<NexmoCall> {
override fun onSuccess(call: NexmoCall?) {
runOnUiThread {
endCallButton.visibility = View.VISIBLE
startCallButton.visibility = View.INVISIBLE
}
}
override fun onError(apiError: NexmoApiError) {
}
})
}
Please make sure to replace PHONE_NUMBER below with the actual phone number you want to call, in the E.164 format (for example, 447700900000).
NOTE: Please make sure that the webhook server you built in the previous steps is still running.
Webhooks
As you proceed with placing the call, please switch to the terminal and notice the /voice/answer endpoint being called to retrieve the NCCO:
Also, as the call progresses through various stages, /voice/event is being sent events:
NOTE: As the call is completed, events will also contain duration and pricing information.
The END CALL button was shown to reflect the current state of the call:

Making an in-app voice call
Make a voice call from a web app to a phone using the Android Client SDK.