summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/call_forward.js61
-rw-r--r--app/controllers/api/v1/pager_groups_controller.rb39
-rw-r--r--app/controllers/api/v1/phone_numbers_controller.rb23
-rw-r--r--app/controllers/api/v1/sip_accounts_controller.rb23
-rw-r--r--app/controllers/api/v1/switchboard_entries_controller.rb23
-rw-r--r--app/controllers/api/v1/switchboards_controller.rb21
-rw-r--r--app/controllers/call_forwards_controller.rb104
-rw-r--r--app/controllers/call_histories_controller.rb33
-rw-r--r--app/controllers/call_routes_controller.rb4
-rw-r--r--app/controllers/config_siemens_controller.rb13
-rw-r--r--app/controllers/config_snom_controller.rb105
-rw-r--r--app/controllers/fax_accounts_controller.rb5
-rw-r--r--app/controllers/gateway_parameters_controller.rb13
-rw-r--r--app/controllers/gateway_settings_controller.rb13
-rw-r--r--app/controllers/gemeinschaft_setups_controller.rb16
-rw-r--r--app/controllers/generic_files_controller.rb87
-rw-r--r--app/controllers/pager_group_destinations_controller.rb41
-rw-r--r--app/controllers/pager_groups_controller.rb43
-rw-r--r--app/controllers/phones_controller.rb21
-rw-r--r--app/controllers/sip_accounts_controller.rb32
-rw-r--r--app/controllers/switchboards_controller.rb6
-rw-r--r--app/controllers/trigger_controller.rb55
-rw-r--r--app/controllers/users_controller.rb20
-rw-r--r--app/controllers/voicemail_accounts_controller.rb100
-rw-r--r--app/controllers/voicemail_messages_controller.rb77
-rw-r--r--app/controllers/voicemail_settings_controller.rb96
-rw-r--r--app/helpers/application_helper.rb18
-rw-r--r--app/helpers/generic_files_helper.rb2
-rw-r--r--app/helpers/pager_group_destinations_helper.rb2
-rw-r--r--app/helpers/pager_groups_helper.rb2
-rw-r--r--app/helpers/voicemail_accounts_helper.rb2
-rw-r--r--app/mailers/notifications.rb15
-rw-r--r--app/models/ability.rb5
-rw-r--r--app/models/backup_job.rb2
-rw-r--r--app/models/call.rb21
-rw-r--r--app/models/call_forward.rb32
-rw-r--r--app/models/call_history.rb19
-rw-r--r--app/models/call_route.rb66
-rw-r--r--app/models/fax_account.rb1
-rw-r--r--app/models/gateway.rb10
-rw-r--r--app/models/gateway_setting.rb4
-rw-r--r--app/models/gemeinschaft_setup.rb22
-rw-r--r--app/models/generic_file.rb62
-rw-r--r--app/models/geo_ip_country.rb16
-rw-r--r--app/models/group.rb8
-rw-r--r--app/models/group_permission.rb2
-rw-r--r--app/models/gs_parameter.rb37
-rw-r--r--app/models/intruder.rb4
-rw-r--r--app/models/pager_group.rb36
-rw-r--r--app/models/pager_group_destination.rb15
-rw-r--r--app/models/phone_book_entry.rb2
-rw-r--r--app/models/phone_number.rb41
-rw-r--r--app/models/sip_account.rb31
-rw-r--r--app/models/softkey.rb5
-rw-r--r--app/models/switchboard.rb32
-rw-r--r--app/models/switchboard_entry.rb35
-rw-r--r--app/models/tenant.rb12
-rw-r--r--app/models/user.rb4
-rw-r--r--app/models/voicemail_account.rb64
-rw-r--r--app/models/voicemail_message.rb42
-rw-r--r--app/models/voicemail_setting.rb71
-rw-r--r--app/serializers/call_serializer.rb6
-rw-r--r--app/serializers/pager_group_destination_serializer.rb3
-rw-r--r--app/serializers/pager_group_serializer.rb7
-rw-r--r--app/serializers/phone_number_serializer.rb3
-rw-r--r--app/serializers/sip_account_serializer.rb7
-rw-r--r--app/serializers/switchboard_entry_serializer.rb14
-rw-r--r--app/serializers/switchboard_serializer.rb9
-rw-r--r--app/uploaders/generic_file_uploader.rb18
-rw-r--r--app/views/call_forwards/_form_core.html.haml13
-rw-r--r--app/views/call_forwards/_index_core.html.haml2
-rw-r--r--app/views/call_forwards/show.html.haml2
-rw-r--r--app/views/call_histories/_index_core.html.haml174
-rw-r--r--app/views/call_histories/_navigation.html.haml27
-rw-r--r--app/views/call_routes/_form_core.html.haml7
-rw-r--r--app/views/call_routes/test.html.haml23
-rw-r--r--app/views/config_snom/show.xml.haml5
-rw-r--r--app/views/config_snom/state_settings.xml.haml47
-rw-r--r--app/views/gateway_parameters/show.html.haml2
-rw-r--r--app/views/gateway_settings/_form_core.html.haml2
-rw-r--r--app/views/gateway_settings/_index_core.html.haml8
-rw-r--r--app/views/gateway_settings/show.html.haml2
-rw-r--r--app/views/gemeinschaft_setups/new.de.html.haml6
-rw-r--r--app/views/gemeinschaft_setups/new.html.haml6
-rw-r--r--app/views/generic_files/_form.html.haml7
-rw-r--r--app/views/generic_files/_form_core.html.haml7
-rw-r--r--app/views/generic_files/_index_core.html.haml20
-rw-r--r--app/views/generic_files/edit.html.haml3
-rw-r--r--app/views/generic_files/index.html.haml6
-rw-r--r--app/views/generic_files/new.html.haml3
-rw-r--r--app/views/generic_files/show.html.haml25
-rw-r--r--app/views/group_permissions/show.html.haml4
-rw-r--r--app/views/intruders/_index_core.html.haml2
-rw-r--r--app/views/intruders/show.html.haml3
-rw-r--r--app/views/layouts/_navbar.html.haml9
-rw-r--r--app/views/notifications/new_voicemail.text.erb2
-rw-r--r--app/views/pager_group_destinations/_form.html.haml7
-rw-r--r--app/views/pager_group_destinations/_form_core.html.haml3
-rw-r--r--app/views/pager_group_destinations/_index_core.html.haml11
-rw-r--r--app/views/pager_group_destinations/edit.html.haml3
-rw-r--r--app/views/pager_group_destinations/index.html.haml6
-rw-r--r--app/views/pager_group_destinations/new.html.haml3
-rw-r--r--app/views/pager_group_destinations/show.html.haml10
-rw-r--r--app/views/pager_groups/_form.html.haml7
-rw-r--r--app/views/pager_groups/_form_core.html.haml3
-rw-r--r--app/views/pager_groups/_index_core.html.haml11
-rw-r--r--app/views/pager_groups/edit.html.haml3
-rw-r--r--app/views/pager_groups/index.html.haml6
-rw-r--r--app/views/pager_groups/new.html.haml3
-rw-r--r--app/views/pager_groups/show.html.haml10
-rw-r--r--app/views/phones/_index_core.html.haml16
-rw-r--r--app/views/phones/index.html.haml2
-rw-r--r--app/views/sip_accounts/_form_core.html.haml2
-rw-r--r--app/views/sip_accounts/_index_core.html.haml11
-rw-r--r--app/views/sip_accounts/index.html.haml2
-rw-r--r--app/views/sip_accounts/show.html.haml5
-rw-r--r--app/views/switchboards/_form_core.html.haml4
-rw-r--r--app/views/switchboards/show-old.html.haml (renamed from app/views/switchboards/show.html.haml)0
-rw-r--r--app/views/switchboards/show.html.erb79
-rw-r--r--app/views/tenants/_admin_area.de.html.haml6
-rw-r--r--app/views/tenants/_admin_area.en.html.haml9
-rw-r--r--app/views/tenants/_generic_files.html.haml5
-rw-r--r--app/views/tenants/_table_of_groups.html.haml8
-rw-r--r--app/views/tenants/_table_of_phones.html.haml12
-rw-r--r--app/views/tenants/_table_of_sip_accounts.html.haml12
-rw-r--r--app/views/tenants/_table_of_voicemail_accounts.html.haml8
-rw-r--r--app/views/tenants/_users_table.html.haml2
-rw-r--r--app/views/users/_generic_files.html.haml7
-rw-r--r--app/views/users/_index_core.html.haml14
-rw-r--r--app/views/users/_voicemail_accounts.html.haml7
-rw-r--r--app/views/users/show.html.haml15
-rw-r--r--app/views/voicemail_accounts/_form.html.haml7
-rw-r--r--app/views/voicemail_accounts/_form_core.html.haml3
-rw-r--r--app/views/voicemail_accounts/_index_core.html.haml18
-rw-r--r--app/views/voicemail_accounts/edit.html.haml3
-rw-r--r--app/views/voicemail_accounts/index.html.haml6
-rw-r--r--app/views/voicemail_accounts/new.html.haml3
-rw-r--r--app/views/voicemail_accounts/show.html.haml16
-rw-r--r--app/views/voicemail_messages/_index_core.html.haml118
-rw-r--r--app/views/voicemail_messages/_navigation.html.haml11
-rw-r--r--app/views/voicemail_settings/_edit_form.html.haml8
-rw-r--r--app/views/voicemail_settings/_edit_form_core.html.haml2
-rw-r--r--app/views/voicemail_settings/_form.html.haml3
-rw-r--r--app/views/voicemail_settings/_form_core.html.haml14
-rw-r--r--app/views/voicemail_settings/_index_core.html.haml14
-rw-r--r--app/views/voicemail_settings/edit.html.haml2
-rw-r--r--app/views/voicemail_settings/index.html.haml6
-rw-r--r--app/views/voicemail_settings/new.html.haml3
-rw-r--r--app/views/voicemail_settings/show.html.haml30
149 files changed, 2395 insertions, 484 deletions
diff --git a/app/assets/javascripts/call_forward.js b/app/assets/javascripts/call_forward.js
new file mode 100644
index 0000000..13c5679
--- /dev/null
+++ b/app/assets/javascripts/call_forward.js
@@ -0,0 +1,61 @@
+ $(document).ready(function(){
+ if($('#call_forward_call_forward_case_id').val() != "3"){
+ $("#timeout_div").css('display','none');
+ }
+ else{
+ $("#timeout_div").css('display','block');
+ }
+ $('#call_forward_call_forward_case_id').change(function(){
+ if($(this).val() != "3"){
+ $("#timeout_div").css('display','none');
+ }
+ else{
+ $("#timeout_div").css('display','block');
+ }
+ })
+
+ var voicemail_pattern = /VoicemailAccount$/;
+
+ if($('#call_forward_call_forwarding_destination').val()) {
+
+ if($('#call_forward_call_forwarding_destination').val() == ":PhoneNumber"){
+ $("#destination_phone_number").attr('name', 'call_forward[destination]');
+ $("#destination_greeting").attr('name', 'disabled');
+ $("#destination_phone_number_div").css('display','block');
+ $("#destination_greeting_div").css('display','none');
+
+ }
+ else if ($('#call_forward_call_forwarding_destination').val().match(voicemail_pattern)){
+ $("#destination_phone_number").attr('name', 'disabled');
+ $("#destination_greeting").attr('name', 'call_forward[destination]');
+ $("#destination_phone_number_div").css('display','none');
+ $("#destination_greeting_div").css('display','block');
+ }
+ else {
+ $("#destination_phone_number").attr('name', 'disabled');
+ $("#destination_greeting").attr('name', 'disabled');
+ $("#destination_phone_number_div").css('display','none');
+ $("#destination_greeting_div").css('display','none');
+ }
+ $('#call_forward_call_forwarding_destination').change(function(){
+ if($(this).val() == ":PhoneNumber"){
+ $("#destination_phone_number").attr('name', 'call_forward[destination]');
+ $("#destination_greeting").attr('name', 'disabled');
+ $("#destination_phone_number_div").css('display','block');
+ $("#destination_greeting_div").css('display','none');
+ }
+ else if ($('#call_forward_call_forwarding_destination').val().match(voicemail_pattern)){
+ $("#destination_phone_number").attr('name', 'disabled');
+ $("#destination_greeting").attr('name', 'call_forward[destination]');
+ $("#destination_phone_number_div").css('display','none');
+ $("#destination_greeting_div").css('display','block');
+ }
+ else{
+ $("#destination_phone_number").attr('name', 'disabled');
+ $("#destination_greeting").attr('name', 'disabled');
+ $("#destination_phone_number_div").css('display','none');
+ $("#destination_greeting_div").css('display','none');
+ }
+ })
+ }
+ });
diff --git a/app/controllers/api/v1/pager_groups_controller.rb b/app/controllers/api/v1/pager_groups_controller.rb
new file mode 100644
index 0000000..753e938
--- /dev/null
+++ b/app/controllers/api/v1/pager_groups_controller.rb
@@ -0,0 +1,39 @@
+module Api
+ module V1
+ class PagerGroupsController < ApplicationController
+ skip_before_filter :verify_authenticity_token
+ respond_to :json
+
+ def index
+ @pager_groups = PagerGroup.all
+ respond_with @pager_groups
+ end
+
+ def show
+ @pager_group = PagerGroup.find(params[:id])
+ respond_with @pager_group
+ end
+
+ def new
+ if params[:sip_account_id] && SipAccount.find(params[:sip_account_id])
+ @pager_group = SipAccount.find(params[:sip_account_id]).pager_groups.new
+ @pager_group.callback_url = params[:callback_url]
+ @pager_group.pager_group_destination_ids = params[:pager_group_destination_ids]
+ if @pager_group.save
+ respond_with @pager_group
+ end
+ end
+
+ end
+
+ def destroy
+ @pager_group = PagerGroup.find(params[:id])
+ if @pager_group
+ @pager_group.destroy
+ respond_with @pager_group
+ end
+ end
+
+ end
+ end
+end
diff --git a/app/controllers/api/v1/phone_numbers_controller.rb b/app/controllers/api/v1/phone_numbers_controller.rb
new file mode 100644
index 0000000..ff58fd3
--- /dev/null
+++ b/app/controllers/api/v1/phone_numbers_controller.rb
@@ -0,0 +1,23 @@
+module Api
+ module V1
+ class PhoneNumbersController < ApplicationController
+ respond_to :json
+
+ def index
+ if params[:ids]
+ @phone_numbers = PhoneNumber.where(:id => params[:ids])
+ else
+ @phone_numbers = PhoneNumber.all
+ end
+
+ respond_with @phone_numbers
+ end
+
+ def show
+ @phone_number = PhoneNumber.find(params[:id])
+
+ respond_with @phone_number
+ end
+ end
+ end
+end
diff --git a/app/controllers/api/v1/sip_accounts_controller.rb b/app/controllers/api/v1/sip_accounts_controller.rb
new file mode 100644
index 0000000..6f305a4
--- /dev/null
+++ b/app/controllers/api/v1/sip_accounts_controller.rb
@@ -0,0 +1,23 @@
+module Api
+ module V1
+ class SipAccountsController < ApplicationController
+ respond_to :json
+
+ def index
+ if params[:ids]
+ @sip_accounts = SipAccount.where(:id => params[:ids])
+ else
+ @sip_accounts = SipAccount.all
+ end
+
+ respond_with @sip_accounts
+ end
+
+ def show
+ @sip_account = SipAccount.find(params[:id])
+
+ respond_with @sip_account
+ end
+ end
+ end
+end
diff --git a/app/controllers/api/v1/switchboard_entries_controller.rb b/app/controllers/api/v1/switchboard_entries_controller.rb
new file mode 100644
index 0000000..688f108
--- /dev/null
+++ b/app/controllers/api/v1/switchboard_entries_controller.rb
@@ -0,0 +1,23 @@
+module Api
+ module V1
+ class SwitchboardEntriesController < ApplicationController
+ respond_to :json
+
+ def index
+ if params[:ids]
+ @switchboard_entries = SwitchboardEntry.where(:id => params[:ids])
+ else
+ @switchboard_entries = SwitchboardEntry.all
+ end
+
+ respond_with @switchboard_entries
+ end
+
+ def show
+ @switchboard_entry = SwitchboardEntry.find(params[:id])
+
+ respond_with @switchboard_entry
+ end
+ end
+ end
+end \ No newline at end of file
diff --git a/app/controllers/api/v1/switchboards_controller.rb b/app/controllers/api/v1/switchboards_controller.rb
new file mode 100644
index 0000000..e6996ca
--- /dev/null
+++ b/app/controllers/api/v1/switchboards_controller.rb
@@ -0,0 +1,21 @@
+module Api
+ module V1
+ class SwitchboardsController < ApplicationController
+ respond_to :json
+
+ def index
+ @user = current_user
+ @switchboards = @user.switchboards
+
+ respond_with @switchboards
+ end
+
+ def show
+ @user = current_user
+ @switchboard = @user.switchboards.find(params[:id])
+
+ respond_with @switchboard
+ end
+ end
+ end
+end
diff --git a/app/controllers/call_forwards_controller.rb b/app/controllers/call_forwards_controller.rb
index b30ee9e..1721aa3 100644
--- a/app/controllers/call_forwards_controller.rb
+++ b/app/controllers/call_forwards_controller.rb
@@ -30,6 +30,7 @@ class CallForwardsController < ApplicationController
@call_forward.active = true
@call_forwarding_destinations = call_forwarding_destination_types()
@call_forward.destination = GsParameter.get('CALLFORWARD_DESTINATION_DEFAULT').to_s if defined?(GsParameter.get('CALLFORWARD_DESTINATION_DEFAULT'))
+ @destination_phone_number = @call_forward.destination
@available_call_forward_cases = []
CallForwardCase.all.each do |available_call_forward_case|
@@ -45,6 +46,8 @@ class CallForwardsController < ApplicationController
@call_forward.call_forward_case_id = CallForwardCase.find_by_value('noanswer').id
@call_forward.timeout = 45
end
+
+ @available_greetings = available_greetings()
end
def create
@@ -62,6 +65,8 @@ class CallForwardsController < ApplicationController
def edit
@available_call_forward_cases = CallForwardCase.all
@call_forwarding_destinations = call_forwarding_destination_types()
+ @available_greetings = available_greetings()
+ @destination_phone_number = @call_forward.destination if @call_forward.call_forwarding_destination == ':PhoneNumber'
end
def update
@@ -82,7 +87,6 @@ class CallForwardsController < ApplicationController
end
private
- private
def set_and_authorize_parent
@parent = @phone_number || @sip_account || @automatic_call_distributor || @hunt_group
authorize! :read, @parent
@@ -92,6 +96,14 @@ class CallForwardsController < ApplicationController
if @parent
if @parent.class == PhoneNumber && @parent.phone_numberable_type == 'SipAccount'
@sip_account = @parent.phone_numberable
+ elsif @parent.class == PhoneNumber && @parent.phone_numberable_type == 'HuntGroup'
+ add_breadcrumb t("hunt_groups.index.page_title"), tenant_hunt_groups_path(@parent.phone_numberable.tenant)
+ add_breadcrumb @parent.phone_numberable, tenant_hunt_group_path(@parent.phone_numberable.tenant, @parent.phone_numberable)
+ add_breadcrumb t("phone_numbers.index.page_title"), hunt_group_phone_numbers_path(@parent.phone_numberable)
+ add_breadcrumb @parent, hunt_group_phone_number_path(@parent.phone_numberable, @parent)
+ elsif @parent.class == HuntGroup
+ add_breadcrumb t("hunt_groups.index.page_title"), tenant_hunt_groups_path(@parent.tenant)
+ add_breadcrumb @parent, tenant_hunt_group_path(@parent.tenant, @parent)
end
if @sip_account
@@ -127,29 +139,101 @@ class CallForwardsController < ApplicationController
end
def call_forwarding_destination_types
-
+ destinations_hash = {}
phone_number_destination = CallForwardingDestination.new()
phone_number_destination.id = ':PhoneNumber'
phone_number_destination.label = 'Phone Number'
- voice_mail_destination = CallForwardingDestination.new()
- voice_mail_destination.id = ':Voicemail'
- voice_mail_destination.label = 'Voice Mail'
call_forwarding_destinations = [
phone_number_destination,
- voice_mail_destination,
]
+ if @parent.class == SipAccount || @parent.class == User || @parent.class == Tenant
+ @parent.voicemail_accounts.each do |voicemail_account|
+ call_forwards_destination = CallForwardingDestination.new()
+ call_forwards_destination.id = "#{voicemail_account.id}:VoicemailAccount"
+ call_forwards_destination.label = "VoicemailAccount: #{voicemail_account.to_s}"
+ if !destinations_hash[call_forwards_destination.id]
+ destinations_hash[call_forwards_destination.id] = true
+ call_forwarding_destinations << call_forwards_destination
+ end
+ end
+ end
+
+ if @parent.class == SipAccount
+ sip_account = @parent
+ group_ids = Group.target_group_ids_by_permission(:forward_to, sip_account.groups)
+
+ if sip_account.sip_accountable.class == User || sip_account.sip_accountable.class == Tenant
+ group_ids = group_ids + Group.target_group_ids_by_permission(:forward_to, sip_account.sip_accountable.groups)
+ sip_account.sip_accountable.voicemail_accounts.each do |voicemail_account|
+ call_forwards_destination = CallForwardingDestination.new()
+ call_forwards_destination.id = "#{voicemail_account.id}:VoicemailAccount"
+ call_forwards_destination.label = "VoicemailAccount: #{voicemail_account.to_s}"
+ if !destinations_hash[call_forwards_destination.id]
+ destinations_hash[call_forwards_destination.id] = true
+ call_forwarding_destinations << call_forwards_destination
+ end
+ end
+ end
+
+ GroupMembership.where(:group_id => group_ids, :item_type => 'VoicemailAccount').each do |group_member|
+ call_forwards_destination = CallForwardingDestination.new()
+ call_forwards_destination.id = "#{group_member.item.id}:VoicemailAccount"
+ call_forwards_destination.label = "VoicemailAccount: #{group_member.item.to_s}"
+ if !destinations_hash[call_forwards_destination.id]
+ destinations_hash[call_forwards_destination.id] = true
+ call_forwarding_destinations << call_forwards_destination
+ end
+ end
+ end
+
+ if @parent.class == PhoneNumber
+ if @parent.phone_numberable.class == SipAccount
+ sip_account = @parent.phone_numberable
+ if sip_account.sip_accountable.class == User || sip_account.sip_accountable.class == Tenant
+ sip_account.sip_accountable.voicemail_accounts.each do |voicemail_account|
+ call_forwards_destination = CallForwardingDestination.new()
+ call_forwards_destination.id = "#{voicemail_account.id}:VoicemailAccount"
+ call_forwards_destination.label = "VoicemailAccount: #{voicemail_account.to_s}"
+ if !destinations_hash[call_forwards_destination.id]
+ destinations_hash[call_forwards_destination.id] = true
+ call_forwarding_destinations << call_forwards_destination
+ end
+ end
+ end
+ end
+ end
+
if GuiFunction.display?('huntgroup_in_destination_field_in_call_forward_form', current_user)
HuntGroup.all.each do |hunt_group|
- hunt_group_destination = CallForwardingDestination.new()
- hunt_group_destination.id = "#{hunt_group.id}:HuntGroup"
- hunt_group_destination.label = "HuntGroup: #{hunt_group.to_s}"
- call_forwarding_destinations.push(hunt_group_destination)
+ call_forwards_destination = CallForwardingDestination.new()
+ call_forwards_destination.id = "#{hunt_group.id}:HuntGroup"
+ call_forwards_destination.label = "HuntGroup: #{hunt_group.to_s}"
+ if !destinations_hash[call_forwards_destination.id]
+ destinations_hash[call_forwards_destination.id] = true
+ call_forwarding_destinations << call_forwards_destination
+ end
end
end
return call_forwarding_destinations
end
+ def available_greetings
+ if @parent.class == PhoneNumber
+ owner = @parent.phone_numberable
+ else
+ owner = @parent
+ end
+
+ if owner.class == SipAccount
+ owner = owner.sip_accountable
+ elsif owner.class == FaxAccount
+ owner = owner.fax_accountable
+ end
+
+ return GenericFile.where(:category => 'greeting', :owner_type => owner.class.to_s, :owner_id => owner.id).map {|x| [x.to_s, x.name] }
+ end
+
end
diff --git a/app/controllers/call_histories_controller.rb b/app/controllers/call_histories_controller.rb
index 2bfd4e3..a4d0c21 100644
--- a/app/controllers/call_histories_controller.rb
+++ b/app/controllers/call_histories_controller.rb
@@ -1,5 +1,8 @@
class CallHistoriesController < ApplicationController
-
+ MAX_CALL_HISTORY_ENTRIES = 10000;
+
+ helper_method :sort_column, :sort_descending
+
load_resource :sip_account
before_filter :set_and_authorize_parent
@@ -18,12 +21,7 @@ class CallHistoriesController < ApplicationController
def index
hunt_group_member_ids = PhoneNumber.where(:phone_numberable_type => 'HuntGroupMember', :number => @sip_account.phone_numbers.map {|a| a.number}).map {|a| a.phone_numberable_id}
hunt_group_ids = HuntGroupMember.where(:id => hunt_group_member_ids, :active => true).map {|a| a.hunt_group_id}
- calls = CallHistory.where('(call_historyable_type = "SipAccount" AND call_historyable_id = ?) OR (call_historyable_type = "HuntGroup" AND call_historyable_id IN (?))', @sip_account.id, hunt_group_ids).order('start_stamp DESC')
-
- @call_histories = calls.paginate(
- :page => @pagination_page_number,
- :per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE')
- )
+ calls = CallHistory.where('(call_historyable_type = "SipAccount" AND call_historyable_id = ?) OR (call_historyable_type = "HuntGroup" AND call_historyable_id IN (?))', @sip_account.id, hunt_group_ids).order(sort_column + ' ' + (sort_descending ? 'DESC' : 'ASC'))
@calls_count = calls.count
@calls_received_count = calls.where(:entry_type => 'received').count
@@ -32,10 +30,15 @@ class CallHistoriesController < ApplicationController
@calls_forwarded_count = calls.where(:entry_type => 'forwarded').count
if ! @type.blank?
- @call_histories = @call_histories.where(:entry_type => @type)
+ @call_histories = calls.where(:entry_type => @type).limit(MAX_CALL_HISTORY_ENTRIES)
+ else
+ @call_histories = calls.limit(MAX_CALL_HISTORY_ENTRIES)
end
- @call_histories = @call_histories.order(:created_at).reverse_order.limit(1000)
+ @call_histories = @call_histories.paginate(
+ :page => @pagination_page_number,
+ :per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE')
+ )
end
@@ -102,4 +105,16 @@ class CallHistoriesController < ApplicationController
end
end
+ def sort_descending
+ if sort_column == 'start_stamp' && params[:desc].to_s.blank?
+ return true
+ end
+
+ params[:desc].to_s == 'true'
+ end
+
+ def sort_column
+ CallHistory.column_names.include?(params[:sort]) ? params[:sort] : 'start_stamp'
+ end
+
end
diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb
index e5cf56a..dc0d175 100644
--- a/app/controllers/call_routes_controller.rb
+++ b/app/controllers/call_routes_controller.rb
@@ -92,6 +92,8 @@ class CallRoutesController < ApplicationController
account = SipAccount.where(:id => params[:sip_account_id]).first
elsif !params[:hunt_group_id].blank?
account = HuntGroup.where(:id => params[:hunt_group_id]).first
+ elsif !params[:fax_account_id].blank?
+ account = FaxAccount.where(:id => params[:fax_account_id]).first
end
if account
@@ -111,7 +113,7 @@ class CallRoutesController < ApplicationController
private
def call_route_parameter_params
- params.require(:call_route).permit(:routing_table, :name, :endpoint_type, :endpoint_id, :position)
+ params.require(:call_route).permit(:routing_table, :name, :endpoint_type, :endpoint_id, :position, :xml)
end
def spread_breadcrumbs
diff --git a/app/controllers/config_siemens_controller.rb b/app/controllers/config_siemens_controller.rb
index 7d5eb3f..3fe3aaa 100644
--- a/app/controllers/config_siemens_controller.rb
+++ b/app/controllers/config_siemens_controller.rb
@@ -194,6 +194,18 @@ class ConfigSiemensController < ApplicationController
#logger.debug(@phone_items)
@my_nonce = params[:WorkpointMessage][:Message][:nonce]
@new_settings = Array.new
+
+ phone_parameters = GsParameter.get_list('phones', 'siemens')
+ phone_parameters.each do |name, value|
+ value = value.gsub!(/\{([a-z0-9_\.]+)\}/) { |v|
+ source = @sip_account
+ $1.split('.').each do |method|
+ source = source.send(method) if source.respond_to?(method)
+ end
+ source.to_s
+ }
+ @new_settings << [name, nil, value]
+ end
@new_settings << ['dhcp', nil, 'true']
@new_settings << ['hostname', nil, mac_address.gsub(':', '') ]
@@ -479,7 +491,6 @@ class ConfigSiemensController < ApplicationController
@new_settings << ['feature-availability', 33, 'true'] # line overview
@new_settings << ['feature-availability', 33, 'false'] # phone lock
-
@soft_keys = Array.new
# Fill softkeys with keys dependent on limit of phone
@sip_account.softkeys.order(:position).each do |sk|
diff --git a/app/controllers/config_snom_controller.rb b/app/controllers/config_snom_controller.rb
index 8db1d57..4b9489b 100644
--- a/app/controllers/config_snom_controller.rb
+++ b/app/controllers/config_snom_controller.rb
@@ -242,6 +242,7 @@ class ConfigSnomController < ApplicationController
phone_sip_accounts = Array.new()
if send_sensitve
+ phone_parameters = GsParameter.get_list('phones', 'snom')
if @phone.sip_accounts && @phone.sip_accounts.count > 0
phone_sip_accounts = @phone.sip_accounts
elsif @phone.fallback_sip_account
@@ -250,6 +251,7 @@ class ConfigSnomController < ApplicationController
expiry_seconds = GsParameter.get('SIP_EXPIRY_SECONDS')
phone_sip_accounts.each do |sip_account|
if (sip_account.sip_accountable_type == @phone.phoneable_type) and (sip_account.sip_accountable_id == @phone.phoneable_id)
+
snom_sip_account = {
:id => sip_account.id,
:active => 'on',
@@ -259,10 +261,24 @@ class ConfigSnomController < ApplicationController
:outbound => sip_account.host,
:name => sip_account.auth_name,
:realname => 'Call',
- :idle_text => sip_account.caller_name,
- :mailbox => "<sip:#{sip_account.auth_name}@#{sip_account.host}>",
+ :user_idle_text => sip_account.caller_name,
:expiry => expiry_seconds,
}
+
+ if sip_account.voicemail_account
+ snom_sip_account[:mailbox] = "<sip:#{sip_account.voicemail_account.name}@#{sip_account.host}>"
+ end
+
+ phone_parameters.each do |name, value|
+ snom_sip_account[name.to_sym] = value.gsub!(/\{([a-z0-9_\.]+)\}/) { |v|
+ source = sip_account
+ $1.split('.').each do |method|
+ source = source.send(method) if source.respond_to?(method)
+ end
+ source.to_s
+ }
+ end
+
@sip_accounts.push(snom_sip_account)
sip_account_index = @sip_accounts.length
sip_account.softkeys.order(:position).each do |softkey|
@@ -786,7 +802,7 @@ AAAA'
@phone_xml_object = {
:name => 'snom_phone_directory',
- :title => "$(lang:menu100_phone_book) #{@dialpad_keys}".strip,
+ :title => "#{t('config_snom.phone_book.title')} #{@dialpad_keys}".strip,
:entries => [],
:softkeys => [],
}
@@ -849,7 +865,6 @@ AAAA'
end
def call_history
-
if ! @sip_account
render(
:status => 404,
@@ -860,10 +875,10 @@ AAAA'
return
end
- if ['dialed', 'missed', 'received'].include? @type
+ if ['dialed', 'missed', 'received', 'forwarded'].include? @type
@phone_xml_object = {
:name => "snom_phone_directory",
- :title => "$(lang:menu100_call_lists) - #{@type.to_s.camelize}",
+ :title => "#{t('config_snom.call_history.title')} - #{@type.to_s.camelize}",
:entries => []
}
@@ -893,11 +908,81 @@ AAAA'
base_url = "#{request.protocol}#{request.host_with_port}#{request.fullpath.split("?")[0]}"
@phone_xml_object = {
:name => 'snom_phone_menu',
- :title => '$(lang:menu100_call_lists)',
+ :title => t('config_snom.call_history.title'),
+ :entries => [
+ {:text => t('config_snom.call_history.missed'), :url => "#{base_url}?&type=missed", :selected => false},
+ {:text => t('config_snom.call_history.received'), :url => "#{base_url}?&type=received", :selected => false},
+ {:text => t('config_snom.call_history.dialed'), :url => "#{base_url}?&type=dialed", :selected => false},
+ ]
+ }
+ end
+
+ respond_to { |format|
+ format.any {
+ self.formats = [ :xml ]
+ render :action => "_#{@phone_xml_object[:name]}"
+ }
+ }
+
+ end
+
+ def voicemail
+ if ! @sip_account
+ render(
+ :status => 404,
+ :layout => false,
+ :content_type => 'text/plain',
+ :text => "<!-- SipAccount not found -->",
+ )
+ return
+ end
+
+ if !@sip_account.voicemail_account
+ render(
+ :status => 404,
+ :layout => false,
+ :content_type => 'text/plain',
+ :text => "<!-- VoicemailAccount not found -->",
+ )
+ return
+ end
+
+ account = @sip_account.voicemail_account
+
+ if ['read', 'unread'].include? @type
+ if @type == 'unread'
+ messages = account.voicemail_messages.where('read_epoch IS NULL OR read_epoch = 0')
+ elsif @type == 'read'
+ messages = account.voicemail_messages.where('read_epoch > 0')
+ end
+ @phone_xml_object = {
+ :name => "snom_phone_directory",
+ :title => t("config_snom.voicemail.#{@type}_count", :count => messages.count),
+ :entries => []
+ }
+ messages.each do |message|
+ @phone_xml_object[:entries].push({
+ :selected => false,
+ :number => "f-vmplay-#{message.uuid}",
+ :text => "#{call_date_compact(Time.at(message.created_epoch).to_datetime)} #{message.cid_name} #{message.cid_number}",
+ })
+ end
+ elsif @type == 'settings'
+ base_url = "#{request.protocol}#{request.host_with_port}#{request.fullpath.split("?")[0]}"
+ @phone_xml_object = {
+ :name => 'snom_phone_menu',
+ :title => t('config_snom.voicemail_settings.title'),
+ :entries => []
+ }
+ else
+ base_url = "#{request.protocol}#{request.host_with_port}#{request.fullpath.split("?")[0]}"
+ @phone_xml_object = {
+ :name => 'snom_phone_menu',
+ :title => account,
:entries => [
- {:text => '$(lang:list_missed)', :url => "#{base_url}?&type=missed", :selected => false},
- {:text => '$(lang:list_taken)', :url => "#{base_url}?&type=received", :selected => false},
- {:text => '$(lang:list_dialed)', :url => "#{base_url}?&type=dialed", :selected => false},
+ {:text => t('config_snom.voicemail.unread_count', :count => account.voicemail_messages.where('read_epoch IS NULL OR read_epoch = 0').count), :url => "#{base_url}?&type=unread", :selected => false},
+ {:text => t('config_snom.voicemail.read_count', :count => account.voicemail_messages.where('read_epoch > 0').count), :url => "#{base_url}?&type=read", :selected => false},
+ {:text => t('config_snom.voicemail.settings'), :url => "#{base_url}?&type=settings", :selected => false},
]
}
end
diff --git a/app/controllers/fax_accounts_controller.rb b/app/controllers/fax_accounts_controller.rb
index 031080e..804cdb9 100644
--- a/app/controllers/fax_accounts_controller.rb
+++ b/app/controllers/fax_accounts_controller.rb
@@ -1,7 +1,8 @@
class FaxAccountsController < ApplicationController
load_resource :user
+ load_resource :tenant
load_resource :user_group
- load_and_authorize_resource :fax_account, :through => [:user, :user_group]
+ load_and_authorize_resource :fax_account, :through => [:user, :user_group, :tenant]
before_filter :set_and_authorize_parent
before_filter :spread_breadcrumbs
@@ -54,7 +55,7 @@ class FaxAccountsController < ApplicationController
private
def set_and_authorize_parent
- @parent = @user || @user_group
+ @parent = @user || @user_group || @tenant
authorize! :read, @parent
end
diff --git a/app/controllers/gateway_parameters_controller.rb b/app/controllers/gateway_parameters_controller.rb
index d5ade9e..693a484 100644
--- a/app/controllers/gateway_parameters_controller.rb
+++ b/app/controllers/gateway_parameters_controller.rb
@@ -2,6 +2,8 @@ class GatewayParametersController < ApplicationController
load_and_authorize_resource :gateway
load_and_authorize_resource :gateway_parameter, :through => [:gateway]
+ before_filter :spread_breadcrumbs
+
def index
@gateway_parameters = @gateway.gateway_parameters
end
@@ -41,4 +43,15 @@ class GatewayParametersController < ApplicationController
@gateway_parameter.destroy
redirect_to gateway_path(@gateway), :notice => t('gateway_parameters.controller.successfuly_destroyed')
end
+
+ private
+ def spread_breadcrumbs
+ add_breadcrumb t("gateways.index.page_title"), gateways_path
+ add_breadcrumb @gateway, @gateway
+ add_breadcrumb t("gateway_parameters.index.page_title"), gateway_gateway_parameters_url(@gateway)
+
+ if @gateway_parameter && !@gateway_parameter.new_record?
+ add_breadcrumb @gateway_parameter
+ end
+ end
end
diff --git a/app/controllers/gateway_settings_controller.rb b/app/controllers/gateway_settings_controller.rb
index 0304411..0fecdaf 100644
--- a/app/controllers/gateway_settings_controller.rb
+++ b/app/controllers/gateway_settings_controller.rb
@@ -2,6 +2,8 @@ class GatewaySettingsController < ApplicationController
load_and_authorize_resource :gateway
load_and_authorize_resource :gateway_setting, :through => [:gateway]
+ before_filter :spread_breadcrumbs
+
def index
@gateway_settings = @gateway.gateway_settings
end
@@ -41,4 +43,15 @@ class GatewaySettingsController < ApplicationController
@gateway_setting.destroy
redirect_to gateway_path(@gateway), :notice => t('gateway_settings.controller.successfuly_destroyed')
end
+
+ private
+ def spread_breadcrumbs
+ add_breadcrumb t("gateways.index.page_title"), gateways_path
+ add_breadcrumb @gateway, @gateway
+ add_breadcrumb t("gateway_settings.index.page_title"), gateway_gateway_settings_url(@gateway)
+
+ if @gateway_setting && !@gateway_setting.new_record?
+ add_breadcrumb @gateway_setting
+ end
+ end
end
diff --git a/app/controllers/gemeinschaft_setups_controller.rb b/app/controllers/gemeinschaft_setups_controller.rb
index 4949fa7..96b1dcb 100644
--- a/app/controllers/gemeinschaft_setups_controller.rb
+++ b/app/controllers/gemeinschaft_setups_controller.rb
@@ -99,6 +99,22 @@ class GemeinschaftSetupsController < ApplicationController
# Auto-Login:
session[:user_id] = user.id
+ # Perimeter settings
+ if !@gemeinschaft_setup.detect_attacks
+ detect_attacks = GsParameter.where(:entity => 'events', :section => 'modules', :name => 'perimeter_defense').first
+ if detect_attacks
+ detect_attacks.update_attributes(:value => '0', :class_type => 'Integer')
+ end
+ end
+
+ if !@gemeinschaft_setup.report_attacks
+ GsParameter.create(:entity => 'perimeter', :section => 'general', :name => 'report_url', :value => '', :class_type => 'String', :description => '')
+ report_url = GsParameter.where(:entity => 'perimeter', :section => 'general', :name => 'report_url').first
+ if report_url
+ report_url.update_attributes(:value => '', :class_type => 'String')
+ end
+ end
+
# Redirect to the user
redirect_to page_help_path, :notice => t('gemeinschaft_setups.initial_setup.successful_setup')
else
diff --git a/app/controllers/generic_files_controller.rb b/app/controllers/generic_files_controller.rb
new file mode 100644
index 0000000..69e00e1
--- /dev/null
+++ b/app/controllers/generic_files_controller.rb
@@ -0,0 +1,87 @@
+class GenericFilesController < ApplicationController
+
+ load_resource :sip_account
+ load_resource :conference
+ load_resource :hunt_group
+ load_resource :automatic_call_distributor
+ load_resource :user
+ load_resource :tenant
+ load_resource :generic_file
+
+ load_and_authorize_resource :generic_file, :through => [:sip_account, :conference, :hunt_group, :automatic_call_distributor, :user, :tenant]
+
+ before_filter :set_and_authorize_parent
+ before_filter :spread_breadcrumbs
+
+ def index
+ @generic_files = @parent.generic_files
+ end
+
+ def show
+ respond_to do |format|
+ format.html
+ format.xml {render :xml => @generic_file}
+ format.all {
+ if request.format == @generic_file.file_type
+ send_file @generic_file.file.path, :type => @generic_file.file_type, :filename => "#{@generic_file.name}.#{request.parameters[:format].to_s}"
+ end
+ }
+ end
+ end
+
+ def new
+ @generic_file = @parent.generic_files.build()
+ end
+
+ def create
+ @generic_file = @parent.generic_files.new(params[:generic_file])
+ if @generic_file.save
+ m = method( :"#{@parent.class.name.underscore}_generic_files_url" )
+ redirect_to m.( @parent ), :notice => t('generic_files.controller.successfuly_created')
+ else
+ render :new
+ end
+ end
+
+ def edit
+ @generic_file = GenericFile.find(params[:id])
+ end
+
+ def update
+ @generic_file = GenericFile.find(params[:id])
+ if @generic_file.update_attributes(params[:generic_file])
+ m = method( :"#{@parent.class.name.underscore}_generic_files_url" )
+ redirect_to m.( @parent ), :notice => t('generic_files.controller.successfuly_updated')
+ else
+ render :edit
+ end
+ end
+
+ def destroy
+ @generic_file = GenericFile.find(params[:id])
+ @generic_file.destroy
+ m = method( :"#{@parent.class.name.underscore}_generic_files_url" )
+ redirect_to m.( @parent ), :notice => t('generic_files.controller.successfuly_destroyed')
+ end
+
+ private
+ def set_and_authorize_parent
+ @parent = @sip_account || @conference || @hunt_group || @automatic_call_distributor || @user || @tenant
+
+ authorize! :read, @parent
+ end
+
+ def spread_breadcrumbs
+ if @parent.class == User
+ add_breadcrumb t("users.index.page_title"), tenant_users_path(@parent.current_tenant)
+ add_breadcrumb @parent, tenant_user_path(@parent.current_tenant, @parent)
+ end
+
+ add_breadcrumb t("generic_files.index.page_title"), method( :"#{@parent.class.name.underscore}_generic_files_url" ).(@parent)
+
+ if !@generic_file.to_s.blank?
+ add_breadcrumb @generic_file
+ end
+
+ end
+end
diff --git a/app/controllers/pager_group_destinations_controller.rb b/app/controllers/pager_group_destinations_controller.rb
new file mode 100644
index 0000000..655054a
--- /dev/null
+++ b/app/controllers/pager_group_destinations_controller.rb
@@ -0,0 +1,41 @@
+class PagerGroupDestinationsController < ApplicationController
+ def index
+ @pager_group_destinations = PagerGroupDestination.all
+ end
+
+ def show
+ @pager_group_destination = PagerGroupDestination.find(params[:id])
+ end
+
+ def new
+ @pager_group_destination = PagerGroupDestination.new
+ end
+
+ def create
+ @pager_group_destination = PagerGroupDestination.new(params[:pager_group_destination])
+ if @pager_group_destination.save
+ redirect_to @pager_group_destination, :notice => t('pager_group_destinations.controller.successfuly_created')
+ else
+ render :new
+ end
+ end
+
+ def edit
+ @pager_group_destination = PagerGroupDestination.find(params[:id])
+ end
+
+ def update
+ @pager_group_destination = PagerGroupDestination.find(params[:id])
+ if @pager_group_destination.update_attributes(params[:pager_group_destination])
+ redirect_to @pager_group_destination, :notice => t('pager_group_destinations.controller.successfuly_updated')
+ else
+ render :edit
+ end
+ end
+
+ def destroy
+ @pager_group_destination = PagerGroupDestination.find(params[:id])
+ @pager_group_destination.destroy
+ redirect_to pager_group_destinations_url, :notice => t('pager_group_destinations.controller.successfuly_destroyed')
+ end
+end
diff --git a/app/controllers/pager_groups_controller.rb b/app/controllers/pager_groups_controller.rb
new file mode 100644
index 0000000..3b145b1
--- /dev/null
+++ b/app/controllers/pager_groups_controller.rb
@@ -0,0 +1,43 @@
+class PagerGroupsController < ApplicationController
+ load_resource :sip_account
+ load_resource :pager_group, :through => :sip_account
+
+ def index
+ end
+
+ def show
+ @pager_group = PagerGroup.find(params[:id])
+ end
+
+ def new
+ @pager_group = PagerGroup.new
+ end
+
+ def create
+ @pager_group = PagerGroup.new(params[:pager_group])
+ if @pager_group.save
+ redirect_to @pager_group, :notice => t('pager_groups.controller.successfuly_created')
+ else
+ render :new
+ end
+ end
+
+ def edit
+ @pager_group = PagerGroup.find(params[:id])
+ end
+
+ def update
+ @pager_group = PagerGroup.find(params[:id])
+ if @pager_group.update_attributes(params[:pager_group])
+ redirect_to @pager_group, :notice => t('pager_groups.controller.successfuly_updated')
+ else
+ render :edit
+ end
+ end
+
+ def destroy
+ @pager_group = PagerGroup.find(params[:id])
+ @pager_group.destroy
+ redirect_to pager_groups_url, :notice => t('pager_groups.controller.successfuly_destroyed')
+ end
+end
diff --git a/app/controllers/phones_controller.rb b/app/controllers/phones_controller.rb
index 3672390..77e7b5e 100644
--- a/app/controllers/phones_controller.rb
+++ b/app/controllers/phones_controller.rb
@@ -6,7 +6,20 @@ class PhonesController < ApplicationController
before_filter :set_and_authorize_parent
before_filter :spread_breadcrumbs
+ helper_method :sort_column, :sort_descending
+
def index
+ if @parent.class == Tenant
+ @phones = @parent.tenant_user_phones.order(sort_column + ' ' + (sort_descending ? 'DESC' : 'ASC')).paginate(
+ :page => params[:page],
+ :per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE')
+ )
+ else
+ @phones = @parent.phones.order(sort_column + ' ' + (sort_descending ? 'DESC' : 'ASC')).paginate(
+ :page => params[:page],
+ :per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE')
+ )
+ end
end
def show
@@ -85,5 +98,13 @@ class PhonesController < ApplicationController
end
@fallback_sip_accounts = SipAccount.where(:sip_accountable_type => 'Tenant') - SipAccount.where(:id => used_sip_account_ids)
end
+
+ def sort_descending
+ params[:desc].to_s == 'true'
+ end
+
+ def sort_column
+ Phone.column_names.include?(params[:sort]) ? params[:sort] : 'id'
+ end
end
diff --git a/app/controllers/sip_accounts_controller.rb b/app/controllers/sip_accounts_controller.rb
index 0d34109..cd34953 100644
--- a/app/controllers/sip_accounts_controller.rb
+++ b/app/controllers/sip_accounts_controller.rb
@@ -6,7 +6,20 @@ class SipAccountsController < ApplicationController
before_filter :set_and_authorize_parent
before_filter :spread_breadcrumbs
+ helper_method :sort_column, :sort_descending
+
def index
+ if @parent.class == Tenant
+ @sip_accounts = @parent.tenant_user_sip_accounts.order(sort_column + ' ' + (sort_descending ? 'DESC' : 'ASC')).paginate(
+ :page => params[:page],
+ :per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE')
+ )
+ else
+ @sip_accounts = @parent.sip_accounts.order(sort_column + ' ' + (sort_descending ? 'DESC' : 'ASC')).paginate(
+ :page => params[:page],
+ :per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE')
+ )
+ end
end
def show
@@ -22,7 +35,6 @@ class SipAccountsController < ApplicationController
@sip_account.call_waiting = GsParameter.get('CALL_WAITING')
@sip_account.clir = GsParameter.get('DEFAULT_CLIR_SETTING')
@sip_account.clip = GsParameter.get('DEFAULT_CLIP_SETTING')
- @sip_account.voicemail_pin = random_pin
@sip_account.callforward_rules_act_per_sip_account = GsParameter.get('CALLFORWARD_RULES_ACT_PER_SIP_ACCOUNT_DEFAULT')
if @parent.class == User
@sip_account.hotdeskable = true
@@ -36,6 +48,10 @@ class SipAccountsController < ApplicationController
break unless SipAccount.exists?(:auth_name => @sip_account.auth_name)
end
@sip_account.password = SecureRandom.hex(GsParameter.get('DEFAULT_LENGTH_SIP_PASSWORD'))
+
+ @sip_account.voicemail_account = VoicemailAccount.where(:voicemail_accountable_type => @parent.class.name, :voicemail_accountable_id => @parent.id).first
+ @sip_account.language_code = @parent.language.try(:code)
+ possible_voicemail_accounts
end
def create
@@ -61,6 +77,7 @@ class SipAccountsController < ApplicationController
end
def edit
+ possible_voicemail_accounts
end
def update
@@ -101,4 +118,17 @@ class SipAccountsController < ApplicationController
end
end
+ def possible_voicemail_accounts
+ @possible_voicemail_accounts = @sip_account.voicemail_accounts
+ @possible_voicemail_accounts = @possible_voicemail_accounts + @sip_account.sip_accountable.voicemail_accounts
+ end
+
+ def sort_descending
+ params[:desc].to_s == 'true'
+ end
+
+ def sort_column
+ SipAccount.column_names.include?(params[:sort]) ? params[:sort] : 'id'
+ end
+
end
diff --git a/app/controllers/switchboards_controller.rb b/app/controllers/switchboards_controller.rb
index 98008c1..3e2f8d6 100644
--- a/app/controllers/switchboards_controller.rb
+++ b/app/controllers/switchboards_controller.rb
@@ -15,6 +15,10 @@ class SwitchboardsController < ApplicationController
def new
@switchboard = @user.switchboards.build
+ @switchboard.show_avatars = true
+ @switchboard.entry_width = 2
+ @switchboard.reload_interval = 2000
+ @switchboard.amount_of_displayed_phone_numbers = 1
spread_breadcrumbs
end
@@ -52,7 +56,7 @@ class SwitchboardsController < ApplicationController
private
def switchboard_params
- params.require(:switchboard).permit(:name)
+ params.require(:switchboard).permit(:name, :reload_interval, :show_avatars, :entry_width, :amount_of_displayed_phone_numbers)
end
def spread_breadcrumbs
diff --git a/app/controllers/trigger_controller.rb b/app/controllers/trigger_controller.rb
index 6b58d6a..3dbb2a5 100644
--- a/app/controllers/trigger_controller.rb
+++ b/app/controllers/trigger_controller.rb
@@ -1,49 +1,44 @@
class TriggerController < ApplicationController
def voicemail
- if !params[:sip_account_id].blank?
- sip_account = SipAccount.where(:id => params[:sip_account_id].to_i).first
- if sip_account
- sip_account.voicemail_messages.where(:notification => nil).each do |message|
- message.notification = false
- message.save
- if !File.exists?( message.file_path )
- next
+ if !params[:voicemail_account_id].blank?
+ voicemail_account = VoicemailAccount.where(:id => params[:voicemail_account_id].to_i).first
+ if voicemail_account
+ voicemail_messages = voicemail_account.voicemail_messages.where(:notification => nil)
+ if voicemail_messages.count > 0
+ if voicemail_account.voicemail_accountable.class == User
+ user = voicemail_account.voicemail_accountable
+ elsif voicemail_account.voicemail_accountable.class == SipAccount && voicemail_account.voicemail_accountable.sip_accountable.class == User
+ user = voicemail_account.voicemail_accountable = voicemail_account.voicemail_accountable.sip_accountable
end
- user = sip_account.sip_accountable
- if user.class != User
- next
+ if user
+ PrivatePub.publish_to("/users/#{user.id}/messages/new", "$('#new_voicemail_or_fax_indicator').hide('fast').show('slow');")
+ PrivatePub.publish_to("/users/#{user.id}/messages/new", "document.title = '* ' + document.title.replace( '* ' , '');")
end
+ end
- # Indicate a new voicemail in the navigation bar.
- #
- PrivatePub.publish_to("/users/#{user.id}/messages/new", "$('#new_voicemail_or_fax_indicator').hide('fast').show('slow');")
- PrivatePub.publish_to("/users/#{user.id}/messages/new", "document.title = '* ' + document.title.replace( '* ' , '');")
+ email = voicemail_account.notify_to
- if user.email.blank?
- next
- end
-
- voicemail_settings = sip_account.voicemail_setting
- if !voicemail_settings
- voicemail_settings = VoicemailSetting.new(:notify => user.send_voicemail_as_email_attachment, :attachment => user.send_voicemail_as_email_attachment, :mark_read => user.send_voicemail_as_email_attachment)
- end
+ if !email.blank?
+ voicemail_messages.each do |message|
+ message.notification = false
+ message.save
+ if !File.exists?( message.file_path )
+ next
+ end
+ message.notification = true
- message.notification = voicemail_settings.notify
- if voicemail_settings.notify
- if Notifications.new_voicemail(message, voicemail_settings.attachment).deliver
- if voicemail_settings.purge
+ if Notifications.new_voicemail(message, voicemail_account, email, voicemail_account.notification_setting('attachment')).deliver
+ if voicemail_account.notification_setting('purge')
message.delete
next
end
message.save
- if voicemail_settings.mark_read
+ if voicemail_account.notification_setting('mark_read')
message.mark_read
end
end
- else
- message.save
end
end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 584d08c..b4ef180 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -5,8 +5,14 @@ class UsersController < ApplicationController
before_filter :set_and_authorize_parent
before_filter :spread_breadcrumbs
+
+ helper_method :sort_column, :sort_descending
def index
+ @users = @parent.users.order(sort_column + ' ' + (sort_descending ? 'DESC' : 'ASC')).paginate(
+ :page => params[:page],
+ :per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE')
+ )
end
def show
@@ -22,6 +28,12 @@ class UsersController < ApplicationController
def create
@user = @parent.users.build(params[:user])
if @user.save
+ if VoicemailAccount.where(:name => "user_#{@user.user_name}").count == 0
+ @user.voicemail_accounts.create(:name => "user_#{@user.user_name}", :active => true )
+ else
+ @user.voicemail_accounts.create(:active => true)
+ end
+
if @parent.class == Tenant
@parent.tenant_memberships.create(:user => @user)
if @parent.user_groups.exists?(:name => 'Users')
@@ -82,4 +94,12 @@ class UsersController < ApplicationController
end
end
+ def sort_descending
+ params[:desc].to_s == 'true'
+ end
+
+ def sort_column
+ User.column_names.include?(params[:sort]) ? params[:sort] : 'id'
+ end
+
end
diff --git a/app/controllers/voicemail_accounts_controller.rb b/app/controllers/voicemail_accounts_controller.rb
new file mode 100644
index 0000000..6e840fb
--- /dev/null
+++ b/app/controllers/voicemail_accounts_controller.rb
@@ -0,0 +1,100 @@
+class VoicemailAccountsController < ApplicationController
+ load_resource :sip_account
+ load_resource :conference
+ load_resource :hunt_group
+ load_resource :automatic_call_distributor
+ load_resource :user
+ load_resource :tenant
+ load_resource :voicemail_account
+
+ load_and_authorize_resource :phone_number, :through => [:sip_account, :conference, :hunt_group, :automatic_call_distributor, :user, :tenant]
+
+ before_filter :set_and_authorize_parent
+ before_filter :spread_breadcrumbs
+
+ def index
+ @voicemail_accounts = @parent.voicemail_accounts
+ end
+
+ def show
+
+ end
+
+ def new
+ @voicemail_account = @parent.voicemail_accounts.build(:active => true)
+ if @parent.class == SipAccount && VoicemailAccount.where(:name => @parent.auth_name).count == 0
+ @voicemail_account.name = @parent.auth_name
+ else
+ @voicemail_account.name = SecureRandom.hex(GsParameter.get('DEFAULT_LENGTH_SIP_AUTH_NAME'))
+ end
+ end
+
+ def create
+ @voicemail_account = @parent.voicemail_accounts.new(params[:voicemail_account])
+ if @voicemail_account.save
+ if @parent.class == User
+ @email = @parent.email
+ end
+ @voicemail_account.voicemail_settings.create(:name => 'pin', :value => ("%06d" % SecureRandom.random_number(999999)), :class_type => 'String')
+ @voicemail_account.voicemail_settings.create(:name => 'notify', :value => 'true', :class_type => 'Boolean')
+ @voicemail_account.voicemail_settings.create(:name => 'attachment', :value => 'true', :class_type => 'Boolean')
+ @voicemail_account.voicemail_settings.create(:name => 'mark_read', :value => 'true', :class_type => 'Boolean')
+ @voicemail_account.voicemail_settings.create(:name => 'purge', :value => 'false', :class_type => 'Boolean')
+ @voicemail_account.voicemail_settings.create(:name => 'email', :value => @email, :class_type => 'String')
+ m = method( :"#{@parent.class.name.underscore}_voicemail_accounts_url" )
+ redirect_to m.( @parent ), :notice => t('voicemail_accounts.controller.successfuly_created')
+ else
+ render :new
+ end
+ end
+
+ def edit
+ @voicemail_account = VoicemailAccount.find(params[:id])
+ end
+
+ def update
+ @voicemail_account = VoicemailAccount.find(params[:id])
+ if @voicemail_account.update_attributes(params[:voicemail_account])
+ m = method( :"#{@parent.class.name.underscore}_voicemail_accounts_url" )
+ redirect_to m.( @parent ), :notice => t('voicemail_accounts.controller.successfuly_updated')
+ else
+ render :edit
+ end
+ end
+
+ def destroy
+ @voicemail_account = VoicemailAccount.find(params[:id])
+ @voicemail_account.destroy
+ m = method( :"#{@parent.class.name.underscore}_voicemail_accounts_url" )
+ redirect_to m.( @parent ), :notice => t('voicemail_accounts.controller.successfuly_destroyed')
+ end
+
+ private
+ def set_and_authorize_parent
+ @parent = @sip_account || @conference || @hunt_group || @automatic_call_distributor || @user || @tenant
+
+ authorize! :read, @parent
+ end
+
+ def spread_breadcrumbs
+ if @parent.class == User
+ add_breadcrumb t("users.index.page_title"), tenant_users_path(@parent.current_tenant)
+ add_breadcrumb @parent, tenant_user_path(@parent.current_tenant, @parent)
+ elsif @parent.class == SipAccount
+ if @parent.sip_accountable.class == User
+ add_breadcrumb t("users.index.page_title"), tenant_users_path(@parent.sip_accountable.current_tenant)
+ add_breadcrumb @parent.sip_accountable, tenant_user_path(@parent.sip_accountable.current_tenant, @parent.sip_accountable)
+ end
+
+ add_breadcrumb t("sip_accounts.index.page_title"), method( :"#{@parent.sip_accountable.class.name.underscore}_sip_accounts_url" ).(@parent.sip_accountable)
+ add_breadcrumb @parent, method( :"#{@parent.sip_accountable.class.name.underscore}_sip_account_path" ).(@parent.sip_accountable, @parent)
+ end
+
+ add_breadcrumb t("voicemail_accounts.index.page_title"), method( :"#{@parent.class.name.underscore}_voicemail_accounts_url" ).(@parent)
+
+ if !@voicemail_account.to_s.blank?
+ add_breadcrumb @voicemail_account.name
+ end
+ end
+
+end
diff --git a/app/controllers/voicemail_messages_controller.rb b/app/controllers/voicemail_messages_controller.rb
index dfe0ae4..7511385 100644
--- a/app/controllers/voicemail_messages_controller.rb
+++ b/app/controllers/voicemail_messages_controller.rb
@@ -1,10 +1,12 @@
class VoicemailMessagesController < ApplicationController
- load_resource :sip_account
- load_and_authorize_resource :voicemail_message, :through => [:sip_account]
+ load_resource :voicemail_account
+ load_and_authorize_resource :voicemail_message, :through => [:voicemail_account]
before_filter :set_and_authorize_parent
before_filter :spread_breadcrumbs
+
+ helper_method :sort_column, :sort_descending
before_filter { |controller|
if ! params[:type].blank? then
@@ -17,26 +19,28 @@ class VoicemailMessagesController < ApplicationController
}
def index
- @messages_count = @sip_account.voicemail_messages.count
- @messages_unread_count = @sip_account.voicemail_messages.where(:read_epoch => 0).count
+ @messages_count = @voicemail_account.voicemail_messages.count
+ @messages_unread_count = @voicemail_account.voicemail_messages.where(:read_epoch => 0).count
@messages_read_count = @messages_count - @messages_unread_count
if @type == 'read'
- @voicemail_messages = @sip_account.voicemail_messages.where('read_epoch > 0').order('created_epoch DESC').paginate(
+ @voicemail_messages = @voicemail_account.voicemail_messages.where('read_epoch > 0').order(sort_column + ' ' + (sort_descending ? 'DESC' : 'ASC')).paginate(
:page => @pagination_page_number,
:per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE')
)
elsif @type == 'unread'
- @voicemail_messages = @sip_account.voicemail_messages.where(:read_epoch => 0).order('created_epoch DESC').paginate(
+ @voicemail_messages = @voicemail_account.voicemail_messages.where(:read_epoch => 0).order(sort_column + ' ' + (sort_descending ? 'DESC' : 'ASC')).paginate(
:page => @pagination_page_number,
:per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE')
)
else
- @voicemail_messages = @sip_account.voicemail_messages.order('created_epoch DESC').paginate(
+ @voicemail_messages = @voicemail_account.voicemail_messages.order(sort_column + ' ' + (sort_descending ? 'DESC' : 'ASC')).paginate(
:page => @pagination_page_number,
:per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE')
)
end
+
+ @available_sip_account = available_sip_account()
end
def show
@@ -78,7 +82,7 @@ class VoicemailMessagesController < ApplicationController
def destroy_multiple
result = false
if ! params[:selected_uuids].blank? then
- voicemail_messages = @sip_account.voicemail_messages.where(:uuid => params[:selected_uuids])
+ voicemail_messages = @voicemail_account.voicemail_messages.where(:uuid => params[:selected_uuids])
voicemail_messages.each do |voicemail_message|
result = voicemail_message.destroy
end
@@ -92,10 +96,20 @@ class VoicemailMessagesController < ApplicationController
end
end
+ def available_sip_account
+ voicemail_accountable = @voicemail_account.voicemail_accountable
+ if voicemail_accountable.class == SipAccount
+ return voicemail_accountable
+ elsif voicemail_accountable.class == User
+ return voicemail_accountable.sip_accounts.first
+ end
+ end
+
def call
phone_number = @voicemail_message.cid_number
- if ! phone_number.blank? && @sip_account.registration
- @sip_account.call(phone_number)
+ sip_account = self.available_sip_account
+ if ! phone_number.blank? && sip_account && sip_account.registration
+ sip_account.call(phone_number)
end
redirect_to(:back)
end
@@ -112,7 +126,7 @@ class VoicemailMessagesController < ApplicationController
private
def set_and_authorize_parent
- @parent = @sip_account
+ @parent = @voicemail_account
authorize! :read, @parent
@@ -123,18 +137,37 @@ class VoicemailMessagesController < ApplicationController
end
def spread_breadcrumbs
- if @parent.class == SipAccount
- if @sip_account.sip_accountable.class == User
- add_breadcrumb t("#{@sip_account.sip_accountable.class.name.underscore.pluralize}.index.page_title"), method( :"tenant_#{@sip_account.sip_accountable.class.name.underscore.pluralize}_path" ).(@sip_account.tenant)
- add_breadcrumb @sip_account.sip_accountable, method( :"tenant_#{@sip_account.sip_accountable.class.name.underscore}_path" ).(@sip_account.tenant, @sip_account.sip_accountable)
- end
- add_breadcrumb t("sip_accounts.index.page_title"), method( :"#{@sip_account.sip_accountable.class.name.underscore}_sip_accounts_path" ).(@sip_account.sip_accountable)
- add_breadcrumb @sip_account, method( :"#{@sip_account.sip_accountable.class.name.underscore}_sip_account_path" ).(@sip_account.sip_accountable, @sip_account)
- add_breadcrumb t("voicemail_messages.index.page_title"), sip_account_voicemail_messages_path(@sip_account)
- if @voicemail_message && !@voicemail_message.new_record?
- add_breadcrumb @voicemail_message, sip_account_voicemail_message_path(@sip_account, @voicemail_message)
- end
+ parent = @voicemail_account.voicemail_accountable
+
+ if parent.class == User
+ add_breadcrumb t("users.index.page_title"), tenant_users_path(parent.current_tenant)
+ add_breadcrumb parent, tenant_user_path(parent.current_tenant, parent)
+ elsif parent.class == SipAccount
+ if parent.sip_accountable.class == User
+ add_breadcrumb t("users.index.page_title"), tenant_users_path(parent.sip_accountable.current_tenant)
+ add_breadcrumb parent.sip_accountable, tenant_user_path(parent.sip_accountable.current_tenant, parent.sip_accountable)
+ end
+
+ add_breadcrumb t("sip_accounts.index.page_title"), method( :"#{parent.sip_accountable.class.name.underscore}_sip_accounts_url" ).(parent.sip_accountable)
+ add_breadcrumb parent, method( :"#{parent.sip_accountable.class.name.underscore}_sip_account_path" ).(parent.sip_accountable, parent)
end
+
+ add_breadcrumb t("voicemail_accounts.index.page_title"), method( :"#{parent.class.name.underscore}_voicemail_accounts_url" ).(parent)
+ add_breadcrumb @voicemail_account.name, method( :"#{parent.class.name.underscore}_voicemail_account_path" ).(parent, @voicemail_account)
+
+ add_breadcrumb t("voicemail_messages.index.page_title")
+ end
+
+ def sort_descending
+ if sort_column == 'created_epoch' && params[:desc].to_s.blank?
+ return true
+ end
+
+ params[:desc].to_s == 'true'
+ end
+
+ def sort_column
+ VoicemailMessage.column_names.include?(params[:sort]) ? params[:sort] : 'created_epoch'
end
end
diff --git a/app/controllers/voicemail_settings_controller.rb b/app/controllers/voicemail_settings_controller.rb
index 5de0c35..f270c3d 100644
--- a/app/controllers/voicemail_settings_controller.rb
+++ b/app/controllers/voicemail_settings_controller.rb
@@ -1,92 +1,82 @@
class VoicemailSettingsController < ApplicationController
- load_resource :sip_account
- load_and_authorize_resource :voicemail_setting, :through => :sip_account, :singleton => true
+ load_and_authorize_resource :voicemail_account
+ load_and_authorize_resource :voicemail_setting, :through => [:voicemail_account]
- before_filter :set_and_authorize_parent
before_filter :spread_breadcrumbs
- before_filter :voicemail_defaults, :only => [:index, :show, :new, :create, :edit]
def index
- render :edit
+ @voicemail_settings = @voicemail_account.voicemail_settings
end
def show
- render :edit
end
def new
- render :edit
+ @names_possible = []
+ VoicemailSetting::VOICEMAIL_SETTINGS.keys.each do |name|
+ if @voicemail_account.voicemail_settings.where(:name => name).first
+ next
+ end
+
+ label = t("voicemail_settings.settings.#{name}")
+ if label =~ /^translation missing/
+ label = name.to_s.gsub('_', ' ').capitalize;
+ end
+
+ @names_possible << [label, name]
+ end
end
def create
- @sip_account = SipAccount.where(:id => params[:sip_account_id]).first
- params[:voicemail_setting][:username] = @sip_account.auth_name
- params[:voicemail_setting][:domain] = @sip_account.sip_domain.try(:host)
- @voicemail_setting = VoicemailSetting.new(params[:voicemail_setting])
+ @voicemail_setting = @voicemail_account.voicemail_settings.build(params[:voicemail_setting])
+ @voicemail_setting.class_type = VoicemailSetting::VOICEMAIL_SETTINGS[@voicemail_setting.name]
if @voicemail_setting.save
- redirect_to sip_account_voicemail_settings_path(@sip_account), :notice => t('voicemail_settings.controller.successfuly_created')
+ m = method( :"#{@voicemail_account.voicemail_accountable.class.name.underscore}_voicemail_account_path" )
+ redirect_to m.( @voicemail_account.voicemail_accountable, @voicemail_account ), :notice => t('voicemail_settings.controller.successfuly_created')
else
- render :action => 'edit'
+ render :new
end
end
def edit
-
+ @voicemail_setting = @voicemail_account.voicemail_settings.find(params[:id])
+ @input_type = VoicemailSetting::VOICEMAIL_SETTINGS.fetch(@voicemail_setting.name,{}).fetch(:input, 'String')
+ @input_html = VoicemailSetting::VOICEMAIL_SETTINGS.fetch(@voicemail_setting.name,{}).fetch(:html, {})
end
def update
+ @voicemail_setting = @voicemail_account.voicemail_settings.find(params[:id])
if @voicemail_setting.update_attributes(params[:voicemail_setting])
- redirect_to sip_account_voicemail_settings_path(@sip_account), :notice => t('voicemail_settings.controller.successfuly_updated')
+ m = method( :"#{@voicemail_account.voicemail_accountable.class.name.underscore}_voicemail_account_path" )
+ redirect_to m.( @voicemail_account.voicemail_accountable, @voicemail_account ), :notice => t('voicemail_settings.controller.successfuly_updated')
else
+ @input_type = VoicemailSetting::VOICEMAIL_SETTINGS.fetch(@voicemail_setting.name,{}).fetch(:input, 'String')
+ @input_html = VoicemailSetting::VOICEMAIL_SETTINGS.fetch(@voicemail_setting.name,{}).fetch(:html, {})
render :edit
end
end
def destroy
-
+ @voicemail_setting = @voicemail_account.voicemail_settings.find(params[:id])
+ @voicemail_setting.destroy
+ m = method( :"#{@voicemail_account.voicemail_accountable.class.name.underscore}_voicemail_account_path" )
+ redirect_to m.( @voicemail_account.voicemail_accountable, @voicemail_account ), :notice => t('voicemail_settings.controller.successfuly_destroyed')
end
private
- def set_and_authorize_parent
- @parent = @sip_account
-
- authorize! :read, @parent
-
- @show_path_method = method( :"#{@parent.class.name.underscore}_voicemail_setting_path" )
- @index_path_method = method( :"#{@parent.class.name.underscore}_voicemail_settings_path" )
- @new_path_method = method( :"new_#{@parent.class.name.underscore}_voicemail_setting_path" )
- @edit_path_method = method( :"edit_#{@parent.class.name.underscore}_voicemail_setting_path" )
- end
-
def spread_breadcrumbs
- if @parent.class == SipAccount
- if @sip_account.sip_accountable.class == User
- add_breadcrumb t("#{@sip_account.sip_accountable.class.name.underscore.pluralize}.index.page_title"), method( :"tenant_#{@sip_account.sip_accountable.class.name.underscore.pluralize}_path" ).(@sip_account.tenant)
- add_breadcrumb @sip_account.sip_accountable, method( :"tenant_#{@sip_account.sip_accountable.class.name.underscore}_path" ).(@sip_account.tenant, @sip_account.sip_accountable)
- end
- add_breadcrumb t("sip_accounts.index.page_title"), method( :"#{@sip_account.sip_accountable.class.name.underscore}_sip_accounts_path" ).(@sip_account.sip_accountable)
- add_breadcrumb @sip_account, method( :"#{@sip_account.sip_accountable.class.name.underscore}_sip_account_path" ).(@sip_account.sip_accountable, @sip_account)
- add_breadcrumb t("voicemail_settings.index.page_title"), sip_account_voicemail_settings_path(@sip_account)
+ voicemail_accountable = @voicemail_account.voicemail_accountable
+ if voicemail_accountable.class == User
+ add_breadcrumb t("users.index.page_title"), tenant_users_path(voicemail_accountable.current_tenant)
+ add_breadcrumb voicemail_accountable, tenant_user_path(voicemail_accountable.current_tenant, voicemail_accountable)
end
- end
-
- def voicemail_defaults
- storage_dir = GsParameter.where(:entity => 'voicemail', :section => 'parameters', :name => 'storage-dir').first.try(:value)
- path = "#{storage_dir}/#{@sip_account.sip_domain.host}/#{@sip_account.auth_name}/"
- @greeting_files = Dir.glob("#{path}*greeting*.wav").collect {|r| [ File.basename(r), File.expand_path(r) ] }
- @name_files = Dir.glob("#{path}*name*.wav").collect {|r| [ File.basename(r), File.expand_path(r) ] }
+
+ add_breadcrumb t("voicemail_accounts.index.page_title"), method( :"#{voicemail_accountable.class.name.underscore}_voicemail_accounts_url" ).(voicemail_accountable)
+ add_breadcrumb @voicemail_account.name, method( :"#{voicemail_accountable.class.name.underscore}_voicemail_account_path" ).(voicemail_accountable, @voicemail_account)
+ add_breadcrumb t("voicemail_settings.index.page_title"), voicemail_account_voicemail_settings_url(@voicemail_account)
- if @voicemail_setting.blank? then
- @voicemail_setting = @sip_account.voicemail_setting
- end
-
- if @voicemail_setting.blank?
- @voicemail_setting = VoicemailSetting.new
- @voicemail_setting.notify = true
- @voicemail_setting.attachment = true
- @voicemail_setting.mark_read = true
- @voicemail_setting.purge = false
+ if !@voicemail_setting.to_s.blank?
+ add_breadcrumb @voicemail_setting
end
end
-
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index de4d677..2c420c4 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -19,4 +19,22 @@ module ApplicationHelper
end
end
+ def sortable(column, title)
+ if !defined?(sort_descending)
+ return title
+ end
+
+ if column.to_s == sort_column.to_s
+ link_class = "sort_descending #{sort_descending}"
+ desc = !!(!sort_descending && column)
+ icon = sort_descending ? ' <i class = "icon-chevron-up"></i> ' : ' <i class = "icon-chevron-down"></i> '
+ else
+ link_class = nil
+ desc = nil
+ icon = ''
+ end
+
+ link_to raw('') + title + raw(icon), {:sort => column, :desc => desc, :type => @type}, {:class => link_class}
+ end
+
end
diff --git a/app/helpers/generic_files_helper.rb b/app/helpers/generic_files_helper.rb
new file mode 100644
index 0000000..6e067ed
--- /dev/null
+++ b/app/helpers/generic_files_helper.rb
@@ -0,0 +1,2 @@
+module GenericFilesHelper
+end
diff --git a/app/helpers/pager_group_destinations_helper.rb b/app/helpers/pager_group_destinations_helper.rb
new file mode 100644
index 0000000..46436dd
--- /dev/null
+++ b/app/helpers/pager_group_destinations_helper.rb
@@ -0,0 +1,2 @@
+module PagerGroupDestinationsHelper
+end
diff --git a/app/helpers/pager_groups_helper.rb b/app/helpers/pager_groups_helper.rb
new file mode 100644
index 0000000..ac8d9fb
--- /dev/null
+++ b/app/helpers/pager_groups_helper.rb
@@ -0,0 +1,2 @@
+module PagerGroupsHelper
+end
diff --git a/app/helpers/voicemail_accounts_helper.rb b/app/helpers/voicemail_accounts_helper.rb
new file mode 100644
index 0000000..5a75e18
--- /dev/null
+++ b/app/helpers/voicemail_accounts_helper.rb
@@ -0,0 +1,2 @@
+module VoicemailAccountsHelper
+end
diff --git a/app/mailers/notifications.rb b/app/mailers/notifications.rb
index 5b46f23..44a6a7a 100644
--- a/app/mailers/notifications.rb
+++ b/app/mailers/notifications.rb
@@ -42,20 +42,11 @@ class Notifications < ActionMailer::Base
mail(from: Tenant.find(GsParameter.get('DEFAULT_API_TENANT_ID')).from_field_pin_change_email, to: "#{user.email}", :subject => "Password recovery")
end
- def new_voicemail(freeswitch_voicemail_msg, attach_file = false)
- sip_account = SipAccount.find_by_auth_name(freeswitch_voicemail_msg.username)
- user = sip_account.sip_accountable
-
+ def new_voicemail(freeswitch_voicemail_msg, account, email, attach_file = false)
@voicemail = Hash.new()
- if ! user.first_name.blank?
- @voicemail[:greeting] = user.first_name
- else
- @voicemail[:greeting] = user.user_name
- end
-
@voicemail[:destination] = freeswitch_voicemail_msg.in_folder
@voicemail[:from] = "#{freeswitch_voicemail_msg.cid_number} #{freeswitch_voicemail_msg.cid_name}"
- @voicemail[:to] = sip_account.to_s
+ @voicemail[:to] = account.to_s
@voicemail[:date] = Time.at(freeswitch_voicemail_msg.created_epoch).getlocal.to_s
@voicemail[:duration] = Time.at(freeswitch_voicemail_msg.message_len).utc.strftime('%T')
@@ -67,7 +58,7 @@ class Notifications < ActionMailer::Base
attachments["#{Time.at(freeswitch_voicemail_msg.created_epoch).getlocal.strftime('%Y%m%d-%H%M%S')}-#{caller_number}.wav"] = File.read(freeswitch_voicemail_msg.file_path)
end
- mail(from: Tenant.find(GsParameter.get('DEFAULT_API_TENANT_ID')).from_field_voicemail_email, to: "#{user.email}", :subject => "New Voicemail from #{@voicemail[:from]}, received #{Time.at(freeswitch_voicemail_msg.created_epoch).getlocal.to_s}")
+ mail(from: Tenant.find(GsParameter.get('DEFAULT_API_TENANT_ID')).from_field_voicemail_email, to: email, :subject => "New Voicemail from #{@voicemail[:from]}, received #{Time.at(freeswitch_voicemail_msg.created_epoch).getlocal.to_s}")
end
def new_fax(fax_document)
diff --git a/app/models/ability.rb b/app/models/ability.rb
index 2dd96b8..8718dc4 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -181,8 +181,11 @@ class Ability
# Voicemail
#
+ can :read, VoicemailAccount
can :manage, VoicemailMessage
- can :manage, VoicemailSetting
+ can [:read, :edit, :update], VoicemailSetting
+
+ can :manage, GenericFile, :owner_type => 'User', :owner_id => user.id
# Switchboard
#
diff --git a/app/models/backup_job.rb b/app/models/backup_job.rb
index 9cb4f53..e2f2e6c 100644
--- a/app/models/backup_job.rb
+++ b/app/models/backup_job.rb
@@ -37,7 +37,7 @@ class BackupJob < ActiveRecord::Base
if tmp_backup_directory.blank?
self.state = 'failed'
else
- system "cd #{backup_directory} && nice -n 19 sudo /bin/tar czf #{backup_name_prefix}#{File.basename(tmp_backup_directory)}.tar.gz #{File.basename(tmp_backup_directory)}"
+ system "cd #{backup_directory} && nice -n 19 ionice -c2 -n7 sudo /bin/tar czf #{backup_name_prefix}#{File.basename(tmp_backup_directory)}.tar.gz #{File.basename(tmp_backup_directory)}"
require 'fileutils'
FileUtils.rm_rf tmp_backup_directory
file = File::Stat.new("#{backup_directory}/#{backup_name_prefix}#{File.basename(tmp_backup_directory)}.tar.gz")
diff --git a/app/models/call.rb b/app/models/call.rb
index a8a0d7f..2bbd08b 100644
--- a/app/models/call.rb
+++ b/app/models/call.rb
@@ -36,7 +36,7 @@ class Call < ActiveRecord::Base
def delete
require 'freeswitch_event'
- return FreeswitchAPI.execute('uuid_kill', self.uuid, true);
+ return FreeswitchAPI.execute('uuid_kill', self.uuid, true)
end
def transfer_blind(destination, call_leg=:aleg, auth_account=nil)
@@ -63,6 +63,25 @@ class Call < ActiveRecord::Base
return FreeswitchAPI.api_result(FreeswitchAPI.api('uuid_transfer', channel_uuid, destination))
end
+
+ def self.bridge(call_uuid1, call_uuid2, hangup_uuids=[])
+ if call_uuid1.blank? || call_uuid2.blank?
+ return nil
+ end
+
+ require 'freeswitch_event'
+ result = FreeswitchAPI.api_result(FreeswitchAPI.api('uuid_bridge', call_uuid1, call_uuid2))
+
+ if result
+ hangup_uuids.each do |kill_uuid|
+ FreeswitchAPI.execute('uuid_kill', kill_uuid, true)
+ end
+ end
+
+ return result
+ end
+
+
def get_variable_from_uuid(channel_uuid, variable_name)
if channel_uuid.blank?
return nil
diff --git a/app/models/call_forward.rb b/app/models/call_forward.rb
index 195ac36..a4bfbb5 100644
--- a/app/models/call_forward.rb
+++ b/app/models/call_forward.rb
@@ -2,7 +2,7 @@ class CallForward < ActiveRecord::Base
attr_accessor :to_voicemail, :hunt_group_id
- attr_accessible :phone_number_id, :call_forward_case_id, :timeout,
+ attr_accessible :call_forward_case_id, :timeout,
:destination, :source, :depth, :active, :to_voicemail,
:hunt_group_id,
:call_forwardable_type, :call_forwardable_id,
@@ -56,7 +56,8 @@ class CallForward < ActiveRecord::Base
end
}
- before_save :split_and_format_destination_numbers
+ before_validation :resolve_prerouting
+
after_save :set_presence
after_save :deactivate_concurring_entries, :if => Proc.new { |cf| cf.active == true }
before_destroy :deactivate_connected_softkeys
@@ -71,7 +72,7 @@ class CallForward < ActiveRecord::Base
else
destinationable_type = " #{self.destinationable_type}"
end
- if self.destinationable
+ if Module.constants.include?(destinationable_type.to_sym) && self.destinationable
destination = "#{self.destinationable}#{destinationable_type}"
else
destination = "#{self.destination}#{destinationable_type}"
@@ -102,19 +103,6 @@ class CallForward < ActiveRecord::Base
end
private
- def split_and_format_destination_numbers
- if !self.destination.blank?
- destinations = self.destination.gsub(/[^+0-9\,]/,'').gsub(/[\,]+/,',').split(/\,/).delete_if{|x| x.blank?}
- self.destination = nil
- if destinations.count > 0
- destinations.each do |single_destination|
- self.destination = self.destination.to_s + ", #{PhoneNumber.parse_and_format(single_destination)}"
- end
- end
- self.destination = self.destination.to_s.gsub(/[^+0-9\,]/,'').gsub(/[\,]+/,',').split(/\,/).sort.delete_if{|x| x.blank?}.join(', ')
- end
- end
-
def set_presence
state = 'terminated'
@@ -149,6 +137,18 @@ class CallForward < ActiveRecord::Base
end
end
+ def resolve_prerouting
+ if self.destinationable_type == 'PhoneNumber' && GsParameter.get('CALLFORWARD_DESTINATION_RESOLVE') != false
+ if self.call_forwardable.class == PhoneNumber
+ prerouting = PhoneNumber.resolve_prerouting(self.destination, self.call_forwardable.phone_numberable)
+ else
+ prerouting = PhoneNumber.resolve_prerouting(self.destination, self.call_forwardable)
+ end
+ if prerouting && !prerouting['destination_number'].blank? && prerouting['type'] == 'phonenumber'
+ self.destination = prerouting['destination_number']
+ end
+ end
+ end
def send_presence_event(state, call_forwarding_service = nil)
dialplan_function = "cftg-#{self.id}"
diff --git a/app/models/call_history.rb b/app/models/call_history.rb
index 81342bd..8ccf4e3 100644
--- a/app/models/call_history.rb
+++ b/app/models/call_history.rb
@@ -133,19 +133,14 @@ class CallHistory < ActiveRecord::Base
end
- def voicemail_message?
- begin
- return self.call_historyable.voicemail_messages.where(:forwarded_by => self.caller_channel_uuid).any?
- rescue
- return nil
- end
- end
-
def voicemail_message
- begin
- return self.call_historyable.voicemail_messages.where(:forwarded_by => self.caller_channel_uuid).first
- rescue
- return nil
+ if self.callee_account_type.downcase == 'voicemailaccount'
+ voicemail_account = VoicemailAccount.where(:id => self.callee_account_id).first
+ if voicemail_account
+ return voicemail_account.voicemail_messages.where(:forwarded_by => self.caller_channel_uuid).first
+ else
+ return nil
+ end
end
end
diff --git a/app/models/call_route.rb b/app/models/call_route.rb
index 590d49b..7b98e5d 100644
--- a/app/models/call_route.rb
+++ b/app/models/call_route.rb
@@ -15,6 +15,8 @@ class CallRoute < ActiveRecord::Base
acts_as_list :scope => '`routing_table` = \'#{routing_table}\''
+ after_save :create_elements
+
def to_s
name.to_s
end
@@ -253,6 +255,47 @@ class CallRoute < ActiveRecord::Base
end
end
+ def xml
+ @xml
+ end
+
+ def xml=(xml_string)
+ @xml = xml_string
+ if xml_string.blank?
+ return
+ end
+
+ begin
+ route_hash = Hash.from_xml(xml_string)
+ rescue Exception => e
+ errors.add(:xml, e.message)
+ return
+ end
+
+ if route_hash['call_route'].class == Hash
+ call_route = route_hash['call_route']
+ self.routing_table = call_route['routing_table'].downcase
+ self.name = call_route['name'].downcase
+ self.position = call_route['position']
+ self.endpoint_type = call_route['endpoint_type']
+ endpoint_from_type_name(call_route['endpoint_type'], call_route['endpoint'])
+
+ if route_hash['call_route']['route_elements'] && route_hash['call_route']['route_elements']['route_element']
+ if route_hash['call_route']['route_elements']['route_element'].class == Hash
+ @elements_array = [route_hash['call_route']['route_elements']['route_element']]
+ else
+ @elements_array = route_hash['call_route']['route_elements']['route_element']
+ end
+ end
+ elsif route_hash['route_elements'].class == Hash && route_hash['route_elements']['route_element']
+ if route_hash['route_elements']['route_element'].class == Hash
+ @elements_array = [route_hash['route_elements']['route_element']]
+ else
+ @elements_array = route_hash['route_elements']['route_element']
+ end
+ end
+
+ end
def self.test_route(table, caller)
arguments = ["'#{table}' table"]
@@ -269,4 +312,27 @@ class CallRoute < ActiveRecord::Base
return JSON.parse(result)
end
+ private
+ def endpoint_from_type_name(endpoint_type, endpoint_name)
+ endpoint_type = endpoint_type.to_s.downcase
+ if endpoint_type == 'phonenumber'
+ self.endpoint_type = 'PhoneNumber'
+ self.endpoint_id = nil
+ elsif endpoint_type == 'gateway'
+ gateway = Gateway.where(:name => endpoint_name).first
+ if gateway
+ self.endpoint_type ='Gateway'
+ self.endpoint_id = gateway.id
+ end
+ end
+ end
+
+ def create_elements
+ if @elements_array && @elements_array.any?
+ @elements_array.each do |element_hash|
+ element = self.route_elements.create(element_hash)
+ end
+ end
+ end
+
end
diff --git a/app/models/fax_account.rb b/app/models/fax_account.rb
index 683447a..2677c5d 100644
--- a/app/models/fax_account.rb
+++ b/app/models/fax_account.rb
@@ -49,6 +49,7 @@ class FaxAccount < ActiveRecord::Base
tenant = case self.fax_accountable_type
when 'UserGroup' ; fax_accountable.tenant
when 'User' ; fax_accountable.current_tenant || fax_accountable.tenants.last
+ when 'Tenant' ; fax_accountable
else nil
end
self.tenant_id = tenant.id if tenant != nil
diff --git a/app/models/gateway.rb b/app/models/gateway.rb
index bf391fb..01b29b2 100644
--- a/app/models/gateway.rb
+++ b/app/models/gateway.rb
@@ -19,6 +19,8 @@ class Gateway < ActiveRecord::Base
after_initialize :set_defaults
before_validation :downcase_technology
+ after_create :create_default_settings
+
def to_s
name
end
@@ -65,4 +67,12 @@ class Gateway < ActiveRecord::Base
end
end
+ def create_default_settings
+ if self.technology == 'sip' then
+ GsParameter.where(:entity => 'sip_gateways', :section => 'settings').each do |default_setting|
+ self.gateway_settings.create(:name => default_setting.name, :value => default_setting.value, :class_type => default_setting.class_type, :description => default_setting.description)
+ end
+ end
+ end
+
end
diff --git a/app/models/gateway_setting.rb b/app/models/gateway_setting.rb
index b412bc6..e96bb52 100644
--- a/app/models/gateway_setting.rb
+++ b/app/models/gateway_setting.rb
@@ -14,6 +14,10 @@ class GatewaySetting < ActiveRecord::Base
'contact' => 'String',
'dial_string' => 'String',
'profile' => 'String',
+ 'from' => 'String',
+ 'from_clir' => 'String',
+ 'asserted_identity' => 'String',
+ 'asserted_identity_clir' => 'String',
},
'xmpp' => {
'server' => 'String',
diff --git a/app/models/gemeinschaft_setup.rb b/app/models/gemeinschaft_setup.rb
index 4b4dd37..ee8e981 100644
--- a/app/models/gemeinschaft_setup.rb
+++ b/app/models/gemeinschaft_setup.rb
@@ -20,6 +20,28 @@ class GemeinschaftSetup < ActiveRecord::Base
before_validation :format_default_area_code
+ def detect_attacks
+ if self[:detect_attacks] == nil
+ return true
+ end
+ return self[:detect_attacks]
+ end
+
+ def detect_attacks=(value)
+ self[:detect_attacks] = value
+ end
+
+ def report_attacks
+ if self[:report_attacks] == nil
+ return true
+ end
+ return self[:report_attacks]
+ end
+
+ def report_attacks=(value)
+ self[:report_attacks] = value
+ end
+
private
def expire_cache
ActionController::Base.expire_page(Rails.application.routes.url_helpers.new_gemeinschaft_setup_path)
diff --git a/app/models/generic_file.rb b/app/models/generic_file.rb
new file mode 100644
index 0000000..0e4dce5
--- /dev/null
+++ b/app/models/generic_file.rb
@@ -0,0 +1,62 @@
+class GenericFile < ActiveRecord::Base
+ FILE_TYPES = %w(pdf ps jpg gif png tif wav mp3)
+ CATEGORIES = %w(file document image greeting recording)
+
+ attr_accessible :name, :file, :file_type, :category, :owner_id, :owner_type
+
+ mount_uploader :file, GenericFileUploader
+
+ belongs_to :owner, :polymorphic => true
+
+ validates :name,
+ :presence => true,
+ :uniqueness => {:scope => [:owner_id, :owner_type]}
+
+ validates :file,
+ :presence => true
+
+ before_save :determine_file_type
+
+ def to_s
+ self.name
+ end
+
+ def store_dir
+ "/var/opt/gemeinschaft/generic_files/#{self.id.to_i}"
+ end
+
+ def mime_type
+ return GenericFile.mime_type(self.file.to_s)
+ end
+
+ def self.mime_type(file_name)
+ mime_type = `file -b --mime-type "#{file_name}"`.strip
+ if mime_type.blank?
+ mime_type = MIME::Types.type_for(file_name).first.to_s
+ end
+
+ return mime_type
+ end
+
+ def file_size
+ if self.file
+ return File.size(self.file.to_s)
+ else
+ return 0
+ end
+ end
+
+ def file_extension
+ mime_type = Mime::LOOKUP[self.file_type]
+ if mime_type.class == Mime::Type
+ return mime_type.symbol
+ end
+ end
+
+ private
+ def determine_file_type
+ if self.file_changed?
+ self.file_type = self.mime_type
+ end
+ end
+end
diff --git a/app/models/geo_ip_country.rb b/app/models/geo_ip_country.rb
new file mode 100644
index 0000000..add95d3
--- /dev/null
+++ b/app/models/geo_ip_country.rb
@@ -0,0 +1,16 @@
+class GeoIpCountry < ActiveRecord::Base
+ attr_accessible :country_code, :country_id, :country_name, :from, :n_from, :n_to, :to
+
+ def self.ip_to_i(ip_address)
+ octets = ip_address.split('.')
+ return (octets[0].to_i * 2**24) + (octets[1].to_i * 2**16) + (octets[2].to_i * 2**8) + octets[3].to_i
+ end
+
+ def self.find_by_ip(ip_address)
+ GeoIpCountry.where(GeoIpCountry.ip_to_i(ip_address).to_s + ' BETWEEN n_from AND n_to').first
+ end
+
+ def to_s
+ self.country_name
+ end
+end
diff --git a/app/models/group.rb b/app/models/group.rb
index 6c65f70..849fa71 100644
--- a/app/models/group.rb
+++ b/app/models/group.rb
@@ -29,4 +29,12 @@ class Group < ActiveRecord::Base
return group_ids.uniq
end
+
+ def self.target_group_ids_by_permission(permission, *group_sets)
+ target_groups = []
+ group_sets.each do |groups|
+ target_groups = target_groups + Group.union(groups.collect{|g| g.permission_targets(permission)})
+ end
+ return target_groups.uniq
+ end
end
diff --git a/app/models/group_permission.rb b/app/models/group_permission.rb
index c859f52..d9c8011 100644
--- a/app/models/group_permission.rb
+++ b/app/models/group_permission.rb
@@ -1,7 +1,7 @@
class GroupPermission < ActiveRecord::Base
attr_accessible :group_id, :permission, :target_group_id
- PERMISSION_TYPES = ['pickup', 'presence']
+ PERMISSION_TYPES = ['pickup', 'presence', 'forward_to',]
belongs_to :group
belongs_to :target_group, :class_name => "Group"
diff --git a/app/models/gs_parameter.rb b/app/models/gs_parameter.rb
index cd4f47b..f301e95 100644
--- a/app/models/gs_parameter.rb
+++ b/app/models/gs_parameter.rb
@@ -17,22 +17,37 @@ class GsParameter < ActiveRecord::Base
else
item = GsParameter.where(:name => wanted_variable).first
end
- if item.nil? || item.class_type == 'Nil'
- return nil
- else
- return item.value.to_i if item.class_type == 'Integer'
- return item.value.to_s if item.class_type == 'String'
- if item.class_type == 'Boolean'
- return true if item.value == 'true'
- return false if item.value == 'false'
- end
- return YAML.load(item.value) if item.class_type == 'YAML'
- end
+ return GsParameter.cast_variable(item)
else
nil
end
end
+ def self.get_list(entity, section)
+ items = {}
+ if GsParameter.table_exists?
+ GsParameter.where(:entity => entity, :section => section).each do |item|
+ items[item.name] = GsParameter.cast_variable(item)
+ end
+ end
+
+ return items
+ end
+
+ def self.cast_variable(item)
+ if item.nil? || item.class_type == 'Nil'
+ return nil
+ else
+ return item.value.to_i if item.class_type == 'Integer'
+ return item.value.to_s if item.class_type == 'String'
+ if item.class_type == 'Boolean'
+ return true if item.value == 'true'
+ return false if item.value == 'false'
+ end
+ return YAML.load(item.value) if item.class_type == 'YAML'
+ end
+ end
+
def to_s
name
end
diff --git a/app/models/intruder.rb b/app/models/intruder.rb
index 9c01634..c305bd3 100644
--- a/app/models/intruder.rb
+++ b/app/models/intruder.rb
@@ -25,6 +25,10 @@ class Intruder < ActiveRecord::Base
key
end
+ def country
+ GeoIpCountry.find_by_ip(self.contact_ip)
+ end
+
def whois(ip_address = self.contact_ip)
if ! ip_address.blank?
begin
diff --git a/app/models/pager_group.rb b/app/models/pager_group.rb
new file mode 100644
index 0000000..5c91ed8
--- /dev/null
+++ b/app/models/pager_group.rb
@@ -0,0 +1,36 @@
+class PagerGroup < ActiveRecord::Base
+ attr_accessible :sip_account_id, :callback_url
+ attr_writer :pager_group_destination_ids
+
+ has_many :pager_group_destinations, :dependent => :destroy
+ belongs_to :sip_account
+
+ validates_presence_of :sip_account_id
+
+ after_create :call
+ before_destroy :hangup_all
+
+ before_save :save_pager_group_destination_ids
+
+ def save_pager_group_destination_ids
+ if @pager_group_destination_ids
+ self.pager_group_destination_ids = @pager_group_destination_ids.split(/,/).map { |sip_account_id| self.pager_group_destinations.build(:sip_account_id => sip_account_id) }
+ end
+ end
+
+ def identifier
+ "pager#{self.id}"
+ end
+
+ def call
+ self.sip_account.call("f-pager-#{self.id}")
+ end
+
+ def hangup_all
+ require 'freeswitch_event'
+ return FreeswitchAPI.execute(
+ 'conference', "#{self.identifier} hup all",
+ true
+ );
+ end
+end
diff --git a/app/models/pager_group_destination.rb b/app/models/pager_group_destination.rb
new file mode 100644
index 0000000..98a1b32
--- /dev/null
+++ b/app/models/pager_group_destination.rb
@@ -0,0 +1,15 @@
+class PagerGroupDestination < ActiveRecord::Base
+ attr_accessible :pager_group_id, :sip_account_id
+
+ belongs_to :pager_group
+ belongs_to :sip_account
+
+ validates_presence_of :pager_group_id
+ validates_presence_of :sip_account_id
+
+ after_create :call
+
+ def call
+ self.sip_account.call("f-pager-#{self.pager_group_id}", '', "Pager #{self.id}")
+ end
+end
diff --git a/app/models/phone_book_entry.rb b/app/models/phone_book_entry.rb
index 96c8468..2a094f7 100644
--- a/app/models/phone_book_entry.rb
+++ b/app/models/phone_book_entry.rb
@@ -1,7 +1,7 @@
# encoding: UTF-8
class PhoneBookEntry < ActiveRecord::Base
- PHONE_NUMBER_NAMES = ['Phone', 'Office', 'Home', 'Mobile', 'Fax']
+ PHONE_NUMBER_NAMES = ['Phone', 'Office', 'Home', 'Mobile', 'Fax', 'Speeddial']
before_save :run_phonetic_algorithm
before_save :save_value_of_to_s
diff --git a/app/models/phone_number.rb b/app/models/phone_number.rb
index f6453ce..4f92731 100644
--- a/app/models/phone_number.rb
+++ b/app/models/phone_number.rb
@@ -16,7 +16,6 @@ class PhoneNumber < ActiveRecord::Base
validate :validate_inbound_uniqueness
before_save :save_value_of_to_s
- after_create :copy_existing_call_forwards_if_necessary
before_validation :'parse_and_split_number!'
validate :validate_number, :if => Proc.new { |phone_number| GsParameter.get('STRICT_INTERNAL_EXTENSION_HANDLING') && GsParameter.get('STRICT_DID_HANDLING') }
validate :check_if_number_is_available, :if => Proc.new { |phone_number| GsParameter.get('STRICT_INTERNAL_EXTENSION_HANDLING') && GsParameter.get('STRICT_DID_HANDLING') }
@@ -210,6 +209,10 @@ class PhoneNumber < ActiveRecord::Base
self.central_office_code = nil
self.extension = self.number.to_s.strip
else
+ prerouting = resolve_prerouting
+ if prerouting && !prerouting['destination_number'].blank? && prerouting['type'] == 'phonenumber'
+ self.number = prerouting['destination_number']
+ end
parsed_number = PhoneNumber.parse( self.number )
if parsed_number
self.country_code = parsed_number[:country_code]
@@ -223,6 +226,28 @@ class PhoneNumber < ActiveRecord::Base
end
end
end
+
+ def resolve_prerouting
+ return PhoneNumber.resolve_prerouting(self.number.strip, self.phone_numberable)
+ end
+
+ def self.resolve_prerouting(number, account = nil)
+ account = account || SipAccount.first
+
+ routes = CallRoute.test_route(:prerouting, {
+ 'caller.destination_number' => number,
+ 'caller.auth_account_type' => account.class.name,
+ 'caller.auth_account_id' => account.id,
+ 'caller.auth_account_uuid' => account.try(:uuid),
+ 'caller.account_type' => account.class.name,
+ 'caller.account_id' => account.id,
+ 'caller.account_uuid' => account.try(:uuid),
+ })
+
+ if routes
+ return routes['routes']['1']
+ end
+ end
# Find the (grand-)parent tenant of this phone number:
#
@@ -287,18 +312,4 @@ class PhoneNumber < ActiveRecord::Base
def save_value_of_to_s
self.value_of_to_s = self.to_s
end
-
- def copy_existing_call_forwards_if_necessary
- if self.phone_numberable.class == SipAccount && self.phone_numberable.callforward_rules_act_per_sip_account == true
- sip_account = SipAccount.find(self.phone_numberable)
- if sip_account.phone_numbers.where('id != ?', self.id).count > 0
- if sip_account.phone_numbers.where('id != ?', self.id).order(:created_at).first.call_forwards.count > 0
- sip_account.phone_numbers.where('id != ?', self.id).first.call_forwards.each do |call_forward|
- call_forward.set_this_callforward_rule_to_all_phone_numbers_of_the_parent_sip_account
- end
- end
- end
- end
- end
-
end
diff --git a/app/models/sip_account.rb b/app/models/sip_account.rb
index 0c923be..668fbfe 100644
--- a/app/models/sip_account.rb
+++ b/app/models/sip_account.rb
@@ -6,7 +6,8 @@ class SipAccount < ActiveRecord::Base
attr_accessible :auth_name, :caller_name, :password, :voicemail_pin,
:tenant_id, :call_waiting, :clir, :clip_no_screening,
:clip, :description, :callforward_rules_act_per_sip_account,
- :hotdeskable, :gs_node_id, :language_code
+ :hotdeskable, :gs_node_id, :language_code, :voicemail_account_id
+
# Associations:
#
@@ -27,8 +28,6 @@ class SipAccount < ActiveRecord::Base
has_many :call_histories, :as => :call_historyable, :dependent => :destroy
- has_one :voicemail_setting, :class_name => "VoicemailSetting", :primary_key => 'auth_name', :foreign_key => 'username', :dependent => :destroy
-
belongs_to :gs_node
belongs_to :language, :foreign_key => 'language_code', :primary_key => 'code'
@@ -44,6 +43,11 @@ class SipAccount < ActiveRecord::Base
has_many :acd_agents, :as => :destination, :dependent => :destroy
has_many :switchboard_entries, :dependent => :destroy
+ has_many :voicemail_accounts, :as => :voicemail_accountable, :dependent => :destroy
+ belongs_to :voicemail_account
+
+ has_many :pager_groups, :dependent => :destroy
+
# Delegations:
#
delegate :host, :to => :sip_domain, :allow_nil => true
@@ -58,15 +62,11 @@ class SipAccount < ActiveRecord::Base
validate_sip_password :password
- validates_format_of :voicemail_pin, :with => /[0-9]+/,
- :allow_nil => true, :allow_blank => true
-
validates_uniqueness_of :auth_name, :scope => :sip_domain_id
# Before and after hooks:
#
before_save :save_value_of_to_s
- after_save :create_voicemail_setting, :if => :'voicemail_setting == nil'
before_validation :find_and_set_tenant_id
before_validation :set_sip_domain_id
before_validation :convert_umlauts_in_caller_name
@@ -154,11 +154,12 @@ class SipAccount < ActiveRecord::Base
return SipRegistration.where(:sip_user => self.auth_name).first
end
- def call( phone_number )
+ def call( phone_number, origin_cid_number = nil, origin_cid_name = 'Call' )
+ origin_cid_number = origin_cid_number || phone_number
require 'freeswitch_event'
return FreeswitchAPI.execute(
'originate',
- "{origination_uuid=#{UUID.new.generate},origination_caller_id_number='#{phone_number}',origination_caller_id_name='Call'}user/#{self.auth_name} #{phone_number}",
+ "{origination_uuid=#{UUID.new.generate},origination_caller_id_number='#{phone_number}',origination_caller_id_name='#{origin_cid_name}'}user/#{self.auth_name} #{phone_number}",
true
);
end
@@ -279,18 +280,6 @@ class SipAccount < ActiveRecord::Base
end
end
- def create_voicemail_setting
- voicemail_setting = VoicemailSetting.new()
- voicemail_setting.username = self.auth_name
- voicemail_setting.domain = self.sip_domain.try(:host)
- voicemail_setting.password = self.voicemail_pin
- voicemail_setting.notify = true
- voicemail_setting.attachment = true
- voicemail_setting.mark_read = true
- voicemail_setting.purge = false
- voicemail_setting.save
- end
-
def create_default_group_memberships
default_groups = Hash.new()
templates = GsParameter.get('SipAccount', 'group', 'default')
diff --git a/app/models/softkey.rb b/app/models/softkey.rb
index 27527f9..7e9b66d 100644
--- a/app/models/softkey.rb
+++ b/app/models/softkey.rb
@@ -35,10 +35,9 @@ class Softkey < ActiveRecord::Base
map{ |phone_number| phone_number.phone_numberable.hunt_group.id }.
uniq
- call_forwards = call_forwards + CallForward.where(:destinationable_type => 'HuntGroup', :destinationable_id => hunt_group_ids, :call_forwardable_type => 'PhoneNumber').
- where('call_forwardable_id NOT IN (?)', phone_numbers_ids)
+ call_forwards = call_forwards + CallForward.where(:destinationable_type => 'HuntGroup', :destinationable_id => hunt_group_ids, :call_forward_case_id => CallForwardCase.where(:value => 'assistant').first.try(:id))
- return call_forwards
+ return call_forwards.uniq
end
def possible_blf_sip_accounts
diff --git a/app/models/switchboard.rb b/app/models/switchboard.rb
index 74e2767..095f878 100644
--- a/app/models/switchboard.rb
+++ b/app/models/switchboard.rb
@@ -6,11 +6,43 @@ class Switchboard < ActiveRecord::Base
:presence => true,
:uniqueness => {:scope => :user_id}
+ validates :reload_interval,
+ :numericality => { :only_integer => true,
+ :greater_than => 249,
+ :allow_nil => true
+ }
+
+ validates :entry_width,
+ :numericality => { :only_integer => true,
+ :greater_than => 0,
+ :less_than => 5
+ }
+
+ validates :amount_of_displayed_phone_numbers,
+ :numericality => { :only_integer => true,
+ :greater_than_or_equal_to => 0,
+ :less_than => 20
+ }
+
belongs_to :user, :touch => true
has_many :switchboard_entries, :dependent => :destroy
has_many :sip_accounts, :through => :switchboard_entries
+ has_many :phone_numbers, :through => :sip_accounts
+
+ before_validation :convert_0_to_nil
def to_s
self.name.to_s
end
+
+ def active_calls
+ self.switchboard_entries.where(:switchable => true).map{|se| se.sip_account}.uniq.map{|sip_account| sip_account.calls}.flatten
+ end
+
+ private
+ def convert_0_to_nil
+ if self.reload_interval == 0
+ self.reload_interval = nil
+ end
+ end
end
diff --git a/app/models/switchboard_entry.rb b/app/models/switchboard_entry.rb
index 76d002f..44de7fd 100644
--- a/app/models/switchboard_entry.rb
+++ b/app/models/switchboard_entry.rb
@@ -5,6 +5,8 @@ class SwitchboardEntry < ActiveRecord::Base
belongs_to :switchboard, :touch => true
belongs_to :sip_account, :touch => true
+ has_many :phone_numbers, :through => :sip_account
+
validates :switchboard,
:presence => true
@@ -28,4 +30,37 @@ class SwitchboardEntry < ActiveRecord::Base
self.name.to_s
end
end
+
+ def avatar_src
+ if self.sip_account.sip_accountable.class == User
+ if self.sip_account.sip_accountable.image?
+ self.sip_account.sip_accountable.image_url(:profile)
+ else
+ if self.sip_account.sip_accountable.male?
+ '/assets/icons/user-male-16x.png'
+ else
+ '/assets/icons/user-female-16x.png'
+ end
+ end
+ else
+ nil
+ end
+ end
+
+ def callstate
+ if self.sip_account.call_legs.where(callstate: 'ACTIVE').any? || self.sip_account.b_call_legs.where(b_callstate: 'ACTIVE').any?
+ 'ACTIVE'
+ else
+ if self.sip_account.call_legs.where(callstate: 'EARLY').any?
+ 'EARLY'
+ else
+ if self.sip_account.call_legs.where(callstate: 'RINGING').any?
+ 'RINGING'
+ else
+ nil
+ end
+ end
+ end
+ end
+
end
diff --git a/app/models/tenant.rb b/app/models/tenant.rb
index ffa68a7..c70ec32 100644
--- a/app/models/tenant.rb
+++ b/app/models/tenant.rb
@@ -63,6 +63,10 @@ class Tenant < ActiveRecord::Base
has_many :group_memberships, :as => :item, :dependent => :destroy, :uniq => true
has_many :groups, :through => :group_memberships
+ has_many :voicemail_accounts, :as => :voicemail_accountable, :dependent => :destroy
+
+ has_many :generic_files, :as => :owner, :dependent => :destroy
+
# Validations:
#
validates_presence_of :name, :state, :country, :language
@@ -210,6 +214,14 @@ class Tenant < ActiveRecord::Base
self.array_of_available_internal_extensions + self.array_of_available_dids
end
+ def tenant_user_sip_accounts
+ SipAccount.where('(sip_accountable_type = "Tenant" AND sip_accountable_id = ?) OR (sip_accountable_type = "User" AND sip_accountable_id IN (?))', self.id, self.users.pluck(:id))
+ end
+
+ def tenant_user_phones
+ Phone.where('(phoneable_type = "Tenant" AND phoneable_id = ?) OR (phoneable_type = "User" AND phoneable_id IN (?))', self.id, self.users.pluck(:id))
+ end
+
private
# Create a public phone book for this tenant
diff --git a/app/models/user.rb b/app/models/user.rb
index b74fc06..5e97459 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -94,6 +94,10 @@ class User < ActiveRecord::Base
has_many :switchboards, :dependent => :destroy
+ has_many :voicemail_accounts, :as => :voicemail_accountable, :dependent => :destroy
+
+ has_many :generic_files, :as => :owner, :dependent => :destroy
+
# Avatar like photo
mount_uploader :image, ImageUploader
diff --git a/app/models/voicemail_account.rb b/app/models/voicemail_account.rb
new file mode 100644
index 0000000..8ec181f
--- /dev/null
+++ b/app/models/voicemail_account.rb
@@ -0,0 +1,64 @@
+class VoicemailAccount < ActiveRecord::Base
+ attr_accessible :uuid, :name, :active, :gs_node_id, :voicemail_accountable_type, :voicemail_accountable_id
+
+ belongs_to :voicemail_accountable, :polymorphic => true
+ has_many :voicemail_settings
+ has_many :voicemail_messages, :foreign_key => 'username', :primary_key => 'name'
+
+ validates :name,
+ :presence => true,
+ :uniqueness => true
+
+ validates :voicemail_accountable_id,
+ :presence => true
+
+ validates :voicemail_accountable_type,
+ :presence => true
+
+ def to_s
+ "#{voicemail_accountable.to_s}: #{name}"
+ end
+
+ def notify_to
+ send_notification = nil
+ if self.voicemail_settings.where(:name => 'notify', :value => true).first
+ send_notification = true
+ elsif self.voicemail_settings.where(:name => 'notify', :value => false).first
+ send_notification = false
+ end
+
+ if send_notification == nil
+ send_notification = GsParameter.get('notify', 'voicemail', 'settings')
+ end
+
+ if !send_notification
+ return send_notification
+ end
+
+ email = self.voicemail_settings.where(:name => 'email').first.try(:value)
+
+ if email.blank?
+ if self.voicemail_accountable.class == User
+ email = self.voicemail_accountable.email
+ end
+ end
+
+ return email
+ end
+
+
+ def notification_setting(name)
+ setting = nil
+ if self.voicemail_settings.where(:name => name, :value => true).first
+ setting = true
+ elsif self.voicemail_settings.where(:name => name, :value => false).first
+ setting = false
+ end
+
+ if setting == nil
+ setting = GsParameter.get(name, 'voicemail', 'settings')
+ end
+
+ return setting
+ end
+end
diff --git a/app/models/voicemail_message.rb b/app/models/voicemail_message.rb
index 91ba457..698aa50 100644
--- a/app/models/voicemail_message.rb
+++ b/app/models/voicemail_message.rb
@@ -2,7 +2,8 @@ class VoicemailMessage < ActiveRecord::Base
self.table_name = 'voicemail_msgs'
self.primary_key = 'uuid'
-# belongs_to :sip_account, :foreign_key => 'username', :primary_key => 'auth_name', :readonly => true
+ belongs_to :voicemail_account, :foreign_key => 'username', :primary_key => 'name', :readonly => true
+
# Prevent objects from being destroyed
def before_destroy
raise ActiveRecord::ReadOnlyRecord
@@ -49,4 +50,43 @@ class VoicemailMessage < ActiveRecord::Base
end
end
+ def phone_book_entry_by_number(number)
+ begin
+ voicemail_accountable = self.voicemail_account.voicemail_accountable
+ rescue
+ return nil
+ end
+
+ if ! voicemail_accountable
+ return nil
+ end
+
+ if voicemail_accountable.class == SipAccount
+ owner = voicemail_accountable.sip_accountable
+ else
+ owner = voicemail_accountable
+ end
+
+ if owner.class == User
+ phone_books = owner.phone_books.all
+ phone_books.concat(owner.current_tenant.phone_books.all)
+ elsif owner.class == Tenant
+ phone_books = owner.phone_books.all
+ end
+
+ if ! phone_books
+ return nil
+ end
+
+ phone_books.each do |phone_book|
+ phone_book_entry = phone_book.find_entry_by_number(number)
+ if phone_book_entry
+ return phone_book_entry
+ end
+ end
+
+ return nil
+
+ end
+
end
diff --git a/app/models/voicemail_setting.rb b/app/models/voicemail_setting.rb
index a8bb304..be3d749 100644
--- a/app/models/voicemail_setting.rb
+++ b/app/models/voicemail_setting.rb
@@ -1,12 +1,67 @@
-class VoicemailSetting < ActiveRecord::Base
- self.table_name = 'voicemail_prefs'
- self.primary_key = 'username'
+class VoicemailSetting < ActiveRecord::Base
+ CLASS_TYPES = ['String', 'Integer', 'Boolean']
+ VOICEMAIL_SETTINGS = {
+ 'pin' => { :type => 'String', :characters => /[^0-9]/, :html => { maxlength: 8 } },
+ 'notify' => { :type => 'Boolean', :input => :boolean },
+ 'attachment' => { :type => 'Boolean', :input => :boolean },
+ 'mark_read' => { :type => 'Boolean', :input => :boolean },
+ 'purge' => { :type => 'Boolean', :input => :boolean },
+ 'email' => { :type => 'String', },
+ 'record_length_max' => { :type => 'Integer', :input => :integer, :html => { min: 0, max: 100 } },
+ 'record_length_min' => { :type => 'Integer', :input => :integer, :html => { min: 0, max: 100 } },
+ 'records_max' => { :type => 'Integer', :input => :integer, :html => { min: 0, max: 100 } },
+ 'pin_length_max' => { :type => 'Integer', :input => :integer, :html => { min: 1, max: 10 } },
+ 'pin_length_min' => { :type => 'Integer', :input => :integer, :html => { min: 1, max: 8 } },
+ 'pin_timeout' => { :type => 'Integer', :input => :integer, :html => { min: 1, max: 10 } },
+ 'key_new_messages' => { :type => 'String', :characters => /[^0-9]\#\*/, :html => { maxlength: 1 } },
+ 'key_saved_messages' => { :type => 'String', :characters => /[^0-9]\#\*/, :html => { maxlength: 1 } },
+ 'key_config_menu' => { :type => 'String', :characters => /[^0-9]\#\*/, :html => { maxlength: 1 } },
+ 'key_terminator' => { :type => 'String', :characters => /[^0-9]\#\*/, :html => { maxlength: 1 } },
+ 'key_previous' => { :type => 'String', :characters => /[^0-9]\#\*/, :html => { maxlength: 1 } },
+ 'key_next' => { :type => 'String', :characters => /[^0-9]\#\*/, :html => { maxlength: 1 } },
+ 'key_delete' => { :type => 'String', :characters => /[^0-9]\#\*/, :html => { maxlength: 1 } },
+ 'key_save' => { :type => 'String', :characters => /[^0-9]\#\*/, :html => { maxlength: 1 } },
+ 'key_main_menu' => { :type => 'String', :characters => /[^0-9]\#\*/, :html => { maxlength: 1 } },
+ 'silence_lenght_abort' => { :type => 'Integer', :input => :integer, :html => { min: 0, max: 100 } },
+ 'silence_level' => { :type => 'Integer', :input => :integer, :html => { min: 0, max: 1000 } },
+ 'record_file_prefix' => { :type => 'String' },
+ 'record_file_suffix' => { :type => 'String' },
+ 'record_file_path' => { :type => 'String' },
+ 'record_repeat' => { :type => 'Integer', :input => :integer, :html => { min: 0, max: 10 } },
+ }
- attr_accessible :username, :domain, :name_path, :greeting_path, :password, :notify, :attachment, :mark_read, :purge, :sip_account
+ attr_accessible :voicemail_account_id, :name, :value, :class_type, :description
- has_one :sip_account, :foreign_key => 'auth_name'
+ belongs_to :voicemail_account
- validates_presence_of :username
- validates_presence_of :domain
- validates :username, :uniqueness => {:scope => :domain}
+ validates :name,
+ :presence => true,
+ :uniqueness => {:scope => :voicemail_account_id}
+
+ validates :class_type,
+ :presence => true,
+ :inclusion => { :in => CLASS_TYPES }
+
+ before_validation :set_class_type_and_value
+
+ def to_s
+ name
+ end
+
+ def set_class_type_and_value
+ seting_pref = VOICEMAIL_SETTINGS[self.name]
+ if seting_pref
+ self.class_type = seting_pref[:type]
+ case self.class_type
+ when 'String'
+ if seting_pref[:characters] && self.class_type == 'String'
+ self.value = self.value.to_s.gsub(seting_pref[:characters], '')
+ end
+ when 'Integer'
+ self.value = self.value.to_i
+ when 'Boolean'
+ self.value = ActiveRecord::ConnectionAdapters::Column.value_to_boolean(self.value).to_s
+ end
+ end
+ end
end
diff --git a/app/serializers/call_serializer.rb b/app/serializers/call_serializer.rb
new file mode 100644
index 0000000..cd41969
--- /dev/null
+++ b/app/serializers/call_serializer.rb
@@ -0,0 +1,6 @@
+class CallSerializer < ActiveModel::Serializer
+ embed :uuids, :include => true
+
+ attributes :start_stamp, :destination, :callstate, :b_callstate, :b_caller_id_number, :sip_account_id
+ attribute :uuid, :key => :id
+end \ No newline at end of file
diff --git a/app/serializers/pager_group_destination_serializer.rb b/app/serializers/pager_group_destination_serializer.rb
new file mode 100644
index 0000000..6b14884
--- /dev/null
+++ b/app/serializers/pager_group_destination_serializer.rb
@@ -0,0 +1,3 @@
+class PagerGroupDestinationSerializer < ActiveModel::Serializer
+ embed :ids, :include => true
+end
diff --git a/app/serializers/pager_group_serializer.rb b/app/serializers/pager_group_serializer.rb
new file mode 100644
index 0000000..ca748d9
--- /dev/null
+++ b/app/serializers/pager_group_serializer.rb
@@ -0,0 +1,7 @@
+class PagerGroupSerializer < ActiveModel::Serializer
+ embed :ids, :include => true
+
+ attributes :id, :sip_account_id, :callback_url
+
+ has_many :pager_group_destinations
+end
diff --git a/app/serializers/phone_number_serializer.rb b/app/serializers/phone_number_serializer.rb
new file mode 100644
index 0000000..865534b
--- /dev/null
+++ b/app/serializers/phone_number_serializer.rb
@@ -0,0 +1,3 @@
+class PhoneNumberSerializer < ActiveModel::Serializer
+ attributes :id, :name, :number
+end
diff --git a/app/serializers/sip_account_serializer.rb b/app/serializers/sip_account_serializer.rb
new file mode 100644
index 0000000..aa749b0
--- /dev/null
+++ b/app/serializers/sip_account_serializer.rb
@@ -0,0 +1,7 @@
+class SipAccountSerializer < ActiveModel::Serializer
+ embed :ids, :include => true
+
+ attributes :id, :auth_name, :caller_name, :sip_accountable_id
+ has_many :phone_numbers
+ has_many :calls
+end
diff --git a/app/serializers/switchboard_entry_serializer.rb b/app/serializers/switchboard_entry_serializer.rb
new file mode 100644
index 0000000..1b6c761
--- /dev/null
+++ b/app/serializers/switchboard_entry_serializer.rb
@@ -0,0 +1,14 @@
+class SwitchboardEntrySerializer < ActiveModel::Serializer
+ attributes :id, :name, :path_to_user, :avatar_src, :callstate
+
+ has_one :sip_account, embed: :ids
+ has_one :switchboard, embed: :ids
+
+ def path_to_user
+ if object.sip_account && object.sip_account.sip_accountable_type == 'User'
+ "/tenants/#{object.sip_account.sip_accountable.current_tenant.id}/users/#{object.sip_account.sip_accountable.id}"
+ else
+ nil
+ end
+ end
+end
diff --git a/app/serializers/switchboard_serializer.rb b/app/serializers/switchboard_serializer.rb
new file mode 100644
index 0000000..6d39667
--- /dev/null
+++ b/app/serializers/switchboard_serializer.rb
@@ -0,0 +1,9 @@
+class SwitchboardSerializer < ActiveModel::Serializer
+ embed :ids, :include => true
+
+ attributes :id, :name
+ has_many :switchboard_entries
+ has_many :sip_accounts, :through => :switchboard_entries
+ has_many :phone_numbers
+ has_many :active_calls
+end
diff --git a/app/uploaders/generic_file_uploader.rb b/app/uploaders/generic_file_uploader.rb
new file mode 100644
index 0000000..4a226ed
--- /dev/null
+++ b/app/uploaders/generic_file_uploader.rb
@@ -0,0 +1,18 @@
+# encoding: utf-8
+
+class GenericFileUploader < CarrierWave::Uploader::Base
+
+ storage :file
+
+ def store_dir
+ model.store_dir
+ end
+
+ def cache_dir
+ '/tmp/generic_file_uploader'
+ end
+
+ def extension_white_list
+ %w(pdf ps jpg jpeg gif png tif tiff wav mp3)
+ end
+end
diff --git a/app/views/call_forwards/_form_core.html.haml b/app/views/call_forwards/_form_core.html.haml
index 83de044..b730941 100644
--- a/app/views/call_forwards/_form_core.html.haml
+++ b/app/views/call_forwards/_form_core.html.haml
@@ -1,11 +1,18 @@
.inputs
= f.input :call_forward_case_id, :as => :select, :collection => @available_call_forward_cases.map {|x| [I18n.t("call_forward_cases.#{x.value}"), x.id] }, :label => t('call_forwards.form.call_forward_case.label'), :hint => conditional_hint('call_forwards.form.call_forward_case_id.hint'), :include_blank => false, :autofocus => true
- = f.input :timeout, :label => t('call_forwards.form.timeout.label'), :hint => conditional_hint('call_forwards.form.timeout.hint')
+
+ %div{:id => 'timeout_div'}
+ = f.input :timeout, :label => t('call_forwards.form.timeout.label'), :hint => conditional_hint('call_forwards.form.timeout.hint')
= f.input :call_forwarding_destination , :as => :select, :collection => @call_forwarding_destinations, :label => t('call_forwards.form.call_forwarding_destination.label'), :hint => conditional_hint('call_forwards.form.call_forwarding_destination.hint'), :include_blank => false
- = f.input :destination, :label => t('call_forwards.form.destination.label'), :hint => conditional_hint('call_forwards.form.destination.hint')
+ %div{:id => 'destination_phone_number_div'}
+ = f.input :destination, :label => t('call_forwards.form.destination_phone_number.label'), :hint => conditional_hint('call_forwards.form.destination_phone_number.hint'), :input_html => { :id => 'destination_phone_number', :value => @destination_phone_number }
+ - if @available_greetings.any?
+ %div{:id => 'destination_greeting_div'}
+ = f.input :destination, :as => :select, :collection => @available_greetings, :label => t('call_forwards.form.destination_greeting.label'), :hint => conditional_hint('call_forwards.form.destination_greeting.hint'), :input_html => { :id => 'destination_greeting' }
- = f.input :source, :label => t('call_forwards.form.source.label'), :hint => conditional_hint('call_forwards.form.source.hint')
= f.input :active, :label => t('call_forwards.form.active.label'), :hint => conditional_hint('call_forwards.form.active.hint')
+
+ = f.input :source, :label => t('call_forwards.form.source.label'), :hint => conditional_hint('call_forwards.form.source.hint')
diff --git a/app/views/call_forwards/_index_core.html.haml b/app/views/call_forwards/_index_core.html.haml
index 3c57405..ab8873b 100644
--- a/app/views/call_forwards/_index_core.html.haml
+++ b/app/views/call_forwards/_index_core.html.haml
@@ -22,7 +22,7 @@
- if call_forward.destinationable_type
%br
= call_forward.destinationable_type
- - if call_forward.destinationable_id
+ - if Module.constants.include?(call_forward.destinationable_type.to_sym)
= ": #{call_forward.destinationable}"
%td= call_forward.source
=render :partial => 'shared/index_view_edit_destroy_part', :locals => {:parent => call_forward.call_forwardable, :child => call_forward}
diff --git a/app/views/call_forwards/show.html.haml b/app/views/call_forwards/show.html.haml
index ad9ab16..fdd5197 100644
--- a/app/views/call_forwards/show.html.haml
+++ b/app/views/call_forwards/show.html.haml
@@ -10,6 +10,8 @@
%strong= t('call_forwards.show.destination') + ":"
- if @call_forward.destinationable_id && @call_forward.destinationable
= "#{@call_forward.destinationable_type}: #{@call_forward.destinationable}"
+ - if !@call_forward.destination.blank?
+ = "(#{@call_forward.destination})"
- elsif !@call_forward.destinationable_type.blank?
= "#{@call_forward.destinationable_type}: #{@call_forward.destination}"
- else
diff --git a/app/views/call_histories/_index_core.html.haml b/app/views/call_histories/_index_core.html.haml
index 8bbf761..9c2cf39 100644
--- a/app/views/call_histories/_index_core.html.haml
+++ b/app/views/call_histories/_index_core.html.haml
@@ -1,85 +1,99 @@
-= render :partial => "call_histories/navigation"
-%table.table.table-striped
- %thead
- %tr
- %th
- Datum
- %th
- Uhrzeit
- %th
- Misc
- %th
- Avatar
- %th
- Teilnehmer
- %th
- Status
+= render :partial => "call_histories/navigation", :locals => {:call_histories => call_histories, :type => @type}
- %tbody
- - for call_history in call_histories
- - if !call_history.display_number.blank?
- - phone_book_entry = call_history.phone_book_entry_by_number(call_history.display_number)
- %tr{:id => "call_history_id_#{call_history.id}_tr", :class => (call_history.duration.blank? ? 'warning' : '')}
- %td
- = l call_history.start_stamp, :format => :short
- %td
- = l call_history.start_stamp, :format => :short
- %td
- - if call_history.voicemail_message?
- .voicemail-message
- %a{:href => sip_account_voicemail_messages_path(@sip_account, :anchor => "message_#{call_history.voicemail_message.id}")}
- = image_tag('icons/gs_envelope_16x.png')
- = call_history.display_call_date(t("call_histories.index.date_format"), t("call_histories.index.date_today_format"))
+- if call_histories.any?
+ = form_tag(destroy_multiple_sip_account_call_histories_path(@sip_account), :method => :delete, :id => 'call_hostory_form') do
+ %table.table.table-striped
+ %thead
+ %tr
+ %th{:width => '10px'}
+ = button_tag(:type => 'submit', :class => 'btn btn-mini btn-danger', :confirm => t("call_histories.index.actions.confirm_selected")) do
+ %i{:class => 'icon-trash icon-white'}
+ %th
+ =sortable :start_stamp, t("call_histories.index.date")
+ %th{:width => '10px'}
+ %th
+ =sortable :caller_id_name, t("call_histories.index.called_party")
+ %th
+ =sortable :duration, t("call_histories.index.duration")
+ %th
+ =sortable :result, t("call_histories.index.status")
+ %th
+ %tfoot
+ %tr
+ %td{:colspan => 2}
+ = button_tag(:type => 'submit', :class => 'btn btn-mini btn-danger', :confirm => t("call_histories.index.actions.confirm_selected")) do
+ %i{:class => 'icon-trash icon-white'}
+ = t("call_histories.index.actions.destroy_multiple")
+ %td{:colspan => 5}
+ %tbody
+ - for call_history in call_histories
+ - if !call_history.display_number.blank?
+ - phone_book_entry = call_history.phone_book_entry_by_number(call_history.display_number)
+ %tr{:id => "call_history_id_#{call_history.id}_tr", :class => (call_history.duration.blank? ? 'warning' : '')}
+ %td.select_box= check_box_tag("selected_ids[]", call_history.id, false, :uuid => "select_item_#{call_history.id}", :class => 'select_item')
+ %td
+ = l call_history.start_stamp, :format => :short
+ %br
+ -if call_history.entry_type == 'dialed'
+ %i{:class => 'icon-arrow-left'}
+ -elsif call_history.entry_type == 'missed'
+ %i{:class => 'icon-time'}
+ -elsif call_history.entry_type == 'forwarded'
+ - if call_history.callee_account_type.to_s.downcase == 'voicemailaccount'
+ - voicemail_message = call_history.voicemail_message
+ - if voicemail_message
+ - if voicemail_message.read_epoch > 0
+ %i{:class => 'icon-bullhorn'}
+ - else
+ %i{:class => 'icon-envelope'}
+ - else
+ %i{:class => 'icon-random'}
+ - else
+ %i{:class => 'icon-random'}
+ - else
+ %i{:class => 'icon-arrow-right'}
- - else
- - case call_history.entry_type
- - when 'forwarded'
- .call-forwarded= call_history.display_call_date(t("call_histories.index.date_format"), t("call_histories.index.date_today_format"))
- - if call_history.callee_account_type.to_s.downcase == 'voicemail'
- = t("call_histories.index.voicemail")
+ - if call_history.entry_type == 'forwarded'
+ - if call_history.callee_account_type.to_s.downcase == 'voicemailaccount'
+ - if voicemail_message
+ %a.name{:href => voicemail_account_voicemail_messages_path(voicemail_message.voicemail_account, :anchor => "message_#{voicemail_message.uuid}")}
+ = voicemail_message.display_duration
+ /= VoicemailAccount.where(:id => call_history.callee_account_id).first.to_s
+ - else
+ = VoicemailAccount.where(:id => call_history.callee_account_id).first.to_s
+ - else
+ = call_history.destination_number
+ - elsif call_history.entry_type == 'dialed'
+ = call_history.caller_id_number
+ - else
+ = call_history.destination_number
+
+ %td
+ - image = call_history.display_image(:mini, phone_book_entry)
+ - if image
+ %ul.thumbnails
+ =image_tag(image, :alt => phone_book_entry.to_s, :class => 'img-rounded')
+ %td
+ - display_name = call_history.display_name
+ - if display_name.blank?
+ - display_name = phone_book_entry.to_s
+ - if phone_book_entry
+ %a.name{:href => phone_book_phone_book_entry_path(phone_book_entry.phone_book, phone_book_entry), :itemprop => "name"}= display_name
- else
- = call_history.destination_number
- - when 'dialed'
- .call-placed= call_history.display_call_date(t("call_histories.index.date_format"), t("call_histories.index.date_today_format"))
- - when 'received'
- .call-received= call_history.display_call_date(t("call_histories.index.date_format"), t("call_histories.index.date_today_format"))
- - when 'missed'
- .call-missed= call_history.display_call_date(t("call_histories.index.date_format"), t("call_histories.index.date_today_format"))
- - else
- .call-unknown
- = t("call_histories.index.#{call_history.entry_type}")
- = call_history.display_call_date(t("call_histories.index.date_format"), t("call_histories.index.date_today_format"))
+ .name= display_name
+ .phone= call_history.display_number
+ %td
+ - if call_history.display_duration
+ = call_history.display_duration
+ %td
+ - if t("call_histories.call_results.#{call_history.result}").include?('translation missing')
+ = call_history.result.gsub('_', ' ').titleize
+ - else
+ = t("call_histories.call_results.#{call_history.result}")
+ %td
+ - if @sip_account.registration && can?(:call, call_history)
+ = link_to raw("<i class = 'icon-bell'></i> ") + t('call_histories.index.actions.call'), call_sip_account_call_history_path(@sip_account, call_history), :method => :put, :class => 'btn btn-mini'
- - if call_history.forwarding_service && call_history.entry_type != 'forwarded'
- = t("call_histories.index.forwarded_by")
- = call_history.display_auth_account_name
- %td
- - image = call_history.display_image(:small, phone_book_entry)
- - if image
- %ul.thumbnails
- %li.span1
- %div.thumbnail
- %a.thumbnail{:href => call_history.display_image(:profile, phone_book_entry)}
- =image_tag(image, :alt => phone_book_entry.to_s, :class => 'img-rounded')
- %td
- - display_name = call_history.display_name
- - if display_name.blank?
- - display_name = phone_book_entry.to_s
- - if phone_book_entry
- %a.name{:href => phone_book_phone_book_entry_path(phone_book_entry.phone_book, phone_book_entry), :itemprop => "name"}= display_name
- - else
- .name= display_name
- .phone= call_history.display_number
- %td
- - if call_history.display_duration
- = call_history.display_duration
- - else
- = t("call_histories.call_results.#{call_history.result}")
- %td
- - if @sip_account.registration && can?(:call, call_history)
- = link_to raw("<i class = 'icon-bell'></i> ") + t('call_histories.index.actions.call'), call_sip_account_call_history_path(@sip_account, call_history), :method => :put, :class => 'btn btn-mini'
- %td
- - if can? :destroy, call_history
- = link_to raw("<i class = 'icon-trash icon-white'></i> ") + t('call_histories.index.actions.destroy'), [@sip_account, call_history], :method => :delete, :remote => true, :class => 'btn btn-mini btn-danger'
- \ No newline at end of file
+ - if can? :destroy, call_history
+ = link_to raw("<i class = 'icon-trash icon-white'></i> ") + t('call_histories.index.actions.destroy'), [@sip_account, call_history], :method => :delete, :remote => true, :class => 'btn btn-mini btn-danger'
diff --git a/app/views/call_histories/_navigation.html.haml b/app/views/call_histories/_navigation.html.haml
index d72ad64..d293471 100644
--- a/app/views/call_histories/_navigation.html.haml
+++ b/app/views/call_histories/_navigation.html.haml
@@ -1,14 +1,15 @@
-%ul{:class => 'nav nav-pills'}
- %li
- %a{ :href => "?type=" }= t("call_histories.index.navigation.all", :calls => @calls_count)
- %li
- %a{ :href => "?type=missed" }= t("call_histories.index.navigation.missed", :calls => @calls_missed_count)
- %li
- %a{ :href => "?type=received" }= t("call_histories.index.navigation.received", :calls => @calls_received_count)
- %li
- %a{ :href => "?type=dialed" }= t("call_histories.index.navigation.dialed", :calls => @calls_dialed_count)
- %li
- %a{ :href => "?type=forwarded" }= t("call_histories.index.navigation.forwarded", :calls => @calls_forwarded_count)
+%div{:class => 'pagination'}
+ %ul
+ %li{:class => (type.blank? ? :active : nil )}
+ %a{ :href => "?type=" }= t("call_histories.index.navigation.all", :calls => @calls_count)
+ %li{:class => (type == 'missed' ? :active : nil )}
+ %a{ :href => "?type=missed" }= t("call_histories.index.navigation.missed", :calls => @calls_missed_count)
+ %li{:class => (type == 'received' ? :active : nil )}
+ %a{ :href => "?type=received" }= t("call_histories.index.navigation.received", :calls => @calls_received_count)
+ %li{:class => (type == 'dialed' ? :active : nil )}
+ %a{ :href => "?type=dialed" }= t("call_histories.index.navigation.dialed", :calls => @calls_dialed_count)
+ %li{:class => (type == 'forwarded' ? :active : nil )}
+ %a{ :href => "?type=forwarded" }= t("call_histories.index.navigation.forwarded", :calls => @calls_forwarded_count)
-/ .pagination
-/ = will_paginate @call_histories
+
+ = will_paginate call_histories, :renderer => BootstrapPagination::Rails, :previous_label => raw('<i class = "icon-chevron-left"></i>'), :next_label => raw('<i class = "icon-chevron-right"></i>'), :class => nil
diff --git a/app/views/call_routes/_form_core.html.haml b/app/views/call_routes/_form_core.html.haml
index 926c985..73b6338 100644
--- a/app/views/call_routes/_form_core.html.haml
+++ b/app/views/call_routes/_form_core.html.haml
@@ -2,4 +2,9 @@
= f.input :routing_table, :collection => CallRoute::ROUTING_TABLES, :label => t('call_routes.form.table.label'), :hint => conditional_hint('call_routes.form.table.hint'), :include_blank => false, :autofocus => true
= f.input :name, :label => t('call_routes.form.name.label'), :hint => conditional_hint('call_routes.form.name.hint')
= f.input :endpoint_str, :collection => @endpoints, :label => t('call_routes.form.endpoint.label'), :hint => conditional_hint('call_routes.form.endpoint.hint'), :include_blank => false
- = f.input :position, :label => t('call_routes.form.position.label'), :hint => conditional_hint('call_routes.form.position.hint') \ No newline at end of file
+ = f.input :position, :label => t('call_routes.form.position.label'), :hint => conditional_hint('call_routes.form.position.hint')
+
+ - if @call_route.new_record?
+ %p
+ %strong= t('call_routes.form.xml.separator')
+ = f.input :xml, :as => 'text', :label => t('call_routes.form.xml.label'), :hint => conditional_hint('call_routes.form.xml.hint') \ No newline at end of file
diff --git a/app/views/call_routes/test.html.haml b/app/views/call_routes/test.html.haml
index 0b0fba7..2183987 100644
--- a/app/views/call_routes/test.html.haml
+++ b/app/views/call_routes/test.html.haml
@@ -1,5 +1,28 @@
%h2= 'Routing Test'
+= form_tag('test', :method => "get") do |f|
+ %p
+ %strong Routing Table
+ = label_tag(:routing_table_outbound, "Outbound")
+ = radio_button_tag(:routing_table, "outbound")
+ = label_tag(:routing_table_inbound, "Inbound")
+ = radio_button_tag(:routing_table, "inbound")
+ = label_tag(:routing_table_prerouting, "Prerouting")
+ = radio_button_tag(:routing_table, "prerouting")
+ %p
+ %strong From
+ %br
+ = collection_select(nil, :sip_account_id, SipAccount.all, :id, :to_s, {:include_blank => false, :prompt => 'Select SIP Account'})
+ = collection_select(nil, :fax_account_id, FaxAccount.all, :id, :to_s, {:include_blank => false, :prompt => 'Select Fax Account'})
+ = collection_select(nil, :hunt_group_id, HuntGroup.all, :id, :to_s, {:include_blank => false, :prompt => 'Select Hunt Group'})
+
+ %p
+ %strong Number
+ %br
+ = text_field_tag(:destination_number)
+
+ %p= submit_tag("Test Route")
+
- if @route_test
- if @route_test['destination']
%h3= 'Destination'
diff --git a/app/views/config_snom/show.xml.haml b/app/views/config_snom/show.xml.haml
index 3d0edf1..22df8bc 100644
--- a/app/views/config_snom/show.xml.haml
+++ b/app/views/config_snom/show.xml.haml
@@ -36,6 +36,7 @@
%ringer_animation{:perm => 'RW'}= 'on'
%display_method{:perm => 'RW'}= 'display_name_number'
%callpickup_dialoginfo{:perm => 'RW'}= 'on'
+ %pickup_indication{:perm => 'RW'}= 'off'
%show_local_line{:perm => 'RW'}= 'off'
%mwi_notification{:perm => 'RW'}= 'silent'
%mwi_dialtone{:perm => 'RW'}= 'normal'
@@ -128,7 +129,7 @@
!= "\<!-- sip accounts: #{@sip_accounts.count} --\>"
- @sip_accounts.each_with_index do |sip_account, array_index|
- index = array_index + 1
- != "\<!-- sip account #{array_index}: #{sip_account[:idle_text]}, #{sip_account[:active]} --\>"
+ != "\<!-- sip account #{array_index}: #{sip_account[:user_idle_text]}, #{sip_account[:active]} --\>"
%user_active{:idx => index, :perm => 'R'}= sip_account[:active]
%user_pname{:idx => index, :perm => 'R'}= sip_account[:pname]
%user_pass{:idx => index, :perm => 'R'}= sip_account[:pass]
@@ -136,7 +137,7 @@
%user_outbound{:idx => index, :perm => 'R'}= sip_account[:outbound]
%user_name{:idx => index, :perm => 'R'}= sip_account[:name]
%user_realname{:idx => index, :perm => 'R'}= sip_account[:realname]
- %user_idle_text{:idx => index, :perm => 'R'}= sip_account[:idle_text]
+ %user_idle_text{:idx => index, :perm => 'R'}= sip_account[:user_idle_text]
%user_mailbox{:idx => index, :perm => 'R'}= sip_account[:mailbox]
%user_expiry{:idx => index, :perm => 'R'}= sip_account[:expiry]
%user_server_type{:idx => index, :perm => 'R'}= 'default'
diff --git a/app/views/config_snom/state_settings.xml.haml b/app/views/config_snom/state_settings.xml.haml
index 6be1efc..8bb5239 100644
--- a/app/views/config_snom/state_settings.xml.haml
+++ b/app/views/config_snom/state_settings.xml.haml
@@ -1,49 +1,56 @@
!!! XML
%SnomIPPhoneMenu{:state => 'relevant', :title => "Gemeinschaft #{GsParameter.get('GEMEINSCHAFT_VERSION')}"}
- %MenuItem{:name => '$(lang:menu100_phone_book)'}
+ %MenuItem{:name => t('config_snom.main_menu.phone_book')}
%URL= "#{@base_url}/#{@sip_account_ids.first}/phone_book.xml"
- %Menu{:name => '$(lang:menu100_call_lists)'}
- %MenuItem{:name => '$(lang:list_missed)'}
+ %Menu{:name => t('config_snom.main_menu.call_history')}
+ %MenuItem{:name => t('config_snom.call_history.missed')}
- @sip_account_ids.each_with_index do |id, index|
%If{:condition => "$(current_line)==#{index+1}"}
%URL= "#{@base_url}/#{id}/call_history_missed.xml"
- %MenuItem{:name => '$(lang:list_taken)'}
+ %MenuItem{:name => t('config_snom.call_history.received')}
- @sip_account_ids.each_with_index do |id, index|
%If{:condition => "$(current_line)==#{index+1}"}
%URL= "#{@base_url}/#{id}/call_history_received.xml"
- %MenuItem{:name => '$(lang:list_dialed)'}
+ %MenuItem{:name => t('config_snom.call_history.dialed')}
- @sip_account_ids.each_with_index do |id, index|
%If{:condition => "$(current_line)==#{index+1}"}
%URL= "#{@base_url}/#{id}/call_history_dialed.xml"
- %MenuItem{:name => '$(lang:sel100_activeline)'}
+ %MenuItem{:name => t('config_snom.call_history.forwarded')}
+ - @sip_account_ids.each_with_index do |id, index|
+ %If{:condition => "$(current_line)==#{index+1}"}
+ %URL= "#{@base_url}/#{id}/call_history_forwarded.xml"
+
+ %MenuItem{:name => t('config_snom.main_menu.voicemail')}
+ %URL= "#{@base_url}/#{@sip_account_ids.first}/voicemail.xml"
+ %MenuItem{:name => t('config_snom.main_menu.sip_account')}
%Action= 'active_line'
- if @enable_login
- %MenuItem{:name => 'Log in'}
+ %MenuItem{:name => t('config_snom.main_menu.log_in')}
%URL= "#{@base_url}/log_in.xml"
- if @enable_logout
- %MenuItem{:name => 'Log out'}
+ %MenuItem{:name => t('config_snom.main_menu.log_out')}
%URL= "#{@base_url}/log_out.xml"
- %Menu{:name => '$(lang:preferences_settings)'}
- %MenuItem{:name => '$(lang:menu_gen_contrast)'}
+ %Menu{:name => t('config_snom.main_menu.preferences')}
+ %MenuItem{:name => t('config_snom.preferences.contrast')}
%Action= 'contrast'
- %MenuItem{:name => '$(lang:use_backlight)'}
+ %MenuItem{:name => t('config_snom.preferences.use_backlight')}
%Action= 'use_backlight'
- %MenuItem{:name => '$(lang:use_backlight) $(lang:backlight_when_active)'}
+ %MenuItem{:name => t('config_snom.preferences.backlight_active')}
%Action= 'backlight_active'
- %MenuItem{:name => '$(lang:use_backlight) $(lang:backlight_when_idle)'}
+ %MenuItem{:name => t('config_snom.preferences.backlight_idle')}
%Action= 'backlight_idle'
- %MenuItem{:name => '$(lang:menu_equalizer)'}
+ %MenuItem{:name => t('config_snom.preferences.equalizer')}
%Action= 'equalizer'
- %Menu{:name => '$(lang:maintenance_settings)'}
- %MenuItem{:name => '$(lang:system_information_menu)'}
+ %Menu{:name => t('config_snom.main_menu.maintenance')}
+ %MenuItem{:name => t('config_snom.maintenance.system_info')}
%Action= 'sysinfo'
- %MenuItem{:name => '$(lang:sel100_reboot)'}
+ %MenuItem{:name => t('config_snom.maintenance.reboot')}
%Action= 'reboot'
%If{:condition => '$(set:admin_mode)'}
- %MenuItem{:name => '$(lang:reset_settings)'}
+ %MenuItem{:name => t('config_snom.maintenance.reset_settings')}
%Action= 'reset_settings'
%If{:condition => '$(update_available)'}
- %MenuItem{:name => '$(lang:update_header)'}
- %Action= 'software_update' \ No newline at end of file
+ %MenuItem{:name => t('config_snom.maintenance.software_update')}
+ %Action= 'software_update'
diff --git a/app/views/gateway_parameters/show.html.haml b/app/views/gateway_parameters/show.html.haml
index 9bdad76..8314b3c 100644
--- a/app/views/gateway_parameters/show.html.haml
+++ b/app/views/gateway_parameters/show.html.haml
@@ -1,7 +1,7 @@
- content_for :title, t("gateway_parameters.show.page_title")
%p
- %strong= t('gateway_parameters.show.gateway_id') + ":"
+ %strong= t('gateway_parameters.show.gateway') + ":"
= @gateway_parameter.gateway
%p
%strong= t('gateway_parameters.show.name') + ":"
diff --git a/app/views/gateway_settings/_form_core.html.haml b/app/views/gateway_settings/_form_core.html.haml
index 229009b..a66dd2e 100644
--- a/app/views/gateway_settings/_form_core.html.haml
+++ b/app/views/gateway_settings/_form_core.html.haml
@@ -1,4 +1,4 @@
.inputs
- = f.input :name, :collection => GatewaySetting::GATEWAY_SETTINGS[@gateway.technology].keys, :label => t('gateway_settings.form.name.label'), :hint => conditional_hint('gateway_settings.form.name.hint'), :autofocus => true, :include_blank => false
+ = f.input :name, :collection => GatewaySetting::GATEWAY_SETTINGS[@gateway.technology].map {|k,v| [t("gateway_settings.settings.#{@gateway.technology}.#{k}.label"), k] }, :label => t('gateway_settings.form.name.label'), :hint => conditional_hint('gateway_settings.form.name.hint'), :autofocus => true, :include_blank => false
= f.input :value, :label => t('gateway_settings.form.value.label'), :hint => conditional_hint('gateway_settings.form.value.hint')
= f.input :description, :label => t('gateway_settings.form.description.label'), :hint => conditional_hint('gateway_settings.form.description.hint')
diff --git a/app/views/gateway_settings/_index_core.html.haml b/app/views/gateway_settings/_index_core.html.haml
index 8098488..36b47c8 100644
--- a/app/views/gateway_settings/_index_core.html.haml
+++ b/app/views/gateway_settings/_index_core.html.haml
@@ -8,7 +8,11 @@
%tbody
- for gateway_setting in gateway_settings
%tr
- %td= gateway_setting.name
+ %td= t("gateway_settings.settings.#{@gateway.technology}.#{gateway_setting.name}.label")
%td= gateway_setting.value
- %td= gateway_setting.description
+ %td
+ - if gateway_setting.description.blank?
+ = t("gateway_settings.settings.#{@gateway.technology}.#{gateway_setting.name}.hint")
+ - else
+ = gateway_setting.description
=render :partial => 'shared/index_view_edit_destroy_part', :locals => {:parent => gateway_setting.gateway, :child => gateway_setting}
diff --git a/app/views/gateway_settings/show.html.haml b/app/views/gateway_settings/show.html.haml
index 019aec4..9880d01 100644
--- a/app/views/gateway_settings/show.html.haml
+++ b/app/views/gateway_settings/show.html.haml
@@ -1,7 +1,7 @@
- content_for :title, t("gateway_settings.show.page_title")
%p
- %strong= t('gateway_settings.show.gateway_id') + ":"
+ %strong= t('gateway_settings.show.gateway') + ":"
= @gateway_setting.gateway
%p
%strong= t('gateway_settings.show.name') + ":"
diff --git a/app/views/gemeinschaft_setups/new.de.html.haml b/app/views/gemeinschaft_setups/new.de.html.haml
index 3c215d1..bba60d3 100644
--- a/app/views/gemeinschaft_setups/new.de.html.haml
+++ b/app/views/gemeinschaft_setups/new.de.html.haml
@@ -20,6 +20,12 @@
= f.input :default_system_email, :label => t('gemeinschaft_setups.form.default_system_email.label'), :hint => conditional_hint('gemeinschaft_setups.form.default_system_email.hint')
+ %strong Angriffserkennung
+
+ = f.input :detect_attacks, :as => :boolean, :label => t('gemeinschaft_setups.form.detect_attacks.label'), :hint => conditional_hint('gemeinschaft_setups.form.detect_attacks.hint')
+ = f.input :report_attacks, :as => :boolean, :label => t('gemeinschaft_setups.form.report_attacks.label'), :hint => conditional_hint('gemeinschaft_setups.form.report_attacks.hint')
+
+
%h3 SIP-Domain
%p In den meisten Fällen sollten Sie den gleichen Wert für SIP-Realm und SIP-Domain benutzen. Wenn Sie mit diesen Begriffen nichts anfangen können, dann geben Sie hier bitte die IP-Adresse dieses Servers ein.
diff --git a/app/views/gemeinschaft_setups/new.html.haml b/app/views/gemeinschaft_setups/new.html.haml
index deac19d..88b73fd 100644
--- a/app/views/gemeinschaft_setups/new.html.haml
+++ b/app/views/gemeinschaft_setups/new.html.haml
@@ -20,6 +20,12 @@
= f.input :default_system_email, :label => t('gemeinschaft_setups.form.default_system_email.label'), :hint => conditional_hint('gemeinschaft_setups.form.default_system_email.hint')
+ %strong Intrusion detection / prevention
+
+ = f.input :detect_attacks, :as => :boolean, :label => t('gemeinschaft_setups.form.detect_attacks.label'), :hint => conditional_hint('gemeinschaft_setups.form.detect_attacks.hint')
+ = f.input :report_attacks, :as => :boolean, :label => t('gemeinschaft_setups.form.report_attacks.label'), :hint => conditional_hint('gemeinschaft_setups.form.report_attacks.hint')
+
+
%h3 SIP-Domain
%p You should use the same value for the SIP realm as for the SIP domain to ensure compatibility with different phone models. In case you have no clue what we are talking about: Just enter the IP address of this server.
diff --git a/app/views/generic_files/_form.html.haml b/app/views/generic_files/_form.html.haml
new file mode 100644
index 0000000..8912daa
--- /dev/null
+++ b/app/views/generic_files/_form.html.haml
@@ -0,0 +1,7 @@
+= simple_form_for([@parent, @generic_file]) do |f|
+ = f.error_notification
+
+ = render "form_core", :f => f
+
+ .form-actions
+ = f.button :submit, conditional_t('generic_files.form.submit')
diff --git a/app/views/generic_files/_form_core.html.haml b/app/views/generic_files/_form_core.html.haml
new file mode 100644
index 0000000..b0e8889
--- /dev/null
+++ b/app/views/generic_files/_form_core.html.haml
@@ -0,0 +1,7 @@
+.inputs
+ - if @generic_file.new_record?
+ = f.input :file, :label => t('generic_files.form.file.label'), :hint => conditional_hint('generic_files.form.file.hint')
+ - else
+ = f.input :file_type, :label => t('generic_files.form.file_type.label'), :hint => conditional_hint('generic_files.form.file_type.hint'), :disabled => true
+ = f.input :name, :label => t('generic_files.form.name.label'), :hint => conditional_hint('generic_files.form.name.hint')
+ = f.input :category, :label => t('generic_files.form.category.label'), :collection => GenericFile::CATEGORIES, :hint => conditional_hint('generic_files.form.category.hint'), :include_blank => false
diff --git a/app/views/generic_files/_index_core.html.haml b/app/views/generic_files/_index_core.html.haml
new file mode 100644
index 0000000..2cea8a1
--- /dev/null
+++ b/app/views/generic_files/_index_core.html.haml
@@ -0,0 +1,20 @@
+%table.table.table-striped
+ %tr
+ %th= t('generic_files.index.category')
+ %th= t('generic_files.index.name')
+ %th= t('generic_files.index.file_type')
+ %th
+ %th
+
+ - for generic_file in generic_files
+ %tr
+ %td= generic_file.category
+ %td= generic_file.name
+ %td= generic_file.file_type
+ %td
+ %p
+ %a{:href => method( :"#{generic_file.owner.class.name.underscore}_generic_file_path" ).(generic_file.owner, generic_file, :format => generic_file.file_extension), :method => :get}
+ %i{:class => 'icon-download'}
+ = t("generic_files.index.actions.download")
+
+ =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:parent => generic_file.owner, :child => generic_file}
diff --git a/app/views/generic_files/edit.html.haml b/app/views/generic_files/edit.html.haml
new file mode 100644
index 0000000..b59dd2b
--- /dev/null
+++ b/app/views/generic_files/edit.html.haml
@@ -0,0 +1,3 @@
+- content_for :title, t("generic_files.edit.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/generic_files/index.html.haml b/app/views/generic_files/index.html.haml
new file mode 100644
index 0000000..b3c489e
--- /dev/null
+++ b/app/views/generic_files/index.html.haml
@@ -0,0 +1,6 @@
+- content_for :title, t("generic_files.index.page_title")
+
+- if @generic_files && @generic_files.count > 0
+ = render "index_core", :generic_files => @generic_files
+
+= render :partial => 'shared/create_link', :locals => {:parent => @parent, :child_class => GenericFile} \ No newline at end of file
diff --git a/app/views/generic_files/new.html.haml b/app/views/generic_files/new.html.haml
new file mode 100644
index 0000000..05af0da
--- /dev/null
+++ b/app/views/generic_files/new.html.haml
@@ -0,0 +1,3 @@
+- content_for :title, t("generic_files.new.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/generic_files/show.html.haml b/app/views/generic_files/show.html.haml
new file mode 100644
index 0000000..9405444
--- /dev/null
+++ b/app/views/generic_files/show.html.haml
@@ -0,0 +1,25 @@
+- content_for :title, t("generic_files.show.page_title")
+
+%p
+ %strong= t('generic_files.show.category') + ":"
+ = @generic_file.category
+
+%p
+ %strong= t('generic_files.show.name') + ":"
+ = @generic_file.name
+
+%p
+ %strong= t('generic_files.show.file_type') + ":"
+ = @generic_file.file_type
+
+%p
+ %strong= t('generic_files.show.file_size') + ":"
+ = number_to_human_size(@generic_file.file_size)
+
+%p
+ %i{:class => 'icon-download'}
+ %strong= t('generic_files.index.actions.download') + ":"
+ %a{:href => method( :"#{@parent.class.name.underscore}_generic_file_path" ).(@parent, @generic_file, :format => @generic_file.file_extension), :method => :get}
+ = "#{@generic_file.name}.#{@generic_file.file_extension}"
+
+= render :partial => 'shared/show_edit_destroy_part', :locals => { :parent => @parent, :child => @generic_file }
diff --git a/app/views/group_permissions/show.html.haml b/app/views/group_permissions/show.html.haml
index 402c5ce..8fe4c2b 100644
--- a/app/views/group_permissions/show.html.haml
+++ b/app/views/group_permissions/show.html.haml
@@ -4,7 +4,7 @@
%strong= t('group_permissions.show.permission') + ":"
= @group_permission.permission
%p
- %strong= t('group_permissions.show.target_group_id') + ":"
- = @group_permission.target_group_id
+ %strong= t('group_permissions.show.target_group') + ":"
+ = @group_permission.target_group
= render :partial => 'shared/show_edit_destroy_part', :locals => { :parent => @group, :child => @group_permission }
diff --git a/app/views/intruders/_index_core.html.haml b/app/views/intruders/_index_core.html.haml
index 1fca601..fa1cf8f 100644
--- a/app/views/intruders/_index_core.html.haml
+++ b/app/views/intruders/_index_core.html.haml
@@ -2,6 +2,7 @@
%tr
%th
%th= t('intruders.index.contact_ip')
+ %th= t('intruders.index.country')
%th= t('intruders.index.points')
%th= t('intruders.index.ban_last')
%th= t('intruders.index.contact_count')
@@ -31,6 +32,7 @@
%i.icon-warning-sign
%td= intruder.contact_ip
+ %td= intruder.country
%td= intruder.points
%td
- if intruder.ban_last
diff --git a/app/views/intruders/show.html.haml b/app/views/intruders/show.html.haml
index df50872..5096941 100644
--- a/app/views/intruders/show.html.haml
+++ b/app/views/intruders/show.html.haml
@@ -22,6 +22,9 @@
%strong= t('intruders.show.contact_ip') + ":"
= @intruder.contact_ip
%p
+ %strong= t('intruders.show.country') + ":"
+ = @intruder.country
+%p
%strong= t('intruders.show.contact_port') + ":"
= @intruder.contact_port
%p
diff --git a/app/views/layouts/_navbar.html.haml b/app/views/layouts/_navbar.html.haml
index 3e1da1c..d83660b 100644
--- a/app/views/layouts/_navbar.html.haml
+++ b/app/views/layouts/_navbar.html.haml
@@ -20,9 +20,10 @@
%li
%a{:href => sip_account_call_histories_path(current_user.sip_accounts.first)}
=t("call_histories.index.page_title")
- %li
- %a{:href => sip_account_voicemail_messages_path(current_user.sip_accounts.first)}
- =t("voicemail_messages.index.page_title")
+ - if current_user.voicemail_accounts.first
+ %li
+ %a{:href => voicemail_account_voicemail_messages_path(current_user.voicemail_accounts.first)}
+ =t("voicemail_messages.index.page_title")
- if current_user
%ul.nav.pull-right
@@ -60,5 +61,5 @@
- if GuiFunction.display?('search_field_in_top_navigation_bar', current_user)
= form_tag search_path, :method => :post, :class => 'navbar-search pull-right' do
- %input.text{:placeholder => 'Suchen ...', :name => 'q', :class => 'search-query span2'}
+ %input.text{:placeholder => t('navigation.search_placeholder'), :name => 'q', :class => 'search-query span2'}
diff --git a/app/views/notifications/new_voicemail.text.erb b/app/views/notifications/new_voicemail.text.erb
index adeabda..926610b 100644
--- a/app/views/notifications/new_voicemail.text.erb
+++ b/app/views/notifications/new_voicemail.text.erb
@@ -1,4 +1,4 @@
-Hello <%= @voicemail[:greeting] %>,
+Hello,
You've just received a voicemail on your Gemeinschaft account <%= @voicemail[:destination] %>.
diff --git a/app/views/pager_group_destinations/_form.html.haml b/app/views/pager_group_destinations/_form.html.haml
new file mode 100644
index 0000000..80cb7bb
--- /dev/null
+++ b/app/views/pager_group_destinations/_form.html.haml
@@ -0,0 +1,7 @@
+= simple_form_for(@pager_group_destination) do |f|
+ = f.error_notification
+
+ = render "form_core", :f => f
+
+ .form-actions
+ = f.button :submit, conditional_t('pager_group_destinations.form.submit')
diff --git a/app/views/pager_group_destinations/_form_core.html.haml b/app/views/pager_group_destinations/_form_core.html.haml
new file mode 100644
index 0000000..2adae24
--- /dev/null
+++ b/app/views/pager_group_destinations/_form_core.html.haml
@@ -0,0 +1,3 @@
+.inputs
+ = f.input :pager_group_id, :label => t('pager_group_destinations.form.pager_group_id.label'), :hint => conditional_hint('pager_group_destinations.form.pager_group_id.hint')
+ = f.input :sip_account_id, :label => t('pager_group_destinations.form.sip_account_id.label'), :hint => conditional_hint('pager_group_destinations.form.sip_account_id.hint')
diff --git a/app/views/pager_group_destinations/_index_core.html.haml b/app/views/pager_group_destinations/_index_core.html.haml
new file mode 100644
index 0000000..78bf3e5
--- /dev/null
+++ b/app/views/pager_group_destinations/_index_core.html.haml
@@ -0,0 +1,11 @@
+%table.table.table-striped
+ %tr
+ %th= t('pager_group_destinations.index.pager_group_id')
+ %th= t('pager_group_destinations.index.sip_account_id')
+
+
+ - for pager_group_destination in pager_group_destinations
+ %tr
+ %td= pager_group_destination.pager_group_id
+ %td= pager_group_destination.sip_account_id
+ =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => pager_group_destination} \ No newline at end of file
diff --git a/app/views/pager_group_destinations/edit.html.haml b/app/views/pager_group_destinations/edit.html.haml
new file mode 100644
index 0000000..4086329
--- /dev/null
+++ b/app/views/pager_group_destinations/edit.html.haml
@@ -0,0 +1,3 @@
+- content_for :title, t("pager_group_destinations.edit.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/pager_group_destinations/index.html.haml b/app/views/pager_group_destinations/index.html.haml
new file mode 100644
index 0000000..8072fb7
--- /dev/null
+++ b/app/views/pager_group_destinations/index.html.haml
@@ -0,0 +1,6 @@
+- content_for :title, t("pager_group_destinations.index.page_title")
+
+- if @pager_group_destinations && @pager_group_destinations.count > 0
+ = render "index_core", :pager_group_destinations => @pager_group_destinations
+
+= render :partial => 'shared/create_link', :locals => {:child_class => PagerGroupDestination} \ No newline at end of file
diff --git a/app/views/pager_group_destinations/new.html.haml b/app/views/pager_group_destinations/new.html.haml
new file mode 100644
index 0000000..346911c
--- /dev/null
+++ b/app/views/pager_group_destinations/new.html.haml
@@ -0,0 +1,3 @@
+- content_for :title, t("pager_group_destinations.new.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/pager_group_destinations/show.html.haml b/app/views/pager_group_destinations/show.html.haml
new file mode 100644
index 0000000..4bc3adb
--- /dev/null
+++ b/app/views/pager_group_destinations/show.html.haml
@@ -0,0 +1,10 @@
+- content_for :title, t("pager_group_destinations.show.page_title")
+
+%p
+ %strong= t('pager_group_destinations.show.pager_group_id') + ":"
+ = @pager_group_destination.pager_group_id
+%p
+ %strong= t('pager_group_destinations.show.sip_account_id') + ":"
+ = @pager_group_destination.sip_account_id
+
+= render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @pager_group_destination } \ No newline at end of file
diff --git a/app/views/pager_groups/_form.html.haml b/app/views/pager_groups/_form.html.haml
new file mode 100644
index 0000000..a9d5782
--- /dev/null
+++ b/app/views/pager_groups/_form.html.haml
@@ -0,0 +1,7 @@
+= simple_form_for(@pager_group) do |f|
+ = f.error_notification
+
+ = render "form_core", :f => f
+
+ .form-actions
+ = f.button :submit, conditional_t('pager_groups.form.submit')
diff --git a/app/views/pager_groups/_form_core.html.haml b/app/views/pager_groups/_form_core.html.haml
new file mode 100644
index 0000000..eeb23d2
--- /dev/null
+++ b/app/views/pager_groups/_form_core.html.haml
@@ -0,0 +1,3 @@
+.inputs
+ = f.input :sip_account_id, :label => t('pager_groups.form.sip_account_id.label'), :hint => conditional_hint('pager_groups.form.sip_account_id.hint')
+ = f.input :callback_url, :label => t('pager_groups.form.callback_url.label'), :hint => conditional_hint('pager_groups.form.callback_url.hint')
diff --git a/app/views/pager_groups/_index_core.html.haml b/app/views/pager_groups/_index_core.html.haml
new file mode 100644
index 0000000..9515bcf
--- /dev/null
+++ b/app/views/pager_groups/_index_core.html.haml
@@ -0,0 +1,11 @@
+%table.table.table-striped
+ %tr
+ %th= t('pager_groups.index.sip_account_id')
+ %th= t('pager_groups.index.callback_url')
+
+
+ - for pager_group in pager_groups
+ %tr
+ %td= pager_group.sip_account_id
+ %td= pager_group.callback_url
+ =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => pager_group} \ No newline at end of file
diff --git a/app/views/pager_groups/edit.html.haml b/app/views/pager_groups/edit.html.haml
new file mode 100644
index 0000000..ec71984
--- /dev/null
+++ b/app/views/pager_groups/edit.html.haml
@@ -0,0 +1,3 @@
+- content_for :title, t("pager_groups.edit.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/pager_groups/index.html.haml b/app/views/pager_groups/index.html.haml
new file mode 100644
index 0000000..455e90e
--- /dev/null
+++ b/app/views/pager_groups/index.html.haml
@@ -0,0 +1,6 @@
+- content_for :title, t("pager_groups.index.page_title")
+
+- if @pager_groups && @pager_groups.count > 0
+ = render "index_core", :pager_groups => @pager_groups
+
+= render :partial => 'shared/create_link', :locals => {:child_class => PagerGroup} \ No newline at end of file
diff --git a/app/views/pager_groups/new.html.haml b/app/views/pager_groups/new.html.haml
new file mode 100644
index 0000000..fbb6ac3
--- /dev/null
+++ b/app/views/pager_groups/new.html.haml
@@ -0,0 +1,3 @@
+- content_for :title, t("pager_groups.new.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/pager_groups/show.html.haml b/app/views/pager_groups/show.html.haml
new file mode 100644
index 0000000..5e0a8c7
--- /dev/null
+++ b/app/views/pager_groups/show.html.haml
@@ -0,0 +1,10 @@
+- content_for :title, t("pager_groups.show.page_title")
+
+%p
+ %strong= t('pager_groups.show.sip_account_id') + ":"
+ = @pager_group.sip_account_id
+%p
+ %strong= t('pager_groups.show.callback_url') + ":"
+ = @pager_group.callback_url
+
+= render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @pager_group } \ No newline at end of file
diff --git a/app/views/phones/_index_core.html.haml b/app/views/phones/_index_core.html.haml
index 9a865f0..175aeb0 100644
--- a/app/views/phones/_index_core.html.haml
+++ b/app/views/phones/_index_core.html.haml
@@ -1,22 +1,30 @@
+- if defined?(phones.total_pages)
+ = will_paginate phones, :renderer => BootstrapPagination::Rails, :previous_label => raw('<i class = "icon-chevron-left"></i>'), :next_label => raw('<i class = "icon-chevron-right"></i>')
+
%table.table.table-striped
%thead
%tr
- %th= t('phones.index.mac_address')
+ - if defined?(show_phoneable) && show_phoneable
+ %th= sortable :phoneable_id, t('phones.index.phoneable')
+ %th= sortable :mac_address, t('phones.index.mac_address')
%th
%span.hidden-phone
- = t('phones.index.phone_model_id')
+ = sortable :phone_model_id, t('phones.index.phone_model_id')
%span.visible-phone
= truncate(t('phones.index.phone_model_id'), :length => 9)
%th
%span.hidden-phone
- = t('phones.index.hot_deskable')
+ = sortable :hot_deskable, t('phones.index.hot_deskable')
%th
%span.hidden-phone
- = t('phones.index.ip_address')
+ = sortable :ip_address, t('phones.index.ip_address')
%tbody
- for phone in phones
%tr{:class => (phone.ip_address.blank? ? 'warning' : '')}
+ - if defined?(show_phoneable) && show_phoneable
+ %td
+ = phone.phoneable
%td= phone.pretty_mac_address
%td= phone.phone_model
%td
diff --git a/app/views/phones/index.html.haml b/app/views/phones/index.html.haml
index 4de7919..8e61706 100644
--- a/app/views/phones/index.html.haml
+++ b/app/views/phones/index.html.haml
@@ -1,6 +1,6 @@
- content_for :title, t("phones.index.page_title")
- if @phones.count > 0
- = render "index_core", :phones => @phones
+ = render "index_core", :phones => @phones, :show_phoneable => (@parent.class == Tenant)
= render :partial => 'shared/create_link', :locals => {:parent => @parent, :child_class => Phone} \ No newline at end of file
diff --git a/app/views/sip_accounts/_form_core.html.haml b/app/views/sip_accounts/_form_core.html.haml
index d7c65d0..f84f38a 100644
--- a/app/views/sip_accounts/_form_core.html.haml
+++ b/app/views/sip_accounts/_form_core.html.haml
@@ -6,7 +6,6 @@
- else
= f.input :auth_name, :as => :string, :label => t('sip_accounts.form.auth_name.label'), :hint => conditional_hint('sip_accounts.form.auth_name.hint')
= f.input :password, :as => :string, :label => t('sip_accounts.form.password.label'), :hint => conditional_hint('sip_accounts.form.password.hint')
- = f.input :voicemail_pin, :as => :string, :label => t('sip_accounts.form.voicemail_pin.label'), :hint => conditional_hint('sip_accounts.form.voicemail_pin.hint')
= f.input :call_waiting, :label => t('sip_accounts.form.call_waiting.label'), :hint => conditional_hint('sip_accounts.form.call_waiting.hint')
= f.input :clir, :label => t('sip_accounts.form.clir.label'), :hint => conditional_hint('sip_accounts.form.clir.hint')
= f.input :clip, :label => t('sip_accounts.form.clip.label'), :hint => conditional_hint('sip_accounts.form.clip.hint')
@@ -14,3 +13,4 @@
= f.input :hotdeskable, :label => t('sip_accounts.form.hotdeskable.label'), :hint => conditional_hint('sip_accounts.form.hotdeskable.hint')
= f.input :clip_no_screening, :label => t('sip_accounts.form.clip_no_screening.label'), :hint => conditional_hint('sip_accounts.form.clip_no_screening.hint')
= f.input :language_code, :collection => Language.all.collect{|l| [l.to_s, l.code]}, :label => t('sip_accounts.form.language_code.label'), :hint => conditional_hint('sip_accounts.form.language_id.hint'), :include_blank => false
+ = f.input :voicemail_account_id, :collection => @possible_voicemail_accounts.collect{|l| [l.to_s, l.id]}, :label => t('sip_accounts.form.voicemail_account_id.label'), :hint => conditional_hint('voicemail_accounts.form.sip_account_id.hint'), :include_blank => true
diff --git a/app/views/sip_accounts/_index_core.html.haml b/app/views/sip_accounts/_index_core.html.haml
index d98ea0a..be1f4cb 100644
--- a/app/views/sip_accounts/_index_core.html.haml
+++ b/app/views/sip_accounts/_index_core.html.haml
@@ -1,10 +1,16 @@
+
+- if defined?(users.total_pages)
+ = will_paginate users, :renderer => BootstrapPagination::Rails, :previous_label => raw('<i class = "icon-chevron-left"></i>'), :next_label => raw('<i class = "icon-chevron-right"></i>')
+
%table.table.table-striped
%thead
%tr
+ - if defined?(show_sip_accountable) && show_sip_accountable
+ %th= sortable :sip_accountable_id, t('sip_accounts.index.sip_accountable')
%th
%span.hidden-phone
= t('sip_accounts.index.online')
- %th= t('sip_accounts.index.caller_name')
+ %th= sortable :caller_name, t('sip_accounts.index.caller_name')
%th
%span.hidden-phone
= t('sip_accounts.index.phone_numbers')
@@ -16,6 +22,9 @@
%tbody
- for sip_account in sip_accounts
%tr{:class => (sip_account.registration ? '' : 'warning')}
+ - if defined?(show_sip_accountable) && show_sip_accountable
+ %td
+ = sip_account.sip_accountable
%td
- if sip_account.registration
%i.icon-ok
diff --git a/app/views/sip_accounts/index.html.haml b/app/views/sip_accounts/index.html.haml
index fbdba48..114943e 100644
--- a/app/views/sip_accounts/index.html.haml
+++ b/app/views/sip_accounts/index.html.haml
@@ -1,6 +1,6 @@
- content_for :title, t("sip_accounts.index.page_title")
- if @sip_accounts.count > 0
- = render "index_core", :sip_accounts => @sip_accounts
+ = render "index_core", :sip_accounts => @sip_accounts, :show_sip_accountable => (@parent.class == Tenant)
= render :partial => 'shared/create_link', :locals => {:parent => @parent, :child_class => SipAccount} \ No newline at end of file
diff --git a/app/views/sip_accounts/show.html.haml b/app/views/sip_accounts/show.html.haml
index e79907f..a7cd3ce 100644
--- a/app/views/sip_accounts/show.html.haml
+++ b/app/views/sip_accounts/show.html.haml
@@ -37,6 +37,11 @@
%strong= t('sip_accounts.show.hotdeskable') + ":"
%td
= @sip_account.hotdeskable == true ? t('simple_form.yes') : t('simple_form.no')
+ %tr
+ %td
+ %strong= t('sip_accounts.show.voicemail_account') + ":"
+ %td
+ = @sip_account.voicemail_account
- if @sip_account.registration.try(:network_ip) && @sip_account.registration.try(:network_port)
%tr
diff --git a/app/views/switchboards/_form_core.html.haml b/app/views/switchboards/_form_core.html.haml
index 61b5934..2258640 100644
--- a/app/views/switchboards/_form_core.html.haml
+++ b/app/views/switchboards/_form_core.html.haml
@@ -1,2 +1,6 @@
.inputs
= f.input :name, :label => t('switchboards.form.name.label'), :hint => conditional_hint('switchboards.form.name.hint'), :autofocus => true
+ = f.input :reload_interval, :label => t('switchboards.form.reload_interval.label'), :hint => conditional_hint('switchboards.form.reload_interval.hint')
+ = f.input :show_avatars, :label => t('switchboards.form.show_avatars.label'), :hint => conditional_hint('switchboards.form.show_avatars.hint')
+ = f.input :entry_width, :label => t('switchboards.form.entry_width.label'), :hint => conditional_hint('switchboards.form.entry_width.hint')
+ = f.input :amount_of_displayed_phone_numbers, :label => t('switchboards.form.amount_of_displayed_phone_numbers.label'), :hint => conditional_hint('switchboards.form.amount_of_displayed_phone_numbers.hint') \ No newline at end of file
diff --git a/app/views/switchboards/show.html.haml b/app/views/switchboards/show-old.html.haml
index a825806..a825806 100644
--- a/app/views/switchboards/show.html.haml
+++ b/app/views/switchboards/show-old.html.haml
diff --git a/app/views/switchboards/show.html.erb b/app/views/switchboards/show.html.erb
new file mode 100644
index 0000000..2a2765f
--- /dev/null
+++ b/app/views/switchboards/show.html.erb
@@ -0,0 +1,79 @@
+<% content_for :title, "Switchboard #{@switchboard.name}" %>
+
+<script>
+ var switchboard_id = <%= @switchboard.id %>;
+ var show_avatars = <%= @switchboard.show_avatars.to_s %>;
+ var reload_interval = <%= @switchboard.reload_interval.nil? ? 0 : @switchboard.reload_interval %>;
+ var amount_of_displayed_phone_numbers = <%= @switchboard.amount_of_displayed_phone_numbers %>;
+</script>
+
+<div class='row'>
+ <div class='span12'>
+ <div id='emberjs-container'></div>
+
+ <script type="text/x-handlebars">
+ {{outlet}}
+ </script>
+
+ <script type="text/x-handlebars" data-template-name="switchboard">
+ <h2>{{name}}</h2>
+
+ {{#if switchboardEntrys.length}}
+ <ul class="thumbnails">
+ {{#each switchboardEntry in switchboardEntrys}}
+ <li class="span2">
+ <div class="thumbnail">
+ {{avatar_img switchboardEntry.avatar_src}}
+ <small>
+ <p>
+ <span class="label">{{switchboardEntry.name}}</span>
+
+ {{#each phoneNumber in switchboardEntry.sipAccount.phoneNumberShortList}}
+ <span class="label">
+ {{phoneNumber.number}}
+ </span>
+ {{/each}}
+ </p>
+
+ {{show_callstate switchboardEntry.callstate}}
+ {{#if switchboardEntry.sipAccount.calls.length}}
+ <p>
+ Anrufe:
+ <br>
+ {{#each call in switchboardEntry.sipAccount.calls}}
+ <span {{bindAttr class=":label call.isActive:label-success"}}>
+ {{call.b_caller_id_number}} -> {{call.destination}}
+ {{#if call.isActive}}
+ *
+ {{/if}}
+ </span>
+ {{/each}}
+ </p>
+ {{/if}}
+
+ {{#if activeCalls.length}}
+ <p>
+ Verbinden mit:
+ <br>
+ {{#each activeCall in activeCalls}}
+ <button {{action blind_transfer}}>
+ {{activeCall.b_caller_id_number}}
+ </button>
+ {{/each}}
+ </p>
+ {{/if}}
+ </small>
+ </div>
+ </li>
+ {{/each}}
+ </ul>
+ {{/if}}
+ </script>
+
+ </div>
+</div>
+
+<script src="/js/libs/handlebars.js"></script>
+<script src="/js/libs/ember.js"></script>
+<script src="/js/libs/ember-data.js"></script>
+<script src="/js/app.js"></script>
diff --git a/app/views/tenants/_admin_area.de.html.haml b/app/views/tenants/_admin_area.de.html.haml
index 8acc95d..db21c80 100644
--- a/app/views/tenants/_admin_area.de.html.haml
+++ b/app/views/tenants/_admin_area.de.html.haml
@@ -16,10 +16,16 @@
= render :partial => 'tenants/table_of_phone_books', :locals => {:tenant => tenant}
+ = render :partial => 'tenants/table_of_voicemail_accounts', :locals => {:tenant => tenant}
+
+ = render :partial => 'generic_files', :locals => {:tenant => tenant}
+
.well
%h2 Gemeinschaft Konfiguration
= render :partial => 'tenants/gs_parameter_table', :locals => {:tenant => tenant}
+ = render :partial => 'tenants/table_of_groups', :locals => {:tenant => tenant}
+
%p
Das System kann
= PhoneModel.count
diff --git a/app/views/tenants/_admin_area.en.html.haml b/app/views/tenants/_admin_area.en.html.haml
index c40e3ca..4b687af 100644
--- a/app/views/tenants/_admin_area.en.html.haml
+++ b/app/views/tenants/_admin_area.en.html.haml
@@ -12,14 +12,21 @@
= render :partial => 'tenants/table_of_automatic_call_distributors', :locals => {:tenant => tenant}
= render :partial => 'tenants/users_table', :locals => {:tenant => tenant}
+
= render :partial => 'tenants/user_groups_table', :locals => {:tenant => tenant}
= render :partial => 'tenants/table_of_phone_books', :locals => {:tenant => tenant}
+ = render :partial => 'tenants/table_of_voicemail_accounts', :locals => {:tenant => tenant}
+
+ = render :partial => 'generic_files', :locals => {:tenant => tenant}
+
.well
%h2 Gemeinschaft Configuration
= render :partial => 'tenants/gs_parameter_table', :locals => {:tenant => tenant}
+ = render :partial => 'tenants/table_of_groups', :locals => {:tenant => tenant}
+
%p
This system can provision a total of
= PhoneModel.count
@@ -42,4 +49,4 @@
= render :partial => 'gateways', :locals => {:tenant => tenant, :gateways => gateways}
- = render :partial => 'table_of_backup_jobs', :locals => {:tenant => tenant, :backup_jobs => backup_jobs} \ No newline at end of file
+ = render :partial => 'table_of_backup_jobs', :locals => {:tenant => tenant, :backup_jobs => backup_jobs}
diff --git a/app/views/tenants/_generic_files.html.haml b/app/views/tenants/_generic_files.html.haml
new file mode 100644
index 0000000..1b6fee5
--- /dev/null
+++ b/app/views/tenants/_generic_files.html.haml
@@ -0,0 +1,5 @@
+-# Files
+-#
+%h2= t('generic_files.index.page_title')
+= render "generic_files/index_core", :generic_files => tenant.generic_files
+= render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => GenericFile} \ No newline at end of file
diff --git a/app/views/tenants/_table_of_groups.html.haml b/app/views/tenants/_table_of_groups.html.haml
new file mode 100644
index 0000000..60f93cc
--- /dev/null
+++ b/app/views/tenants/_table_of_groups.html.haml
@@ -0,0 +1,8 @@
+%h2= t("groups.index.page_title")
+
+- if Group.count <= GsParameter.get('NUMBER_OF_SHOWN_ITEMS')
+ = render "groups/index_core", :groups => Group.all
+ = render :partial => 'shared/create_link', :locals => {:child_class => Group}
+- else
+ %p
+ = link_to t("groups.index.page_title"), groups_path
diff --git a/app/views/tenants/_table_of_phones.html.haml b/app/views/tenants/_table_of_phones.html.haml
index e87191d..9736ece 100644
--- a/app/views/tenants/_table_of_phones.html.haml
+++ b/app/views/tenants/_table_of_phones.html.haml
@@ -1,7 +1,11 @@
-- cache(['tenant_show_table_of_phones', I18n.locale, tenant, tenant.phones.count, tenant.phones.reorder(:updated_at).last]) do
+- phones = @tenant.tenant_user_phones
+- cache(['tenant_show_table_of_phones', I18n.locale, tenant, phones.count, phones.reorder(:updated_at).last]) do
-# Phones
-#
%h2= t('phones.index.page_title')
- - if tenant.phones.any?
- = render "phones/index_core", :phones => tenant.phones
- = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => Phone}
+ - if phones.count <= GsParameter.get('NUMBER_OF_SHOWN_ITEMS')
+ = render "phones/index_core", :phones => phones, :show_phoneable => true
+ = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => Phone}
+ - else
+ %p
+ = link_to t('phones.index.page_title'), tenant_phones_path(tenant)
diff --git a/app/views/tenants/_table_of_sip_accounts.html.haml b/app/views/tenants/_table_of_sip_accounts.html.haml
index b2f2612..4a1d570 100644
--- a/app/views/tenants/_table_of_sip_accounts.html.haml
+++ b/app/views/tenants/_table_of_sip_accounts.html.haml
@@ -5,7 +5,7 @@
-#
%h2= t('sip_accounts.index.page_title')
- if tenant.sip_accounts.any?
- = render "sip_accounts/index_core", :sip_accounts => tenant.sip_accounts
+ = render "sip_accounts/index_core", :sip_accounts => tenant.sip_accounts, :show_sip_accountable => true
= render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => SipAccount}
.span8
@@ -18,7 +18,11 @@
.span12
-# SIP accounts
-#
+ - sip_accounts = @tenant.tenant_user_sip_accounts
%h2= t('sip_accounts.index.page_title')
- - if tenant.sip_accounts.any?
- = render "sip_accounts/index_core", :sip_accounts => tenant.sip_accounts
- = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => SipAccount}
+ - if sip_accounts.count <= GsParameter.get('NUMBER_OF_SHOWN_ITEMS')
+ = render "sip_accounts/index_core", :sip_accounts => sip_accounts, :show_sip_accountable => true
+ = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => SipAccount}
+ - else
+ %p
+ = link_to t('sip_accounts.index.page_title'), tenant_sip_accounts_path(tenant)
diff --git a/app/views/tenants/_table_of_voicemail_accounts.html.haml b/app/views/tenants/_table_of_voicemail_accounts.html.haml
new file mode 100644
index 0000000..1cf455a
--- /dev/null
+++ b/app/views/tenants/_table_of_voicemail_accounts.html.haml
@@ -0,0 +1,8 @@
+- cache(['table_of_pbx_features_voicemail_accounts_row', I18n.locale, tenant, tenant.voicemail_accounts.count, tenant.voicemail_accounts.reorder(:updated_at).last]) do
+ -# VoicemailAccounts
+ -#
+ - if (can?( :index, VoicemailAccount ) && tenant.voicemail_accounts.count > 0 ) || can?( :create, VoicemailAccount )
+ %h2= t('voicemail_accounts.index.page_title')
+ - if can?( :index, VoicemailAccount ) && tenant.voicemail_accounts.count > 0
+ = render "voicemail_accounts/index_core", :voicemail_accounts => tenant.voicemail_accounts
+ = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => VoicemailAccount}
diff --git a/app/views/tenants/_users_table.html.haml b/app/views/tenants/_users_table.html.haml
index 850ea5e..099b27a 100644
--- a/app/views/tenants/_users_table.html.haml
+++ b/app/views/tenants/_users_table.html.haml
@@ -4,4 +4,4 @@
= render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => User}
- else
%p
- = link_to "Liste aller User.", tenant_users_path(tenant) \ No newline at end of file
+ = link_to t('users.index.page_title'), tenant_users_path(tenant)
diff --git a/app/views/users/_generic_files.html.haml b/app/views/users/_generic_files.html.haml
new file mode 100644
index 0000000..15bdb74
--- /dev/null
+++ b/app/views/users/_generic_files.html.haml
@@ -0,0 +1,7 @@
+-# Files
+-#
+- if (can?( :index, GenericFile ) && user.generic_files.count > 0 ) || can?( :create, GenericFile )
+ %h2= t('generic_files.index.page_title')
+ - if can?( :index, GenericFile ) && user.generic_files.count > 0
+ = render "generic_files/index_core", :generic_files => user.generic_files
+ = render :partial => 'shared/create_link', :locals => {:parent => user, :child_class => GenericFile} \ No newline at end of file
diff --git a/app/views/users/_index_core.html.haml b/app/views/users/_index_core.html.haml
index 9d63afc..7038457 100644
--- a/app/views/users/_index_core.html.haml
+++ b/app/views/users/_index_core.html.haml
@@ -1,16 +1,20 @@
-- cache(['user_table_row_inner_td', I18n.locale, current_user, users.reorder(:updated_at).last, users.count, GsParameter.get('NUMBER_OF_SHOWN_ITEMS')]) do
+- cache(['user_table_row_inner_td', I18n.locale, current_user, users.reorder(:updated_at).last, users.first, users.last, GsParameter.get('NUMBER_OF_SHOWN_ITEMS')]) do
+
+ - if defined?(users.total_pages)
+ = will_paginate users, :renderer => BootstrapPagination::Rails, :previous_label => raw('<i class = "icon-chevron-left"></i>'), :next_label => raw('<i class = "icon-chevron-right"></i>')
+
%table.table.table-striped
%thead
%tr
%th
- %th= t('users.index.user_name')
+ %th= sortable :user_name, t('users.index.user_name')
%th
%span.hidden-phone
- = t('users.index.email')
+ = sortable :email, t('users.index.email')
%th
%span.hidden-phone
- = t('users.index.first_name')
- %th= t('users.index.last_name')
+ = sortable :first_name, t('users.index.first_name')
+ %th= sortable :last_name, t('users.index.last_name')
%tbody
- for user in users
diff --git a/app/views/users/_voicemail_accounts.html.haml b/app/views/users/_voicemail_accounts.html.haml
new file mode 100644
index 0000000..4410b09
--- /dev/null
+++ b/app/views/users/_voicemail_accounts.html.haml
@@ -0,0 +1,7 @@
+-# VoicemailAccount
+-#
+- if (can?( :index, VoicemailAccount ) && user.voicemail_accounts.count > 0 ) || can?( :create, VoicemailAccount )
+ %h2= t('voicemail_accounts.index.page_title')
+ - if can?( :index, VoicemailAccount ) && user.voicemail_accounts.count > 0
+ = render "voicemail_accounts/index_core", {:voicemail_accounts => user.voicemail_accounts, :voicemail_accountable => user}
+ = render :partial => 'shared/create_link', :locals => {:parent => user, :child_class => VoicemailAccount} \ No newline at end of file
diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml
index 98f7cc6..697604a 100644
--- a/app/views/users/show.html.haml
+++ b/app/views/users/show.html.haml
@@ -43,13 +43,12 @@
%strong ...
%p
=link_to t("call_histories.index.page_title"), sip_account_call_histories_path(sip_account)
- %br
- =link_to t("voicemail_messages.index.page_title"), sip_account_voicemail_messages_path(sip_account)
+ - if ! sip_account.voicemail_account.blank?
+ %br
+ =link_to t("voicemail_messages.index.page_title"), voicemail_account_voicemail_messages_path(sip_account.voicemail_account)
%br
=link_to t("call_forwards.index.page_title"), sip_account_call_forwards_path(sip_account)
%br
- =link_to t("voicemail_settings.index.page_title"), sip_account_voicemail_settings_path(sip_account)
- %br
=link_to t("softkeys.index.page_title"), sip_account_softkeys_path(sip_account)
%br
=link_to t("ringtones.show.page_title"), sip_account_ringtones_path(sip_account)
@@ -85,8 +84,14 @@
- cache(['user_show_fax_accounts_overview', I18n.locale, @user, @user.fax_accounts]) do
= render :partial => 'fax_accounts', :locals => {:user => @user}
+ - cache(['user_show_voicemail_accounts_overview', I18n.locale, @user, @user.voicemail_accounts]) do
+ = render :partial => 'voicemail_accounts', :locals => {:user => @user}
+
- cache(['user_show_conferences_overview', I18n.locale, @user, @user.conferences]) do
= render :partial => 'conferences', :locals => {:user => @user}
- cache(['user_switchboards_overview', I18n.locale, @user, @user.switchboards]) do
- = render :partial => 'switchboards', :locals => {:user => @user} \ No newline at end of file
+ = render :partial => 'switchboards', :locals => {:user => @user}
+
+ - cache(['user_show_generic_files_overview', I18n.locale, @user, @user.generic_files]) do
+ = render :partial => 'generic_files', :locals => {:user => @user} \ No newline at end of file
diff --git a/app/views/voicemail_accounts/_form.html.haml b/app/views/voicemail_accounts/_form.html.haml
new file mode 100644
index 0000000..1e5ffc0
--- /dev/null
+++ b/app/views/voicemail_accounts/_form.html.haml
@@ -0,0 +1,7 @@
+= simple_form_for([@parent, @voicemail_account]) do |f|
+ = f.error_notification
+
+ = render "form_core", :f => f
+
+ .form-actions
+ = f.button :submit, conditional_t('voicemail_accounts.form.submit')
diff --git a/app/views/voicemail_accounts/_form_core.html.haml b/app/views/voicemail_accounts/_form_core.html.haml
new file mode 100644
index 0000000..a13ae51
--- /dev/null
+++ b/app/views/voicemail_accounts/_form_core.html.haml
@@ -0,0 +1,3 @@
+.inputs
+ = f.input :name, :label => t('voicemail_accounts.form.name.label'), :hint => conditional_hint('voicemail_accounts.form.name.hint')
+ = f.input :active, :label => t('voicemail_accounts.form.active.label'), :hint => conditional_hint('voicemail_accounts.form.active.hint')
diff --git a/app/views/voicemail_accounts/_index_core.html.haml b/app/views/voicemail_accounts/_index_core.html.haml
new file mode 100644
index 0000000..cd87c31
--- /dev/null
+++ b/app/views/voicemail_accounts/_index_core.html.haml
@@ -0,0 +1,18 @@
+%table.table.table-striped
+ %tr
+ %th
+ %th= t('voicemail_accounts.index.name')
+ %th= t('voicemail_messages.index.page_title')
+
+
+ - for voicemail_account in voicemail_accounts
+ %tr
+ %td
+ - if voicemail_account.active
+ %i.icon-ok
+ - else
+ %i.icon-ban-circle
+ %td= voicemail_account.name
+ %td= link_to voicemail_account.voicemail_messages.count, voicemail_account_voicemail_messages_path(voicemail_account)
+
+ =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:parent => voicemail_account.voicemail_accountable, :child => voicemail_account}
diff --git a/app/views/voicemail_accounts/edit.html.haml b/app/views/voicemail_accounts/edit.html.haml
new file mode 100644
index 0000000..8d1518e
--- /dev/null
+++ b/app/views/voicemail_accounts/edit.html.haml
@@ -0,0 +1,3 @@
+- content_for :title, t("voicemail_accounts.edit.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/voicemail_accounts/index.html.haml b/app/views/voicemail_accounts/index.html.haml
new file mode 100644
index 0000000..2bc8ae4
--- /dev/null
+++ b/app/views/voicemail_accounts/index.html.haml
@@ -0,0 +1,6 @@
+- content_for :title, t("voicemail_accounts.index.page_title")
+
+- if @voicemail_accounts && @voicemail_accounts.count > 0
+ = render "index_core", :voicemail_accounts => @voicemail_accounts
+
+= render :partial => 'shared/create_link', :locals => {:parent => @parent, :child_class => VoicemailAccount} \ No newline at end of file
diff --git a/app/views/voicemail_accounts/new.html.haml b/app/views/voicemail_accounts/new.html.haml
new file mode 100644
index 0000000..193779d
--- /dev/null
+++ b/app/views/voicemail_accounts/new.html.haml
@@ -0,0 +1,3 @@
+- content_for :title, t("voicemail_accounts.new.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/voicemail_accounts/show.html.haml b/app/views/voicemail_accounts/show.html.haml
new file mode 100644
index 0000000..8c75c93
--- /dev/null
+++ b/app/views/voicemail_accounts/show.html.haml
@@ -0,0 +1,16 @@
+- content_for :title, t("voicemail_accounts.show.page_title")
+
+%p
+ %strong= t('voicemail_accounts.show.name') + ":"
+ = @voicemail_account.name
+%p
+ %strong= t('voicemail_accounts.show.active') + ":"
+ = @voicemail_account.active
+
+= render :partial => 'shared/show_edit_destroy_part', :locals => { :parent => @parent, :child => @voicemail_account }
+
+%h3= t('voicemail_settings.index.page_title')
+- if @voicemail_account.voicemail_settings.any?
+ = render "voicemail_settings/index_core", :voicemail_settings => @voicemail_account.voicemail_settings
+ %br
+= render :partial => 'shared/create_link', :locals => { :parent => @voicemail_account, :child_class => VoicemailSetting }
diff --git a/app/views/voicemail_messages/_index_core.html.haml b/app/views/voicemail_messages/_index_core.html.haml
index 5e82761..f93365c 100644
--- a/app/views/voicemail_messages/_index_core.html.haml
+++ b/app/views/voicemail_messages/_index_core.html.haml
@@ -1,45 +1,77 @@
-= form_tag(destroy_multiple_sip_account_voicemail_messages_path(@sip_account), :method => :delete, :id => 'voicemail_message_form') do
- %header.entries-nav= render :partial => "voicemail_messages/navigation"
- .content
- %table.table.table-striped
-
- - for voicemail_message in voicemail_messages
- %tr.voicemail-messages-entry{:id => "message_#{voicemail_message.uuid}"}
- %td.select_box= check_box_tag("selected_uuids[]", voicemail_message.uuid, false, :uuid => "select_item_#{voicemail_message.uuid}", :class => 'select_item')
- %td.time
- .voicemail-received
- = voicemail_message.format_date(voicemail_message.created_epoch, t("voicemail_messages.index.date_format"), t("voicemail_messages.index.date_today_format"))
- - read_date = voicemail_message.format_date(voicemail_message.read_epoch, t("voicemail_messages.index.date_format"), t("voicemail_messages.index.date_today_format"))
- - if read_date
- .voicemail-read
- = read_date
- %td.folder
- = t("voicemail_messages.index.mailbox.#{voicemail_message.in_folder}")
- %td.user
- .name= voicemail_message.cid_name
- .phone= voicemail_message.cid_number
- %td.status
- .duration= voicemail_message.display_duration
- %td
- - if ! voicemail_message.flags.blank?
- = t("voicemail_messages.index.flags.#{voicemail_message.flags}")
- %td.form-actions
- - if can?(:show, voicemail_message) && File.readable?(voicemail_message.file_path)
- = link_to t('voicemail_messages.index.actions.download'), sip_account_voicemail_message_path(@sip_account, voicemail_message, :format => :wav), :method => :get
- %td.actions
- - if @sip_account.registration && can?(:call, voicemail_message)
- = link_to t('voicemail_messages.index.actions.call'), call_sip_account_voicemail_message_path(@sip_account, voicemail_message), :method => :put
- %td.form-actions
- - if can?(:edit, voicemail_message) && voicemail_message.read_epoch > 0
- = link_to t('voicemail_messages.index.actions.mark_unread'), mark_unread_sip_account_voicemail_message_path(@sip_account, voicemail_message), :method => :put
- - else
- = link_to t('voicemail_messages.index.actions.mark_read'), mark_read_sip_account_voicemail_message_path(@sip_account, voicemail_message), :method => :put
- %td.form-actions
- - if can? :destroy, voicemail_message
- = link_to t('voicemail_messages.index.actions.destroy'), sip_account_voicemail_message_path(@sip_account, voicemail_message), :method => :delete
+= render :partial => "voicemail_messages/navigation", :locals => {:type => @type}
+
+- if voicemail_messages.any?
+ = form_tag(destroy_multiple_voicemail_account_voicemail_messages_path(@voicemail_account), :method => :delete, :id => 'Setting_form') do
+ %table.table.table-striped
+ %thead
+ %tr
+ %th{:width => '10px'}
+ = button_tag(:type => 'submit', :class => 'btn btn-mini btn-danger', :confirm => t("voicemail_messages.index.actions.confirm_selected")) do
+ %i{:class => 'icon-trash icon-white'}
+ %th
+ =sortable :created_epoch, t("voicemail_messages.index.date")
+ %th{:width => '10px'}
+ %th
+ =sortable :cid_name, t("voicemail_messages.index.calling_party")
+ %th
+ =sortable :message_len, t("voicemail_messages.index.duration")
+ %th
+ =sortable :flags, t("voicemail_messages.index.message_flags")
+ %th
+ %th
+ %tfoot
+ %tr
+ %td{:colspan => 2}
+ = button_tag(:type => 'submit', :class => 'btn btn-mini btn-danger', :confirm => t("voicemail_messages.index.actions.confirm_selected")) do
+ %i{:class => 'icon-trash icon-white'}
+ = t("voicemail_messages.index.actions.destroy_multiple")
+ %td{:colspan => 4}
+ %tbody
+ - for voicemail_message in voicemail_messages
+ - phone_book_entry = nil
+ - image = nil
+ - if !voicemail_message.cid_number.blank?
+ - phone_book_entry = voicemail_message.phone_book_entry_by_number(voicemail_message.cid_number)
+ - if phone_book_entry
+ - image = phone_book_entry.image_url(:mini)
+ %tr{:id => "message_#{voicemail_message.uuid}"}
+ %td.select_box= check_box_tag("selected_uuids[]", voicemail_message.uuid, false, :uuid => "select_item_#{voicemail_message.uuid}", :class => 'select_item')
+ %td
+ = l Time.at(voicemail_message.created_epoch).to_datetime, :format => :short
+ - if voicemail_message.read_epoch > 0
+ %br
+ %i{:class => 'icon-bullhorn'}
+ = l Time.at(voicemail_message.read_epoch).to_datetime, :format => :short
+ - else
+ %br
+ %i{:class => 'icon-envelope'}
+ = t("voicemail_messages.index.unread")
+ %td
+ - if image
+ %ul.thumbnails
+ =image_tag(image, :alt => phone_book_entry.to_s, :class => 'img-rounded')
+ %td
+ - if phone_book_entry
+ %a.name{:href => phone_book_phone_book_entry_path(phone_book_entry.phone_book, phone_book_entry), :itemprop => "name"}= voicemail_message.cid_name
+ - else
+ .name= voicemail_message.cid_name
+ .phone= voicemail_message.cid_number
+ %td
+ = voicemail_message.display_duration
+ %td
+ - if ! voicemail_message.flags.blank?
+ = t("voicemail_messages.index.flags.#{voicemail_message.flags}")
+ %td
+ - if can?(:show, voicemail_message) && File.readable?(voicemail_message.file_path)
+ = link_to raw("<i class = 'icon-download'></i> ") + t('voicemail_messages.index.actions.download'), voicemail_account_voicemail_message_path(@voicemail_account, voicemail_message, :format => :wav), :method => :get
+ - if can?(:edit, voicemail_message) && voicemail_message.read_epoch > 0
+ = link_to raw("<i class = 'icon-envelope'></i> ") + t('voicemail_messages.index.actions.mark_unread'), mark_unread_voicemail_account_voicemail_message_path(@voicemail_account, voicemail_message), :method => :put
+ - else
+ = link_to raw("<i class = 'icon-bullhorn'></i> ") + t('voicemail_messages.index.actions.mark_read'), mark_read_voicemail_account_voicemail_message_path(@voicemail_account, voicemail_message), :method => :put
+ %td
+ - if @available_sip_account && @available_sip_account.registration && can?(:call, voicemail_message)
+ = link_to raw("<i class = 'icon-bell'></i> ") + t('voicemail_messages.index.actions.call'), call_voicemail_account_voicemail_message_path(@voicemail_account, voicemail_message), :method => :put, :class => 'btn btn-mini'
- %footer.entries-nav= render :partial => "voicemail_messages/navigation"
- = link_to Haml::Engine.new("%i.icon-remove").render + ' test ', root_url
- = image_submit_tag('icons/cross-16x.png', :confirm => t("voicemail_messages.index.actions.confirm_selected"))
- = t("voicemail_messages.index.actions.destroy_multiple")
+ - if can? :destroy, voicemail_message
+ = link_to raw("<i class = 'icon-trash icon-white'></i> ") + t('voicemail_messages.index.actions.destroy'), [@voicemail_account, voicemail_message], :method => :delete, :remote => true, :class => 'btn btn-mini btn-danger'
diff --git a/app/views/voicemail_messages/_navigation.html.haml b/app/views/voicemail_messages/_navigation.html.haml
index 2277bf2..225801c 100644
--- a/app/views/voicemail_messages/_navigation.html.haml
+++ b/app/views/voicemail_messages/_navigation.html.haml
@@ -1,9 +1,10 @@
-%nav
- %ol.abc
- %li
+%div{:class => 'pagination'}
+ %ul
+ %li{:class => (type.blank? ? :active : nil )}
%a{ :href => "?type=" }= t('voicemail_messages.index.navigation.all', :count => @messages_count)
+ %li{:class => (type == 'read' ? :active : nil )}
%a{ :href => "?type=read" }= t('voicemail_messages.index.navigation.read', :count => @messages_read_count)
+ %li{:class => (type == 'unread' ? :active : nil )}
%a{ :href => "?type=unread" }= t('voicemail_messages.index.navigation.unread', :count => @messages_unread_count)
-.pagination
- = will_paginate @voicemail_messages
+ = will_paginate @voicemail_messages, :renderer => BootstrapPagination::Rails, :previous_label => raw('<i class = "icon-chevron-left"></i>'), :next_label => raw('<i class = "icon-chevron-right"></i>'), :class => nil
diff --git a/app/views/voicemail_settings/_edit_form.html.haml b/app/views/voicemail_settings/_edit_form.html.haml
new file mode 100644
index 0000000..374df9f
--- /dev/null
+++ b/app/views/voicemail_settings/_edit_form.html.haml
@@ -0,0 +1,8 @@
+
+= simple_form_for([@voicemail_account, @voicemail_setting]) do |f|
+ = f.error_notification
+
+ = render "edit_form_core", :f => f
+
+ .form-actions
+ = f.button :submit, conditional_t('voicemail_settings.form.submit')
diff --git a/app/views/voicemail_settings/_edit_form_core.html.haml b/app/views/voicemail_settings/_edit_form_core.html.haml
new file mode 100644
index 0000000..4352f24
--- /dev/null
+++ b/app/views/voicemail_settings/_edit_form_core.html.haml
@@ -0,0 +1,2 @@
+.inputs
+ = f.input :value, :label => t("voicemail_settings.settings.#{@voicemail_setting.name.to_s}"), :hint => @voicemail_setting.description, :as => @input_type, input_html: @input_html
diff --git a/app/views/voicemail_settings/_form.html.haml b/app/views/voicemail_settings/_form.html.haml
index cd43b2d..08fc37b 100644
--- a/app/views/voicemail_settings/_form.html.haml
+++ b/app/views/voicemail_settings/_form.html.haml
@@ -1,4 +1,5 @@
-= simple_form_for([@sip_account,@voicemail_setting]) do |f|
+
+= simple_form_for([@voicemail_account, @voicemail_setting]) do |f|
= f.error_notification
= render "form_core", :f => f
diff --git a/app/views/voicemail_settings/_form_core.html.haml b/app/views/voicemail_settings/_form_core.html.haml
index 08bdfc2..00d2a9e 100644
--- a/app/views/voicemail_settings/_form_core.html.haml
+++ b/app/views/voicemail_settings/_form_core.html.haml
@@ -1,11 +1,5 @@
-.inputs
- = f.input :greeting_path, :as => :select, :label => t('voicemail_settings.form.greeting.label'), :hint => conditional_hint('voicemail_settings.form.greeting.hint'), :collection => @greeting_files
- = f.input :name_path, :as => :select, :label => t('voicemail_settings.form.name.label'), :hint => conditional_hint('voicemail_settings.form.name.hint'), :collection => @name_files
-
- = f.input :password, :label => t('voicemail_settings.form.pin.label'), :hint => conditional_hint('voicemail_settings.form.pin.hint')
-
- = f.input :notify, :as => :boolean, :label => t('voicemail_settings.form.notify.label'), :hint => conditional_hint('voicemail_settings.form.notify.hint')
- = f.input :attachment, :as => :boolean, :label => t('voicemail_settings.form.attachment.label'), :hint => conditional_hint('voicemail_settings.form.attachment.hint')
- = f.input :mark_read, :as => :boolean, :label => t('voicemail_settings.form.mark_read.label'), :hint => conditional_hint('voicemail_settings.form.mark_read.hint')
- = f.input :purge, :as => :boolean, :label => t('voicemail_settings.form.purge.label'), :hint => conditional_hint('voicemail_settings.form.purge.hint')
+.inputs
+ = f.input :name, :collection => @names_possible, :label => t('voicemail_settings.form.name.label'), :hint => conditional_hint('voicemail_settings.form.name.hint'), :autofocus => true, :include_blank => false
+ = f.input :value, :label => t('voicemail_settings.form.value.label'), :hint => conditional_hint('voicemail_settings.form.value.hint')
+ = f.input :description, :label => t('voicemail_settings.form.description.label'), :hint => conditional_hint('voicemail_settings.form.description.hint')
diff --git a/app/views/voicemail_settings/_index_core.html.haml b/app/views/voicemail_settings/_index_core.html.haml
new file mode 100644
index 0000000..9173fe6
--- /dev/null
+++ b/app/views/voicemail_settings/_index_core.html.haml
@@ -0,0 +1,14 @@
+%table.table.table-striped
+ %thead
+ %tr
+ %th= t('voicemail_settings.index.name')
+ %th= t('voicemail_settings.index.value')
+ %th= t('voicemail_settings.index.description')
+
+ %tbody
+ - for voicemail_setting in voicemail_settings
+ %tr
+ %td= t("voicemail_settings.settings.#{voicemail_setting.name}")
+ %td= voicemail_setting.value
+ %td= voicemail_setting.description
+ =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:parent => voicemail_setting.voicemail_account, :child => voicemail_setting}
diff --git a/app/views/voicemail_settings/edit.html.haml b/app/views/voicemail_settings/edit.html.haml
index 56e5765..cfda363 100644
--- a/app/views/voicemail_settings/edit.html.haml
+++ b/app/views/voicemail_settings/edit.html.haml
@@ -1,3 +1,3 @@
- content_for :title, t("voicemail_settings.edit.page_title")
-= render "form"
+= render "edit_form" \ No newline at end of file
diff --git a/app/views/voicemail_settings/index.html.haml b/app/views/voicemail_settings/index.html.haml
new file mode 100644
index 0000000..5eb9940
--- /dev/null
+++ b/app/views/voicemail_settings/index.html.haml
@@ -0,0 +1,6 @@
+- content_for :title, t("voicemail_settings.index.page_title")
+
+- if @voicemail_settings && @voicemail_settings.count > 0
+ = render "index_core", :voicemail_settings => @voicemail_settings
+
+= render :partial => 'shared/create_link', :locals => {:parent => @voicemail_account, :child_class => VoicemailSetting}
diff --git a/app/views/voicemail_settings/new.html.haml b/app/views/voicemail_settings/new.html.haml
new file mode 100644
index 0000000..6eddc39
--- /dev/null
+++ b/app/views/voicemail_settings/new.html.haml
@@ -0,0 +1,3 @@
+- content_for :title, t("voicemail_settings.new.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/voicemail_settings/show.html.haml b/app/views/voicemail_settings/show.html.haml
index e156d7b..277874e 100644
--- a/app/views/voicemail_settings/show.html.haml
+++ b/app/views/voicemail_settings/show.html.haml
@@ -1,26 +1,16 @@
- content_for :title, t("voicemail_settings.show.page_title")
%p
- %strong= t('voicemail_settings.show.greeting_path') + ":"
- = File.basename(@voicemail_setting.greeting_path.to_s)
-
+ %strong= t('voicemail_settings.show.name') + ":"
+ = @voicemail_setting.name
%p
- %strong= t('voicemail_settings.show.name_path') + ":"
- = File.basename(@voicemail_setting.name_path.to_s)
-
+ %strong= t('voicemail_settings.show.value') + ":"
+ = @voicemail_setting.value
+%p
+ %strong= t('voicemail_settings.show.class_type') + ":"
+ = @voicemail_setting.class_type
%p
- %strong= t('voicemail_settings.show.flags') + ":"
- - if @voicemail_setting.notify
- %br
- = "- " + t('voicemail_settings.show.notify')
- - if @voicemail_setting.attachment
- %br
- = "- " + t('voicemail_settings.show.attachment')
- - if @voicemail_setting.mark_read
- %br
- = "- " + t('voicemail_settings.show.mark_read')
- - if @voicemail_setting.purge
- %br
- = "- " + t('voicemail_settings.show.purge')
+ %strong= t('voicemail_settings.show.description') + ":"
+ = @voicemail_setting.description
-= link_to t('voicemail_settings.actions.edit'), edit_sip_account_voicemail_setting_path(@sip_account, @voicemail_setting)
+= render :partial => 'shared/show_edit_destroy_part', :locals => {:parent => @voicemail_setting.voicemail_account, :child => @voicemail_setting} \ No newline at end of file