[sip-comm-dev] Bugs in AudioNotificationService and AudionNotifierServiceImpl ??


#1

Hi!

I probably found a bug (two bugs) in the audio-notification-classes. I
attached my solutions, however, I am not sure, if I just used it the wrong
way.

What I wanted to do, is change the ring tone. Therefore I used the
notification service:

        File f = new File("d:\\applause.wav"); //just for testing purpose

        // Register incoming message notifications.

        notificationService.removeEventNotification("IncomingCall");

        notificationService.registerNotificationForEvent("IncomingCall",

                NotificationService.ACTION_SOUND,

                f.toURI().toString(),

                null);

this does not work for two reasons:

net.java.sip.communicator.impl.gui.main.call.CallManager

in line 506:

        NotificationManager.fireNotification(

            Sounds.INCOMING_CALL,

            null,

            "Incoming call recived from: "

                + sourceCall.getCallParticipants().next());

Should be

       NotificationManager.fireNotification(

                NotificationManager.INCOMING_CALL,

            null,

            "Incoming call recived from: "

                + sourceCall.getCallParticipants().next());

And in the AudioNotifierServiceImpl

               URL url = AudioNotifierServiceImpl.class.getClassLoader()

                    .getResource(uri);

                audioClip = new SCAudioClipImpl(url, this);

                audioClips.put(uri, audioClip);

only can deal with resources stored in bundles, no chance to take a local
file. The next view lines of code help and overcome this issue. However, I
think in this case, not a string shall be passed, but already an URL. What
do you think?

                URL url = AudioNotifierServiceImpl.class.getClassLoader()

                        .getResource(uri);

                if (url == null) {

                    // not found by the classloader! perhaps it's a local
file

                    try {

                        url = new URL(uri);

                    } catch (MalformedURLException e) {

                    }

                }

And furthermore, I told the issue, that calling tones do not stop when the
other party rejects or accepts a call. Shouldn't be somewhere the stop()
method of the SCAudioClip objet in the SoubndNotificationHanlder called?
E.g. in stop?

Regards, thomas


#2

Hi Thomas,

I've just applied, committed and ack-ed your fixes.

see inline.

Hofer Thomas wrote:

Hi!

I probably found a bug (two bugs) in the audio-notification-classes. I
attached my solutions, however, I am not sure, if I just used it the wrong
way.

It's very possible, we have just created the notification service and have not tested it a lot yet. We are also making some modifications to the service right now.

We're now preparing a GUI plug-in that would allow the user to change all sounds and to configure all notifications. You may be interested.

What I wanted to do, is change the ring tone. Therefore I used the
notification service:

        File f = new File("d:\\applause.wav"); //just for testing purpose

        // Register incoming message notifications.

        notificationService.removeEventNotification("IncomingCall");

        notificationService.registerNotificationForEvent("IncomingCall",

                NotificationService.ACTION_SOUND,

                f.toURI().toString(),

                null);

this does not work for two reasons:

net.java.sip.communicator.impl.gui.main.call.CallManager

in line 506:

        NotificationManager.fireNotification(

            Sounds.INCOMING_CALL,

            null,

            "Incoming call recived from: "

                + sourceCall.getCallParticipants().next());

Should be

       NotificationManager.fireNotification(

                NotificationManager.INCOMING_CALL,

            null,

            "Incoming call recived from: "

                + sourceCall.getCallParticipants().next());

Absolutely, I've fixed that.

And in the AudioNotifierServiceImpl

               URL url = AudioNotifierServiceImpl.class.getClassLoader()

                    .getResource(uri);

                audioClip = new SCAudioClipImpl(url, this);

                audioClips.put(uri, audioClip);

only can deal with resources stored in bundles, no chance to take a local
file. The next view lines of code help and overcome this issue. However, I
think in this case, not a string shall be passed, but already an URL. What
do you think?

                URL url = AudioNotifierServiceImpl.class.getClassLoader()

                        .getResource(uri);

                if (url == null) {

                    // not found by the classloader! perhaps it's a local
file

                    try {

                        url = new URL(uri);

                    } catch (MalformedURLException e) {

                    }

                }

Yes, it was a known bug that was pending. Thanks!

And furthermore, I told the issue, that calling tones do not stop when the
other party rejects or accepts a call. Shouldn't be somewhere the stop()
method of the SCAudioClip objet in the SoubndNotificationHanlder called?
E.g. in stop?

Nice catch! I've added that also.

Thanks again Thomas!

Yana

···

Regards, thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net