Add the possibility to invite callees to an existing conference. Part of issue #726 Conference call user interface.

cusax-fix
Yana Stamcheva 16 years ago
parent bcfc4a3810
commit 930bbaebc8

@ -93,6 +93,7 @@ service.gui.buttons.CALL_BUTTON_PRESSED_BG=resources/images/impl/gui/buttons/cal
service.gui.buttons.HANGUP_BUTTON_BG=resources/images/impl/gui/buttons/hangupButton.png
service.gui.buttons.HANGUP_ROLLOVER_BUTTON_BG=resources/images/impl/gui/buttons/hangupButtonRollover.png
service.gui.buttons.HANGUP_BUTTON_PRESSED_BG=resources/images/impl/gui/buttons/hangupButtonPressed.png
service.gui.buttons.ADD_TO_CALL_BUTTON=resources/images/impl/gui/buttons/addToCall.png
service.gui.buttons.STATUS_SELECTOR_BOX=resources/images/impl/gui/buttons/combobox.png
service.gui.buttons.BUTTON_BG=resources/images/impl/gui/buttons/dialButtonBg.png
service.gui.buttons.BUTTON_ROLLOVER_BG=resources/images/impl/gui/buttons/dialButtonRolloverBg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 413 B

@ -36,6 +36,8 @@ public class CallDialog
{
private static final String DIAL_BUTTON = "DIAL_BUTTON";
private static final String CONFERENCE_BUTTON = "CONFERENCE_BUTTON";
private static final String HANGUP_BUTTON = "HANGUP_BUTTON";
private DialpadDialog dialpadDialog;
@ -108,6 +110,10 @@ public CallDialog(Call call, String callType)
ImageLoader.getImage(ImageLoader.CALL_SETTING_BUTTON_BG),
ImageLoader.getImage(ImageLoader.DIAL_BUTTON));
SIPCommButton conferenceButton = new SIPCommButton(
ImageLoader.getImage(ImageLoader.CALL_SETTING_BUTTON_BG),
ImageLoader.getImage(ImageLoader.ADD_TO_CALL_BUTTON));
holdButton = new HoldButton(call);
muteButton = new MuteButton(call);
videoButton = new LocalVideoButton(call);
@ -118,6 +124,13 @@ public CallDialog(Call call, String callType)
dialButton.addActionListener(this);
dialButton.addMouseListener(this);
conferenceButton.setName(CONFERENCE_BUTTON);
conferenceButton.setToolTipText(
GuiActivator.getResources().getI18NString(
"service.gui.CREATE_CONFERENCE_CALL"));
conferenceButton.addActionListener(this);
conferenceButton.addMouseListener(this);
contentPane.add(callPanel, BorderLayout.CENTER);
contentPane.add(buttonsPanel, BorderLayout.SOUTH);
@ -127,6 +140,7 @@ public CallDialog(Call call, String callType)
hangupButton.addActionListener(this);
settingsPanel.add(dialButton);
settingsPanel.add(conferenceButton);
settingsPanel.add(holdButton);
settingsPanel.add(muteButton);
@ -176,6 +190,13 @@ else if (buttonName.equals(DIAL_BUTTON))
dialpadDialog.setVisible(false);
}
}
else if (buttonName.equals(CONFERENCE_BUTTON))
{
ConferenceInviteDialog inviteDialog
= new ConferenceInviteDialog(call);
inviteDialog.setVisible(true);
}
}
public void mouseClicked(MouseEvent e)

@ -200,10 +200,23 @@ public static void createCall( ProtocolProviderService protocolProvider,
* @param callees the list of contacts to call to
*/
public static void createConferenceCall(
ProtocolProviderService protocolProvider,
String[] callees)
String[] callees,
ProtocolProviderService protocolProvider)
{
new CreateConferenceCallThread(protocolProvider, callees).start();
new CreateConferenceCallThread(callees, protocolProvider).start();
}
/**
* Invites the given list of <tt>callees</tt> to the given conference
* <tt>call</tt>.
*
* @param callees the list of contacts to invite
* @param call the protocol provider to which this call belongs
*/
public static void inviteToConferenceCall( String[] callees,
Call call)
{
new InviteToConferenceCallThread(callees, call).start();
}
/**
@ -338,11 +351,11 @@ private static class CreateConferenceCallThread
final ProtocolProviderService protocolProvider;
public CreateConferenceCallThread(
ProtocolProviderService protocolProvider,
String[] callees)
String[] callees,
ProtocolProviderService protocolProvider)
{
this.protocolProvider = protocolProvider;
this.callees = callees;
this.protocolProvider = protocolProvider;
}
public void run()
@ -371,6 +384,51 @@ public void run()
}
}
/**
* Invites a list of callees to a conference call.
*/
private static class InviteToConferenceCallThread
extends Thread
{
String[] callees;
final Call call;
public InviteToConferenceCallThread(String[] callees, Call call)
{
this.callees = callees;
this.call = call;
}
public void run()
{
OperationSetTelephonyConferencing confOpSet
= (OperationSetTelephonyConferencing) call.getProtocolProvider()
.getOperationSet(OperationSetTelephonyConferencing.class);
if (confOpSet == null)
return;
for (String callee : callees)
{
try
{
confOpSet.inviteCalleeToCall(callee, call);
}
catch (OperationNotSupportedException e)
{
logger.error("Failed to invite callee: " + callee, e);
new ErrorDialog(null,
GuiActivator.getResources()
.getI18NString("service.gui.ERROR"),
e.getMessage(),
ErrorDialog.ERROR).showDialog();
}
}
}
}
/**
* Hangups all call peers in the given call.
*/

@ -76,6 +76,7 @@ public class MainCallPanel
/**
* Initializes and constructs this panel.
* @param mainFrame the main application window
*/
public MainCallPanel(MainFrame mainFrame)
{
@ -211,7 +212,7 @@ public void actionPerformed(ActionEvent evt)
= telephonyContacts.toArray(contactAddressStrings);
CallManager.createConferenceCall(
protocolProvider, contactAddressStrings);
contactAddressStrings, protocolProvider);
}
}
else if (!phoneNumberCombo.isComboFieldEmpty())
@ -276,6 +277,7 @@ public MainFrame getMainFrame()
/**
* Gets the protocol provider used for making calls.
* @return the protocol provider service
*/
public ProtocolProviderService getCallProvider()
{

@ -32,16 +32,21 @@ public class ConferenceInviteDialog
private Object lastSelectedAccount;
private Call call;
/**
* Constructs the <tt>ChatInviteDialog</tt>.
* Creates <tt>ConferenceInviteDialog</tt> by specifying the call, to which
* the contacts are invited.
*
* <tt>ChatRoom</tt>, where the contact is invited.
* @param call the call to which the contacts are invited
*/
public ConferenceInviteDialog ()
public ConferenceInviteDialog(Call call)
{
super(GuiActivator.getResources()
.getI18NString("service.gui.INVITE_CONTACT_TO_CALL"));
this.call = call;
JLabel accountSelectorLabel = new JLabel(
GuiActivator.getResources().getI18NString("service.gui.CALL_VIA"));
@ -128,24 +133,43 @@ public void actionPerformed(ActionEvent e)
});
}
/**
* Constructs the <tt>ConferenceInviteDialog</tt>.
*/
public ConferenceInviteDialog()
{
this(null);
}
/**
* Initializes the account list.
*/
private void initAccountListData()
{
Iterator<ProtocolProviderService> protocolProviders
= GuiActivator.getUIService()
.getMainFrame().getProtocolProviders();
while(protocolProviders.hasNext())
// If we have a specified call, we'll have only one provider in the
// box.
if (call != null)
{
accountSelectorBox.addItem(call.getProtocolProvider());
accountSelectorBox.setEnabled(false);
}
else
{
ProtocolProviderService protocolProvider = protocolProviders.next();
Iterator<ProtocolProviderService> protocolProviders
= GuiActivator.getUIService()
.getMainFrame().getProtocolProviders();
OperationSet opSet = protocolProvider
.getOperationSet(OperationSetTelephonyConferencing.class);
while(protocolProviders.hasNext())
{
ProtocolProviderService protocolProvider
= protocolProviders.next();
if (opSet != null && protocolProvider.isRegistered())
accountSelectorBox.addItem(protocolProvider);
OperationSet opSet = protocolProvider
.getOperationSet(OperationSetTelephonyConferencing.class);
if (opSet != null && protocolProvider.isRegistered())
accountSelectorBox.addItem(protocolProvider);
}
}
// Select the first possible account.
@ -215,7 +239,14 @@ private void inviteContacts()
= selectedContactAddresses.toArray(contactAddressStrings);
}
CallManager.createConferenceCall(
selectedProvider, contactAddressStrings);
if (call != null)
{
CallManager.inviteToConferenceCall(contactAddressStrings, call);
}
else
{
CallManager.createConferenceCall(
contactAddressStrings, selectedProvider);
}
}
}

@ -373,6 +373,12 @@ public class ImageLoader
public static final ImageID DIAL_BUTTON
= new ImageID("service.gui.buttons.DIAL_BUTTON");
/**
* A dial button icon. The icon shown in the CallPeer panel.
*/
public static final ImageID ADD_TO_CALL_BUTTON
= new ImageID("service.gui.buttons.ADD_TO_CALL_BUTTON");
/**
* A put-on/off-hold button icon. The icon shown in the CallPeer
* panel.

@ -29,7 +29,11 @@ public class CallGibberishImpl
*/
private Vector<CallPeer> callPeers = new Vector<CallPeer>();
/**
* Creates a <tt>CallGibberishImpl</tt> by specifying the
* <tt>sourceProvider</tt>.
* @param sourceProvider the source provider
*/
public CallGibberishImpl(
ProtocolProviderServiceGibberishImpl sourceProvider)
{
@ -39,8 +43,7 @@ public CallGibberishImpl(
/**
* Returns an iterator over all call peers.
*
* @return an Iterator over all peers currently involved in the
* call.
* @return an Iterator over all peers currently involved in the call.
*/
public Iterator<CallPeer> getCallPeers()
{
@ -50,7 +53,7 @@ public Iterator<CallPeer> getCallPeers()
/**
* Returns the number of peers currently associated with this call.
*
* @return an <tt>int</tt> indicating the number of peers
* @return an <code>int</code> indicating the number of peers
* currently associated with this call.
*/
public int getCallPeerCount()
@ -121,19 +124,14 @@ && getCallState().equals(CallState.CALL_INITIALIZATION))
}
public void peerDisplayNameChanged(CallPeerChangeEvent evt)
{
}
{}
public void peerAddressChanged(CallPeerChangeEvent evt)
{
}
{}
public void peerImageChanged(CallPeerChangeEvent evt)
{
}
{}
public void peerTransportAddressChanged(CallPeerChangeEvent
evt)
{
}
public void peerTransportAddressChanged(CallPeerChangeEvent evt)
{}
}

@ -38,10 +38,17 @@ public class OperationSetTelephonyConferencingGibberishImpl
private final OperationSetBasicTelephonyGibberishImpl telephonyOpSet;
/**
* A table mapping call ids against call instances.
* A table mapping call id-s against call instances.
*/
private Hashtable<String, Call> activeCalls = new Hashtable<String, Call>();
/**
* Creates an <tt>OperationSetTelephonyConferencingGibberishImpl</tt> by
* specifying the protocol <tt>provider</tt> and the according
* <tt>telephonyOpSet</tt>.
* @param provider the protocol provider
* @param telephonyOpSet the according telephony operation set
*/
public OperationSetTelephonyConferencingGibberishImpl(
ProtocolProviderServiceGibberishImpl provider,
OperationSetBasicTelephonyGibberishImpl telephonyOpSet)
@ -50,6 +57,10 @@ public OperationSetTelephonyConferencingGibberishImpl(
this.telephonyOpSet = telephonyOpSet;
}
/**
* Creates a conference call with the given list of <tt>callees</tt>
* @param callees the list of callees to invite in the call
*/
public Call createConfCall(String[] callees)
throws OperationNotSupportedException
{
@ -71,10 +82,22 @@ public Call createConfCall(String[] callees)
return newCall;
}
public CallPeer inviteCalleeToCall(String uri, Call existingCall)
/**
* Invites the given <tt>callee</tt> to the given <tt>existingCall</tt>.
* @param callee the address of the callee to invite
* @param existingCall the call, to which she will be invited
*/
public CallPeer inviteCalleeToCall(String callee, Call existingCall)
throws OperationNotSupportedException
{
return null;
CallGibberishImpl gibberishCall = (CallGibberishImpl) existingCall;
CallPeerGibberishImpl callPeer
= new CallPeerGibberishImpl(callee, gibberishCall);
gibberishCall.addCallPeer(callPeer);
return callPeer;
}
public void callPeerAdded(CallPeerEvent evt)

Loading…
Cancel
Save