Browse files

Merge branch 'release-4.6-update-2'

  • Loading branch information...
2 parents 40ce8ea + 5055641 commit f37a4f1300bf8ccf0f72731bcbc26875e1a4b526 @ezuce-admin ezuce-admin committed Jan 23, 2013
Showing with 279 additions and 167 deletions.
  1. +1 −1 mak/build.mk.in
  2. +2 −0 sipXconfig/etc/sipxpbx/sipxproxy/sipxproxy.properties
  3. +4 −0 sipXconfig/etc/sipxpbx/sipxproxy/sipxproxy.xml
  4. +2 −0 sipXconfig/etc/sipxpbx/sipxregistrar/sipxregistrar.properties
  5. +4 −48 sipXconfig/etc/sipxpbx/sipxregistrar/sipxregistrar.xml
  6. +4 −1 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/cdr/CdrManagerImpl.java
  7. +17 −11 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/cdr/CdrSearch.java
  8. +30 −2 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/registrar/RegistrarConfiguration.java
  9. +4 −0 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/registrar/RegistrarSettings.java
  10. +19 −0 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/speeddial/SpeedDialManagerImpl.java
  11. +2 −0 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/speeddial/speeddial.beans.xml
  12. +9 −3 sipXconfig/neoconf/test/org/sipfoundry/sipxconfig/cdr/CdrManagerImplTestIntegration.java
  13. +51 −4 sipXconfig/neoconf/test/org/sipfoundry/sipxconfig/cdr/CdrSearchTest.java
  14. +1 −0 sipXconfig/neoconf/test/org/sipfoundry/sipxconfig/proxy/expected-proxy-config
  15. +7 −6 sipXconfig/neoconf/test/org/sipfoundry/sipxconfig/registrar/expected-registrar-config
  16. +7 −6 sipXconfig/neoconf/test/org/sipfoundry/sipxconfig/registrar/expected-registrar-config-with-plugins
  17. +1 −1 sipXconfig/web/context/WEB-INF/cdr/CdrFilter.jwc
  18. +5 −1 sipXconfig/web/src/org/sipfoundry/sipxconfig/site/admin/commserver/BundlePanel.java
  19. +0 −1 sipXportLib/include/os/shared/OsMsgQShared.h
  20. +3 −3 sipXportLib/src/os/shared/OsMsgQShared.cpp
  21. +1 −1 sipXproxy/include/sipxproxy/SipRouter.h
  22. +17 −0 sipXproxy/src/SipRouter.cpp
  23. +78 −74 sipXregistry/lib/redirect_plugins/SipRedirectorAliasDB.cpp
  24. +7 −1 sipXregistry/lib/redirect_plugins/SipRedirectorAliasDB.h
  25. +1 −1 sipXrelease/release
  26. +2 −2 sipXtackLib/src/net/SipClientWriteBuffer.cpp
View
2 mak/build.mk.in
@@ -60,7 +60,7 @@ help.{1|2|6}.dist = Build archive, typically compressed tar
%.dist : %.autoreconf %.configure %.dist_;
%.dist_ :;$(MAKE) -C $(PROJ) dist
.SECONDEXPANSION:
-%.dist-by-dep : $$(addsuffix .dist-by-dep,$$($$*_DEPS))
+$(sipx:=.dist-by-dep) $(app:=.dist-by-dep): %.dist-by-dep : $$(addsuffix .dist-by-dep,$$($$*_DEPS))
@if test -f $($(PROJ)_TAR) ; then \
x=`find $(SRC)/$(PROJ)/ -type f \( \
-not -name configure \
View
2 sipXconfig/etc/sipxpbx/sipxproxy/sipxproxy.properties
@@ -46,6 +46,8 @@ proxy-configuration.SIPX_PROXY_MAX_FORWARDS.label=Maximum Forwards
proxy-configuration.SIPX_PROXY_MAX_FORWARDS.description=(Max-Forwards header field)Maximum number of hops a request can transit on the way to its destination.
proxy-configuration.SIPX_PROXY_STALE_TCP_TIMEOUT.label=Stale TCP Timeout
proxy-configuration.SIPX_PROXY_STALE_TCP_TIMEOUT.description=
+proxy-configuration.SIPX_PROXY_ENSURE_TCP_LIFETIME.label=Ensure TCP Lifetime
+proxy-configuration.SIPX_PROXY_ENSURE_TCP_LIFETIME.description=
proxy-configuration.SIPX_PROXY_CALL_STATE.label=Call State
proxy-configuration.SIPX_PROXY_CALL_STATE.description=
proxy-configuration.SIPX_PROXY_LOG_CONSOLE.label=Log Console
View
4 sipXconfig/etc/sipxpbx/sipxproxy/sipxproxy.xml
@@ -81,6 +81,10 @@
<setting name="SIPX_PROXY_STALE_TCP_TIMEOUT" advanced="yes">
<type><integer/></type>
</setting>
+ <setting name="SIPX_PROXY_ENSURE_TCP_LIFETIME">
+ <type><boolean /></type>
+ <value>0</value>
+ </setting>
<!-- unsure what these next 2 settings do -->
<setting name="SIPX_PROXY_LOG_CONSOLE" hidden="yes">
<type><string/></type>
View
2 sipXconfig/etc/sipxpbx/sipxregistrar/sipxregistrar.properties
@@ -88,3 +88,5 @@ registrar-config.SIP_REDIRECT.140-FALLBACK.ALLOW_UNBOUND.label=Allow Unbound
registrar-config.SIP_REDIRECT.140-FALLBACK.ALLOW_UNBOUND.description=If checked, applications that know the shared secret will be allowed to make external calls
registrar-config.SIP_REGISTRAR_ADD_DIVERSION.label=Add Diversion Headers
registrar-config.SIP_REGISTRAR_ADD_DIVERSION.description=If checked, redirection through user forwards will be preserved as diversion headers containing the original URI.
+registrar-config.SIP_REGISTRAR_EARLY_ALIAS_RESOLUTION.label=Early alias resolution
+registrar-config.SIP_REGISTRAR_EARLY_ALIAS_RESOLUTION.description=If checked, early domain alias resolution will be enabled.
View
52 sipXconfig/etc/sipxpbx/sipxregistrar/sipxregistrar.xml
@@ -95,54 +95,6 @@
<type><string/></type>
<value>^(CSCO|Cisco)</value>
</setting>
- <setting name="SIP_REDIRECT_AUTHORITY_LEVEL.090-USERPARAM" hidden="yes">
- <type><integer required="yes"/></type>
- <value>60</value>
- </setting>
- <setting name="SIP_REDIRECT_AUTHORITY_LEVEL.100-PICKUP" hidden="yes">
- <type><integer required="yes"/></type>
- <value>50</value>
- </setting>
- <setting name="SIP_REDIRECT_AUTHORITY_LEVEL.110-ALIAS" hidden="yes">
- <type><integer required="yes"/></type>
- <value>40</value>
- </setting>
- <setting name="SIP_REDIRECT_AUTHORITY_LEVEL.120-REG" hidden="yes">
- <type><integer required="yes"/></type>
- <value>40</value>
- </setting>
- <setting name="SIP_REDIRECT_AUTHORITY_LEVEL.130-MAPPING" hidden="yes">
- <type><integer required="yes"/></type>
- <value>40</value>
- </setting>
- <setting name="SIP_REDIRECT_AUTHORITY_LEVEL.140-FALLBACK" hidden="yes">
- <type><integer required="yes"/></type>
- <value>30</value>
- </setting>
- <setting name="SIP_REDIRECT_AUTHORITY_LEVEL.150-ISN" hidden="yes">
- <type><integer required="yes"/></type>
- <value>40</value>
- </setting>
- <setting name="SIP_REDIRECT_AUTHORITY_LEVEL.160-ENUM" hidden="yes">
- <type><integer required="yes"/></type>
- <value>40</value>
- </setting>
- <setting name="SIP_REDIRECT_AUTHORITY_LEVEL.900-PRESENCE" hidden="yes">
- <type><integer required="yes"/></type>
- <value>100</value>
- </setting>
- <setting name="SIP_REDIRECT_AUTHORITY_LEVEL.997-SUBSCRIBE" hidden="yes">
- <type><integer required="yes"/></type>
- <value>100</value>
- </setting>
- <setting name="SIP_REDIRECT_AUTHORITY_LEVEL.998-TIMEOFDAY" hidden="yes">
- <type><integer required="yes"/></type>
- <value>100</value>
- </setting>
- <setting name="SIP_REDIRECT_AUTHORITY_LEVEL.999-AUTHROUTER" hidden="yes">
- <type><integer required="yes"/></type>
- <value>100</value>
- </setting>
<setting name="SIP_REDIRECT.140-FALLBACK.ALLOW_UNBOUND" advanced="yes">
<type refid="yesNo"/>
<value>N</value>
@@ -151,6 +103,10 @@
<type refid="yesNo"/>
<value>N</value>
</setting>
+ <setting name="SIP_REGISTRAR_EARLY_ALIAS_RESOLUTION" advanced="yes">
+ <type refid="yesNo"/>
+ <value>N</value>
+ </setting>
</group>
<group name="userparam" advanced="yes">
<setting name="SIP_REDIRECT.090-USERPARAM.STRIP_ALL" advanced="yes">
View
5 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/cdr/CdrManagerImpl.java
@@ -26,6 +26,7 @@
import java.util.Collections;
import java.util.Date;
import java.util.List;
+import java.util.Set;
import java.util.TimeZone;
import javax.xml.rpc.ServiceException;
@@ -293,7 +294,9 @@ public CdrsStatementCreator(Date from, Date to, CdrSearch search, User user, Tim
if (user != null) {
m_forUser = new CdrSearch();
m_forUser.setMode(CdrSearch.Mode.ANY);
- m_forUser.setTerm(user.getUserName());
+ Set<String> names = user.getAliases();
+ names.add(user.getName());
+ m_forUser.setTerm(names.toArray(new String[0]));
}
}
View
28 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/cdr/CdrSearch.java
@@ -9,7 +9,11 @@
*/
package org.sipfoundry.sipxconfig.cdr;
+import static org.apache.commons.lang.StringUtils.join;
+
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import org.sipfoundry.sipxconfig.dialplan.CallTag;
@@ -40,7 +44,9 @@
}
private Mode m_mode = Mode.NONE;
- private String m_term;
+ private String[] m_term = new String[] {
+ ""
+ };
private String m_order;
private boolean m_ascending = true;
@@ -60,11 +66,11 @@ public Mode getMode() {
return m_mode;
}
- public void setTerm(String term) {
+ public void setTerm(String[] term) {
m_term = term;
}
- public String getTerm() {
+ public String[] getTerm() {
return m_term;
}
@@ -73,25 +79,25 @@ public void setOrder(String order, boolean ascending) {
m_ascending = ascending;
}
- private void appendSearchTermSql(StringBuilder sql) {
- sql.append(" LIKE '%<sip:");
- sql.append(m_term);
- sql.append("@%>'");
+ private void appendSearchTermSql(StringBuilder sql, String call) {
+ List<String> sqlList = new ArrayList<String>();
+ for (String name : m_term) {
+ sqlList.add(call + " LIKE '%<sip:" + name + "@%>'");
+ }
+ sql.append(join(sqlList.toArray(), OR));
}
private void appendCallerSql(StringBuilder sql) {
sql.append(OPEN_PARANTHESIS);
- sql.append(CdrManagerImpl.CALLER_AOR);
- appendSearchTermSql(sql);
+ appendSearchTermSql(sql, CdrManagerImpl.CALLER_AOR);
sql.append(AND);
sql.append(CdrManagerImpl.CALLER_INTERNAL);
sql.append("=true)");
}
private void appendCalleeSql(StringBuilder sql) {
sql.append(OPEN_PARANTHESIS);
- sql.append(CdrManagerImpl.CALLEE_AOR);
- appendSearchTermSql(sql);
+ appendSearchTermSql(sql, CdrManagerImpl.CALLEE_AOR);
sql.append(AND);
appendCalleeInternalRouteSql(sql);
sql.append(CLOSED_PARANTHESIS);
View
32 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/registrar/RegistrarConfiguration.java
@@ -50,6 +50,8 @@
public class RegistrarConfiguration implements ConfigProvider, ApplicationContextAware {
private static final SettingFilter NO_UNDERSCORE = new PatternSettingFilter(".*/_.*");
+ private static final String WEIGHT_40 = "40";
+ private static final String WEIGHT_100 = "100";
private Registrar m_registrar;
private ApplicationContext m_context;
@@ -87,13 +89,39 @@ void write(Writer wtr, RegistrarSettings settings, Domain domain, Location locat
KeyValueConfiguration file = KeyValueConfiguration.colonSeparated(wtr);
Setting root = settings.getSettings();
file.writeSettings(SettingUtil.filter(NO_UNDERSCORE, root.getSetting("registrar-config")));
+ // add authority levels
+ file.write("SIP_REDIRECT_AUTHORITY_LEVEL.090-USERPARAM", "60");
+ file.write("SIP_REDIRECT_AUTHORITY_LEVEL.100-PICKUP", "50");
+ if (settings.isEarlyAliasResolutionEnabled()) {
+ file.write("SIP_REDIRECT_AUTHORITY_LEVEL.110-ALIAS", WEIGHT_40);
+ file.write("SIP_REDIRECT_AUTHORITY_LEVEL.120-REG", WEIGHT_40);
+ } else {
+ file.write("SIP_REDIRECT_AUTHORITY_LEVEL.110-REG", WEIGHT_40);
+ file.write("SIP_REDIRECT_AUTHORITY_LEVEL.120-ALIAS", WEIGHT_40);
+ }
+ file.write("SIP_REDIRECT_AUTHORITY_LEVEL.130-MAPPING", WEIGHT_40);
+ file.write("SIP_REDIRECT_AUTHORITY_LEVEL.140-FALLBACK", "30");
+ file.write("SIP_REDIRECT_AUTHORITY_LEVEL.150-ISN", WEIGHT_40);
+ file.write("SIP_REDIRECT_AUTHORITY_LEVEL.160-ENUM", WEIGHT_40);
+ file.write("SIP_REDIRECT_AUTHORITY_LEVEL.900-PRESENCE", WEIGHT_100);
+ file.write("SIP_REDIRECT_AUTHORITY_LEVEL.997-SUBSCRIBE", WEIGHT_100);
+ file.write("SIP_REDIRECT_AUTHORITY_LEVEL.998-TIMEOFDAY", WEIGHT_100);
+ file.write("SIP_REDIRECT_AUTHORITY_LEVEL.999-AUTHROUTER", WEIGHT_100);
+
file.write("SIP_REDIRECT.100-PICKUP.ORBIT_FILENAME", "$(sipx.SIPX_CONFDIR)/orbits.xml");
file.write("SIP_REDIRECT.130-MAPPING.MAPPING_RULES_FILENAME", "$(sipx.SIPX_CONFDIR)/mappingrules.xml");
file.write("SIP_REDIRECT.140-FALLBACK.MAPPING_RULES_FILENAME", "$(sipx.SIPX_CONFDIR)/fallbackrules.xml");
file.write("SIP_REDIRECT_HOOK_LIBRARY.090-USERPARAM", "$(sipx.SIPX_LIBDIR)/libRedirectorUserParam.so");
file.write("SIP_REDIRECT_HOOK_LIBRARY.100-PICKUP", "$(sipx.SIPX_LIBDIR)/libRedirectorPickUp.so");
- file.write("SIP_REDIRECT_HOOK_LIBRARY.110-ALIAS", "$(sipx.SIPX_LIBDIR)/libRedirectorAliasDB.so");
- file.write("SIP_REDIRECT_HOOK_LIBRARY.120-REG", "$(sipx.SIPX_LIBDIR)/libRedirectorRegDB.so");
+ String aliasRedirector = "$(sipx.SIPX_LIBDIR)/libRedirectorAliasDB.so";
+ String regRedirector = "$(sipx.SIPX_LIBDIR)/libRedirectorRegDB.so";
+ if (settings.isEarlyAliasResolutionEnabled()) {
+ file.write("SIP_REDIRECT_HOOK_LIBRARY.110-ALIAS", aliasRedirector);
+ file.write("SIP_REDIRECT_HOOK_LIBRARY.120-REG", regRedirector);
+ } else {
+ file.write("SIP_REDIRECT_HOOK_LIBRARY.110-REG", regRedirector);
+ file.write("SIP_REDIRECT_HOOK_LIBRARY.120-ALIAS", aliasRedirector);
+ }
file.write("SIP_REDIRECT_HOOK_LIBRARY.130-MAPPING", "$(sipx.SIPX_LIBDIR)/libRedirectorMapping.so");
file.write("SIP_REDIRECT_HOOK_LIBRARY.140-FALLBACK", "$(sipx.SIPX_LIBDIR)/libRedirectorFallback.so");
file.write("SIP_REDIRECT_HOOK_LIBRARY.150-ISN", "$(sipx.SIPX_LIBDIR)/libRedirectorISN.so");
View
4 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/registrar/RegistrarSettings.java
@@ -61,6 +61,10 @@ public int getPresencePort() {
return (Integer) getSettingTypedValue("registrar-config/_SIP_REGISTRAR_PRESENCE_PORT");
}
+ public boolean isEarlyAliasResolutionEnabled() {
+ return (Boolean) getSettingTypedValue("registrar-config/SIP_REGISTRAR_EARLY_ALIAS_RESOLUTION");
+ }
+
@Override
protected Setting loadSettings() {
return getModelFilesContext().loadModelFile("sipxregistrar/sipxregistrar.xml");
View
19 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/speeddial/SpeedDialManagerImpl.java
@@ -15,10 +15,12 @@
import java.util.List;
import java.util.Set;
+import org.sipfoundry.sipxconfig.cfgmgt.ConfigManager;
import org.sipfoundry.sipxconfig.common.CoreContext;
import org.sipfoundry.sipxconfig.common.SipxHibernateDaoSupport;
import org.sipfoundry.sipxconfig.common.User;
import org.sipfoundry.sipxconfig.commserver.Location;
+import org.sipfoundry.sipxconfig.commserver.SipxReplicationContext;
import org.sipfoundry.sipxconfig.dialplan.DialingRule;
import org.sipfoundry.sipxconfig.feature.FeatureManager;
import org.sipfoundry.sipxconfig.rls.Rls;
@@ -29,6 +31,8 @@
public class SpeedDialManagerImpl extends SipxHibernateDaoSupport implements SpeedDialManager {
private CoreContext m_coreContext;
private FeatureManager m_featureManager;
+ private ConfigManager m_configManager;
+ private SipxReplicationContext m_sipxReplicationContext;
@Override
public SpeedDial getSpeedDialForUserId(Integer userId, boolean create) {
@@ -180,5 +184,20 @@ public void setFeatureManager(FeatureManager featureManager) {
@Override
public void clear() {
removeAll(SpeedDial.class);
+
+ // A little convoluted, but only way i could keep mongo and postgres in sync
+ // which is critical for resource-lists.xml.
+ m_sipxReplicationContext.generateAll();
+ m_configManager.configureEverywhere(Rls.FEATURE);
+ }
+
+ @Required
+ public void setConfigManager(ConfigManager configManager) {
+ m_configManager = configManager;
+ }
+
+ @Required
+ public void setSipxReplicationContext(SipxReplicationContext sipxReplicationContext) {
+ m_sipxReplicationContext = sipxReplicationContext;
}
}
View
2 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/speeddial/speeddial.beans.xml
@@ -16,6 +16,8 @@
<bean id="speedDialManagerImpl" class="org.sipfoundry.sipxconfig.speeddial.SpeedDialManagerImpl" parent="abstractDaoImpl">
<property name="coreContext" ref="coreContext" />
<property name="featureManager" ref="featureManager" />
+ <property name="configManager" ref="configManager" />
+ <property name="sipxReplicationContext" ref="sipxReplicationContextImpl" />
</bean>
<bean id="speedDialOnEdit" class="org.sipfoundry.sipxconfig.speeddial.SpeadDialOnEdit">
View
12 sipXconfig/neoconf/test/org/sipfoundry/sipxconfig/cdr/CdrManagerImplTestIntegration.java
@@ -55,23 +55,29 @@ public void testGetJson() throws Exception {
public void testGetCdrsSearchFrom() {
CdrSearch cdrSearch = new CdrSearch();
cdrSearch.setMode(Mode.CALLER);
- cdrSearch.setTerm("200");
+ cdrSearch.setTerm(new String[] {
+ "200"
+ });
List<Cdr> cdrs = m_cdrManager.getCdrs(null, null, cdrSearch, null);
assertTrue(cdrs.size() == 3);
}
public void testGetCdrsSearchTo() {
CdrSearch cdrSearch = new CdrSearch();
cdrSearch.setMode(Mode.CALLEE);
- cdrSearch.setTerm("201");
+ cdrSearch.setTerm(new String[] {
+ "201"
+ });
List<Cdr> cdrs = m_cdrManager.getCdrs(null, null, cdrSearch, null);
assertTrue(cdrs.size() == 6);
}
public void testGetCdrsSearchAny() {
CdrSearch cdrSearch = new CdrSearch();
cdrSearch.setMode(Mode.ANY);
- cdrSearch.setTerm("200");
+ cdrSearch.setTerm(new String[] {
+ "200"
+ });
List<Cdr> cdrs = m_cdrManager.getCdrs(null, null, cdrSearch, null);
assertTrue(cdrs.size() == 5);
}
View
55 sipXconfig/neoconf/test/org/sipfoundry/sipxconfig/cdr/CdrSearchTest.java
@@ -29,25 +29,59 @@ public void testGetSqlEmpty() {
public void testGetSqlCaller() {
CdrSearch search = new CdrSearch();
- search.setTerm("abc");
+ search.setTerm(new String[] {
+ "abc"
+ });
search.setMode(CdrSearch.Mode.CALLER);
StringBuilder sql = new StringBuilder();
assertTrue(sql.toString(), search.appendGetSql(sql));
assertEquals(" AND (caller_aor LIKE '%<sip:abc@%>' AND caller_internal=true)", sql.toString());
}
+ public void testGetSqlCallerWithAliases() {
+ CdrSearch search = new CdrSearch();
+ search.setTerm(new String[] {
+ "abc", "def"
+ });
+ search.setMode(CdrSearch.Mode.CALLER);
+ StringBuilder sql = new StringBuilder();
+ assertTrue(sql.toString(), search.appendGetSql(sql));
+ assertEquals(
+ " AND (caller_aor LIKE '%<sip:abc@%>' OR caller_aor LIKE '%<sip:def@%>' AND caller_internal=true)",
+ sql.toString());
+ }
+
public void testGetSqlCallee() {
CdrSearch search = new CdrSearch();
- search.setTerm("abc");
+ search.setTerm(new String[] {
+ "abc"
+ });
+ search.setMode(CdrSearch.Mode.CALLEE);
+ StringBuilder sql = new StringBuilder();
+ assertTrue(sql.toString(), search.appendGetSql(sql));
+ assertEquals(
+ " AND (callee_aor LIKE '%<sip:abc@%>' AND (callee_route LIKE '%INT' OR callee_route LIKE '%AA' OR callee_route LIKE '%VM' OR callee_route LIKE '%PAGE' OR callee_route LIKE '%PARK' OR callee_route LIKE '%DPUP' OR callee_route IS NULL))",
+ sql.toString());
+ }
+
+ public void testGetSqlCalleeWithAliases() {
+ CdrSearch search = new CdrSearch();
+ search.setTerm(new String[] {
+ "abc", "def"
+ });
search.setMode(CdrSearch.Mode.CALLEE);
StringBuilder sql = new StringBuilder();
assertTrue(sql.toString(), search.appendGetSql(sql));
- assertEquals(" AND (callee_aor LIKE '%<sip:abc@%>' AND (callee_route LIKE '%INT' OR callee_route LIKE '%AA' OR callee_route LIKE '%VM' OR callee_route LIKE '%PAGE' OR callee_route LIKE '%PARK' OR callee_route LIKE '%DPUP' OR callee_route IS NULL))", sql.toString());
+ assertEquals(
+ " AND (callee_aor LIKE '%<sip:abc@%>' OR callee_aor LIKE '%<sip:def@%>' AND (callee_route LIKE '%INT' OR callee_route LIKE '%AA' OR callee_route LIKE '%VM' OR callee_route LIKE '%PAGE' OR callee_route LIKE '%PARK' OR callee_route LIKE '%DPUP' OR callee_route IS NULL))",
+ sql.toString());
}
public void testGetSqlAny() {
CdrSearch search = new CdrSearch();
- search.setTerm("abc");
+ search.setTerm(new String[] {
+ "abc"
+ });
search.setMode(CdrSearch.Mode.ANY);
StringBuilder sql = new StringBuilder();
assertTrue(sql.toString(), search.appendGetSql(sql));
@@ -56,6 +90,19 @@ public void testGetSqlAny() {
sql.toString());
}
+ public void testGetSqlAnyWithAliases() {
+ CdrSearch search = new CdrSearch();
+ search.setTerm(new String[] {
+ "abc", "def"
+ });
+ search.setMode(CdrSearch.Mode.ANY);
+ StringBuilder sql = new StringBuilder();
+ assertTrue(sql.toString(), search.appendGetSql(sql));
+ assertEquals(
+ " AND ((caller_aor LIKE '%<sip:abc@%>' OR caller_aor LIKE '%<sip:def@%>' AND caller_internal=true) OR (callee_aor LIKE '%<sip:abc@%>' OR callee_aor LIKE '%<sip:def@%>' AND (callee_route LIKE '%INT' OR callee_route LIKE '%AA' OR callee_route LIKE '%VM' OR callee_route LIKE '%PAGE' OR callee_route LIKE '%PARK' OR callee_route LIKE '%DPUP' OR callee_route IS NULL)))",
+ sql.toString());
+ }
+
public void testGetOrderBySql() {
CdrSearch search = new CdrSearch();
StringBuilder sql = new StringBuilder();
View
1 sipXconfig/neoconf/test/org/sipfoundry/sipxconfig/proxy/expected-proxy-config
@@ -7,6 +7,7 @@ SIPX_PROXY_TLS_PORT : 5061
SIPX_PROXY_AUTHENTICATE_ALGORITHM :
SIPX_PROXY_MAX_FORWARDS :
SIPX_PROXY_STALE_TCP_TIMEOUT :
+SIPX_PROXY_ENSURE_TCP_LIFETIME : 0
SIPX_PROXY_LOG_CONSOLE :
SIPX_PROXY_CALL_STATE :
SIPX_PROXY.205_subscriptionauth.PACKAGES_REQUIRING_AUTHENTICATION : dialog
View
13 sipXconfig/neoconf/test/org/sipfoundry/sipxconfig/registrar/expected-registrar-config
@@ -10,10 +10,13 @@ SIP_REGISTRAR_MIN_EXPIRES_NORMAL :
SIP_REGISTRAR_MAX_EXPIRES_NATED :
SIP_REGISTRAR_MIN_EXPIRES_NATED :
SIP_REGISTRAR.MWI.UA.CISCO : ^(CSCO|Cisco)
+SIP_REDIRECT.140-FALLBACK.ALLOW_UNBOUND : Y
+SIP_REGISTRAR_ADD_DIVERSION : N
+SIP_REGISTRAR_EARLY_ALIAS_RESOLUTION : N
SIP_REDIRECT_AUTHORITY_LEVEL.090-USERPARAM : 60
SIP_REDIRECT_AUTHORITY_LEVEL.100-PICKUP : 50
-SIP_REDIRECT_AUTHORITY_LEVEL.110-ALIAS : 40
-SIP_REDIRECT_AUTHORITY_LEVEL.120-REG : 40
+SIP_REDIRECT_AUTHORITY_LEVEL.110-REG : 40
+SIP_REDIRECT_AUTHORITY_LEVEL.120-ALIAS : 40
SIP_REDIRECT_AUTHORITY_LEVEL.130-MAPPING : 40
SIP_REDIRECT_AUTHORITY_LEVEL.140-FALLBACK : 30
SIP_REDIRECT_AUTHORITY_LEVEL.150-ISN : 40
@@ -22,15 +25,13 @@ SIP_REDIRECT_AUTHORITY_LEVEL.900-PRESENCE : 100
SIP_REDIRECT_AUTHORITY_LEVEL.997-SUBSCRIBE : 100
SIP_REDIRECT_AUTHORITY_LEVEL.998-TIMEOFDAY : 100
SIP_REDIRECT_AUTHORITY_LEVEL.999-AUTHROUTER : 100
-SIP_REDIRECT.140-FALLBACK.ALLOW_UNBOUND : Y
-SIP_REGISTRAR_ADD_DIVERSION : N
SIP_REDIRECT.100-PICKUP.ORBIT_FILENAME : $(sipx.SIPX_CONFDIR)/orbits.xml
SIP_REDIRECT.130-MAPPING.MAPPING_RULES_FILENAME : $(sipx.SIPX_CONFDIR)/mappingrules.xml
SIP_REDIRECT.140-FALLBACK.MAPPING_RULES_FILENAME : $(sipx.SIPX_CONFDIR)/fallbackrules.xml
SIP_REDIRECT_HOOK_LIBRARY.090-USERPARAM : $(sipx.SIPX_LIBDIR)/libRedirectorUserParam.so
SIP_REDIRECT_HOOK_LIBRARY.100-PICKUP : $(sipx.SIPX_LIBDIR)/libRedirectorPickUp.so
-SIP_REDIRECT_HOOK_LIBRARY.110-ALIAS : $(sipx.SIPX_LIBDIR)/libRedirectorAliasDB.so
-SIP_REDIRECT_HOOK_LIBRARY.120-REG : $(sipx.SIPX_LIBDIR)/libRedirectorRegDB.so
+SIP_REDIRECT_HOOK_LIBRARY.110-REG : $(sipx.SIPX_LIBDIR)/libRedirectorRegDB.so
+SIP_REDIRECT_HOOK_LIBRARY.120-ALIAS : $(sipx.SIPX_LIBDIR)/libRedirectorAliasDB.so
SIP_REDIRECT_HOOK_LIBRARY.130-MAPPING : $(sipx.SIPX_LIBDIR)/libRedirectorMapping.so
SIP_REDIRECT_HOOK_LIBRARY.140-FALLBACK : $(sipx.SIPX_LIBDIR)/libRedirectorFallback.so
SIP_REDIRECT_HOOK_LIBRARY.150-ISN : $(sipx.SIPX_LIBDIR)/libRedirectorISN.so
View
13 ...g/neoconf/test/org/sipfoundry/sipxconfig/registrar/expected-registrar-config-with-plugins
@@ -10,10 +10,13 @@ SIP_REGISTRAR_MIN_EXPIRES_NORMAL :
SIP_REGISTRAR_MAX_EXPIRES_NATED :
SIP_REGISTRAR_MIN_EXPIRES_NATED :
SIP_REGISTRAR.MWI.UA.CISCO : ^(CSCO|Cisco)
+SIP_REDIRECT.140-FALLBACK.ALLOW_UNBOUND : N
+SIP_REGISTRAR_ADD_DIVERSION : N
+SIP_REGISTRAR_EARLY_ALIAS_RESOLUTION : N
SIP_REDIRECT_AUTHORITY_LEVEL.090-USERPARAM : 60
SIP_REDIRECT_AUTHORITY_LEVEL.100-PICKUP : 50
-SIP_REDIRECT_AUTHORITY_LEVEL.110-ALIAS : 40
-SIP_REDIRECT_AUTHORITY_LEVEL.120-REG : 40
+SIP_REDIRECT_AUTHORITY_LEVEL.110-REG : 40
+SIP_REDIRECT_AUTHORITY_LEVEL.120-ALIAS : 40
SIP_REDIRECT_AUTHORITY_LEVEL.130-MAPPING : 40
SIP_REDIRECT_AUTHORITY_LEVEL.140-FALLBACK : 30
SIP_REDIRECT_AUTHORITY_LEVEL.150-ISN : 40
@@ -22,15 +25,13 @@ SIP_REDIRECT_AUTHORITY_LEVEL.900-PRESENCE : 100
SIP_REDIRECT_AUTHORITY_LEVEL.997-SUBSCRIBE : 100
SIP_REDIRECT_AUTHORITY_LEVEL.998-TIMEOFDAY : 100
SIP_REDIRECT_AUTHORITY_LEVEL.999-AUTHROUTER : 100
-SIP_REDIRECT.140-FALLBACK.ALLOW_UNBOUND : N
-SIP_REGISTRAR_ADD_DIVERSION : N
SIP_REDIRECT.100-PICKUP.ORBIT_FILENAME : $(sipx.SIPX_CONFDIR)/orbits.xml
SIP_REDIRECT.130-MAPPING.MAPPING_RULES_FILENAME : $(sipx.SIPX_CONFDIR)/mappingrules.xml
SIP_REDIRECT.140-FALLBACK.MAPPING_RULES_FILENAME : $(sipx.SIPX_CONFDIR)/fallbackrules.xml
SIP_REDIRECT_HOOK_LIBRARY.090-USERPARAM : $(sipx.SIPX_LIBDIR)/libRedirectorUserParam.so
SIP_REDIRECT_HOOK_LIBRARY.100-PICKUP : $(sipx.SIPX_LIBDIR)/libRedirectorPickUp.so
-SIP_REDIRECT_HOOK_LIBRARY.110-ALIAS : $(sipx.SIPX_LIBDIR)/libRedirectorAliasDB.so
-SIP_REDIRECT_HOOK_LIBRARY.120-REG : $(sipx.SIPX_LIBDIR)/libRedirectorRegDB.so
+SIP_REDIRECT_HOOK_LIBRARY.110-REG : $(sipx.SIPX_LIBDIR)/libRedirectorRegDB.so
+SIP_REDIRECT_HOOK_LIBRARY.120-ALIAS : $(sipx.SIPX_LIBDIR)/libRedirectorAliasDB.so
SIP_REDIRECT_HOOK_LIBRARY.130-MAPPING : $(sipx.SIPX_LIBDIR)/libRedirectorMapping.so
SIP_REDIRECT_HOOK_LIBRARY.140-FALLBACK : $(sipx.SIPX_LIBDIR)/libRedirectorFallback.so
SIP_REDIRECT_HOOK_LIBRARY.150-ISN : $(sipx.SIPX_LIBDIR)/libRedirectorISN.so
View
2 sipXconfig/web/context/WEB-INF/cdr/CdrFilter.jwc
@@ -23,7 +23,7 @@
<binding name="renderer" value="bean:propertyRenderer" />
</component>
<component id="queryText" type="TextField">
- <binding name="value" value="cdrSearch.term" />
+ <binding name="value" value="cdrSearch.term[0]" />
</component>
<component id="renderQuery" type="If">
<binding name="condition" value="cdrSearch.search" />
View
6 sipXconfig/web/src/org/sipfoundry/sipxconfig/site/admin/commserver/BundlePanel.java
@@ -39,6 +39,7 @@
import org.apache.tapestry.components.IPrimaryKeyConverter;
import org.apache.tapestry.event.PageBeginRenderListener;
import org.apache.tapestry.event.PageEvent;
+import org.sipfoundry.sipxconfig.cfgmgt.ConfigManager;
import org.sipfoundry.sipxconfig.common.BeanWithId;
import org.sipfoundry.sipxconfig.common.UserException;
import org.sipfoundry.sipxconfig.commserver.Location;
@@ -78,6 +79,9 @@
@InjectObject("spring:locationsManager")
public abstract LocationsManager getLocationsManager();
+ @InjectObject("spring:configManager")
+ public abstract ConfigManager getConfigManager();
+
public abstract void setLocations(List<Location> locations);
public abstract List<Location> getLocations();
@@ -152,7 +156,7 @@ public void pageBeginRender(PageEvent event) {
List<Location> locations = getLocations();
if (locations == null) {
- locations = getLocationsManager().getLocationsList();
+ locations = new ArrayList<Location>(getConfigManager().getRegisteredLocations());
setLocations(locations);
}
View
1 sipXportLib/include/os/shared/OsMsgQShared.h
@@ -241,7 +241,6 @@ class OsMsgQShared : public OsMsgQBase
Semaphore _sem;
mutex_critic_sec _cs;
std::queue<OsMsg*> _queue;
- int _maxMsgs;
int _maxMsgLen;
int _options;
bool _reportFull;
View
6 sipXportLib/src/os/shared/OsMsgQShared.cpp
@@ -34,11 +34,11 @@ OsMsgQShared::OsMsgQShared(const char* name,
int options,
bool reportFull)
: OsMsgQBase(name),
- _maxMsgs(maxMsgs),
_maxMsgLen(maxMsgLen),
_options(options),
_reportFull(reportFull)
{
+ mMaxMsgs = maxMsgs;
}
// Destructor
@@ -167,12 +167,12 @@ OsStatus OsMsgQShared::doSendCore(OsMsg* pMsg,
int count = numMsgs();
- if (_reportFull && 2 * count > _maxMsgs)
+ if (_reportFull && 2 * count > mMaxMsgs)
{
OS_LOG_WARNING(FAC_KERNEL,
"OsMsgQShared::doSendCore message queue '" << mName.data()
<< "' is over half full - count = " << count
- << " max = " << _maxMsgs);
+ << " max = " << mMaxMsgs);
}
system_tap_queue_enqueue(mName.data(), 0, _queue.size());
View
2 sipXproxy/include/sipxproxy/SipRouter.h
@@ -201,7 +201,7 @@ class SipRouter : public OsServerTask
ForwardRules* mpForwardingRules; ///< Holds to forwarding rules instructions
PluginHooks mAuthPlugins; ///< decision making modules from configuration
PluginHooks mTransactionPlugins;
-
+ UtlBoolean mEnsureTcpLifetime; ///< If set, transport will be explicity specified in record routes.
/// P-Asserted-Identity header is only applicable for INVITE, REFER, BYE,
/// OPTIONS, NOTIFY, and SUBSCRIBE
bool isPAIdentityApplicable(const SipMessage& sipRequest);
View
17 sipXproxy/src/SipRouter.cpp
@@ -75,6 +75,7 @@ SipRouter::SipRouter(SipUserAgent& sipUserAgent,
,mAuthPlugins(AuthPlugin::Factory, AuthPlugin::Prefix)
,mTransactionPlugins(SipBidirectionalProcessorPlugin::Factory, SipBidirectionalProcessorPlugin::Prefix)
,mpEntityDb(0)
+ ,mEnsureTcpLifetime(FALSE)
{
// Get Via info to use as defaults for route & realm
UtlString dnsName;
@@ -279,6 +280,8 @@ void SipRouter::readConfig(OsConfigDb& configDb, const Url& defaultUri)
mRouteHostSecurePort.append(":");
mRouteHostSecurePort.appendNumber(proxyTlsPort);
+ mEnsureTcpLifetime = configDb.getBoolean("SIPX_PROXY_ENSURE_TCP_LIFETIME", FALSE);
+
// these should really be redundant with the existing aliases,
// but it's better to be safe and add them to ensure that they are
// properly recognized (the alias db prunes duplicates anyway)
@@ -939,7 +942,21 @@ SipRouter::ProxyAction SipRouter::proxyMessage(SipMessage& sipRequest, SipMessag
route.setUrlParameter("lr",NULL);
if( sipRequest.getSendProtocol() == OsSocket::SSL_SOCKET )
+ {
route.setUrlParameter("transport=tls",NULL);
+ }
+ else if (mEnsureTcpLifetime && sipRequest.getSendProtocol() == OsSocket::TCP)
+ {
+ //
+ // Endpoints behind NAT need to maintain a reusable transport
+ // to work properly. Unfortuantely, Some user-agents fallback
+ // to UDP if the transport parameter in record route is not
+ // specific. We therefore explicitly define "tcp" transport param
+ // to maintain the TCP connection at least within the life time
+ // of the dialog
+ //
+ route.setUrlParameter("transport=tcp",NULL);
+ }
route.toString(recordRoute);
sipRequest.addRecordRouteUri(recordRoute);
View
152 sipXregistry/lib/redirect_plugins/SipRedirectorAliasDB.cpp
@@ -44,7 +44,8 @@ static UtlString _localDomain;
// Constructor
SipRedirectorAliasDB::SipRedirectorAliasDB(const UtlString& instanceName) :
RedirectPlugin(instanceName),
- _enableDiversionHeader(FALSE)
+ _enableDiversionHeader(FALSE),
+ _enableEarlyAliasResolution(FALSE)
{
mLogName.append("[");
mLogName.append(instanceName);
@@ -94,8 +95,79 @@ void SipRedirectorAliasDB::readConfig(OsConfigDb& configDb)
);
_enableDiversionHeader = configDb.getBoolean("SIP_REGISTRAR_ADD_DIVERSION", FALSE);
+ _enableEarlyAliasResolution = configDb.getBoolean("SIP_REGISTRAR_EARLY_ALIAS_RESOLUTION", FALSE);
}
+bool
+SipRedirectorAliasDB::resolveAlias(
+ const SipMessage& message,
+ UtlString& requestString,
+ Url& requestUri
+)
+{
+ bool isDomainAlias = false;
+ bool isUserAlias = false;
+
+ UtlString domain;
+ UtlString hostAlias;
+ UtlString userAlias;
+
+ requestUri.getHostAddress(domain);
+ UtlBoolean isMyHostAlias = mpSipUserAgent->isMyHostAlias(requestUri);
+ if (mpSipUserAgent && domain != _localDomain && isMyHostAlias)
+ {
+ isDomainAlias = true;
+ hostAlias = domain;
+ }
+
+ UtlString requestIdentity;
+ requestUri.getIdentity(requestIdentity);
+
+ EntityDB::Aliases aliases;
+ bool isUserIdentity = false;
+ EntityDB* entityDb = SipRegistrar::getInstance(NULL)->getEntityDB();
+ entityDb->getAliasContacts(requestUri, aliases, isUserIdentity);
+ int numAliasContacts = aliases.size();
+ EntityDB::Aliases::iterator iter = aliases.begin();
+
+ if (numAliasContacts == 1 && iter != aliases.end())
+ {
+ // If disableForwarding and the relation value is "userforward",
+ // do not record this contact.
+ if (isUserIdentity && iter->relation != ALIASDB_RELATION_USERFORWARD && iter->relation != "callgroup")
+ {
+ UtlString contact = iter->contact.c_str();
+ Url contactUri(contact);
+ isUserAlias = true;
+ contactUri.getUserId(userAlias);
+ }
+ }
+
+
+ if (isUserAlias)
+ {
+ requestUri.setUserId(userAlias.data());
+ requestUri.getUri(requestString);
+ }
+
+ if (isDomainAlias)
+ {
+ requestUri.setHostAddress(hostAlias);
+ requestUri.getUri(requestString);
+ }
+
+ if (isUserAlias || isDomainAlias)
+ {
+ OS_LOG_NOTICE(FAC_SIP, "SipRedirectorAliasDB::lookUp normalized request-uri to " << requestString.data());
+ }
+
+
+ return isUserAlias || isDomainAlias;
+}
+
+
+
+
RedirectPlugin::LookUpStatus
SipRedirectorAliasDB::lookUp(
const SipMessage& message,
@@ -120,30 +192,15 @@ SipRedirectorAliasDB::lookUp(
mLogName.data());
}
- bool isDomainAlias = false;
- UtlString domain;
- UtlString hostAlias;
- requestUri.getHostAddress(domain);
- UtlBoolean isMyHostAlias = mpSipUserAgent->isMyHostAlias(requestUri);
- if (mpSipUserAgent && domain != _localDomain && isMyHostAlias)
+ if (_enableEarlyAliasResolution)
{
- isDomainAlias = true;
- hostAlias = domain;
- requestUri.setHostAddress(_localDomain);
+ resolveAlias(message, requestString, requestUri);
}
+
UtlString requestIdentity;
requestUri.getIdentity(requestIdentity);
- OS_LOG_DEBUG(FAC_SIP, mLogName.data() << "::lookUp identity: " << requestIdentity.data()
- << " domain: " << domain.data()
- << " local-domain: " << _localDomain.data()
- << " isHostAlias: " << isMyHostAlias);
-
-
- //ResultSet aliases;
- //AliasDB::getInstance()->getContacts(requestUri, aliases);
- //int numAliasContacts = aliases.getSize();
EntityDB::Aliases aliases;
bool isUserIdentity = false;
@@ -183,32 +240,7 @@ SipRedirectorAliasDB::lookUp(
}
contactUri.setUrlParameter(SIP_SIPX_CALL_DEST_FIELD, "AL");
-
-
- if (numAliasContacts == 1 && isDomainAlias && isUserIdentity && iter->relation != "callgroup")
- {
-
- UtlString userId;
- contactUri.getUserId(userId);
- requestUri.setUserId(userId.data());
- requestUri.getUri(requestString);
- OS_LOG_NOTICE(FAC_SIP, "SipRedirectorAliasDB::lookUp normalized request-uri to " << requestString.data());
- }
- else
- {
- if (isDomainAlias && iter->relation == "callgroup")
- {
- //
- // Hunt groups are also aliases so we want them to loop back to us so it gets properly mapped
- // the next turn around.
- //
- requestUri.setHostAddress(hostAlias);
- requestUri.getUri(requestString);
- }
- // Add the contact.
- contactList.add( contactUri, *this );
- }
-
+ contactList.add( contactUri, *this );
if (_enableDiversionHeader && contactList.getDiversionHeader().empty())
{
@@ -238,35 +270,7 @@ SipRedirectorAliasDB::lookUp(
}
}
}
- else if (isDomainAlias)
- {
- //
- // No alias found. If this is was towards a domain alias, make sure to reset it back to
- // the old value prior to feeding it to the rest of the redirectors if the userId is not a real user.
- //
- UtlString userId;
- requestUri.getUserId(userId);
- EntityRecord entity;
- if (entityDb->findByUserId(userId.str(), entity))
- {
- if (!entity.realm().empty() && !entity.password().empty())
- {
- requestUri.getUri(requestString);
- OS_LOG_NOTICE(FAC_SIP, "SipRedirectorAliasDB::lookUp normalized request-uri to " << requestString.data());
- }
- else
- {
- requestUri.setHostAddress(hostAlias);
- requestUri.getUri(requestString);
- }
- }
- else
- {
- requestUri.setHostAddress(hostAlias);
- requestUri.getUri(requestString);
- }
- }
-
+
return RedirectPlugin::SUCCESS;
}
View
8 sipXregistry/lib/redirect_plugins/SipRedirectorAliasDB.h
@@ -66,11 +66,17 @@ class SipRedirectorAliasDB : public RedirectPlugin
private:
+ bool resolveAlias(
+ const SipMessage& message,
+ UtlString& requestString,
+ Url& requestUri
+ );
+
// String to use in place of class name in log messages:
// "[instance] class".
UtlString mLogName;
UtlBoolean _enableDiversionHeader;
-
+ UtlBoolean _enableEarlyAliasResolution;
protected:
};
View
2 sipXrelease/release
@@ -1 +1 @@
-0
+1
View
4 sipXtackLib/src/net/SipClientWriteBuffer.cpp
@@ -187,9 +187,9 @@ void SipClientWriteBuffer::insertMessage(SipMessage* message)
// as to clear any state of the socket).
Os::Logger::instance().log(FAC_SIP, PRI_ERR,
"SipClientWriteBuffer[%s]::insertMessage "
- "mWriteBuffer has %d entries, exceeding the limit of %d",
+ "mWriteBuffer has '%d' entries, exceeding the limit of maxMsgs '%d'",
getName().data(), (int) mWriteBuffer.entries(),
- (int) getMessageQueue()->maxMsgs());
+ getMessageQueue()->maxMsgs());
emptyBuffer(TRUE);
clientStopSelf();
}

0 comments on commit f37a4f1

Please sign in to comment.