From 45d4b7bbfdc754fb1c02a0f1e51aed8040ea07d5 Mon Sep 17 00:00:00 2001 From: dizzy Date: Thu, 14 Apr 2016 15:05:18 +0300 Subject: [PATCH 1/3] SIPX-470: Live Attendant not updated in Mongo properly - fix contact replication --- .../sipfoundry/sipxconfig/dialplan/AttendantRule.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/dialplan/AttendantRule.java b/sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/dialplan/AttendantRule.java index 3f57ae0366..de1cb08ebd 100644 --- a/sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/dialplan/AttendantRule.java +++ b/sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/dialplan/AttendantRule.java @@ -184,6 +184,7 @@ public boolean isLiveAttendant() { public void setLiveAttendant(boolean liveAttendant) { m_liveAttendant = liveAttendant; + m_liveAttendantEnabled = liveAttendant; } public String getLiveAttendantExtension() { @@ -224,6 +225,7 @@ public boolean isLiveAttendantEnabled() { public void setLiveAttendantEnabled(boolean enable) { m_liveAttendantEnabled = enable; + m_liveAttendant = enable; } public Date getLiveAttendantExpire() { @@ -321,12 +323,11 @@ public Collection getAliasMappings(String domainName) { AliasMapping liveAttendantAlias = new AliasMapping(getExtension(), liveContact, ALIAS_RELATION); AliasMapping attendantAlias = new AliasMapping(getExtension(), String.format(ATTENDANT_CONTACT, getAttendantIdentity(), domainName), ALIAS_RELATION); - if (isLiveAttendantEnabled()) { - mappings.add(liveAttendantAlias); - } + if (isLiveAttendant()) { - mappings.add(attendantAlias); + mappings.add(liveAttendantAlias); } + mappings.add(attendantAlias); String[] aliases = getAttendantAliasesAsArray(getAttendantAliases()); if (!StringUtils.isEmpty(m_did)) { @@ -373,6 +374,6 @@ public String getEntityName() { */ @Override public boolean isReplicationEnabled() { - return isEnabled(); + return isEnabled() && isLiveAttendant(); } } From 9bf38cb2ae0095a836b4bbeb4ebf45b261469415 Mon Sep 17 00:00:00 2001 From: Mircea Carasel Date: Tue, 8 Mar 2016 14:55:38 +0200 Subject: [PATCH 2/3] SIPX-438: REST API bug -fix phone line rest api --- .../sipxconfig/api/impl/PhoneLineApiImpl.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/api/impl/PhoneLineApiImpl.java b/sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/api/impl/PhoneLineApiImpl.java index bb21594f93..55a7aae30f 100644 --- a/sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/api/impl/PhoneLineApiImpl.java +++ b/sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/api/impl/PhoneLineApiImpl.java @@ -14,8 +14,7 @@ */ package org.sipfoundry.sipxconfig.api.impl; -import java.util.Collection; -import java.util.List; +import java.util.Collections; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.Response; @@ -58,14 +57,14 @@ public Response newLine(String phoneId, LineBean lineBean) { if (phone == null) { return Response.status(Status.NOT_FOUND).entity(PHONE_NOT_FOUND).build(); } - Line line = phone.createLine(); if (lineBean.getUser() != null) { User user = m_coreContext.loadUserByUserNameOrAlias(lineBean.getUser()); if (user == null) { return Response.status(Status.NOT_FOUND).entity("User not found").build(); } - line.setUser(user); + m_phoneContext.addUsersToPhone(phone.getId(), Collections.singleton(user.getId())); } else { + Line line = phone.createLine(); LineInfo lineInfo = new LineInfo(); lineInfo.setUserId(lineBean.getUserId()); lineInfo.setDisplayName(lineBean.getDisplayName()); @@ -75,9 +74,9 @@ public Response newLine(String phoneId, LineBean lineBean) { lineInfo.setRegistrationServerPort(lineBean.getRegistrationServerPort()); lineInfo.setVoiceMail(lineBean.getVoicemail()); line.setLineInfo(lineInfo); + phone.addLine(line); + m_phoneContext.storePhone(phone); } - phone.addLine(line); - m_phoneContext.storePhone(phone); return Response.ok().build(); } @@ -105,8 +104,7 @@ public Response deletePhoneLine(String phoneId, Integer lineId) { Phone phone = getPhoneByIdOrMac(phoneId); if (phone != null) { if (line != null) { - Collection lines = DataCollectionUtil.removeByPrimaryKey(phone.getLines(), lineId); - phone.setLines((List) lines); + DataCollectionUtil.removeByPrimaryKey(phone.getLines(), line.getId()); m_phoneContext.storePhone(phone); return Response.ok().build(); } From 93ef169bd2fcc9eceb8340dc678017d2791e23a3 Mon Sep 17 00:00:00 2001 From: Andrei Vilcu Date: Fri, 22 Apr 2016 10:39:42 +0300 Subject: [PATCH 3/3] UC-3901 Restore operation of 15.10 backup configuration to 15.12 fails do not fail restore if elasticsearch archive not found in archive --- sipXconfig/bin/sipxconfig_archive.rb.in | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sipXconfig/bin/sipxconfig_archive.rb.in b/sipXconfig/bin/sipxconfig_archive.rb.in index 8d64c4aa41..a2980254f0 100644 --- a/sipXconfig/bin/sipxconfig_archive.rb.in +++ b/sipXconfig/bin/sipxconfig_archive.rb.in @@ -131,7 +131,7 @@ class Restore < ArchiveBase v = File.read("#{@tmpdir}/version").split(".") dev = (v[0].to_i == '0'.to_i and v[1].to_i == '0'.to_i) pre_mongo = !(dev or (v[0].to_i == '4'.to_i and v[1].to_i > '4'.to_i) or v[0].to_i > '4'.to_i or v[0].to_i >= '14'.to_i) - pre_elasticsearch = !(dev or (v[0].to_i >= '15'.to_i and v[1].to_i >= '10'.to_i)) + pre_elasticsearch = !(dev or (v[0].to_i >= '15'.to_i and v[1].to_i >= '10'.to_i) or (v[0].to_i >= '16'.to_i)) else raise "Not a known archive, version file is missing." end @@ -179,13 +179,13 @@ class Restore < ArchiveBase elasticsearch_started = cmd "service elasticsearch status" if (!pre_elasticsearch and elasticsearch_started) cmd "tar -zxvf #{params[:file]} -C / elasticsearch_backup" or - raise "Failed to extract elasticsearch backup from archive" + cmd "echo Failed to extract elasticsearch backup from archive" cmd "curl -XPUT 'http://localhost:9200/_snapshot/sipXcom_backup?wait_for_completion=true' -d '{ \"type\": \"fs\", \"settings\": { \"location\": \"#{@tmpdir}/elasticsearch_backup/\", \"compress\": true }}'" or - raise "Could not create elasticsearch snapshot repository" + cmd "echo Could not create elasticsearch snapshot repository" cmd "curl -XDELETE 'http://localhost:9200/audit?wait_for_completion=true'" or - raise "Failed to remove old audit index" + cmd "echo Failed to remove old audit index" cmd "curl -XPOST 'http://localhost:9200/_snapshot/sipXcom_backup/elasticsearch_backup/_restore?wait_for_completion=true'" or - raise "Failed to restore elasticsearch snapshot" + cmd "echo Failed to restore elasticsearch snapshot" end if params.has_key?(:reset_password)