summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-03-09 05:45:39 -0500
committerPeter Kozak <spag@golwen.net>2013-03-09 05:45:39 -0500
commit595a48a91f8549b20109942e0b80df4f891d5999 (patch)
tree55727c1b572bce0bc80c383cb6e3c29e7fe28fd6 /app/models
parent2a9e544a6a1f846fa1291c62a85cf7ef019ced64 (diff)
status method added
Diffstat (limited to 'app/models')
-rw-r--r--app/models/sip_account.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/app/models/sip_account.rb b/app/models/sip_account.rb
index a5b8bad..bb45a4c 100644
--- a/app/models/sip_account.rb
+++ b/app/models/sip_account.rb
@@ -184,6 +184,33 @@ class SipAccount < ActiveRecord::Base
return sip_accounts
end
+ def status
+ states = Array.new
+
+ SipAccount.last.call_legs.each do |call_leg|
+ states << {
+ :status => call_leg.callstate,
+ :caller => true,
+ :endpoint_name => call_leg.callee_name,
+ :endpoint_number => call_leg.destination,
+ :endpoint_sip_account_id => call_leg.b_sip_account_id,
+ :start_stamp => call_leg.start_stamp,
+ }
+ end
+
+ SipAccount.last.b_call_legs.each do |call_leg|
+ states << {
+ :status => call_leg.callstate,
+ :caller => false,
+ :endpoint_name => call_leg.caller_id_name,
+ :endpoint_number => call_leg.caller_id_number,
+ :endpoint_sip_account_id => call_leg.sip_account_id,
+ :start_stamp => call_leg.start_stamp,
+ }
+ end
+
+ return states
+ end
private