How to implement ringing in outgoing Android VOIP call
Asked Answered
O

2

12

We are using agora.io for voice calling in our app(VOIP). The calls between two people are going seemless. But when I am dialing person B, I am not able to hear the dial tone while the call is being connected. I basically want to hear the ringing when the call is being connect. However, the person is getting the incoming caller tune while his phone is ringing.

Can you anyone help me how to do this?

We are building Android App, Java, Kotlin, and Agora.io SDK

Oven answered 1/9, 2019 at 8:4 Comment(3)
Prabhakar, if the answer below worked for you, would you please confirm it as the correct response?Distemper
Done. Thank you for reminding, @DistemperOven
Glad it worked for you!Distemper
D
9

Currently Agora.io's Android SDK does not directly support playing audio on the caller side. This would need to be achieved using Android's Telcom package, more specifically implementing Connection, ConnectionService and ToneGenerator classes.

Whenever you start your call you may want to create a new tone, replacing <AUDIO STREAM> below with the stream that you want to play the tone within, and replacing <VOLUME LEVEL> with an integer (or enum) to set the volume level.

ToneGenerator dtmfGenerator = new ToneGenerator(<AUDIO STREAM>,<VOLUME LEVEL>);
dtmfGenerator.startTone(ToneGenerator.TONE_DTMF_0, 1000); 
dtmfGenerator.stopTone();

For example if you want to leverage the Call tone using the above example, you would use ToneGenerator.TONE_SUP_RINGTONE

ToneGenerator dtmfGenerator = new ToneGenerator(ToneGenerator.TONE_SUP_RINGTONE,ToneGenerator.MAX_VOLUME);
dtmfGenerator.startTone(ToneGenerator.TONE_DTMF_0, 1000); 
dtmfGenerator.stopTone();
Distemper answered 5/9, 2019 at 14:45 Comment(0)
D
-1

If you are working in Flutter, the flutter_dtmf package does this...

import 'package:flutter_dtmf/dtmf.dart';

...
Dtmf.playTone("1", durationMs: 1000);
Downright answered 10/6, 2022 at 14:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.