Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'release-4.6-updates'

Conflicts:
	sipXcommons/.classpath
  • Loading branch information...
commit 7f443e92810cce3f4f35a97e5cb1b826a9e275be 2 parents 2f800ed + 800b09e
@ezuce-admin ezuce-admin authored
Showing with 1,241 additions and 2,164 deletions.
  1. +0 −21 Makefile.in
  2. +37 −4 mak/build.mk.in
  3. +37 −0 mak/modules.mk.in
  4. +0 −2  sipXcallLib/include/tao/TaoProviderAdaptor.h
  5. +1 −2  sipXcallLib/src/tao/TaoProviderAdaptor.cpp
  6. +0 −8 sipXcallLib/src/tapi/sipXtapi.cpp
  7. +1 −1  sipXcommons/.classpath
  8. BIN  sipXcommons/lib/js-1.7R1.jar
  9. BIN  sipXcommons/lib/js-1.7R4.jar
  10. +1 −0  sipXconfig/common.am
  11. +0 −22 sipXconfig/etc/sipxpbx/sipxproxy/sipxproxy.properties
  12. +3 −46 sipXconfig/etc/sipxpbx/sipxproxy/sipxproxy.xml
  13. +32 −5 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/bulk/RowInserter.java
  14. +52 −14 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/bulk/csv/CsvRowInserter.java
  15. +1 −1  sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/bulk/csv/ExportCsv.java
  16. +6 −1 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/bulk/csv/SimpleCsvWriter.java
  17. +20 −13 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/bulk/ldap/LdapImportManagerImpl.java
  18. +21 −11 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/bulk/ldap/LdapRowInserter.java
  19. +1 −1  sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/common/AbstractUser.java
  20. +35 −9 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/dialplan/AutoAttendant.java
  21. +2 −0  sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/dialplan/AutoAttendantManager.java
  22. +13 −0 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/dialplan/AutoAttendantManagerImpl.java
  23. +1 −1  sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/firewall/FirewallConfig.java
  24. +0 −1  sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/proxy/ProxyConfiguration.java
  25. +1 −54 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/proxy/ProxySettings.java
  26. +2 −0  sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/rls/ResourceLists.java
  27. +43 −0 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/vm/MailboxPreferences.java
  28. +80 −44 sipXconfig/neoconf/test/org/sipfoundry/sipxconfig/bulk/csv/CsvRowInserterTest.java
  29. +4 −3 sipXconfig/neoconf/test/org/sipfoundry/sipxconfig/bulk/ldap/LdapRowInserterTest.java
  30. +42 −1 sipXconfig/neoconf/test/org/sipfoundry/sipxconfig/dialplan/AutoAttendantTestIntegration.java
  31. +0 −6 sipXconfig/neoconf/test/org/sipfoundry/sipxconfig/proxy/expected-proxy-config
  32. +1 −0  sipXconfig/web/context/WEB-INF/backup/RestoreFinalize.html
  33. +3 −0  sipXconfig/web/context/WEB-INF/backup/RestoreFinalize.properties
  34. +3 −0  sipXconfig/web/context/WEB-INF/dialplan/ManageAttendants.html
  35. +1 −0  sipXconfig/web/context/WEB-INF/dialplan/ManageAttendants.properties
  36. +8 −0 sipXconfig/web/src/org/sipfoundry/sipxconfig/site/dialplan/ManageAttendants.java
  37. +1 −0  sipXivr/bin/voicemail_clean.in
  38. +2 −1  sipXmediaLib/include/rtcp/RTCPTimer.h
  39. +1 −0  sipXmediaLib/src/rtcp/RTCPTimer.cpp
  40. +6 −0 sipXpark/src/main.cpp
  41. +0 −3  sipXportLib/include/Makefile.am
  42. +176 −162 sipXportLib/include/os/OsTimer.h
  43. +0 −110 sipXportLib/include/os/OsTimerMsg.h
  44. +0 −123 sipXportLib/include/os/OsTimerTask.h
  45. +0 −109 sipXportLib/include/os/shared/OsTimerMessage.h
  46. +0 −2  sipXportLib/src/Makefile.am
  47. +451 −337 sipXportLib/src/os/OsTimer.cpp
  48. +0 −94 sipXportLib/src/os/OsTimerMsg.cpp
  49. +0 −538 sipXportLib/src/os/OsTimerTask.cpp
  50. +0 −18 sipXportLib/src/os/test/main.cpp
  51. +0 −2  sipXportLib/src/test/Makefile.am
  52. +0 −126 sipXportLib/src/test/os/OsSysLogTest.cpp
  53. +5 −5 sipXportLib/src/test/os/OsTaskTest.cpp
  54. +0 −72 sipXportLib/src/test/os/OsTimerTaskTest.cpp
  55. +39 −165 sipXportLib/src/test/os/OsTimerTest.cpp
  56. +2 −2 sipXproxy/src/sipXproxymain.cpp
  57. +5 −0 sipXpublisher/src/statusserver/main.cpp
  58. +22 −3 sipXregistry/lib/redirect_plugins/SipRedirectorAliasDB.cpp
  59. +6 −5 sipXregistry/lib/redirect_plugins/SipRedirectorFallback.cpp
  60. +6 −0 sipXregistry/src/main.cpp
  61. +22 −1 sipXrls/src/ContactSet.cpp
  62. +7 −1 sipXrls/src/main.cpp
  63. +6 −0 sipXsaa/src/main.cpp
  64. +2 −2 sipXsupervisor/etc/dhcpd.cf
  65. +1 −1  sipXsupervisor/etc/iptables.erb
  66. +3 −1 sipXtackLib/include/net/SipTransactionList.h
  67. +2 −2 sipXtackLib/include/net/SipUserAgent.h
  68. +9 −2 sipXtackLib/src/net/SipTransactionList.cpp
  69. +15 −2 sipXtackLib/src/net/SipUserAgent.cpp
  70. +0 −1  sipXtackLib/src/test/net/SipServerShutdownTest.cpp
  71. +0 −3  sipXtackLib/src/test/net/SipUserAgentTest.cpp
View
21 Makefile.in
@@ -27,17 +27,6 @@ PROJ = $(filter $(all),$(subst ., ,$@))
proj = $(call lowercase,$(PROJ))
PROJ_REVISION = $(shell cd $(SRC)/$(PROJ) && ./config/revision-gen @PACKAGE_VERSION@)
-# find any matches of $(sipx) or $(lib) anywhere in a target string and expands it into multiple target that
-# would follow the given target.
-# example: foo.B.bar... becomes 'foo.B.bar foo.C.bar' when list is 'A B C'
-after = $(shell echo $(space)$2$(space) | awk -F : '{if (match($$0,/ $1 /)) {print substr($$0,RSTART)}}')
-..._sipx_list = $(call after,$(PROJ),$(sipx))
-..._sipx_expanded = $(foreach T,$(..._sipx_list),$(subst $(PROJ),$(T),$*))
-..._lib_list = $(call after,$(PROJ),$(lib))
-..._lib_expanded = $(foreach T,$(..._lib_list),$(subst $(PROJ),$(T),$*))
-..._app_list = $(call after,$(PROJ),$(app))
-..._app_expanded = $(foreach T,$(..._app_list),$(subst $(PROJ),$(T),$*))
-
default-first-target : help;
sipx.% :
@@ -55,16 +44,6 @@ app.list lib.list sipx.list : %.list :
include $(sort $(wildcard mak/*.mk))
-help.*{1|2}*... = Perform all targets would normally follow the given target in addition to the target itself.\
- Very useful when you want to pick-up the build where it last stopped. For example 'make sipXthree...' would\
- expand to 'make sipXthree sipXfour sipXfive' but it would not include 'make sipXone sipXtwo'. You can use\
- the ... pattern anywhere you a specify a package name. Examples: 'make sipXconfig.rpm...',\
- 'make distro.centos-5-i386.OpenACD.rpm...'. See 'make sipx.list lib.list' for what the natural order of\
- packages.
-
-%... :
- $(MAKE) $(..._sipx_expanded) $(..._lib_expanded) $(..._app_expanded)
-
help-values.{1} = Any sipXecs package. For all sipXecs packages use 'sipx'. Complete list of sipXecs packages : $(sipx)
help-values.{2} = Any dependency package. For all dependencies use 'lib'. Complete list of dependencies : $(lib)
help-values.{6} = Any sipXecs application. For all app use 'app'. Complete list of app : $(app)
View
41 mak/build.mk.in
@@ -11,9 +11,16 @@ help.app=Build all sipx apps including targets autoreconf, configure, all and in
app :
$(MAKE) $(foreach P,$(app),$(P))
-$(foreach T,$(sipx) $(app),$(T)) : % : %.build;
-$(foreach T,$(sipx) $(app),$(T)...) : %... : %.build...;
-$(foreach T,$(sipx) $(app),$(T).build) : %.build : %.autoreconf %.configure %.all-install ;
+.PHONY:$(sipx) $(app)
+.SECONDEXPANSION:
+$(sipx) $(app) : $$($$@_DEPS)
+ @echo "$$rm_on_deps_change" | bash
+ @if ! test -f $(PROJ)/.installed ; then \
+ $(MAKE) $@.build; \
+ touch $(PROJ)/.installed; \
+ fi
+
+$(foreach T,$(sipx) $(app),$(T).build) : %.build : %.autoreconf %.configure %.all-install;
help.{1|6}.all-install=Run 'make all install' in each target
$(foreach T,$(sipx) $(app),$(T).all-install) : %.all-install : %.all %.install ;
@@ -45,10 +52,36 @@ help.{1|2|6}.dist = Build archive, typically compressed tar
MAKE_COMMANDS = check install clean dist
$(foreach C,$(MAKE_COMMANDS) all,$(eval help.{1}.$(C)=Run make $(C) on each project))
$(foreach P,$(sipx) $(app),$(P).install) :; $(MAKE) -C $(PROJ) install
-$(foreach P,$(sipx) $(app),$(P).clean) :; $(MAKE) -C $(PROJ) clean
+$(foreach P,$(sipx) $(app),$(P).clean) :
+ $(MAKE) -C $(PROJ) clean
+ ! test -f $(PROJ)/.installed || rm $(PROJ)/.installed
+
$(foreach P,$(sipx) $(app),$(P).check) :; $(MAKE) -C $(PROJ) check
# projects do not all have an "all" target, they probably should, until then, use
# no-target default
$(foreach C,all,$(foreach T,$(sipx) $(app),$(T).all)) :
$(MAKE) -C $(PROJ)
+
+# This first checks if any files have changed in a project, if not, then
+# checks if any dependent projects were build since this project was
+# build. If so clear the build file
+define rm_on_deps_change
+ if test -f $(PROJ)/.installed ; then
+ x=`find $(SRC)/$(PROJ) -type f -newer $(PROJ)/.installed -printf .`
+ if [ -n "$$x" ] ; then
+ rm $(PROJ)/.installed
+ elif [ -n "$($@_DEPS)" ] ; then
+ for f in $(addprefix $(PROJ)/,$($@_DEPS=.installed)) ; do
+ if test -f $(PROJ)/.installed ; then
+ if test -f $$f ; then
+ if [ $$f -nt $(PROJ)/.installed ] ; then
+ rm $(PROJ)/.installed
+ fi
+ fi
+ fi
+ done
+ fi
+ fi
+endef
+export rm_on_deps_change
View
37 mak/modules.mk.in
@@ -4,6 +4,43 @@
# order is import for some of these as afar as building dependencies first
# consult spec files for authority on dependencies before changing the order
+deps = $(1) $($(1)_DEPS)
+
+sipXtackLib_DEPS = $(call deps,sipXportLib)
+sipXmediaLib_DEPS = $(call deps,sipXtackLib)
+sipXmediaAdapterLib_DEPS = $(call deps,sipXmediaLib)
+sipXcallLib_DEPS = $(call deps,sipXmediaAdapterLib)
+sipXsupervisor_DEPS =
+sipXmongo_DEPS = $(call deps,sipXsupervisor)
+sipXcommserverLib_DEPS = $(call deps,sipXsupervisor) $(call deps,sipXtackLib)
+sipXsqa_DEPS = $(call deps,sipXcommserverLib)
+sipXsnmp_DEPS = $(call deps,sipXsupervisor)
+sipXpostgres_DEPS = $(call deps,sipXsupervisor)
+sipXtunnel_DEPS = $(call deps,sipXsupervisor)
+sipXdns_DEPS = $(call deps,sipXsupervisor)
+sipXhttpd_DEPS = $(call deps,sipXsupervisor)
+sipXcommons_DEPS = $(call deps,sipXsupervisor)
+sipXrelay_DEPS = $(call deps,sipXcommserverLib) $(call deps,sipXcommons)
+sipXbridge_DEPS = $(call deps,sipXrelay)
+sipXfreeSwitch_DEPS = $(call deps,sipXcommserverLib)
+sipXcdr_DEPS = $(call deps,sipXcommserverLib)
+sipXacdStatistics_DEPS = $(call deps,sipXcommons)
+sipXconfig_DEPS = $(call deps,sipXcommons) $(call deps,sipXsupervisor)
+sipXopenfire_DEPS = $(call deps,sipXconfig)
+sipXcounterpath_DEPS = $(call deps,sipXconfig)
+sipXaudiocodes_DEPS = $(call deps,sipXconfig)
+sipXprompts_DEPS = $(call deps,sipXsupervisor)
+sipXivr_DEPS = $(call deps,sipXconfig)
+sipXproxy_DEPS = $(call deps,sipXcommserverLib)
+sipXpublisher_DEPS = $(call deps,sipXcommserverLib)
+sipXregistry_DEPS = $(call deps,sipXcommserverLib)
+sipXpark_DEPS = $(call deps,sipXcallLib) $(call deps,sipXcommserverLib)
+sipXpage_DEPS = $(call deps,sipXcommserverLib) $(call deps,sipXcommons)
+sipXpolycom_DEPS = $(call deps,sipXconfig)
+sipXrls_DEPS = $(call deps,sipXsqa) $(call deps,sipXcallLib) $(call deps,sipXcommserverLib)
+sipXsaa_DEPS = $(call deps,sipXcallLib)
+sipXrelease_DEPS =
+
sipx = \
sipXportLib \
sipXtackLib \
View
2  sipXcallLib/include/tao/TaoProviderAdaptor.h
@@ -40,7 +40,6 @@
class CpCallManager;
class MpMediaTask;
class OsNameDb;
-class OsTimerTask;
class PsPhoneTask;
class UtlMemCheck;
class SipUserAgent;
@@ -161,7 +160,6 @@ friend class TaoServerTask;
CpCallManager* mpCallMgrTask; // call manager task
MpMediaTask* mpMediaTask; // media processing task
PsPhoneTask* mpPhoneTask; // phone set task
- OsTimerTask* mpTimerTask; // timer manager task
SipUserAgent* mpSipUserAgentTask; // sip stack
PtMGCP* mpMgcpStackTask; // MGCP stack
HttpServer* mpHttpServer; // Http Server
View
3  sipXcallLib/src/tao/TaoProviderAdaptor.cpp
@@ -40,8 +40,7 @@ TaoProviderAdaptor::TaoProviderAdaptor(CpCallManager *pCallMgr,
: TaoAdaptor("TaoProviderAdaptor-%d", maxRequestQMsgs),
mpCallMgrTask(pCallMgr),
mpMediaTask(NULL),
- mpPhoneTask(NULL),
- mpTimerTask(NULL)
+ mpPhoneTask(NULL)
{
mpSvrTransport = rpSvrTransport;
parseMessage(rMsg);
View
8 sipXcallLib/src/tapi/sipXtapi.cpp
@@ -45,7 +45,6 @@
#include "os/OsLock.h"
#include "os/OsLogger.h"
#include "os/OsLoggerHelper.h"
-#include "os/OsTimerTask.h"
#include "os/OsStunAgentTask.h"
#include "net/TapiMgr.h"
#include "net/SipSrvLookup.h"
@@ -500,9 +499,6 @@ SIPXTAPI_API SIPX_RESULT sipxUnInitialize(SIPX_INST hInst)
if ( (nCalls == 0) && (nConferences == 0) && (nLines == 0) )
{
- // Destroy the timer task to flush timers
- OsTimerTask::destroyTimerTask() ;
-
// get rid of pointer to the line manager in the refresh manager
pInst->pRefreshManager->setLineMgr(NULL);
@@ -599,10 +595,6 @@ SIPXTAPI_API SIPX_RESULT sipxUnInitialize(SIPX_INST hInst)
delete pInst;
pInst = NULL;
- // Destroy the timer task once more -- some of the destructors (SipUserAgent)
- // mistakenly re-creates them when terminating.
- OsTimerTask::destroyTimerTask() ;
-
sipxDestroyMediaFactoryFactory() ;
rc = SIPX_RESULT_SUCCESS ;
View
2  sipXcommons/.classpath
@@ -69,7 +69,6 @@
<classpathentry exported="true" kind="lib" path="lib/jfreechart-1.0.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jibx-bind-1.1.6a.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jibx-run-1.1.6a.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/js-1.7R1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jstl.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jta.jar"/>
<classpathentry exported="true" kind="lib" path="lib/junitperf-1.9.1.jar"/>
@@ -164,5 +163,6 @@
<classpathentry exported="true" kind="lib" path="lib/jedis-2.1.0.jar"/>
<classpathentry exported="true" kind="lib" path="lib/spring-data-redis-1.0.1.RELEASE.jar"/>
<classpathentry exported="true" kind="lib" path="lib/mongo-2.9.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/js-1.7R4.jar"/>
<classpathentry kind="output" path="bin.eclipse/classes"/>
</classpath>
View
BIN  sipXcommons/lib/js-1.7R1.jar
Binary file not shown
View
BIN  sipXcommons/lib/js-1.7R4.jar
Binary file not shown
View
1  sipXconfig/common.am
@@ -52,6 +52,7 @@ neoconf_PKGS = \
jaxen \
jaxrpc \
jettison \
+ js-1.7R4 \
ldapbp \
lucene-core \
mime-dir-j-vcard4j \
View
22 sipXconfig/etc/sipxpbx/sipxproxy/sipxproxy.properties
@@ -10,28 +10,6 @@ proxy-configuration.SIPX_PROXY_DEFAULT_EXPIRES.label=Default Expiration
proxy-configuration.SIPX_PROXY_DEFAULT_EXPIRES.description=Number of seconds a call is allowed to go unanswered; \
if this many seconds pass, the call request is returned with an error.
-call-rate-limit.label=Call Rate Limit
-
-call-rate-limit.SIPX_PROXY_AUTOBAN_THRESHOLD_VIOLATORS.label=Penalize Threshold Violators
-call-rate-limit.SIPX_PROXY_AUTOBAN_THRESHOLD_VIOLATORS.description=If set on true the IPs identified as threshold violators \
- are automatically added on the black list
-
-call-rate-limit.SIPX_PROXY_PACKETS_PER_SECOND_THRESHOLD.label=Packets per Second
-call-rate-limit.SIPX_PROXY_PACKETS_PER_SECOND_THRESHOLD.description=Number of packets per second allowed from an IP address before \
- considering it a DoS attack. Every time this threshold is exceeded the Violation Rate value associated with this IP is incremented.
-
-call-rate-limit.SIPX_PROXY_THRESHOLD_VIOLATION_RATE.label=Violation Rate
-call-rate-limit.SIPX_PROXY_THRESHOLD_VIOLATION_RATE.description=When this threshold is exceeded the IP address is added on the black list.
-
-call-rate-limit.SIPX_PROXY_BAN_LIFETIME.label=Penalty Period
-call-rate-limit.SIPX_PROXY_BAN_LIFETIME.description=Length of time (in milliseconds) that rate violators will be penalized.
-
-call-rate-limit.SIPX_PROXY_WHITE_LIST.label=White List
-call-rate-limit.SIPX_PROXY_WHITE_LIST.description=List of trusted IPs (comma separated values of IP addresses or subnet) that will be never added on the black list.
-
-call-rate-limit.SIPX_PROXY_BLACK_LIST.label=Black List
-call-rate-limit.SIPX_PROXY_BLACK_LIST.description=List of untrusted IPs (comma separated values of IP addresses or subnet) considered DoS Attackers.
-
alert-info.label=Alert-Info
alert-info.description=The Alert-Info header field can trigger alternate ringer sounds on many \
telephones, it is used to mark external phonecalls as such and trigger a different ringer sound if the phone \
View
49 sipXconfig/etc/sipxpbx/sipxproxy/sipxproxy.xml
@@ -54,19 +54,19 @@
<type refid="loglevel" />
<value>NOTICE</value>
</setting>
- <setting name="SIPX_PROXY_TCP_PORT" advanced="yes">
+ <setting name="SIPX_PROXY_TCP_PORT" hidden="yes">
<type>
<integer />
</type>
<value>5060</value>
</setting>
- <setting name="SIPX_PROXY_UDP_PORT" advanced="yes">
+ <setting name="SIPX_PROXY_UDP_PORT" hidden="yes">
<type>
<integer />
</type>
<value>5060</value>
</setting>
- <setting name="SIPX_PROXY_TLS_PORT" advanced="yes">
+ <setting name="SIPX_PROXY_TLS_PORT" hidden="yes">
<type>
<integer />
</type>
@@ -154,47 +154,4 @@
<value></value>
</setting>
</group>
- <group name="call-rate-limit">
- <setting name="SIPX_PROXY_AUTOBAN_THRESHOLD_VIOLATORS">
- <type>
- <boolean>
- <true>
- <value>true</value>
- </true>
- <false>
- <value>false</value>
- </false>
- </boolean>
- </type>
- <value>true</value>
- </setting>
- <setting name="SIPX_PROXY_PACKETS_PER_SECOND_THRESHOLD">
- <type>
- <integer />
- </type>
- <value>100</value>
- </setting>
- <setting name="SIPX_PROXY_THRESHOLD_VIOLATION_RATE">
- <type>
- <integer />
- </type>
- <value>50</value>
- </setting>
- <setting name="SIPX_PROXY_BAN_LIFETIME">
- <type>
- <integer />
- </type>
- <value>3600</value>
- </setting>
- <setting name="SIPX_PROXY_WHITE_LIST">
- <type>
- <string multiLine="yes" maxLen="1000"/>
- </type>
- </setting>
- <setting name="SIPX_PROXY_BLACK_LIST">
- <type>
- <string multiLine="yes" maxLen="1000"/>
- </type>
- </setting>
- </group>
</model>
View
37 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/bulk/RowInserter.java
@@ -12,6 +12,7 @@
import java.io.Serializable;
import org.apache.commons.collections.Closure;
+import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.sipfoundry.sipxconfig.bulk.csv.CsvRowInserter;
@@ -71,8 +72,8 @@ public final void execute(Object input) {
* @param input - one row of imported data
* @return if true data can be imported, if false the row will be skipped
*/
- protected RowStatus checkRowData(T input) {
- return input == null ? RowStatus.FAILURE : RowStatus.SUCCESS;
+ protected RowResult checkRowData(T input) {
+ return input == null ? new RowResult(RowStatus.FAILURE) : new RowResult(RowStatus.SUCCESS);
}
/**
@@ -116,15 +117,18 @@ private JobTransaction(Serializable id, T input) {
protected void doInTransactionWithoutResult(TransactionStatus status_) {
m_jobContext.start(m_id);
- switch (checkRowData(m_input)) {
+ switch (checkRowData(m_input).getRowStatus()) {
case SUCCESS:
insertRow(m_input);
m_jobContext.success(m_id);
afterInsert();
break;
case FAILURE:
- String errorMessage = "Invalid data format when importing: "
- + dataToString(m_input);
+ String errorMessage = "Invalid data format when importing: " + dataToString(m_input);
+ String wrongData = checkRowData(m_input).getErrorMessage();
+ if (StringUtils.isNotBlank(wrongData)) {
+ errorMessage += " - unsupported value: " + wrongData;
+ }
LOG.warn(errorMessage);
m_jobContext.failure(m_id, errorMessage, null);
break;
@@ -146,4 +150,27 @@ protected void doInTransactionWithoutResult(TransactionStatus status_) {
}
}
}
+
+ public static class RowResult {
+ private RowStatus m_rowStatus;
+
+ private String m_errorMessage;
+
+ public RowResult(RowStatus status) {
+ m_rowStatus = status;
+ }
+
+ public RowResult(RowStatus status, String mess) {
+ m_rowStatus = status;
+ m_errorMessage = mess;
+ }
+
+ public RowStatus getRowStatus() {
+ return m_rowStatus;
+ }
+
+ public String getErrorMessage() {
+ return m_errorMessage;
+ }
+ }
}
View
66 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/bulk/csv/CsvRowInserter.java
@@ -17,6 +17,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import java.util.regex.Pattern;
import org.apache.commons.lang.StringUtils;
import org.sipfoundry.commons.security.Md5Encoder;
@@ -34,7 +35,9 @@
import org.sipfoundry.sipxconfig.setting.Group;
import org.sipfoundry.sipxconfig.setting.GroupAutoAssign;
import org.sipfoundry.sipxconfig.setting.SettingDao;
+import org.sipfoundry.sipxconfig.setting.type.SipUriSetting;
import org.sipfoundry.sipxconfig.vm.MailboxManager;
+import org.sipfoundry.sipxconfig.vm.MailboxPreferences;
import org.springframework.beans.factory.annotation.Required;
public class CsvRowInserter extends RowInserter<String[]> {
@@ -88,21 +91,45 @@ public void setPhoneContext(PhoneContext phoneContext) {
* @return CheckRowDataRetVal
*/
@Override
- protected RowStatus checkRowData(String[] row) {
+ protected RowResult checkRowData(String[] row) {
String userName = Index.USERNAME.get(row);
String serialNo = Index.SERIAL_NUMBER.get(row);
if (isBlank(serialNo) && isBlank(userName)) {
- return RowStatus.FAILURE;
+ return new RowResult(RowStatus.FAILURE);
}
if (isNotBlank(userName)) {
// check for a valid user name
if (!UserValidationUtils.isValidUserName(userName)) {
- return RowStatus.FAILURE;
+ return new RowResult(RowStatus.FAILURE, userName);
}
}
- return RowStatus.SUCCESS;
+
+ // voice mail settings and user caller alias
+ if (!MailboxPreferences.ActiveGreeting.isValid(Index.ACTIVE_GREETING.get(row))) {
+ return new RowResult(RowStatus.FAILURE, Index.ACTIVE_GREETING.get(row));
+ } else if (!MailboxPreferences.AttachType.isValid(Index.PRIMARY_EMAIL_NOTIFICATION.get(row))) {
+ return new RowResult(RowStatus.FAILURE, Index.PRIMARY_EMAIL_NOTIFICATION.get(row));
+ } else if (!MailboxPreferences.MailFormat.isValid(Index.PRIMARY_EMAIL_FORMAT.get(row))) {
+ return new RowResult(RowStatus.FAILURE, Index.PRIMARY_EMAIL_FORMAT.get(row));
+ } else if (!isValidBooleanData(Index.PRIMARY_EMAIL_ATTACH_AUDIO.get(row))) {
+ return new RowResult(RowStatus.FAILURE, Index.PRIMARY_EMAIL_ATTACH_AUDIO.get(row));
+ } else if (!MailboxPreferences.AttachType.isValid(Index.ALT_EMAIL_NOTIFICATION.get(row))) {
+ return new RowResult(RowStatus.FAILURE, Index.ALT_EMAIL_NOTIFICATION.get(row));
+ } else if (!MailboxPreferences.MailFormat.isValid(Index.ALT_EMAIL_FORMAT.get(row))) {
+ return new RowResult(RowStatus.FAILURE, Index.ALT_EMAIL_FORMAT.get(row));
+ } else if (!isValidBooleanData(Index.ALT_EMAIL_ATTACH_AUDIO.get(row))) {
+ return new RowResult(RowStatus.FAILURE, Index.ALT_EMAIL_ATTACH_AUDIO.get(row));
+ } else if (!isValidBooleanData(Index.VOICEMAIL_SERVER.get(row))) {
+ return new RowResult(RowStatus.FAILURE, Index.VOICEMAIL_SERVER.get(row));
+ } else if (!isValidCallerIdData(Index.EXTERNAL_NUMBER.get(row))) {
+ return new RowResult(RowStatus.FAILURE, Index.EXTERNAL_NUMBER.get(row));
+ } else if (!isValidBooleanData(Index.ANONYMOUS_CALLER_ALIAS.get(row))) {
+ return new RowResult(RowStatus.FAILURE, Index.ANONYMOUS_CALLER_ALIAS.get(row));
+ }
+
+ return new RowResult(RowStatus.SUCCESS);
}
/**
@@ -280,16 +307,6 @@ private void insertData(User user, Collection<Group> userGroups, Phone phone,
}
}
- void updateMailbox(User user, boolean newMailbox) {
- if (!m_mailboxManager.isEnabled()) {
- return;
- }
- String userName = user.getUserName();
- if (newMailbox) {
- m_mailboxManager.deleteMailbox(userName);
- }
- }
-
Line addLine(Phone phone, User user, String settings) {
if (user == null) {
return null;
@@ -328,6 +345,27 @@ protected String dataToString(String[] row) {
return join(ids, " ");
}
+ private static boolean isValidBooleanData(String s) {
+ if (s != null) {
+ if (s.equalsIgnoreCase("true") || s.equalsIgnoreCase("false") || StringUtils.isEmpty(s)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static boolean isValidCallerIdData(String s) {
+ SipUriSetting setting = new SipUriSetting();
+ setting.setUserPartOnly(true);
+ Pattern pattern = Pattern.compile(setting.getPattern());
+ if (s != null) {
+ if (pattern.matcher(s).matches() || StringUtils.isEmpty(s)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
public void setSettingDao(SettingDao settingDao) {
m_settingDao = settingDao;
}
View
2  sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/bulk/csv/ExportCsv.java
@@ -182,7 +182,7 @@ void exportUser(SimpleCsvWriter csv, String[] row, User user) throws IOException
Index.ALT_EMAIL_FORMAT.set(row, mailboxPreferences.getAlternateEmailFormat().name());
Index.ALT_EMAIL_ATTACH_AUDIO.set(row,
String.valueOf(mailboxPreferences.isIncludeAudioAttachmentAlternateEmail()));
- Index.VOICEMAIL_SERVER.set(row, String.valueOf(user.getVoicemailServer()));
+ Index.VOICEMAIL_SERVER.set(row, String.valueOf(user.isVoicemailServer()));
// user caller alias
UserCallerAliasInfo callerAlias = new UserCallerAliasInfo(user);
View
7 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/bulk/csv/SimpleCsvWriter.java
@@ -17,6 +17,7 @@
public class SimpleCsvWriter {
private Writer m_writer;
private boolean m_quote = true;
+ private char m_delim = CsvParserImpl.FIELD_SEPARATOR;
public SimpleCsvWriter(Writer writer) {
m_writer = writer;
@@ -46,7 +47,7 @@ public void write(String[] fields, boolean quote) throws IOException {
line.append(CsvParserImpl.FIELD_QUOTE);
}
if (i < fields.length - 1) {
- line.append(CsvParserImpl.FIELD_SEPARATOR);
+ line.append(m_delim);
} else {
line.append('\n');
}
@@ -80,4 +81,8 @@ public boolean isQuote() {
public void setQuote(boolean quote) {
m_quote = quote;
}
+
+ public void setDelim(char delim) {
+ m_delim = delim;
+ }
}
View
33 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/bulk/ldap/LdapImportManagerImpl.java
@@ -26,7 +26,6 @@
import org.sipfoundry.sipxconfig.bulk.csv.Index;
import org.sipfoundry.sipxconfig.bulk.csv.SimpleCsvWriter;
import org.sipfoundry.sipxconfig.common.UserException;
-import org.springframework.dao.DataAccessException;
import org.springframework.ldap.CollectingNameClassPairCallbackHandler;
import org.springframework.ldap.LdapTemplate;
import org.springframework.ldap.NameClassPairCallbackHandler;
@@ -47,13 +46,18 @@ public void setUserMapper(UserMapper userMapper) {
}
public void insert(int connectionId) {
- m_rowInserter.setAttrMap(m_ldapManager.getAttrMap(connectionId));
- m_rowInserter.setDomain(m_ldapManager.getConnectionParams(connectionId).getDomain());
- m_rowInserter.beforeInserting();
- NameClassPairCallbackHandler handler = new NameClassPairMapperClosureAdapter(
- m_rowInserter);
- runSearch(handler, 0, connectionId);
- m_rowInserter.afterInserting();
+ LOG.info("***** START INSERTING DATA *****");
+ try {
+ m_rowInserter.setAttrMap(m_ldapManager.getAttrMap(connectionId));
+ m_rowInserter.setDomain(m_ldapManager.getConnectionParams(connectionId).getDomain());
+ m_rowInserter.beforeInserting();
+ NameClassPairCallbackHandler handler = new NameClassPairMapperClosureAdapter(
+ m_rowInserter);
+ runSearch(handler, 0, connectionId);
+ m_rowInserter.afterInserting();
+ } catch (Exception ex) {
+ LOG.error("***** FAILURE DURING INSERTING DATA *****", ex);
+ }
}
public List<UserPreview> getExample(int connectionId) {
@@ -149,11 +153,14 @@ private void runSearch(NameClassPairCallbackHandler handler, long limit, int con
LdapTemplate template = m_templateFactory.getLdapTemplate(m_ldapManager.getConnectionParams(connectionId));
try {
template.search(base, filter, sc, handler, LdapManager.NULL_PROCESSOR);
- } catch (SearchLimitExceededException normal) {
- // See http://forum.springframework.org/archive/index.php/t-27836.html
- LOG.debug("Normal overflow, requesting to preview more records then exist");
- } catch (DataAccessException e) {
- throw new UserException("LDAP search failed : " + e.getCause().getMessage());
+ } catch (Exception e) {
+ if (e instanceof SearchLimitExceededException) {
+ // See http://forum.springframework.org/archive/index.php/t-27836.html
+ LOG.info("Normal overflow, requesting to preview more records then exist");
+ } else {
+ LOG.error("LDAP search failed", e);
+ throw new UserException("LDAP search failed : " + e.getCause().getMessage());
+ }
}
}
View
32 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/bulk/ldap/LdapRowInserter.java
@@ -16,13 +16,14 @@
import java.util.Set;
import java.util.TreeSet;
-import javax.naming.NamingException;
import javax.naming.directory.Attributes;
import javax.naming.directory.SearchResult;
+import org.apache.commons.lang.StringUtils;
import org.sipfoundry.sipxconfig.bulk.RowInserter;
import org.sipfoundry.sipxconfig.common.CoreContext;
import org.sipfoundry.sipxconfig.common.User;
+import org.sipfoundry.sipxconfig.common.UserException;
import org.sipfoundry.sipxconfig.common.UserValidationUtils;
import org.sipfoundry.sipxconfig.conference.ConferenceBridgeContext;
import org.sipfoundry.sipxconfig.forwarding.ForwardingContext;
@@ -46,6 +47,7 @@
private AttrMap m_attrMap;
private String m_domain;
private Set<String> m_aliases;
+ private Set<String> m_importedUserNames;
private boolean m_preserveMissingUsers;
@@ -55,7 +57,11 @@ public void beforeInserting() {
m_userMapper.setAttrMap(m_attrMap);
// get all the users from LDAP group
m_existingUserNames = new HashSet<String>();
- Group defaultGroup = m_coreContext.getGroupByName(getAttrMap().getDefaultGroupName(),
+ //initialize imported username set -
+ //this will contain usernames successfuly imported in the current import session
+ //we will use it to check for duplicated usernames
+ m_importedUserNames = new HashSet<String>();
+ Group defaultGroup = m_coreContext.getGroupByName(m_attrMap.getDefaultGroupName(),
false);
if (defaultGroup != null) {
Collection<String> userNames = m_coreContext.getGroupMembersNames(defaultGroup);
@@ -71,6 +77,7 @@ public void afterInserting() {
// remove all the users that were not re-imported from LDAP
m_coreContext.deleteUsersByUserName(m_existingUserNames);
m_existingUserNames.clear();
+ m_importedUserNames.clear();
}
@Override
@@ -125,8 +132,10 @@ void insertRow(SearchResult searchResult, Attributes attrs) {
} else {
m_coreContext.saveUser(user);
}
- } catch (NamingException e) {
- throw new RuntimeException(e);
+ m_importedUserNames.add(userName);
+ } catch (Exception e) {
+ LOG.error("Failed inserting row", e);
+ throw new UserException(e);
}
}
@@ -139,24 +148,25 @@ protected String dataToString(SearchResult sr) {
}
@Override
- protected RowStatus checkRowData(SearchResult sr) {
+ protected RowResult checkRowData(SearchResult sr) {
Attributes attrs = sr.getAttributes();
String idAttrName = m_attrMap.getIdentityAttributeName();
if (attrs.get(idAttrName) == null) {
- return RowStatus.FAILURE;
+ return new RowResult(RowStatus.FAILURE);
}
RowStatus status = RowStatus.SUCCESS;
try {
String userName = m_userMapper.getUserName(attrs);
// check username
- if (!UserValidationUtils.isValidUserName(userName)) {
- return RowStatus.FAILURE;
+ if (!UserValidationUtils.isValidUserName(userName)
+ || (m_importedUserNames != null && m_importedUserNames.contains(userName))) {
+ return new RowResult(RowStatus.FAILURE);
}
Set<String> aliases = m_userMapper.getAliasesSet(attrs);
if (aliases != null) {
Set<String> aliasesToRemove = new TreeSet<String>();
for (String alias : aliases) {
- if (m_coreContext.isAliasInUseForOthers(alias, userName)) {
+ if (StringUtils.equals(userName, alias) || m_coreContext.isAliasInUseForOthers(alias, userName)) {
aliasesToRemove.add(alias);
status = RowStatus.WARNING_ALIAS_COLLISION;
}
@@ -167,9 +177,9 @@ protected RowStatus checkRowData(SearchResult sr) {
}
m_aliases = aliases;
} catch (Exception e) {
- return RowStatus.FAILURE;
+ return new RowResult(RowStatus.FAILURE);
}
- return status;
+ return new RowResult(status);
}
public void setAttrMap(AttrMap attrMap) {
View
2  sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/common/AbstractUser.java
@@ -537,7 +537,7 @@ public void setAlternateEmailAttachAudio(Boolean alternateEmailAttachAudio) {
setSettingTypedValue(ALT_EMAIL_ATTACH_AUDIO, alternateEmailAttachAudio);
}
- public Boolean getVoicemailServer() {
+ public Boolean isVoicemailServer() {
Setting setting = null == getSettings() ? null : getSettings().getSetting(FREESWITH_VOICEMAIL.getPath());
return null == setting ? Boolean.valueOf(EMPTY_STRING) : (setting.getTypedValue() == null ? Boolean
.valueOf(EMPTY_STRING) : (Boolean) setting.getTypedValue());
View
44 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/dialplan/AutoAttendant.java
@@ -13,12 +13,14 @@
import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Map;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.sipfoundry.sipxconfig.cfgmgt.DeployConfigOnEdit;
+import org.sipfoundry.sipxconfig.common.DialPad;
import org.sipfoundry.sipxconfig.common.NamedObject;
import org.sipfoundry.sipxconfig.feature.Feature;
import org.sipfoundry.sipxconfig.setting.AbstractSettingVisitor;
@@ -30,25 +32,24 @@
public class AutoAttendant extends BeanWithGroups implements NamedObject, DeployConfigOnEdit {
public static final Log LOG = LogFactory.getLog(AutoAttendant.class);
-
public static final String BEAN_NAME = "autoAttendant";
-
public static final String OPERATOR_ID = "operator";
-
public static final String AFTERHOUR_ID = "afterhour";
+ public static final String OVERALL_DIGIT_TIMEOUT = "dtmf/overallDigitTimeout";
+ public static final String DTMF_INTERDIGIT_TIMEOUT = "dtmf/interDigitTimeout";
+ public static final String MAX_DIGITS = "dtmf/maxDigits";
+ public static final String ONFAIL_NOINPUT_COUNT = "onfail/noinputCount";
+ public static final String ONFAIL_NOMATCH_COUNT = "onfail/nomatchCount";
+ public static final String ONFAIL_TRANSFER = "onfail/transfer";
+ public static final String ONFAIL_TRANSFER_EXT = "onfail/transfer-extension";
+ public static final String ONFAIL_TRANSFER_PROMPT = "onfail/transfer-prompt";
private static final String SYSTEM_NAME_PREFIX = "xcf";
-
private String m_name;
-
private String m_description;
-
private String m_prompt;
-
private AttendantMenu m_menu = new AttendantMenu();
-
private String m_systemId;
-
private String m_promptsDirectory;
@Override
@@ -198,4 +199,29 @@ public static Integer getIdFromSystemId(String attendantId) {
public Collection<Feature> getAffectedFeaturesOnChange() {
return Arrays.asList((Feature) DialPlanContext.FEATURE, (Feature) AutoAttendantManager.FEATURE);
}
+
+ public void duplicateSettings(AutoAttendant attendant) {
+ AttendantMenu menu = new AttendantMenu();
+ Map<DialPad, AttendantMenuItem> items = getMenu().getMenuItems();
+ if (items != null) {
+ for (DialPad dp : items.keySet()) {
+ AttendantMenuItem item = items.get(dp);
+ if (item != null) {
+ menu.addMenuItem(DialPad.getByName(dp.getName()), item.getAction(), item.getParameter());
+ }
+ }
+ }
+ attendant.setMenu(menu);
+ attendant.setPrompt(getPrompt());
+ attendant.setSettingValue(DTMF_INTERDIGIT_TIMEOUT, getSettingValue(DTMF_INTERDIGIT_TIMEOUT));
+ attendant.setSettingValue(MAX_DIGITS, getSettingValue(MAX_DIGITS));
+ attendant.setSettingValue(OVERALL_DIGIT_TIMEOUT, getSettingValue(OVERALL_DIGIT_TIMEOUT));
+ attendant.setSettingValue(ONFAIL_NOINPUT_COUNT, getSettingValue(ONFAIL_NOINPUT_COUNT));
+ attendant.setSettingValue(ONFAIL_NOMATCH_COUNT, getSettingValue(ONFAIL_NOMATCH_COUNT));
+ attendant.setSettingValue(ONFAIL_TRANSFER, getSettingValue(ONFAIL_TRANSFER));
+ attendant.setSettingValue(ONFAIL_TRANSFER_EXT, getSettingValue(ONFAIL_TRANSFER_EXT));
+ attendant.setSettingValue(ONFAIL_TRANSFER_PROMPT, getSettingValue(ONFAIL_TRANSFER_PROMPT));
+ attendant.setGroupsAsList(getGroupsAsList());
+ }
+
}
View
2  sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/dialplan/AutoAttendantManager.java
@@ -35,6 +35,8 @@
void deleteAutoAttendantsByIds(Collection<Integer> attendantsIds);
+ void dupeAutoAttendants(Collection<Integer> attendantsIds);
+
Group getDefaultAutoAttendantGroup();
AutoAttendant newAutoAttendantWithDefaultGroup();
View
13 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/dialplan/AutoAttendantManagerImpl.java
@@ -98,6 +98,18 @@ public void deleteAutoAttendantsByIds(Collection<Integer> attendantIds) {
}
}
+ @Override
+ public void dupeAutoAttendants(Collection<Integer> attendantsIds) {
+ for (Integer id : attendantsIds) {
+ AutoAttendant aa = getAutoAttendant(id);
+ AutoAttendant newAa = newAutoAttendantWithDefaultGroup();
+ newAa.setName(aa.getName() + "-duped" + System.currentTimeMillis());
+ newAa.setDescription("autogenerated AA");
+ aa.duplicateSettings(newAa);
+ storeAutoAttendant(newAa);
+ }
+ }
+
public void deleteAutoAttendant(AutoAttendant attendant) {
if (attendant.isPermanent()) {
throw new AttendantInUseException();
@@ -262,4 +274,5 @@ public void setAliasManager(AliasManager aliasManager) {
public void setBeanFactory(BeanFactory beanFactory) {
m_beanFactory = beanFactory;
}
+
}
View
2  sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/firewall/FirewallConfig.java
@@ -79,7 +79,7 @@ public void replicate(ConfigManager manager, ConfigRequest request) throws IOExc
}
if (!enabled) {
- return;
+ continue;
}
Writer sysctl = new FileWriter(new File(dir, "sysctl.part"));
View
1  sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/proxy/ProxyConfiguration.java
@@ -98,7 +98,6 @@ void write(Writer wtr, ProxySettings settings, Location location, Domain domain,
config.writeSetting(xferPlugin, root.getSetting("msftxchghack/EXCHANGE_SERVER_FQDN"));
config.writeSetting(xferPlugin, root.getSetting("msftxchghack/ADDITIONAL_EXCHANGE_SERVER_FQDN"));
config.writeSetting("SIPX_PROXY.210_msftxchghack.", root.getSetting("msftxchghack/USERAGENT"));
- config.writeSettings(root.getSetting("call-rate-limit"));
config.write("SIPX_PROXY_HOST_NAME", location.getFqdn());
int port = settings.getSipTcpPort();
String aliases = format("%s:%d %s:%d", location.getAddress(), port, location.getFqdn(), port);
View
55 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/proxy/ProxySettings.java
@@ -20,26 +20,16 @@
import java.util.Collection;
import java.util.Collections;
-import org.apache.commons.lang.StringUtils;
-import org.sipfoundry.commons.util.IPAddressUtil;
import org.sipfoundry.sipxconfig.cfgmgt.DeployConfigOnEdit;
-import org.sipfoundry.sipxconfig.common.UserException;
import org.sipfoundry.sipxconfig.feature.Feature;
import org.sipfoundry.sipxconfig.setting.PersistableSettings;
import org.sipfoundry.sipxconfig.setting.Setting;
-import org.sipfoundry.sipxconfig.setting.SettingsValidator;
-public class ProxySettings extends PersistableSettings implements DeployConfigOnEdit, SettingsValidator {
+public class ProxySettings extends PersistableSettings implements DeployConfigOnEdit {
public static final String LOG_SETTING = "proxy-configuration/SIPX_PROXY_LOG_LEVEL";
public static final String SIP_PORT_SETTING = "proxy-configuration/SIPX_PROXY_TCP_PORT";
public static final String SIP_UDP_PORT_SETTING = "proxy-configuration/SIPX_PROXY_UDP_PORT";
public static final String SIP_SECURE_PORT_SETTING = "proxy-configuration/TLS_SIP_PORT";
- public static final String AUTOBAN_THRESHOLD_VIOLATORS = "call-rate-limit/SIPX_PROXY_AUTOBAN_THRESHOLD_VIOLATORS";
- public static final String ALLOWED_PACKETS_PER_SECOND = "call-rate-limit/SIPX_PROXY_PACKETS_PER_SECOND_THRESHOLD";
- public static final String THRESHOLD_VIOLATION_RATE = "call-rate-limit/SIPX_PROXY_THRESHOLD_VIOLATION_RATE";
- public static final String BAN_LIFETIME = "call-rate-limit/SIPX_PROXY_BAN_LIFETIME";
- public static final String WHITE_LIST = "call-rate-limit/SIPX_PROXY_WHITE_LIST";
- public static final String BLACK_LIST = "call-rate-limit/SIPX_PROXY_BLACK_LIST";
public int getSipTcpPort() {
return (Integer) getSettingTypedValue(SIP_PORT_SETTING);
@@ -53,54 +43,11 @@ public int getSecureSipPort() {
return (Integer) getSettingTypedValue(SIP_SECURE_PORT_SETTING);
}
- public boolean getAutobanThresholdViolators() {
- return (Boolean) getSettingTypedValue(AUTOBAN_THRESHOLD_VIOLATORS);
- }
-
- public Integer getAllowedPacketsPerSecond() {
- return (Integer) getSettingTypedValue(ALLOWED_PACKETS_PER_SECOND);
- }
-
- public Integer getThresholdViolationRate() {
- return (Integer) getSettingTypedValue(THRESHOLD_VIOLATION_RATE);
- }
-
- public Integer getBanLifetime() {
- return (Integer) getSettingTypedValue(BAN_LIFETIME);
- }
-
- public String getWhiteList() {
- return (String) getSettingTypedValue(WHITE_LIST);
- }
-
- public String getBlackList() {
- return (String) getSettingTypedValue(BLACK_LIST);
- }
-
public int getDefaultInitDelay() {
return (Integer) getSettingTypedValue("proxy-configuration/SIPX_PROXY_DEFAULT_SERIAL_EXPIRES");
}
@Override
- public void validate(Setting settings) {
- ProxySettings p = (ProxySettings) settings;
- checkIpList(p.getWhiteList(), "&msg.invalidWhiteList");
- checkIpList(p.getBlackList(), "&msg.invalidBlackList");
- }
-
- private void checkIpList(String list, String message) {
- if (StringUtils.isNotEmpty(list)) {
- String[] ipTokens = StringUtils.split(list, ',');
- for (String ip : ipTokens) {
- if (!IPAddressUtil.isLiteralIPAddress(StringUtils.trim(ip))
- && !IPAddressUtil.isLiteralIPSubnetAddress(StringUtils.trim(ip))) {
- throw new UserException(message, ip);
- }
- }
- }
- }
-
- @Override
protected Setting loadSettings() {
return getModelFilesContext().loadModelFile("sipxproxy/sipxproxy.xml");
}
View
2  sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/rls/ResourceLists.java
@@ -44,6 +44,8 @@ public Document getDocument() {
Document document = XmlFile.FACTORY.createDocument();
Element lists = document.addElement("lists", NAMESPACE);
Element imList = null;
+ // TIP : To avoid loading all users, can't this query
+ // use { "spdl" : { "$exists" : true } } instead? --Douglas
DBCursor cursor = m_validUsers.getUsers();
while (cursor.hasNext()) {
DBObject user = cursor.next();
View
43 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/vm/MailboxPreferences.java
@@ -11,11 +11,15 @@
import java.io.File;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import org.sipfoundry.sipxconfig.common.User;
public class MailboxPreferences {
+ public static final String EMPTY = "";
+
public static final String ACTIVE_GREETING = "voicemail/mailbox/active-greeting";
public static final String BUSY_PROMPT = "voicemail/mailbox/user-busy-prompt";
public static final String VOICEMAIL_TUI = "voicemail/mailbox/voicemail-tui";
@@ -37,6 +41,8 @@
public enum ActiveGreeting {
NONE("none"), STANDARD("standard"), OUT_OF_OFFICE("outofoffice"), EXTENDED_ABSENCE("extendedabsence");
+ private static final Set<String> IDS = new HashSet<String>();
+
private final String m_id;
ActiveGreeting(String id) {
@@ -47,6 +53,13 @@ public String getId() {
return m_id;
}
+ static {
+ for (ActiveGreeting e : ActiveGreeting.values()) {
+ IDS.add(e.getId());
+ }
+ IDS.add(EMPTY);
+ }
+
public static ActiveGreeting fromId(String id) {
for (ActiveGreeting greeting : ActiveGreeting.values()) {
if (greeting.getId().equals(id)) {
@@ -55,11 +68,17 @@ public static ActiveGreeting fromId(String id) {
}
return NONE;
}
+
+ public static boolean isValid(String s) {
+ return IDS.contains(s);
+ }
}
public enum AttachType {
NO("0"), YES("1")/* , IMAP("2") */;
+ private static final Set<String> VALUES = new HashSet<String>();
+
private String m_value;
AttachType(String value) {
@@ -70,6 +89,13 @@ public String getValue() {
return m_value;
}
+ static {
+ for (AttachType e : AttachType.values()) {
+ VALUES.add(e.getValue());
+ }
+ VALUES.add(EMPTY);
+ }
+
public static AttachType fromValue(String value) {
for (AttachType e : values()) {
if (e.m_value.equals(value)) {
@@ -78,6 +104,10 @@ public static AttachType fromValue(String value) {
}
return NO;
}
+
+ public static boolean isValid(String s) {
+ return VALUES.contains(s);
+ }
}
public enum VoicemailTuiType {
@@ -105,6 +135,19 @@ public static VoicemailTuiType fromValue(String value) {
public enum MailFormat {
FULL, MEDIUM, BRIEF;
+
+ private static final Set<String> VALUES = new HashSet<String>();
+
+ static {
+ for (MailFormat e : MailFormat.values()) {
+ VALUES.add(e.toString());
+ }
+ VALUES.add(EMPTY);
+ }
+
+ public static boolean isValid(String s) {
+ return VALUES.contains(s);
+ }
}
private ActiveGreeting m_activeGreeting = ActiveGreeting.NONE;
View
124 sipXconfig/neoconf/test/org/sipfoundry/sipxconfig/bulk/csv/CsvRowInserterTest.java
@@ -16,15 +16,18 @@
import junit.framework.TestCase;
import org.sipfoundry.sipxconfig.bulk.RowInserter;
+import org.sipfoundry.sipxconfig.bulk.RowInserter.RowStatus;
import org.sipfoundry.sipxconfig.common.CoreContext;
import org.sipfoundry.sipxconfig.common.User;
import org.sipfoundry.sipxconfig.device.ModelSource;
+import org.sipfoundry.sipxconfig.permission.PermissionManager;
import org.sipfoundry.sipxconfig.phone.Line;
import org.sipfoundry.sipxconfig.phone.Phone;
import org.sipfoundry.sipxconfig.phone.PhoneContext;
import org.sipfoundry.sipxconfig.phone.PhoneModel;
import org.sipfoundry.sipxconfig.phone.TestPhone;
import org.sipfoundry.sipxconfig.phone.TestPhoneModel;
+import org.sipfoundry.sipxconfig.test.TestHelper;
import org.sipfoundry.sipxconfig.vm.MailboxManager;
public class CsvRowInserterTest extends TestCase {
@@ -86,15 +89,20 @@ public void testUserDetailsFromRow() {
coreContext.loadUserByUserName("bongo");
expectLastCall().andReturn(bongo);
- replay(coreContext);
+ PermissionManager pm = createMock(PermissionManager.class);
+ pm.getPermissionModel();
+ expectLastCall().andReturn(TestHelper.loadSettings("commserver/user-settings.xml")).anyTimes();
+ bongo.setPermissionManager(pm);
+
+ replay(coreContext, pm);
String[] userRow1 = new String[] {
- "bongo", "1234","123", "abcdef", "", "Star", "","","","","","",""," im_id","Prof","Manager","user1122",
- "job title", "job dept", "company name", "assistant name",
- "001122", "112233", "223344", "33445566", "44556677", "alternate@gmail.com","alternateImId", "location",
- "home street", "home city", "home state", "home country", "34001",
- "office street", "office city", "office state", "office country", "34342", "office designation",
- "Twitter", "Linkedin", "Facebook", "Xing"
+ "bongo", "1234", "123", "abcdef", "", "Star", "", "", "", "", "", "", "", " im_id", "Prof", "Manager",
+ "user1122", "job title", "job dept", "company name", "assistant name", "001122", "112233", "223344",
+ "33445566", "44556677", "alternate@gmail.com", "alternateImId", "location", "home street", "home city",
+ "home state", "home country", "34001", "office street", "office city", "office state", "office country",
+ "34342", "office designation", "Twitter", "Linkedin", "Facebook", "Xing", "outofoffice", "1", "MEDIUM",
+ "true", "1", "BRIEF", "false", "true", "CallerID", "true", "", ""
};
CsvRowInserter impl = new CsvRowInserter();
@@ -137,6 +145,17 @@ public void testUserDetailsFromRow() {
assertEquals("Facebook", user1.getUserProfile().getFacebookName());
assertEquals("Xing", user1.getUserProfile().getXingName());
+ assertEquals("outofoffice", user1.getActiveGreeting());
+ assertEquals("1", user1.getPrimaryEmailNotification());
+ assertEquals("MEDIUM", user1.getPrimaryEmailFormat());
+ assertEquals(new Boolean(true), user1.isPrimaryEmailAttachAudio());
+ assertEquals("1", user1.getAlternateEmailNotification());
+ assertEquals("BRIEF", user1.getAlternateEmailFormat());
+ assertEquals(new Boolean(false), user1.isAlternateEmailAttachAudio());
+ assertEquals(new Boolean(true), user1.isVoicemailServer());
+ assertEquals("CallerID", user1.getExternalNumber());
+ assertEquals(new Boolean(true), user1.isAnonymousCallerAlias());
+
verify(coreContext);
}
@@ -150,44 +169,89 @@ public void testCheckRowData() {
String[] row = {
"kuku", "123", "777", "", "", "", "", "", "", "001122334466", "polycom300", "yellow phone", ""
};
- assertEquals(RowInserter.RowStatus.SUCCESS, impl.checkRowData(row));
+ assertEquals(RowStatus.SUCCESS, impl.checkRowData(row).getRowStatus());
+
String[] rowShort = {
"kuku", "", "", "", "", "", "", "", "", "001122334466", "polycom300", "yellow phone"
};
- assertEquals(RowInserter.RowStatus.SUCCESS, impl.checkRowData(rowShort));
+ assertEquals(RowStatus.SUCCESS, impl.checkRowData(rowShort).getRowStatus());
String[] rowAuthRealmMatch = {
"authMatch", "1234", "123", "", "", "", "", "", "", "001122334466",
"polycom300", "yellow phone", ""
};
- assertEquals(RowInserter.RowStatus.SUCCESS, impl.checkRowData(rowAuthRealmMatch));
+ assertEquals(RowStatus.SUCCESS, impl.checkRowData(rowAuthRealmMatch).getRowStatus());
String[] rowSuperadminhashpinsuccess = {
"superadmin", "12345678901234567890123456789012", "", "", "", "", "", "", "", "001122334466",
"polycom300", "yellow phone", ""
};
- assertEquals(RowInserter.RowStatus.SUCCESS, impl.checkRowData(rowSuperadminhashpinsuccess));
+ assertEquals(RowStatus.SUCCESS, impl.checkRowData(rowSuperadminhashpinsuccess).getRowStatus());
superadmin.setPintoken("49b45dc98f67624e117a86ea4c9dc0da");
String[] rowSuperadminclearpinsuccess = {
"superadmin", "1234", "444", "", "", "", "", "", "", "001122334466", "polycom300", "yellow phone", ""
};
- assertEquals(RowInserter.RowStatus.SUCCESS, impl.checkRowData(rowSuperadminclearpinsuccess));
+ assertEquals(RowStatus.SUCCESS, impl.checkRowData(rowSuperadminclearpinsuccess).getRowStatus());
//
// Changes made allow either username or serialnumber to be blank, not both.
//
row[Index.USERNAME.getValue()] = "";
- assertEquals(RowInserter.RowStatus.SUCCESS, impl.checkRowData(row));
+ assertEquals(RowInserter.RowStatus.SUCCESS, impl.checkRowData(row).getRowStatus());
row[Index.SERIAL_NUMBER.getValue()] = "";
- assertEquals(RowInserter.RowStatus.FAILURE, impl.checkRowData(row));
+ assertEquals(RowInserter.RowStatus.FAILURE, impl.checkRowData(row).getRowStatus());
row[Index.USERNAME.getValue()] = "kuku";
- assertEquals(RowInserter.RowStatus.SUCCESS, impl.checkRowData(row));
+ assertEquals(RowInserter.RowStatus.SUCCESS, impl.checkRowData(row).getRowStatus());
String[] rowWithInvalidUsername = {
"@200", "", "", "", "", "", "", "", "001122334466", "polycom300", "yellow phone", ""
};
- assertEquals(RowInserter.RowStatus.FAILURE, impl.checkRowData(rowWithInvalidUsername));
+ assertEquals(RowStatus.FAILURE, impl.checkRowData(rowWithInvalidUsername).getRowStatus());
+
+ String[] rowWithVMSettingsAndCallerId = {
+ "200", "", "", "", "", "", "", "", "0004f22f62ab", "polycom335", "Polycom Polycom335", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "outofoffice", "1", "MEDIUM", "true", "1", "BRIEF", "false", "true", "CallerID", "true", "",
+ ""
+ };
+ assertEquals(RowStatus.SUCCESS, impl.checkRowData(rowWithVMSettingsAndCallerId).getRowStatus());
+
+ String[] rowWithInvalidActiveGreeting = {
+ "200", "", "", "", "", "", "", "", "0004f22f62ab", "polycom335", "Polycom Polycom335", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "wrongGreetings", "1", "MEDIUM", "true", "1", "BRIEF", "false", "true", "JohnCallerID",
+ "true", "", ""
+ };
+ assertEquals(RowStatus.FAILURE, impl.checkRowData(rowWithInvalidActiveGreeting).getRowStatus());
+
+ String[] rowWithInvalidEmailNotification = {
+ "200", "", "", "", "", "", "", "", "0004f22f62ab", "polycom335", "Polycom Polycom335", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "outofoffice", "3", "MEDIUM", "true", "", "", "", "", "CallerID", "true", "", ""
+ };
+ assertEquals(RowStatus.FAILURE, impl.checkRowData(rowWithInvalidEmailNotification).getRowStatus());
+
+ String[] rowWithInvalidEmailFormat = {
+ "200", "", "", "", "", "", "", "", "0004f22f62ab", "polycom335", "Polycom Polycom335", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "outofoffice", "2", "WRONG", "true", "", "", "", "", "CallerID", "true", "", ""
+ };
+ assertEquals(RowStatus.FAILURE, impl.checkRowData(rowWithInvalidEmailFormat).getRowStatus());
+
+ String[] rowWithInvalidEmailAttachAudio = {
+ "200", "", "", "", "", "", "", "", "0004f22f62ab", "polycom335", "Polycom Polycom335", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "outofoffice", "2", "FULL", "wrong", "", "", "", "", "CallerID", "", "", ""
+ };
+ assertEquals(RowStatus.FAILURE, impl.checkRowData(rowWithInvalidEmailAttachAudio).getRowStatus());
+
+ String[] rowWithInvalidCallerID = {
+ "200", "", "", "", "", "", "", "", "0004f22f62ab", "polycom335", "Polycom Polycom335", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "outofoffice", "2", "FULL", "wrong", "", "", "", "", "wrong Caller ID", "", "", ""
+ };
+ assertEquals(RowStatus.FAILURE, impl.checkRowData(rowWithInvalidCallerID).getRowStatus());
}
public void testDataToString() {
@@ -313,34 +377,6 @@ public void testPhoneFromRowSpaces() {
verify(phoneContext, phoneModelSource);
}
- public void testUpdateMailboxPreferences() {
- User user = new User();
- user.setUserName("kuku");
-
- MailboxManager mailboxManager = createMock(MailboxManager.class);
-
- mailboxManager.isEnabled();
- expectLastCall().andReturn(true);
- mailboxManager.deleteMailbox("kuku");
-
- mailboxManager.isEnabled();
- expectLastCall().andReturn(true);
-
- mailboxManager.isEnabled();
- expectLastCall().andReturn(false);
- replay(mailboxManager);
-
- CsvRowInserter impl = new CsvRowInserter();
- impl.setMailboxManager(mailboxManager);
-
- impl.updateMailbox(user, true);
-
- impl.updateMailbox(user, false);
-
- impl.updateMailbox(user, true);
- verify(mailboxManager);
- }
-
public void testAddLine() {
CsvRowInserter impl = new CsvRowInserter();
Phone phone = new TestPhone();
View
7 sipXconfig/neoconf/test/org/sipfoundry/sipxconfig/bulk/ldap/LdapRowInserterTest.java
@@ -27,6 +27,7 @@
import org.easymock.EasyMock;
import org.easymock.IMocksControl;
import org.sipfoundry.sipxconfig.bulk.RowInserter;
+import org.sipfoundry.sipxconfig.bulk.RowInserter.RowStatus;
import org.sipfoundry.sipxconfig.bulk.csv.Index;
import org.sipfoundry.sipxconfig.common.CoreContext;
import org.sipfoundry.sipxconfig.common.User;
@@ -179,7 +180,7 @@ public void testCheckRowData() throws Exception {
control.andReturn(null);
control.replay();
m_rowInserter.setUserMapper(userMapper);
- assertEquals(RowInserter.RowStatus.FAILURE, m_rowInserter.checkRowData(searchResult));
+ assertEquals(RowStatus.FAILURE, m_rowInserter.checkRowData(searchResult).getRowStatus());
control.reset();
searchResult.getAttributes();
@@ -192,7 +193,7 @@ public void testCheckRowData() throws Exception {
control.andReturn(Collections.singleton(SALES));
control.replay();
m_rowInserter.setUserMapper(userMapper);
- assertEquals(RowInserter.RowStatus.FAILURE, m_rowInserter.checkRowData(searchResult));
+ assertEquals(RowStatus.FAILURE, m_rowInserter.checkRowData(searchResult).getRowStatus());
control.reset();
searchResult.getAttributes();
@@ -205,6 +206,6 @@ public void testCheckRowData() throws Exception {
control.andReturn(Collections.singleton(SALES));
control.replay();
m_rowInserter.setUserMapper(userMapper);
- assertEquals(RowInserter.RowStatus.SUCCESS, m_rowInserter.checkRowData(searchResult));
+ assertEquals(RowStatus.SUCCESS, m_rowInserter.checkRowData(searchResult).getRowStatus());
}
}
View
43 sipXconfig/neoconf/test/org/sipfoundry/sipxconfig/dialplan/AutoAttendantTestIntegration.java
@@ -13,6 +13,7 @@
import static org.junit.Assert.assertArrayEquals;
import java.util.Collections;
+import java.util.List;
import java.util.Map;
import org.sipfoundry.sipxconfig.common.DialPad;
@@ -39,7 +40,14 @@ public void testUpdate() throws Exception {
assertEquals(new Integer(1000), aa.getId());
}
- public void testSave() throws Exception {
+ public void testDupe() throws Exception {
+ loadDataSet("dialplan/seedAttendant.xml");
+ assertEquals(1, m_autoAttendantManager.getAutoAttendants().size());
+ m_autoAttendantManager.dupeAutoAttendants(Collections.singleton(1000));
+ assertEquals(2, m_autoAttendantManager.getAutoAttendants().size());
+ }
+
+ public void testSaveAndDupe() throws Exception {
AutoAttendant aa = m_autoAttendantManager.newAutoAttendantWithDefaultGroup();
aa.setName("test-aa");
aa.setDescription("aa description");
@@ -49,6 +57,14 @@ public void testSave() throws Exception {
menu.addMenuItem(DialPad.NUM_1, AttendantMenuAction.TRANSFER_OUT, "1234");
menu.addMenuItem(DialPad.NUM_5, AttendantMenuAction.OPERATOR);
aa.setMenu(menu);
+ aa.setSettingTypedValue(AutoAttendant.DTMF_INTERDIGIT_TIMEOUT, 4);
+ aa.setSettingTypedValue(AutoAttendant.MAX_DIGITS, 5);
+ aa.setSettingTypedValue(AutoAttendant.OVERALL_DIGIT_TIMEOUT, 6);
+ aa.setSettingTypedValue(AutoAttendant.ONFAIL_NOINPUT_COUNT, 4);
+ aa.setSettingTypedValue(AutoAttendant.ONFAIL_NOMATCH_COUNT, 8);
+ aa.setSettingTypedValue(AutoAttendant.ONFAIL_TRANSFER, true);
+ aa.setSettingTypedValue(AutoAttendant.ONFAIL_TRANSFER_EXT, "1001");
+ aa.setSettingTypedValue(AutoAttendant.ONFAIL_TRANSFER_PROMPT, "transfer.wav");
m_autoAttendantManager.storeAutoAttendant(aa);
flush();
@@ -62,6 +78,31 @@ public void testSave() throws Exception {
"attendant_menu_item as m where a.auto_attendant_id = m.auto_attendant_id order by dialpad_key",
actual);
assertArrayEquals(expected, actual.toArray());
+
+ m_autoAttendantManager.dupeAutoAttendants(Collections.singleton(aa.getId()));
+ List<AutoAttendant> autoAttendants = m_autoAttendantManager.getAutoAttendants();
+ assertEquals(2, autoAttendants.size());
+ for (AutoAttendant attendant : autoAttendants) {
+ if (attendant.getDescription().equals("autogenerated AA")) {
+ assertEquals("thankyou_goodbye.wav", attendant.getPrompt());
+ AttendantMenu aMenu = attendant.getMenu();
+ Map<DialPad, AttendantMenuItem> items = aMenu.getMenuItems();
+ AttendantMenuItem item1 = items.get(DialPad.NUM_1);
+ assertEquals("1234", item1.getParameter());
+ assertEquals("transfer_out", item1.getAction().getName());
+ AttendantMenuItem item2 = items.get(DialPad.NUM_5);
+ assertEquals(null, item2.getParameter());
+ assertEquals("operator", item2.getAction().getName());
+ assertEquals(4, attendant.getSettingTypedValue(AutoAttendant.DTMF_INTERDIGIT_TIMEOUT));
+ assertEquals(5, attendant.getSettingTypedValue(AutoAttendant.MAX_DIGITS));
+ assertEquals(6, attendant.getSettingTypedValue(AutoAttendant.OVERALL_DIGIT_TIMEOUT));
+ assertEquals(4, attendant.getSettingTypedValue(AutoAttendant.ONFAIL_NOINPUT_COUNT));
+ assertEquals(8, attendant.getSettingTypedValue(AutoAttendant.ONFAIL_NOMATCH_COUNT));
+ assertTrue((Boolean) attendant.getSettingTypedValue(AutoAttendant.ONFAIL_TRANSFER));
+ assertEquals("1001", attendant.getSettingTypedValue(AutoAttendant.ONFAIL_TRANSFER_EXT));
+ assertEquals("transfer.wav", attendant.getSettingTypedValue(AutoAttendant.ONFAIL_TRANSFER_PROMPT));
+ }
+ }
}
public void testDefaultAttendantGroup() throws Exception {
View
6 sipXconfig/neoconf/test/org/sipfoundry/sipxconfig/proxy/expected-proxy-config
@@ -20,12 +20,6 @@ SIPX_PROXY.400_authrules.IDENTITY_VALIDITY_SECONDS : 300
SIPX_PROXY.200_xfer.EXCHANGE_SERVER_FQDN :
SIPX_PROXY.200_xfer.ADDITIONAL_EXCHANGE_SERVER_FQDN :
SIPX_PROXY.210_msftxchghack.USERAGENT : ^RTCC/
-SIPX_PROXY_AUTOBAN_THRESHOLD_VIOLATORS : true
-SIPX_PROXY_PACKETS_PER_SECOND_THRESHOLD : 100
-SIPX_PROXY_THRESHOLD_VIOLATION_RATE : 50
-SIPX_PROXY_BAN_LIFETIME : 3600
-SIPX_PROXY_WHITE_LIST :
-SIPX_PROXY_BLACK_LIST :
SIPX_PROXY_HOST_NAME : sipx.example.org
SIPX_PROXY_HOST_ALIASES : 192.168.1.1:5060 sipx.example.org:5060
SIPX_PROXY_CALL_STATE_DB : ENABLE
View
1  sipXconfig/web/context/WEB-INF/backup/RestoreFinalize.html
@@ -1,5 +1,6 @@
<div jwcid="@common/Border" borderTitle="ognl:borderTitle">
<span jwcid="@common/ErrorMsg" validator="bean:validator" />
+ <span jwcid="@common/QuickHelp" value="message:quick.help"/>
<form jwcid="form@Form" delegate="bean:validator">
<fieldset jwcid="@setting/SettingsFieldset" settings="ognl:restoreSettings" renderGroupTitle="false"/>
<ul class="component-submit">
View
3  sipXconfig/web/context/WEB-INF/backup/RestoreFinalize.properties
@@ -3,3 +3,6 @@ confirm.restore=Are you sure you want to restore the selected backup(s)?
restore.success=Restore successful
error.passwordsRequired=If you enabled Decode PINs option both Reset Voicemail \
PINs and Reset passwords values are required.
+quick.help=<b><span style="font-size:14px">If the 'superadmin' password is not correctly decrypted during the restore, you can use <br/>\
+ 'service sipxconfig reset-admin' to reset it.<br/>\
+ You can then log in to the Admin GUI with no password and set a new password.</span></b>
View
3  sipXconfig/web/context/WEB-INF/dialplan/ManageAttendants.html
@@ -40,6 +40,9 @@
value="message:button.delete" listener="listener:deleteSelected"/>
<span jwcid="@common/Confirm" component="component:deleteButton" prompt="message:confirm.delete"/>
</li>
+ <li>
+ <input jwcid="dupeButton@Submit" id="list:attendant:dupe" listener="listener:dupeSelected" value="message:button.dupe"/>
+ </li>
</ul>
</form>
</div>
View
1  sipXconfig/web/context/WEB-INF/dialplan/ManageAttendants.properties
@@ -12,5 +12,6 @@ help.attendantConfig=Auto Attendants can be nested. Per auto-attendant there is
followed by a dialpad entry. Nesting is possible by selecting "Auto Attendant" as an action.
tab.manage=Auto Attendants
tab.special=Special Mode
+button.dupe=Duplicate
help.attendantSpecial=Use special auto attendant to temporarily overwrite the auto attendant configuration.<br>By default the auto \
attendant is selected based on the auto attendant dialing rules. If the special auto attendant is activated it is used to handle all calls.
View
8 sipXconfig/web/src/org/sipfoundry/sipxconfig/site/dialplan/ManageAttendants.java
@@ -58,6 +58,14 @@ public void deleteSelected() {
}
}
+ public void dupeSelected() {
+ Collection selectedRows = getSelections().getAllSelected();
+ if (selectedRows != null) {
+ AutoAttendantManager manager = getAutoAttendantManager();
+ manager.dupeAutoAttendants(selectedRows);
+ }
+ }
+
public IPage edit(Integer id) {
EditAutoAttendant page = getEditPage();
AutoAttendant attendant = getAutoAttendantManager().getAutoAttendant(id);
View
1  sipXivr/bin/voicemail_clean.in
@@ -71,6 +71,7 @@ then
fi
done
+ [ -f "@SIPX_BINDIR@/additional-voicemail-cleanup" ] && . @SIPX_BINDIR@/additional-voicemail-cleanup ${DAYS}
else
echo "Mailstore '${MAILSTORE_DIR}' not found" 1>&2
exit 1
View
3  sipXmediaLib/include/rtcp/RTCPTimer.h
@@ -25,7 +25,6 @@
#ifdef __pingtel_on_posix__
#include "os/OsTime.h"
#include "os/OsCallback.h"
-#include "os/OsTimer.h"
#endif
@@ -33,6 +32,8 @@
#define MILLI2SECS 1000
#define MILLI2NANO 1000000
+class OsTimer;
+
/**
*
* Class Name: CRTCPTimer
View
1  sipXmediaLib/src/rtcp/RTCPTimer.cpp
@@ -13,6 +13,7 @@
#include <process.h>
#endif
+#include <os/OsTimer.h>
#include "rtcp/RTCPTimer.h"
#ifdef INCLUDE_RTCP /* [ */
View
6 sipXpark/src/main.cpp
@@ -17,6 +17,7 @@
#include <os/OsLogger.h>
#include <os/OsConfigDb.h>
#include <os/UnixSignals.h>
+#include <os/OsTimer.h>
#include <net/NameValueTokenizer.h>
#include <net/SipPublishContentMgr.h>
#include <persist/SipPersistentSubscriptionMgr.h>
@@ -671,6 +672,11 @@ int main(int argc, char* argv[])
}
+ //
+ // Terminate the timer thread
+ //
+ OsTimer::terminateTimerService();
+
// Flush the log file
Os::Logger::instance().flush();
View
3  sipXportLib/include/Makefile.am
@@ -86,15 +86,12 @@ nobase_include_HEADERS = \
os/OsTime.h \
os/OsTimeLog.h \
os/OsTimer.h \
- os/OsTimerMsg.h \
- os/OsTimerTask.h \
os/OsTokenizer.h \
os/ostream \
os/OsUnLock.h \
os/OsUtil.h \
os/OsWriteLock.h \
os/shared/OsMsgQShared.h \
- os/shared/OsTimerMessage.h \
os/OsStunAgentTask.h \
os/OsStunQueryAgent.h \
os/OsStunDatagramSocket.h \
View
338 sipXportLib/include/os/OsTimer.h
@@ -22,7 +22,12 @@
#include "os/OsStatus.h"
#include "os/OsTime.h"
#include "utl/UtlContainableAtomic.h"
-
+#include <boost/function.hpp>
+#include <boost/bind.hpp>
+#include <boost/asio.hpp>
+#include <boost/thread.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/system/error_code.hpp>
// DEFINES
@@ -51,21 +56,16 @@
* A timer may be stopped at any time (except when the timer is being
* destroyed). The destructor calls stop() before freeing the timer.
*
- * If the stop() is synchronous, it may block, but it ensures that any
- * event routine call will have finished before stop() returns. If
- * the stop() is asynchronous, it will not block, but an event routine
+ * stop() is asynchronous, it will not block, but an event routine
* execution that has been previously committed may execute after stop()
- * returns. (For one-shot timers, this can be detected by examining the
- * return value of stop().)
+ * returns.
*
* Once a timer is stopped with stop() or by firing (if it is a one-shot
* timer), it can be started again. The time interval of a timer can be
* changed every time it is started, but its notification information is
* fixed when it is created.
*
- * All methods can be used concurrently, except that no other method may be
- * called concurrently with the destructor (which cannot be made to work,
- * as the destructor deletes the timer's memory). Note that a timer may
+ * All methods can be used concurrently. Note that a timer may
* fire while it is being deleted; the destructor handles this situation
* correctly, the timer is guaranteed to exist until after the event
* routine returns.
@@ -77,51 +77,33 @@
* the event routine of a periodic timer is entered, the timer is
* still in the running state.
*
- * (If mbManagedNotifier is set, the timer may not be destroyed (using
- * deleteAsync, which is non-blocking), as that destroys the
- * OsNotifier object whose method is the event notifier that is
- * currently running. But there is no current interface for creating
- * that situation.)
- *
- * Most methods are non-blocking, except to seize the timer's mutex
- * and to post messages to the timer task's message queue. The
- * exceptions are the destructor and synchronous stops, which must
- * block until they get a response from the timer task.
- *
- * If VALGRIND_TIMER_ERROR is defined, additional code is created to
- * detect and backtrace errors in timer usage. This code causes run-time
- * errors that Valgrind can detect to produce backtraces of where the
- * invalid method invocations were made.
- *
- * If NDEBUG is defined, some checking code that is used only to trigger
- * asserts is omitted. (To prevent chaos when different libraries are
- * compiled with different options, defining NDEBUG does *not* change
- * the members of the objects.)
*
* @nosubgrouping
*/
class OsTimer : public UtlContainableAtomic
{
- friend class OsTimerTask;
friend class OsTimerTest;
/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:
- /// The states a timer can be in.
- enum OsTimerState
- {
- STOPPED, /**< timer has not been started, or has fired
- * or been stopped.
- */
- STARTED ///< timer is running and will fire.
- };
+ /// The states a timer can be in.
+ enum OsTimerState
+ {
+ STOPPED, /**< timer has not been started, or has fired
+ * or been stopped.
+ */
+ STARTED ///< timer is running and will fire.
+ };
/// type for absolute time in microseconds since the epoch
typedef Int64 Time;
/// type for time interval in microseconds
typedef Int64 Interval;
+ /// type for timer boost function callback
+ typedef boost::function<void(OsTimer&, boost::system::error_code)> Handler;
+
/* ============================ CREATORS ================================== */
/** @name Constructors
@@ -166,18 +148,17 @@ class OsTimer : public UtlContainableAtomic
* (The copy is made using pMsg->createCopy().)
*/
+ OsTimer(const Handler& handler);
+ /// This constructor accepts a handler function instead of message queue.
+ /// One must take caution in using this facility to make sure that the handler
+ /// function will not block becuase it is directly called from the
+ /// io_service thread;
+
/// @}
/// Destructor
virtual ~OsTimer();
- /// Non-blocking asynchronous delete operation
- static void deleteAsync(OsTimer* timer);
- /**<
- * Stops the timer, then sends a message to the timer task, which will
- * eventually delete it. Provides a non-blocking way to delete an
- * OsTimer.
- */
/* ============================ MANIPULATORS ============================== */
@@ -193,21 +174,34 @@ class OsTimer : public UtlContainableAtomic
*/
/// Start the timer to fire once at the indicated date/time
- virtual OsStatus oneshotAt(const OsDateTime& when);
+ OsStatus oneshotAt(const OsDateTime& when);
/// Start the timer to fire once at the current time + offset
- virtual OsStatus oneshotAfter(const OsTime& offset);
+ OsStatus oneshotAfter(const OsTime& offset);
+
/// Start the timer to fire periodically starting at the indicated date/time
- virtual OsStatus periodicAt(const OsDateTime& when, OsTime period);
+ OsStatus periodicAt(const OsDateTime& when, OsTime period);
+
+ /// Start the timer to fire periodically starting at current time + offset
+ OsStatus periodicEvery(OsTime offset, OsTime period);
+
+ /// Start the timer to fire once at the current time + offset
+ OsStatus oneshotAfter(const boost::asio::deadline_timer::duration_type& offset);
/// Start the timer to fire periodically starting at current time + offset
- virtual OsStatus periodicEvery(OsTime offset, OsTime period);
+ OsStatus periodicEvery(const boost::asio::deadline_timer::duration_type& offset,
+ const boost::asio::deadline_timer::duration_type& period);
+
+ /// Perform a blocking wait on the timer.
+ /// Returns error code if any.
+ static boost::system::error_code wait(const boost::asio::deadline_timer::duration_type& offset);
+
/// @}
/// Stop the timer if it has been started
- virtual OsStatus stop(UtlBoolean synchronous = TRUE);
+ OsStatus stop(UtlBoolean synchronous = TRUE);
/**<
* stop() can be called when the timer is in any state, and returns a
* value that reflects that state:
@@ -222,32 +216,30 @@ class OsTimer : public UtlContainableAtomic
* will return OS_SUCCESS. This allows the caller of stop() to know
* whether to clean up or not.
*
- * If synchronous is TRUE, the call will block if necessary to
- * ensure that any event routine execution for this timer will
- * finish before stop() returns. If synchronous is FALSE, the call
- * will not block, but a previously committed event routine
- * execution may happen after stop() returns.
+ * All calls to stop are synchronous. The synchronous flag is no longer
+ * used after migration to boost deadline timer.
+ *
*/
/* ============================ ACCESSORS ================================= */
/// Return the OsNotification object for this timer
- virtual OsNotification* getNotifier(void) const;
+ OsNotification* getNotifier(void) const;
/**<
* If the timer was constructed with OsTimer(OsMsgQ*, const int),
* it returns the address of an internally allocated OsNotification.
*/
/// Get the userData value of a timer constructed with OsTimer(OsMsgQ*, int).
- virtual void* getUserData();
+ void* getUserData();
/// Get the ContainableType for a UtlContainable derived class.
- virtual UtlContainableType getContainableType() const;
+ UtlContainableType getContainableType() const;
/* ============================ INQUIRY =================================== */
/// Compare the this object to another like-object.
- virtual int compareTo(UtlContainable const *) const;
+ int compareTo(UtlContainable const *) const;
/**
* Results for comparing with a non-like object are undefined.
*
@@ -255,10 +247,10 @@ class OsTimer : public UtlContainableAtomic
*/
/// Return the state value for this OsTimer object
- virtual OsTimerState getState(void);
+ OsTimerState getState(void);
/// Return all the state information for this OsTimer object.
- virtual void getFullState(enum OsTimerState& state,
+ void getFullState(enum OsTimerState& state,
Time& expiresAt,
UtlBoolean& periodic,
Interval& period);
@@ -266,53 +258,18 @@ class OsTimer : public UtlContainableAtomic
/// Get the current time as a Time.
static Time now();
+ /// Terminate the internal timer service thread and cancel all existing timers.
+ /// This is normally called prior to program termination.
+ /// If the timer service is terminated, it cannot be restarted.
+ static void terminateTimerService();
+
/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:
static const UtlContainableType TYPE;
/**< Class type used for runtime checking */
- OsBSem mBSem; //< semaphore to lock access to members
-
- unsigned int mApplicationState;
- //< state as seen by application methods
- unsigned int mTaskState; //< state as seen by the timer task
- UtlBoolean mDeleting; //< TRUE if timer is being deleted
- UtlBoolean mProcessingInProgress; //< TRUE if OsTimerTask is currently processing a message related to this timer
- OsNotification* mpNotifier; //< used to signal timer expiration event
- UtlBoolean mbManagedNotifier;
- /**< TRUE if OsTimer destructor
- * should delete *mpNotifier
- */
-