A hack fixing problem with playing notifications during the ongoing call.

cusax-fix
Damian Minkov 13 years ago
parent 9d2858020d
commit 93aeb79acf

@ -1525,4 +1525,14 @@ public ContactList createContactListComponent()
{
return new TreeContactList();
}
/**
* Returns a collection of all currently in progress calls.
*
* @return a collection of all currently in progress calls.
*/
public Collection<Call> getInProgressCalls()
{
return CallManager.getInProgressCalls();
}
}

@ -6,6 +6,7 @@
*/
package net.java.sip.communicator.impl.notification;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.notification.*;
import net.java.sip.communicator.service.systray.*;
import net.java.sip.communicator.util.*;
@ -31,6 +32,11 @@ public class NotificationActivator
private static SystrayService systrayService;
private static NotificationService notificationService;
/**
* A reference to the <tt>UIService</tt> currently in use in Jitsi.
*/
private static UIService uiService = null;
private CommandNotificationHandler commandHandler;
private LogMessageNotificationHandler logMessageHandler;
private PopupMessageNotificationHandler popupMessageHandler;
@ -125,4 +131,18 @@ public static SystrayService getSystray()
return systrayService;
}
/**
* Returns a reference to an UIService implementation currently registered
* in the bundle context or null if no such implementation was found.
*
* @return a reference to an UIService implementation currently registered
* in the bundle context or null if no such implementation was found.
*/
public static UIService getUIService()
{
if(uiService == null)
uiService = ServiceUtils.getService(bundleContext, UIService.class);
return uiService;
}
}

@ -9,6 +9,7 @@
import java.awt.*;
import java.util.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.notification.*;
import org.jitsi.service.audionotifier.*;
@ -107,6 +108,20 @@ private void play(SoundNotificationAction action, NotificationData data,
|| StringUtils.isNullOrEmpty(action.getDescriptor(), true))
return;
// this is hack, seen on some os (particularly seen on macosx with
// external devices).
// when playing notification in the call, can break the call and
// no further communicating can be done after the notification.
// So we skip playing notification if we have a call running
if(playback)
{
UIService uiService = NotificationActivator.getUIService();
if(uiService.getInProgressCalls().size() > 0)
{
return;
}
}
SCAudioClip audio = audioNotifService
.createAudio(action.getDescriptor(), playback);
@ -215,7 +230,7 @@ private class PCSpeakerClip
public void play()
{
started = true;
new Thread()
new Thread("Playing beep:" + this.getClass())
{
@Override
public void run()

@ -462,4 +462,11 @@ public SecurityAuthority getDefaultSecurityAuthority(
* @return the created <tt>ContactList</tt>
*/
public ContactList createContactListComponent();
/**
* Returns a collection of all currently in progress calls.
*
* @return a collection of all currently in progress calls.
*/
public Collection<Call> getInProgressCalls();
}

Loading…
Cancel
Save