Author Message
ajay011
Joined: Aug 8, 2017
Messages: 11
Offline
Hi,

I am able to make audio/video call using avaya client sdk but caller tune (ringing tone) is not played. Does avaya sdk play the tone by default or i will have to use it my own?
Rumata
Joined: Dec 20, 2016
Messages: 133
Offline
Hi,
Thank you for your question.

This is UI responsobility to play ringing tone. Please refer to sample app.

For example for Windows you can do following
1) Create Sound player object in CallManager class
private SoundPlayer soundPlayer = new SoundPlayer(CommunicationSampleApp.Properties.Resources.ringback);

2) Implement following call event handlers
void CallRemoteAlerting(object sender, RemoteAlertingEventArgs e)
{
soundPlayer.PlayLooping();
}

void CallEstablished(object sender, EventArgs e)
{
soundPlayer.Stop();
}
ajay011
Joined: Aug 8, 2017
Messages: 11
Offline
Thanks for your reply. I want to implement it in android. Please help me for android.
Rumata
Joined: Dec 20, 2016
Messages: 133
Offline
You can do the same steps on Android:

0) Add ringback.wav file with your tone to raw resources

1) Create and initialize new field in SDKManager class
private SoundPool mSoundPool;
private int mRingbackSoundID = 0;
private int mRingbackStreamID = 0;

private SDKManager(Activity activity) {
...
mSoundPool = new SoundPool(4, AudioManager.STREAM_MUSIC, 0);
mRingbackSoundID = mSoundPool.load(activity.getApplicationContext(), R.raw.ringback, 1);
}

2) implement following methods in the SDKManager class

public void onCallRemoteAlerting(Call call, boolean hasEarlyMedia) {
if (!hasEarlyMedia) {
mRingbackStreamID = mSoundPool.play(mRingbackSoundID, 0.99f, 0.99f, 0, /*loop*/-1, 1);
}
...
}

public void onCallEstablished(Call call) {
mSoundPool.stop(mRingbackStreamID);
mRingbackStreamID = 0;
...
}

public void onCallFailed(Call call, CallException e) {
mSoundPool.stop(mRingbackStreamID);
mRingbackStreamID = 0;
...
}
ajay011
Joined: Aug 8, 2017
Messages: 11
Offline
Thanks for the reply.
Its working fine. But i also wanted to toggle playing of ringing audio between speaker and handset.

It also tried to play tone by creating instance of AudioFilePlayer
audioFilePlayer = mClient.getMediaEngine().getAudioInterface().createAudioFilePlayer(application, new AudioFilePlayerListener() {
@Override
public void onAudioFileDidStartPlaying(AudioFilePlayer audioFilePlayer) {

}

@Override
public void onAudioFileDidStopPlaying(AudioFilePlayer audioFilePlayer) {

}
});

audioFilePlayer.setTone(AudioTone.RING_BACK);
audioFilePlayer.setLoop(true);
audioFilePlayer.startPlaying();


but its not playing the tone and throwing exceptions-

(AudioPlayProxy.java:270) Stop AudioTrack is NULL!
(AudioPlayProxy.java:113) Uninitialize AudioTrack is not initialized
(AudioRecordProxy.java:238) Stop AudioRecord is NULL!
(AudioRecordProxy.java:112) Uninitialize AudioRecord is not initialized
ERROR ; (14:44:25:506 | 2) FILE: 1 1025; 1643; Not a wave file (too short)
ERROR ; (14:44:25:506 | 0) FILE: 1 1025; 1643; failed to read WAV header!
ERROR ; (14:44:25:506 | 0) FILE: 1 1025; 1643; Not a valid WAV file!
Rumata
Joined: Dec 20, 2016
Messages: 133
Offline
Does it work for you if we save wav file to device and replace line

audioFilePlayer.setTone(AudioTone.RING_BACK);

with

AudioFilePlayer.setFile("/path/to/file/ringback.wav");

?
Go to:   
Mobile view