Commit 19486c49 authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

[GATE-39] Incorporated the work of Ravin Dimantha and Patrick Siu for initial SIP/SIMPLE support!

Replaces included sip icons with Ryans new ones.
Applied Ryan's suggestions for a better filter look/feel on the registrations page.
Added new library files to plugins.iml.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk/src/plugins/gateway@7107 b35dd754-fafc-0310-a699-88a17e54d16e
parent 0789ab69
File added
Name | Version
-------------------------------------------------------
cindy.jar | 2.4.4
concurrent.jar | 1.3.4
dwr.jar | 1.1.1 (patched [#3])
irclib.jar | 1.10
jainsipapi.jar | 1.2 (nightly 2007-02-13)
jainsipri.jar | 1.2 (nightly 2007-02-13)
jakarta-regexp.jar | 1.3
jml.jar | svn-20061216
joscar-client.jar | svn-20070204 (patched [#2])
joscar-common.jar | svn-20070204
joscar-protocol.jar | svn-20070204 (patched [#2])
log4j.jar | 1.2.8
picocontainer.jar | 1.2.0
ymsg_network.jar | 0.61 (patched [#1])
ymsg_support.jar | 0.61 (patched [#1])
......
......@@ -153,6 +153,17 @@
## Added key: 'gateway.base.registrationdeniedbadusername'
## Added key: 'gateway.web.settings.unstable.title'
## Added key: 'gateway.web.settings.unstable.notice'
##
## 1.0 Beta 8
## Added key: 'gateway.sip.shortservice'
## Added key: 'gateway.sip.service'
## Added key: 'gateway.sip.name'
## Added key: 'gateway.sip.username'
## Added key: 'gateway.sip.password'
## Added key: 'gateway.sip.registration'
## Added key: 'gateway.sip.passwordincorrect'
## Added key: 'gateway.sip.sendmsgfailed'
## Added key: 'gateway.sip.illegalaccount'
# Temporary Tags Until Fixed Properly
......@@ -242,6 +253,17 @@ gateway.irc.donotdisturb=Do Not Disturb
gateway.irc.errorreceived=IRC error received:
gateway.irc.errorreceivedwithcode=IRC error received (code {0}):
# SIP Transport
gateway.sip.shortservice=SIP
gateway.sip.service=SIMPLE
gateway.sip.name=SIMPLE Transport
gateway.sip.username=Username
gateway.sip.password=Password
gateway.sip.registration=Please enter your SIMPLE username and password.
gateway.sip.passwordincorrect=The password you registered with is incorrect. Please re-register with the correct password.
gateway.sip.sendmsgfailed=Unable to send SIMPLE message. Reason:
gateway.sip.illegalaccount=You are registered with the SIP/SIMPLE transport with an illegal account name.\nThe account name should look like an email address.\nYou registered as:
# Web Interface (Settings)
gateway.web.settings.instructions=Select which gateways will be allowed, what features are available, and who can connect to each gateway service. Checking a gateway enables the service.
gateway.web.settings.tests=Tests
......
......@@ -141,3 +141,12 @@ gateway.base.registrationdeniednoacct=Ihre Registrierung wurde verweigert, weil
gateway.base.registrationdeniedbadusername=Ihre Registrierung wurde verweigert, weil der von ihnen angegebene Benutzername fr diesen Service ungltig ist.
gateway.web.settings.unstable.title=Instabile Gateways
gateway.web.settings.unstable.notice=Die folgenden Gateways sind instabil und es wird nicht empfohlen diese in einer Produktionsumgebung einzusetzen. Sie werden bereitgestellt fr die, die interessiert sind instabile Dienste zu testen und wissen, da diese mglicherweise nicht richtig funktionieren.
gateway.sip.shortservice=SIP
gateway.sip.service=SIMPLE
gateway.sip.name=SIMPLE Transport
gateway.sip.username=Username
gateway.sip.password=Password
gateway.sip.registration=Please enter your SIMPLE username and password.
gateway.sip.passwordincorrect=The password you registered with is incorrect. Please re-register with the correct password.
gateway.sip.sendmsgfailed=Unable to send SIMPLE message. Reason:
gateway.sip.illegalaccount=You are registered with the SIP/SIMPLE transport with an illegal account name.\nThe account name should look like an email address.\nYou registered as:
\ No newline at end of file
......@@ -141,3 +141,12 @@ gateway.base.registrationdeniednoacct=u registraci\u00f3n fue denegada ya que no
gateway.base.registrationdeniedbadusername=Su registraci\u00f3n fue denegada ya que el nombre de usuario especificado no es v\u00e1lido para este servicio.
gateway.web.settings.unstable.title=Gateways Inestables
gateway.web.settings.unstable.notice=Los siguientes transportes estan inestables por lo que no se recomandienda su uso en ambientes de producci\u00f3n. Los mismos son provistos para aquellos que desean probar servicios inestables y que no tienen problema si los mismos no funcionan correctamente.
gateway.sip.shortservice=SIP
gateway.sip.service=SIMPLE
gateway.sip.name=SIMPLE Transport
gateway.sip.username=Username
gateway.sip.password=Password
gateway.sip.registration=Please enter your SIMPLE username and password.
gateway.sip.passwordincorrect=The password you registered with is incorrect. Please re-register with the correct password.
gateway.sip.sendmsgfailed=Unable to send SIMPLE message. Reason:
gateway.sip.illegalaccount=You are registered with the SIP/SIMPLE transport with an illegal account name.\nThe account name should look like an email address.\nYou registered as:
\ No newline at end of file
......@@ -141,3 +141,12 @@ gateway.base.registrationdeniednoacct=Seu registro foi negado porque voc
gateway.base.registrationdeniedbadusername=Seu registro foi negado pois o usurio fornecido no vlido para o servio.
gateway.web.settings.unstable.title=Gateways Instveis
gateway.web.settings.unstable.notice=Os gateways a seguir no so recomendados para ambientes de produo. Eles so disponibilizados para aqueles que desejam testar o servio mesmo sabendo que eles podem no funcionar corretamente.
gateway.sip.shortservice=SIP
gateway.sip.service=SIMPLE
gateway.sip.name=SIMPLE Transport
gateway.sip.username=Username
gateway.sip.password=Password
gateway.sip.registration=Please enter your SIMPLE username and password.
gateway.sip.passwordincorrect=The password you registered with is incorrect. Please re-register with the correct password.
gateway.sip.sendmsgfailed=Unable to send SIMPLE message. Reason:
gateway.sip.illegalaccount=You are registered with the SIP/SIMPLE transport with an illegal account name.\nThe account name should look like an email address.\nYou registered as:
\ No newline at end of file
......@@ -81,6 +81,10 @@ public class GatewayPlugin implements Plugin {
/* Set up MSN transport. */
transports.put("msn", new TransportInstance(TransportType.msn, LocaleUtils.getLocalizedString("gateway.msn.name", "gateway"), "org.jivesoftware.wildfire.gateway.protocols.msn.MSNTransport", componentManager));
maybeStartService("msn");
/* Set up SIP/SIMPLE transport. */
transports.put("sip", new TransportInstance(TransportType.sip, LocaleUtils.getLocalizedString("gateway.sip.name", "gateway"), "org.jivesoftware.wildfire.gateway.protocols.simple.SimpleTransport", componentManager));
maybeStartService("sip");
}
public void destroyPlugin() {
......
package org.jivesoftware.wildfire.gateway.protocols.simple;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Properties;
import java.util.TooManyListenersException;
import javax.sip.InvalidArgumentException;
import javax.sip.ListeningPoint;
import javax.sip.ObjectInUseException;
import javax.sip.PeerUnavailableException;
import javax.sip.SipFactory;
import javax.sip.SipProvider;
import javax.sip.SipStack;
import javax.sip.TransportNotSupportedException;
import javax.sip.address.AddressFactory;
import javax.sip.header.HeaderFactory;
import javax.sip.message.MessageFactory;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.util.Log;
import org.jivesoftware.wildfire.gateway.BaseTransport;
import org.jivesoftware.wildfire.gateway.PresenceType;
import org.jivesoftware.wildfire.gateway.Registration;
import org.jivesoftware.wildfire.gateway.TransportLoginStatus;
import org.jivesoftware.wildfire.gateway.TransportSession;
import org.xmpp.packet.JID;
/**
* A transport implementation for SIMPLE protocol.
* @author Patrick Siu
* @version 0.0.1
*/
public class SimpleTransport extends BaseTransport {
SipFactory sipFactory = null;
public SimpleTransport() {
super();
// Initialize the SipFactory
sipFactory = SipFactory.getInstance();
sipFactory.setPathName("gov.nist");
}
public TransportSession registrationLoggedIn(Registration registration, JID jid, PresenceType presenceType, String verboseStatus, Integer priority) {
TransportSession session = new SimpleSession(registration, jid, this, priority);
// Possibly more work here!
((SimpleSession) session).login(presenceType, verboseStatus);
return session;
}
public void registrationLoggedOut(TransportSession session) {
((SimpleSession) session).logout();
session.sessionDone();
// Just in case.
// session.setLoginStatus(TransportLoginStatus.LOGGED_OUT);
}
public String getTerminologyUsername() {
return LocaleUtils.getLocalizedString("gateway.sip.username", "gateway");
}
public String getTerminologyPassword() {
return LocaleUtils.getLocalizedString("gateway.sip.password", "gateway");
}
public String getTerminologyNickname() {
// If this string is needed, then take it. Just put a draft code to ensure integrity.
String result = null;
return result;
}
public String getTerminologyRegistration() {
return LocaleUtils.getLocalizedString("gateway.sip.registration", "gateway");
}
public Boolean isPasswordRequired() {
// Just put a draft code to ensure integrity.
Boolean result = true;
return result;
}
public Boolean isNicknameRequired() {
// Just put a draft code to ensure integrity.
Boolean result = false;
return result;
}
public Boolean isUsernameValid(String username) {
// Just put a draft code to ensure integrity.
Boolean result = username.matches("\\w+");
return result;
}
// The following code are generic custom classes for SIP-XMPP conversion.
public void convertJabStatusToSIP(PresenceType jabStatus) {
}
public void convertSIPStatusToJap() {
}
/**
* An improved method to do the trick.
*/
public String convertJIDToID(JID jid) {
String node = jid.getNode();
while (!JID.unescapeNode(node).equals(node)) {
node = JID.unescapeNode(node);
}
return node;
}
int portOffset = 0;
synchronized int generateListenerPort() {
return (ListeningPoint.PORT_5060 + (++portOffset));
}
}
<?xml version="1.0" encoding="UTF-8"?>
<optionsconfig>
<leftpanel></leftpanel>
<rightpanel>
<item type="text" sysprop="plugin.gateway.sip.connecthost" var="host" desckey="gateway.web.settings.host" default="localhost"/>
<item type="text" sysprop="plugin.gateway.sip.connectport" var="port" desckey="gateway.web.settings.port" default="5060"/>
</rightpanel>
</optionsconfig>
......@@ -31,6 +31,7 @@
trEnabled.put("irc", plugin.getTransportInstance("irc").isEnabled());
trEnabled.put("msn", plugin.getTransportInstance("msn").isEnabled());
trEnabled.put("yahoo", plugin.getTransportInstance("yahoo").isEnabled());
trEnabled.put("sip", plugin.getTransportInstance("sip").isEnabled());
String success = request.getParameter("success");
webManager.init(request, response, session, application, out);
......@@ -155,6 +156,7 @@
if (webManager.getPageProperty("gateway-registrations", "filterYAHOO", 0) != 0) { filteropts.add("yahoo"); }
if (webManager.getPageProperty("gateway-registrations", "filterIRC", 0) != 0) { filteropts.add("irc"); }
if (webManager.getPageProperty("gateway-registrations", "filterSIGNEDON", 0) != 0) { filteropts.add("signedon"); }
if (webManager.getPageProperty("gateway-registrations", "filterSIP", 0) != 0) { filteropts.add("sip"); }
}
else {
filteropts.add("aim");
......@@ -162,6 +164,7 @@
filteropts.add("msn");
filteropts.add("yahoo");
filteropts.add("irc");
filteropts.add("sip");
}
webManager.setPageProperty("gateway-registrations", "filterSET", 1);
......@@ -171,6 +174,7 @@
webManager.setPageProperty("gateway-registrations", "filterYAHOO", filteropts.contains("yahoo") ? 1 : 0);
webManager.setPageProperty("gateway-registrations", "filterIRC", filteropts.contains("irc") ? 1 : 0);
webManager.setPageProperty("gateway-registrations", "filterSIGNEDON", filteropts.contains("signedon") ? 1 : 0);
webManager.setPageProperty("gateway-registrations", "filterSIP", filteropts.contains("sip") ? 1 : 0);
int resCount = 0;
for (Registration registration : registrations) {
......@@ -341,6 +345,7 @@
<% if (trEnabled.get("icq")) { %> <option value="icq"><fmt:message key="gateway.icq.shortservice" /></option> <% } %>
<% if (trEnabled.get("irc")) { %> <option value="irc"><fmt:message key="gateway.irc.shortservice" /></option> <% } %>
<% if (trEnabled.get("msn")) { %> <option value="msn"><fmt:message key="gateway.msn.shortservice" /></option> <% } %>
<% if (trEnabled.get("sip")) { %> <option value="sip"><fmt:message key="gateway.sip.shortservice" /></option> <% } %>
<% if (trEnabled.get("yahoo")) { %> <option value="yahoo"><fmt:message key="gateway.yahoo.shortservice" /></option> <% } %>
</select><br>
<strong><fmt:message key="gateway.web.registrations.gateway" /></strong>
......@@ -432,28 +437,33 @@
<strong>Filter by:</strong>
<label for="filterAIMcheckbox">
<input type="checkbox" name="filter[]" value="aim" <%= ((filteropts.contains("aim")) ? "checked" : "") %> id="filterAIMcheckbox">
<img src="images/aim.gif" alt="" border="0">
<span><fmt:message key="gateway.aim.shortservice" /></span>
<img src="images/aim.gif" alt="" border="0" alt="<fmt:message key="gateway.aim.shortservice" />">
<!--<span><fmt:message key="gateway.aim.shortservice" /></span>-->
</label>
<label for="filterICQcheckbox">
<input type="checkbox" name="filter[]" value="icq" <%= ((filteropts.contains("icq")) ? "checked" : "") %> id="filterICQcheckbox">
<img src="images/icq.gif" alt="" border="0">
<span><fmt:message key="gateway.icq.shortservice" /></span>
<img src="images/icq.gif" alt="" border="0" alt="<fmt:message key="gateway.icq.shortservice" />">
<!--<span><fmt:message key="gateway.icq.shortservice" /></span>-->
</label>
<label for="filterIRCcheckbox">
<input type="checkbox" name="filter[]" value="irc" <%= ((filteropts.contains("irc")) ? "checked" : "") %> id="filterIRCcheckbox">
<img src="images/irc.gif" alt="" border="0">
<span><fmt:message key="gateway.irc.shortservice" /></span>
<img src="images/irc.gif" alt="" border="0" alt="<fmt:message key="gateway.irc.shortservice" />">
<!--<span><fmt:message key="gateway.irc.shortservice" /></span>-->
</label>
<label for="filterMSNcheckbox">
<input type="checkbox" name="filter[]" value="msn" <%= ((filteropts.contains("msn")) ? "checked" : "") %> id="filterMSNcheckbox">
<img src="images/msn.gif" alt="" border="0">
<span><fmt:message key="gateway.msn.shortservice" /></span>
<img src="images/msn.gif" alt="" border="0" alt="<fmt:message key="gateway.msn.shortservice" />">
<!--<span><fmt:message key="gateway.msn.shortservice" /></span>-->
</label>
<label for="filterSIPcheckbox">
<input type="checkbox" name="filter[]" value="sip" <%= ((filteropts.contains("sip")) ? "checked" : "") %> id="filterSIPcheckbox">
<img src="images/sipsimple.gif" alt="" border="0" alt="<fmt:message key="gateway.sip.shortservice" />">
<!--<span><fmt:message key="gateway.sip.shortservice" /></span>-->
</label>
<label for="filterYAHOOcheckbox">
<input type="checkbox" name="filter[]" value="yahoo" <%= ((filteropts.contains("yahoo")) ? "checked" : "") %> id="filterYAHOOcheckbox">
<img src="images/yahoo.gif" alt="" border="0">
<span><fmt:message key="gateway.yahoo.shortservice" /></span>
<img src="images/yahoo.gif" alt="" border="0" alt="<fmt:message key="gateway.yahoo.shortservice" />">
<!--<span><fmt:message key="gateway.yahoo.shortservice" /></span>-->
</label>
<label for="filterActiveOnly">
<input type="checkbox" name="filter[]" value="signedon" <%= ((filteropts.contains("signedon")) ? "checked" : "") %> id="filterActiveOnly">
......
......@@ -354,6 +354,7 @@
GatewaySettings icqSettings = new GatewaySettings(out, plugin, TransportType.icq, LocaleUtils.getLocalizedString("gateway.icq.service", "gateway"));
GatewaySettings ircSettings = new GatewaySettings(out, plugin, TransportType.irc, LocaleUtils.getLocalizedString("gateway.irc.service", "gateway"));
GatewaySettings msnSettings = new GatewaySettings(out, plugin, TransportType.msn, LocaleUtils.getLocalizedString("gateway.msn.service", "gateway"));
GatewaySettings sipSettings = new GatewaySettings(out, plugin, TransportType.sip, LocaleUtils.getLocalizedString("gateway.sip.service", "gateway"));
GatewaySettings yahooSettings = new GatewaySettings(out, plugin, TransportType.yahoo, LocaleUtils.getLocalizedString("gateway.yahoo.service", "gateway"));
%>
......@@ -615,6 +616,7 @@
<p><fmt:message key="gateway.web.settings.unstable.notice" /></p>
<% sipSettings.printSettingsDialog(); %>
<% yahooSettings.printSettingsDialog(); %>
</form>
......
......@@ -123,21 +123,3 @@ function toggleEdit(theNum) {
Effect.Appear($(editRow), {duration: .2});
}
}
/*
toggleFilters function
this is for a future feature, to replace the row of filter options with a
dynamic pulldown menu.
*/
/*
function toggleFilters() {
if ($(jiveFilterDrop).style.display != 'none') {
Effect.toggle($(jiveFilterDrop),'slide', {duration: .4});
} else {
Effect.toggle($(jiveFilterDrop),'slide', {duration: .4});
}
}
*/
\ No newline at end of file
......@@ -344,6 +344,14 @@ a.jive-gatewayButtonOn {
background: url(../images/msn-gray.gif) no-repeat left;
background-position: 2px 1px;
}
.jive-gateway-SIPon {
background: url(../images/sip.gif) no-repeat left;
background-position: 2px 1px;
}
.jive-gateway-SIPoff {
background: url(../images/sip-gray.gif) no-repeat left;
background-position: 2px 1px;
}
.jive-gateway-YAHOOon {
background: url(../images/yahoo.gif) no-repeat left;
background-position: 0px 1px;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment