Skip to content

Commit e8ebc88

Browse files
author
Antonis Tsakiridis
committed
Fixed #397: Ringing sound takes too long to kick in
1 parent c99da77 commit e8ebc88

File tree

5 files changed

+10
-16
lines changed

5 files changed

+10
-16
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
#Mon Sep 19 12:31:43 EEST 2016
2-
VERSION_CODE=1263
1+
#Mon Sep 19 12:37:17 EEST 2016
2+
VERSION_CODE=1267
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
#Mon Sep 19 12:31:43 EEST 2016
2-
VERSION_CODE=1283
1+
#Mon Sep 19 12:37:17 EEST 2016
2+
VERSION_CODE=1287

restcomm.android.sdk/src/main/java/org/restcomm/android/sdk/MediaClient/AppRTCAudioManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ public void run()
237237

238238
// Request audio focus before making any device switch.
239239
audioManager.requestAudioFocus(null, AudioManager.STREAM_VOICE_CALL,
240-
AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK);
240+
AudioManager.AUDIOFOCUS_GAIN);
241241

242242
// Start by setting MODE_IN_COMMUNICATION as default audio mode. It is
243243
// required to be in this mode when playout and/or recording starts for

restcomm.android.sdk/src/main/java/org/restcomm/android/sdk/RCConnection.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -333,14 +333,6 @@ private RCConnection(Builder builder)
333333
remoteMediaType = RCConnection.sdp2Mediatype(builder.incomingCallSdp);
334334
}
335335
peer = builder.peer;
336-
337-
audioManager.startCallMedia();
338-
/*
339-
if (incoming) {
340-
audioManager.playRingingSound();
341-
}
342-
*/
343-
344336
timeoutHandler = new Handler(device.getMainLooper());
345337
}
346338

@@ -1468,6 +1460,7 @@ public void run()
14681460

14691461
// stop any calling or ringing sound
14701462
audioManager.stop();
1463+
audioManager.startCallMedia();
14711464

14721465
// we 're connected, cancel any pending timeout timers
14731466
timeoutHandler.removeCallbacksAndMessages(null);

restcomm.android.sdk/src/main/java/org/restcomm/android/sdk/RCDevice.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,7 @@ public void onCallArrivedEvent(String jobId, String peer, String sdpOffer, HashM
949949
{
950950
RCLogger.i(TAG, "onCallArrivedEvent(): id: " + jobId + ", peer: " + peer);
951951

952-
audioManager.playRingingSound();
952+
//audioManager.playRingingSound();
953953

954954
// filter out potential '<' and '>' and leave just the SIP URI
955955
String peerSipUri = peer.replaceAll("^<", "").replaceAll(">$", "");
@@ -966,6 +966,7 @@ public void onCallArrivedEvent(String jobId, String peer, String sdpOffer, HashM
966966
state = DeviceState.BUSY;
967967

968968
if (isServiceAttached) {
969+
audioManager.playRingingSound();
969970
// Service is attached to an activity, let's send the intent normally that will open the call activity
970971
callIntent.setAction(ACTION_INCOMING_CALL);
971972
callIntent.putExtra(RCDevice.EXTRA_DID, peerSipUri);
@@ -1116,7 +1117,7 @@ void onNotificationCall(RCConnection connection, HashMap<String, String> customH
11161117
.setSmallIcon(R.drawable.ic_call_24dp)
11171118
.setContentTitle(peerUsername)
11181119
.setContentText(text)
1119-
//.setSound(Uri.parse("android.resource://" + getPackageName() + "/" + audioManager.getResourceIdForKey(ParameterKeys.RESOURCE_SOUND_RINGING)))
1120+
.setSound(Uri.parse("android.resource://" + getPackageName() + "/" + audioManager.getResourceIdForKey(ParameterKeys.RESOURCE_SOUND_RINGING)))
11201121
// Need this to show up as Heads-up Notification
11211122
.setPriority(NotificationCompat.PRIORITY_HIGH)
11221123
.setAutoCancel(true) // cancel notification when user acts on it (Important: only applies to default notification area, not additional actions)
@@ -1130,7 +1131,7 @@ void onNotificationCall(RCConnection connection, HashMap<String, String> customH
11301131

11311132
Notification notification = builder.build();
11321133
// Add FLAG_INSISTENT so that the notification rings repeatedly (FLAG_INSISTENT is not exposed via builder, let's add manually)
1133-
//notification.flags = notification.flags | Notification.FLAG_INSISTENT;
1134+
notification.flags = notification.flags | Notification.FLAG_INSISTENT;
11341135

11351136
boolean notificationIdExists = true;
11361137
Integer activeNotificationId = callNotifications.get(peerUsername);

0 commit comments

Comments
 (0)