summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/models/call_route.rb11
-rw-r--r--app/models/sip_account.rb2
-rw-r--r--app/models/sip_registration.rb21
-rw-r--r--app/views/call_routes/_index_core.html.haml11
-rw-r--r--app/views/call_routes/show.html.haml11
-rw-r--r--app/views/fax_accounts/_index_core.html.haml6
-rw-r--r--app/views/sip_accounts/show.html.haml7
-rw-r--r--config/locales/views/call_routes/de.yml6
-rw-r--r--config/locales/views/call_routes/en.yml6
-rw-r--r--config/locales/views/sip_accounts/de.yml1
-rw-r--r--config/locales/views/sip_accounts/en.yml1
11 files changed, 64 insertions, 19 deletions
diff --git a/app/models/call_route.rb b/app/models/call_route.rb
index 28120c1..b4496ab 100644
--- a/app/models/call_route.rb
+++ b/app/models/call_route.rb
@@ -238,4 +238,15 @@ class CallRoute < ActiveRecord::Base
end
end
end
+
+ def endpoint
+ if self.endpoint_id.to_i > 0
+ begin
+ return self.endpoint_type.camelize.constantize.where(:id => self.endpoint_id.to_i).first
+ rescue
+ return nil
+ end
+ end
+ end
+
end
diff --git a/app/models/sip_account.rb b/app/models/sip_account.rb
index d35f9b4..444eb12 100644
--- a/app/models/sip_account.rb
+++ b/app/models/sip_account.rb
@@ -133,7 +133,7 @@ class SipAccount < ActiveRecord::Base
end
def registration
- return FreeswitchRegistration.where(:reg_user => self.auth_name).first
+ return SipRegistration.where(:sip_user => self.auth_name).first
end
def call( phone_number )
diff --git a/app/models/sip_registration.rb b/app/models/sip_registration.rb
new file mode 100644
index 0000000..b668301
--- /dev/null
+++ b/app/models/sip_registration.rb
@@ -0,0 +1,21 @@
+class SipRegistration < ActiveRecord::Base
+ # Makes sure that this is a readonly model.
+ def readonly?
+ return true
+ end
+
+ # Prevent objects from being destroyed
+ def before_destroy
+ raise ActiveRecord::ReadOnlyRecord
+ end
+
+ # Prevent objects from being deleted
+ def self.delete_all
+ raise ActiveRecord::ReadOnlyRecord
+ end
+
+ # Prevent objects from being deleted
+ def delete
+ raise ActiveRecord::ReadOnlyRecord
+ end
+end
diff --git a/app/views/call_routes/_index_core.html.haml b/app/views/call_routes/_index_core.html.haml
index 2e9238e..f0acebb 100644
--- a/app/views/call_routes/_index_core.html.haml
+++ b/app/views/call_routes/_index_core.html.haml
@@ -4,7 +4,7 @@
%tr
%th= t('call_routes.index.name')
%th= t('route_elements.index.pattern')
- %th= t('call_routes.index.endpoint_type')
+ %th= t('call_routes.index.endpoint')
%tbody
- for call_route in call_routes
@@ -18,5 +18,10 @@
= ', ...'
- else
= '-'
- %td= call_route.endpoint_type
- =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => call_route} \ No newline at end of file
+ %td
+ - endpoint = call_route.endpoint
+ - if endpoint
+ = endpoint
+ - else
+ = call_route.endpoint_type
+ =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => call_route}
diff --git a/app/views/call_routes/show.html.haml b/app/views/call_routes/show.html.haml
index 70fe13e..09daf53 100644
--- a/app/views/call_routes/show.html.haml
+++ b/app/views/call_routes/show.html.haml
@@ -7,11 +7,12 @@
%strong= t('call_routes.show.name') + ":"
= @call_route.name
%p
- %strong= t('call_routes.show.endpoint_type') + ":"
- = @call_route.endpoint_type
-%p
- %strong= t('call_routes.show.endpoint_id') + ":"
- = @call_route.endpoint_id
+ %strong= t('call_routes.show.endpoint') + ":"
+ - endpoint = @call_route.endpoint
+ - if endpoint
+ = endpoint
+ - else
+ = @call_route.endpoint_type
= render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @call_route }
diff --git a/app/views/fax_accounts/_index_core.html.haml b/app/views/fax_accounts/_index_core.html.haml
index f86a4ac..d694f8f 100644
--- a/app/views/fax_accounts/_index_core.html.haml
+++ b/app/views/fax_accounts/_index_core.html.haml
@@ -28,9 +28,11 @@
%br
= truncate(fax_account.station_id, :length => 20)
%td
- = link_to fax_account.fax_documents.inbound.count, fax_account_fax_documents_path(fax_account, :anchor => "fax_document_#{fax_account.fax_documents.inbound.first.try(:id)}")
+ - inbound_documents = fax_account.fax_documents.where(:inbound => true)
+ - outbound_documents = fax_account.fax_documents.where(:inbound => [false, nil])
+ = link_to inbound_documents.count, fax_account_fax_documents_path(fax_account, :anchor => "fax_document_#{inbound_documents.first.try(:id)}")
= '/'
- = link_to fax_account.fax_documents.outbound.count, fax_account_fax_documents_path(fax_account, :anchor => "fax_document_#{fax_account.fax_documents.outbound.first.try(:id)}")
+ = link_to outbound_documents.count, fax_account_fax_documents_path(fax_account, :anchor => "fax_document_#{outbound_documents.first.try(:id)}")
- if fax_account.fax_documents.any?
%br
%small
diff --git a/app/views/sip_accounts/show.html.haml b/app/views/sip_accounts/show.html.haml
index c21b3f4..72e10df 100644
--- a/app/views/sip_accounts/show.html.haml
+++ b/app/views/sip_accounts/show.html.haml
@@ -55,6 +55,13 @@
%strong= t('sip_accounts.show.expires') + ":"
%td
= "#{@sip_account.registration.try(:expires) - Time.now.to_i} s"
+ - if @sip_account.registration.try(:user_agent)
+ %tr
+ %td
+ %strong= t('sip_accounts.show.user_agent') + ":"
+ %td
+ = @sip_account.registration.try(:user_agent)
+
= render :partial => 'shared/show_edit_destroy_part', :locals => { :parent => @sip_account.sip_accountable, :child => @sip_account }
diff --git a/config/locales/views/call_routes/de.yml b/config/locales/views/call_routes/de.yml
index 260b869..a8d6f4b 100644
--- a/config/locales/views/call_routes/de.yml
+++ b/config/locales/views/call_routes/de.yml
@@ -9,8 +9,7 @@ de:
page_title: 'Liste aller Call Routen'
routing_table: 'Routing Table'
name: 'Name'
- endpoint_type: 'Endpoint type'
- endpoint_id: 'Endpoint'
+ endpoint: 'Endpoint'
position: 'Position'
actions:
confirm_destroy: 'Sind Sie sicher, dass Sie folgendes löschen möchten: Call Route'
@@ -23,8 +22,7 @@ de:
page_title: 'Call Route bearbeiten'
routing_table: 'Routing Table'
name: 'Name'
- endpoint_type: 'Endpoint type'
- endpoint_id: 'Endpoint'
+ endpoint: 'Endpoint'
position: 'Position'
actions:
confirm_destroy: 'Sind Sie sicher, dass die dieses Element löschen möchten?'
diff --git a/config/locales/views/call_routes/en.yml b/config/locales/views/call_routes/en.yml
index 25e4c51..8596474 100644
--- a/config/locales/views/call_routes/en.yml
+++ b/config/locales/views/call_routes/en.yml
@@ -9,8 +9,7 @@ en:
page_title: 'Listing Call route'
table: 'Table'
name: 'Name'
- endpoint_type: 'Endpoint type'
- endpoint_id: 'Endpoint'
+ endpoint: 'Endpoint'
position: 'Position'
actions:
confirm_destroy: 'Are you sure you want to delete this Call route?'
@@ -23,8 +22,7 @@ en:
page_title: 'Show Call route'
table: 'Table'
name: 'Name'
- endpoint_type: 'Endpoint type'
- endpoint_id: 'Endpoint'
+ endpoint: 'Endpoint'
position: 'Position'
actions:
confirm_destroy: 'Are you sure you want to delete this element?'
diff --git a/config/locales/views/sip_accounts/de.yml b/config/locales/views/sip_accounts/de.yml
index e711137..2820336 100644
--- a/config/locales/views/sip_accounts/de.yml
+++ b/config/locales/views/sip_accounts/de.yml
@@ -40,6 +40,7 @@ de:
callforward_rules_act_per_sip_account: 'Rufweiterleitungen gelten für das gesamte SIP-Account'
registration: 'Registrierung'
expires: 'Läuft ab'
+ user_agent: 'User Agent'
actions:
confirm_destroy: 'Sind Sie sicher, dass Sie diesen SIP-Account löschen möchten?'
destroy: 'Löschen'
diff --git a/config/locales/views/sip_accounts/en.yml b/config/locales/views/sip_accounts/en.yml
index 99d14b5..aa934e9 100644
--- a/config/locales/views/sip_accounts/en.yml
+++ b/config/locales/views/sip_accounts/en.yml
@@ -40,6 +40,7 @@ en:
callforward_rules_act_per_sip_account: 'Callforwards work for the whole sip account'
registration: 'Registration'
expires: 'Expires'
+ user_agent: 'User Agent'
actions:
confirm_destroy: 'Are you sure you want to delete this SIP account?'
destroy: 'Delete'