Skip to content

Commit

Permalink
XX-10705 Removed call watcher code
Browse files Browse the repository at this point in the history
Removed code that relied on call watcher from IM bot - IM bot does not depend on sipXopenfire anymore
Changed a few methods in DomainConfiguration that were declared as static, but weren't really (potentially squashed a bug in sipXbridge while at it; same for sipXrest)
  • Loading branch information
Alex Mateescu committed Nov 26, 2013
1 parent 563064c commit 4c750f9
Show file tree
Hide file tree
Showing 73 changed files with 939 additions and 4,431 deletions.
70 changes: 48 additions & 22 deletions sipXbridge/src/main/java/org/sipfoundry/sipxbridge/Gateway.java
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public class Gateway {
static final String AUTHENTICATION_FAILED_ALARM_ID = "AUTHENTICATION_FAILED %s ";

static final String ITSP_ACCOUNT_CONFIGURATION_ERROR_ALARM_ID = "ITSP_ACCOUNT_CONFIGURATION_ERROR";

static final String TLS_CERTIFICATE_MISMATCH_ALARM_ID = "TLS_CERTIFICATE_MISMATCH";

public static final String ACCOUNT_OK_ALARM_ID = "ACCOUNT_OK : %s (recovery from eariler error)";
Expand Down Expand Up @@ -290,14 +290,15 @@ static void initializeLogging() throws SipXbridgeException {
String logLevel = bridgeConfiguration.getLogLevel();

java.util.logging.Level level = java.util.logging.Level.OFF;
if (logLevel.equals("INFO"))
if (logLevel.equals("INFO")) {
level = java.util.logging.Level.INFO;
else if (logLevel.equals("DEBUG"))
} else if (logLevel.equals("DEBUG")) {
level = java.util.logging.Level.FINE;
else if (logLevel.equals("TRACE"))
} else if (logLevel.equals("TRACE")) {
level = java.util.logging.Level.FINER;
else if (logLevel.equals("WARN"))
} else if (logLevel.equals("WARN")) {
level = java.util.logging.Level.WARNING;
}

/*
* BUGBUG For now turn off Logging on STUN4j. It writes to stdout.
Expand Down Expand Up @@ -384,7 +385,9 @@ static void discoverAddress() throws SipXbridgeException {

globalAddress = report.getPublicAddress().getSocketAddress()
.getAddress().getHostAddress();
if ( logger.isDebugEnabled() ) logger.debug("Stun report = " + report);
if ( logger.isDebugEnabled() ) {
logger.debug("Stun report = " + report);
}

if ( oldPublicAddress != null && !oldPublicAddress.equals(globalAddress) ||
( oldStunPort != -1 && oldStunPort != report.getPublicAddress().getPort() ) ) {
Expand Down Expand Up @@ -416,14 +419,16 @@ static void discoverAddress() throws SipXbridgeException {
}
return;
} finally {
if ( logger.isDebugEnabled() ) logger.debug("global address = " + globalAddress);
if ( logger.isDebugEnabled() ) {
logger.debug("global address = " + globalAddress);
}
}
}

public static void raiseAlarm(String id, Object... args) {
logger.error("ALARM_BRIDGE_" + format(id, args));
}

/**
* Start timer to rediscover our address.
*
Expand Down Expand Up @@ -482,7 +487,9 @@ static PriorityQueue<Hop> initializeSipxProxyAddresses()
Collection<Hop> hops = serverFinder.findSipServers(proxyUri);
PriorityQueue<Hop> proxyAddressTable = new PriorityQueue<Hop>();
proxyAddressTable.addAll(hops);
if ( logger.isDebugEnabled() ) logger.debug("proxy address table = " + proxyAddressTable);
if ( logger.isDebugEnabled() ) {
logger.debug("proxy address table = " + proxyAddressTable);
}
return proxyAddressTable;
} catch (Exception ex) {
logger.error("Cannot do address lookup ", ex);
Expand Down Expand Up @@ -518,8 +525,10 @@ static void initializeSipListeningPoints() {

int externalPort = bridgeConfiguration.getExternalPort();
String externalAddress = bridgeConfiguration.getExternalAddress();
if ( logger.isDebugEnabled() ) logger.debug("External Address:port = " + externalAddress + ":"
+ externalPort);
if ( logger.isDebugEnabled() ) {
logger.debug("External Address:port = " + externalAddress + ":"
+ externalPort);
}
ListeningPoint externalUdpListeningPoint = ProtocolObjects
.getSipStack().createListeningPoint(externalAddress,
externalPort, "udp");
Expand All @@ -529,7 +538,9 @@ static void initializeSipListeningPoints() {
externalPort, "tcp");
Gateway.supportedTransports.add("tcp");
if (Gateway.isTlsSupportEnabled) {
if ( logger.isDebugEnabled() ) logger.debug("tlsSupport is enabled -- creating TLS Listening point and provider");
if ( logger.isDebugEnabled() ) {
logger.debug("tlsSupport is enabled -- creating TLS Listening point and provider");
}
ListeningPoint externalTlsListeningPoint = ProtocolObjects
.getSipStack().createListeningPoint(externalAddress,
externalPort + 1, "tls");
Expand All @@ -554,8 +565,10 @@ static void initializeSipListeningPoints() {
gatewayFromAddress = ProtocolObjects.addressFactory
.createAddress(ProtocolObjects.addressFactory.createSipURI(
SIPXBRIDGE_USER, domain));
if ( logger.isDebugEnabled() ) logger.debug("Local Address:port " + localIpAddress + ":"
+ localPort);
if ( logger.isDebugEnabled() ) {
logger.debug("Local Address:port " + localIpAddress + ":"
+ localPort);
}

if ( !Gateway.getSipxProxyTransport().equalsIgnoreCase("tls")) {
ListeningPoint internalUdpListeningPoint = ProtocolObjects
Expand All @@ -571,7 +584,9 @@ static void initializeSipListeningPoints() {

internalProvider.addListeningPoint(internalTcpListeningPoint);
} else {
if ( logger.isDebugEnabled() ) logger.debug("tlsSupport is for proxy enabled -- creating TLS Listening point and provider");
if ( logger.isDebugEnabled() ) {
logger.debug("tlsSupport is for proxy enabled -- creating TLS Listening point and provider");
}
ListeningPoint internalTlsListeningPoint = ProtocolObjects
.getSipStack().createListeningPoint(localIpAddress,
localPort, "tls");
Expand Down Expand Up @@ -987,10 +1002,14 @@ static void start() throws SipXbridgeException {
Gateway.proxyURI = ProtocolObjects.addressFactory.createSipURI(
null, getBridgeConfiguration().getSipxProxyDomain());
if ( getBridgeConfiguration().getSipxProxyPort() > 0 ) {
if ( logger.isDebugEnabled() ) logger.debug("setting sipx proxy port " + getBridgeConfiguration().getSipxProxyPort() );
if ( logger.isDebugEnabled() ) {
logger.debug("setting sipx proxy port " + getBridgeConfiguration().getSipxProxyPort() );
}
Gateway.proxyURI.setPort( getBridgeConfiguration().getSipxProxyPort());
} else {
if ( logger.isDebugEnabled() ) logger.debug("sipx proxy port is : " + getBridgeConfiguration().getSipxProxyPort() );
if ( logger.isDebugEnabled() ) {
logger.debug("sipx proxy port is : " + getBridgeConfiguration().getSipxProxyPort() );
}

}
} catch (Exception ex) {
Expand Down Expand Up @@ -1023,8 +1042,9 @@ static void start() throws SipXbridgeException {
startSipListener();

// Set secret for signing SipXauthIdentity. The null check is for the regression tester's benefit.
if ( DomainConfiguration.getSharedSecret() != null ) {
SipXauthIdentity.setSecret(DomainConfiguration.getSharedSecret());
DomainConfiguration config = new DomainConfiguration(System.getProperty("conf.dir") + "/domain-config");
if (config.getSharedSecret() != null) {
SipXauthIdentity.setSecret(config.getSharedSecret());
} else {
logger.warn("Shared secret is null!");
}
Expand All @@ -1040,7 +1060,9 @@ static void start() throws SipXbridgeException {
System.exit(0);
}
}
if ( logger.isDebugEnabled() ) logger.debug("Global address = " + Gateway.getGlobalAddress());
if ( logger.isDebugEnabled() ) {
logger.debug("Global address = " + Gateway.getGlobalAddress());
}

/*
* Can start sending outbound calls. Cannot yet make inbound calls.
Expand Down Expand Up @@ -1081,7 +1103,9 @@ private static void parsePeerIdentitiesFile() {
static synchronized void stop() {
Gateway.state = GatewayState.STOPPING;

if ( logger.isDebugEnabled() ) logger.debug("Stopping Gateway");
if ( logger.isDebugEnabled() ) {
logger.debug("Stopping Gateway");
}
// Purge the timer.
getTimer().purge();
try {
Expand Down Expand Up @@ -1133,7 +1157,9 @@ private static void exit() {
* Stop bridge, release all resources and exit.
*/
Gateway.initializeLogging();
if ( logger.isDebugEnabled() ) logger.debug("exit()");
if ( logger.isDebugEnabled() ) {
logger.debug("exit()");
}

/*
* Connect to the sipxbridge server and ask him to exit.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
*
*/
public class DomainConfiguration {
private static String m_domainConfigFile;
private static String m_sipDomainName;
private static String m_sipRealm;
private static String m_sharedSecret;
private static final Logger logger = Logger.getLogger(DomainConfiguration.class);

private static Logger logger = Logger.getLogger(DomainConfiguration.class);
private final String m_domainConfigFile;
private String m_sipDomainName;
private String m_sipRealm;
private String m_sharedSecret;

public DomainConfiguration(String domainConfigFilename) {
m_domainConfigFile = domainConfigFilename;
Expand Down Expand Up @@ -55,31 +55,31 @@ public DomainConfiguration(String domainConfigFilename) {
}
}

public static String getSipRealm() {
public String getSipRealm() {
return m_sipRealm;
}

public static String getSipDomainName() {
public String getSipDomainName() {
return m_sipDomainName;
}

public static String getSharedSecret() {
public String getSharedSecret() {
return m_sharedSecret;
}

private static void setSipRealm(String sipRealm) {
private void setSipRealm(String sipRealm) {
m_sipRealm = sipRealm;
}

private static void setSipDomainName(String sipDomainName) {
private void setSipDomainName(String sipDomainName) {
m_sipDomainName = sipDomainName;
}

private static void setSharedSecret(String sharedSecret) {
private void setSharedSecret(String sharedSecret) {
m_sharedSecret = sharedSecret;
}

private static void parseDomainConfig(Properties domainConfig) {
private void parseDomainConfig(Properties domainConfig) {
setSipRealm(domainConfig.getProperty("SIP_REALM"));
setSipDomainName(domainConfig.getProperty("SIP_DOMAIN_NAME"));
setSharedSecret(domainConfig.getProperty("SHARED_SECRET"));
Expand Down
1 change: 0 additions & 1 deletion sipXimbot/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/sipxcommons"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry combineaccessrules="false" kind="src" path="/sipXopenfire"/>
<classpathentry combineaccessrules="false" kind="src" path="/sipXrest"/>
<classpathentry kind="output" path="classes"/>
</classpath>
1 change: 0 additions & 1 deletion sipXimbot/common.am
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ imbot_PKGS = \
javax.servlet \
mongo \
xmlrpc-client \
sipx-openfire-presence-plugin \
ws-commons-util
28 changes: 7 additions & 21 deletions sipXimbot/src/org/sipfoundry/sipximbot/IMBot.java
Original file line number Diff line number Diff line change
Expand Up @@ -340,15 +340,15 @@ static public String getUserStatus(User user) {
String jid = getjid(user);
if(jid == null) {
return null;
} else {
Presence pres = m_roster.getPresence(jid);
}

if(pres != null) {
return pres.getStatus();
} else {
return null;
}
Presence pres = m_roster.getPresence(jid);

if (pres != null) {
return pres.getStatus();
}

return null;
}

static public UserPresence getUserPresence(User user) {
Expand All @@ -359,17 +359,6 @@ static public UserPresence getUserPresence(User user) {
return UserPresence.INCONFERENCE;
}

PhonePresence phonePresence;
try {
phonePresence = new PhonePresence();
phonePresence.isUserOnThePhone(user.getUserName());
if(phonePresence.isUserOnThePhone(user.getUserName())) {
return UserPresence.ONPHONE;
}
} catch (Exception e) {

}

String jid = getjid(user);
if(jid == null) {
return UserPresence.AVAILABLE;
Expand Down Expand Up @@ -463,6 +452,3 @@ static public void init() {
imThread.start();
}
}



60 changes: 0 additions & 60 deletions sipXimbot/src/org/sipfoundry/sipximbot/PhonePresence.java

This file was deleted.

16 changes: 1 addition & 15 deletions sipXopenfire/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,10 @@
<classpathentry kind="src" path="vcard-synchserver/src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="var" path="OPENFIRE_ROOT/lib/activation.jar"/>
<classpathentry kind="var" path="OPENFIRE_ROOT/lib/bouncycastle.jar"/>
<classpathentry kind="var" path="OPENFIRE_ROOT/lib/commons-el.jar"/>
<classpathentry kind="var" path="OPENFIRE_ROOT/lib/hsqldb.jar"/>
<classpathentry kind="var" path="OPENFIRE_ROOT/lib/jasper-compiler.jar"/>
<classpathentry kind="var" path="OPENFIRE_ROOT/lib/jasper-runtime.jar"/>
<classpathentry kind="var" path="OPENFIRE_ROOT/lib/jdic.jar"/>
<classpathentry kind="var" path="OPENFIRE_ROOT/lib/jtds.jar"/>
<classpathentry kind="var" path="OPENFIRE_ROOT/lib/mail.jar"/>
<classpathentry kind="var" path="OPENFIRE_ROOT/lib/mysql.jar"/>
<classpathentry kind="var" path="OPENFIRE_ROOT/lib/openfire.jar"/>
<classpathentry kind="var" path="OPENFIRE_ROOT/lib/postgres.jar"/>
<classpathentry kind="var" path="OPENFIRE_ROOT/lib/servlet.jar"/>
<classpathentry kind="var" path="OPENFIRE_ROOT/lib/startup.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/sipXconfig-neoconf"/>
<classpathentry combineaccessrules="false" kind="src" path="/sipxcommons"/>
<classpathentry kind="var" path="OPENFIRE_ROOT"/>
<classpathentry combineaccessrules="false" kind="src" path="/sipXconfig-web"/>
<classpathentry kind="var" path="SIPX_JAVADIR/sipXecs/sipXcommons/sipxsqaclient.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/openfire"/>
<classpathentry kind="output" path="bin.eclipse"/>
</classpath>
4 changes: 2 additions & 2 deletions sipXopenfire/presence-plugin/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jardir = @SIPX_JAVADIR@/sipXopenfire/plugins
jar_DATA = \
$(presence_JAR)

plugin_JAR = src/sipx-openfire-presence-plugin.jar
plugin_JAR = src/sipx-openfire-plugin.jar

# presence jar include other jars. more like a war.
presence_JAR = sipx-openfire-presence.jar
presence_JAR = sipx-openfire.jar
presence_FILES = \
$(call JavaDep,@SIPX_JAVADIR@/sipXcommons,$(plugin_JAR_RT_PKGS)) \
$(plugin_JAR)
Expand Down
Loading

0 comments on commit 4c750f9

Please sign in to comment.