aboutsummaryrefslogtreecommitdiffstats
path: root/src/net
diff options
context:
space:
mode:
authorSebastien Vincent <seb@jitsi.org>2011-08-23 14:04:43 +0000
committerSebastien Vincent <seb@jitsi.org>2011-08-23 14:04:43 +0000
commit6e080f08a2d95ca398ee6ce15dd34f5211b82c58 (patch)
treeffc9a81dee6b1348223f1452808b0f2eb5ea8f09 /src/net
parentc4183ff560b6895eed58c4113d7dd8a268302b0d (diff)
downloadjitsi-6e080f08a2d95ca398ee6ce15dd34f5211b82c58.zip
jitsi-6e080f08a2d95ca398ee6ce15dd34f5211b82c58.tar.gz
jitsi-6e080f08a2d95ca398ee6ce15dd34f5211b82c58.tar.bz2
Adds the possibility to specify a default telephony domain name for XMPP (used when we want to call a XMPP contact without domain name). Adds also the possibility to specify a domain name to have default GTalk voice capabilities.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicTelephonyJabberImpl.java19
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java15
-rwxr-xr-xsrc/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistration.java25
-rw-r--r--src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationForm.java19
-rw-r--r--src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java8
-rw-r--r--src/net/java/sip/communicator/plugin/jabberaccregwizz/TelephonyConfigPanel.java126
6 files changed, 201 insertions, 11 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicTelephonyJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicTelephonyJabberImpl.java
index 28e9141..4c129e4 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicTelephonyJabberImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicTelephonyJabberImpl.java
@@ -281,7 +281,7 @@ public class OperationSetBasicTelephonyJabberImpl
protocolProvider.getDiscoveryManager().
discoverInfo(calleeURI);
- if (discoverInfo.containsFeature(
+ if (discoverInfo != null && discoverInfo.containsFeature(
ProtocolProviderServiceJabberImpl.URN_XMPP_JINGLE))
{
if(priority > bestPriority)
@@ -293,17 +293,20 @@ public class OperationSetBasicTelephonyJabberImpl
}
else
{
+ AccountID accountID = getProtocolProvider().getAccountID();
+ String bypassDomain = accountID.getAccountPropertyString(
+ "TELEPHONY_BYPASS_GTALK_CAPS");
+
+ boolean alwaysCallGtalk = (bypassDomain != null) &&
+ bypassDomain.equals(calleeAddress.substring(
+ calleeAddress.indexOf('@') + 1));
+
// test GTALK property
- if(!protocolProvider.isGTalkTesting())
+ if(!protocolProvider.isGTalkTesting() && !alwaysCallGtalk)
{
continue;
}
- boolean alwaysCallGtalk =
- getProtocolProvider().getAccountID().
- getAccountPropertyBoolean(
- "BYPASS_GTALK_CAPABILITIES", false);
-
/* see if peer supports Google Talk voice */
if(getProtocolProvider().isExtFeatureListSupported(
calleeURI, ProtocolProviderServiceJabberImpl.
@@ -731,10 +734,12 @@ public class OperationSetBasicTelephonyJabberImpl
return;
// test GTALK property
+ /*
if(!protocolProvider.isGTalkTesting() && (packet instanceof SessionIQ))
{
return;
}
+ */
if(packet instanceof JingleIQ)
{
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java
index 9872176..0bfb96e 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java
@@ -1715,6 +1715,11 @@ public class ProtocolProviderServiceJabberImpl
EntityCapsManager capsManager = discoveryManager.getCapsManager();
EntityCapsManager.Caps caps = capsManager.getCapsByUser(jid);
+ String bypassDomain = accountID.getAccountPropertyString(
+ "TELEPHONY_BYPASS_GTALK_CAPS");
+ String domain = StringUtils.parseServer(jid);
+ boolean domainEquals = domain.equals(bypassDomain);
+
if(caps != null && caps.ext != null)
{
String exts[] = caps.ext.split(" ");
@@ -1722,6 +1727,12 @@ public class ProtocolProviderServiceJabberImpl
for(String extFeature : extFeatures)
{
+ // in case we have a domain that have to bypass GTalk caps
+ if(extFeature.equals(CAPS_GTALK_WEB_VOICE) && domainEquals)
+ {
+ return true;
+ }
+
found = false;
for(String ext : exts)
{
@@ -2137,9 +2148,7 @@ public class ProtocolProviderServiceJabberImpl
, false) ||
accountID.getAccountPropertyBoolean(
ProtocolProviderFactory.IS_USE_GOOGLE_ICE,
- false) ||
- accountID.getAccountPropertyBoolean(
- "BYPASS_GTALK_CAPABILITIES", false));
+ false));
}
UserCredentials getUserCredentials()
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistration.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistration.java
index 01636a7..743ff37 100755
--- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistration.java
+++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistration.java
@@ -86,6 +86,11 @@ public class JabberAccountRegistration
private boolean bypassGtalkCaps = false;
/**
+ * Domain name that will bypass GTalk caps.
+ */
+ private String domainBypassCaps = null;
+
+ /**
* The port.
*/
private int port = new Integer(DEFAULT_PORT).intValue();
@@ -249,6 +254,16 @@ public class JabberAccountRegistration
}
/**
+ * Returns telephony domain that bypass GTalk caps.
+ *
+ * @return telephony domain
+ */
+ public String getTelephonyDomainBypassCaps()
+ {
+ return domainBypassCaps;
+ }
+
+ /**
* The address of the server we will use for this account
* @return String
*/
@@ -343,6 +358,16 @@ public class JabberAccountRegistration
}
/**
+ * Sets telephony domain that bypass GTalk caps.
+ *
+ * @param text telephony domain to set
+ */
+ public void setTelephonyDomainBypassCaps(String text)
+ {
+ this.domainBypassCaps = text;
+ }
+
+ /**
* Sets the server
*
* @param serverAddress the IP address or FQDN of the server.
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationForm.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationForm.java
index 30a5aa5..af5b718 100644
--- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationForm.java
+++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationForm.java
@@ -29,6 +29,8 @@ public class JabberAccountRegistrationForm
private final IceConfigPanel iceConfigPanel;
+ private final TelephonyConfigPanel telephonyConfigPanel;
+
private boolean isModification;
private final JabberAccountRegistrationWizard wizard;
@@ -56,6 +58,8 @@ public class JabberAccountRegistrationForm
connectionPanel = new ConnectionPanel(this);
iceConfigPanel = new IceConfigPanel();
+
+ telephonyConfigPanel = new TelephonyConfigPanel();
}
/**
@@ -87,6 +91,10 @@ public class JabberAccountRegistrationForm
tabbedPane.addTab(Resources.getString("service.gui.ICE"),
iceConfigPanel);
+ if (telephonyConfigPanel.getParent() != tabbedPane)
+ tabbedPane.addTab(Resources.getString("service.gui.TELEPHONY"),
+ telephonyConfigPanel);
+
if (tabbedPane.getParent() != this)
this.add(tabbedPane, BorderLayout.NORTH);
@@ -308,6 +316,10 @@ public class JabberAccountRegistrationForm
registration.setUseUPNP(iceConfigPanel.isUseUPNP());
+ registration.setTelephonyDomainBypassCaps(
+ telephonyConfigPanel.getTelephonyDomainBypassCaps());
+ registration.setOverridePhoneSufix(
+ telephonyConfigPanel.getTelephonyDomain());
return true;
}
@@ -486,6 +498,13 @@ public class JabberAccountRegistrationForm
accountID.getAccountPropertyBoolean(
ProtocolProviderFactory.IS_SERVER_OVERRIDDEN,
false));
+
+ String telephonyDomain = accountProperties.get("OVERRIDE_PHONE_SUFFIX");
+ telephonyConfigPanel.setTelephonyDomain(telephonyDomain);
+
+ String bypassCapsDomain = accountProperties.get(
+ "TELEPHONY_BYPASS_GTALK_CAPS");
+ telephonyConfigPanel.setTelephonyDomainBypassCaps(bypassCapsDomain);
}
/**
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java
index d50b77a..d40a345 100644
--- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java
@@ -333,9 +333,15 @@ public class JabberAccountRegistrationWizard
registration.getOverridePhoneSuffix());
}
- accountProperties.put("BYPASS_GTALK_PROPERTIES",
+ accountProperties.put("BYPASS_GTALK_CAPABILITIES",
String.valueOf(registration.getBypassGtalkCaps()));
+ if(registration.getTelephonyDomainBypassCaps() != null)
+ {
+ accountProperties.put("TELEPHONY_BYPASS_GTALK_CAPS",
+ registration.getTelephonyDomainBypassCaps());
+ }
+
accountProperties.put(ProtocolProviderFactory.SERVER_ADDRESS,
serverName);
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/TelephonyConfigPanel.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/TelephonyConfigPanel.java
new file mode 100644
index 0000000..db8b8db
--- /dev/null
+++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/TelephonyConfigPanel.java
@@ -0,0 +1,126 @@
+/*
+ * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.plugin.jabberaccregwizz;
+
+import java.awt.*;
+
+import javax.swing.*;
+
+import net.java.sip.communicator.util.swing.*;
+
+/**
+ * Telephony related configuration panel.
+ *
+ * @author Sebastien Vincent
+ */
+public class TelephonyConfigPanel
+ extends TransparentPanel
+{
+ /**
+ * Serial version UID.
+ */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Text field for domain name.
+ */
+ private final JTextField domainField = new TrimTextField();
+
+ /**
+ * Text field for domain name.
+ */
+ private final JTextField domainBypassCapsField = new TrimTextField();
+
+ /**
+ * Main panel.
+ */
+ private final TransparentPanel mainPanel = new TransparentPanel();
+
+ private final JPanel lblPanel
+ = new TransparentPanel(new GridLayout(0, 1, 10, 10));
+
+ private final JPanel valPanel
+ = new TransparentPanel(new GridLayout(0, 1, 10, 10));
+
+ private final JPanel telPanel
+ = new TransparentPanel(new BorderLayout(10, 10));
+
+ /**
+ * Constructor.
+ */
+ public TelephonyConfigPanel()
+ {
+ super(new BorderLayout());
+
+ mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
+
+ JLabel domainLbl = new JLabel(
+ Resources.getString("plugin.jabberaccregwizz.TELEPHONY_DOMAIN"));
+ JLabel gtalkCallLbl = new JLabel(
+ Resources.getString(
+ "plugin.jabberaccregwizz.DOMAIN_BYPASS_CAPS"));
+
+ /*
+ panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
+ panel.add(domainLbl);
+ panel.add(domainField);
+ panel.add(gtalkCallLbl);
+
+ add(panel);
+ */
+ lblPanel.add(domainLbl);
+ lblPanel.add(gtalkCallLbl);
+ valPanel.add(domainField);
+ valPanel.add(domainBypassCapsField);
+ telPanel.add(lblPanel, BorderLayout.WEST);
+ telPanel.add(valPanel, BorderLayout.CENTER);
+
+ mainPanel.add(telPanel);
+
+ add(mainPanel, BorderLayout.NORTH);
+ }
+
+ /**
+ * Returns telephony domain.
+ *
+ * @return telephony domain
+ */
+ public String getTelephonyDomain()
+ {
+ return domainField.getText();
+ }
+
+ /**
+ * Sets telephony domain.
+ *
+ * @param text telephony domain to set
+ */
+ public void setTelephonyDomain(String text)
+ {
+ domainField.setText(text);
+ }
+
+ /**
+ * Returns telephony domain that bypass GTalk caps.
+ *
+ * @return telephony domain
+ */
+ public String getTelephonyDomainBypassCaps()
+ {
+ return domainBypassCapsField.getText();
+ }
+
+ /**
+ * Sets telephony domain that bypass GTalk caps.
+ *
+ * @param text telephony domain to set
+ */
+ public void setTelephonyDomainBypassCaps(String text)
+ {
+ domainBypassCapsField.setText(text);
+ }
+}