diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/freeswitch_event.rb | 20 | ||||
-rw-r--r-- | lib/tasks/backup.rake | 6 | ||||
-rw-r--r-- | lib/tasks/csv_user_import.rake (renamed from lib/tasks/cvs_user_import.rake) | 0 | ||||
-rw-r--r-- | lib/tasks/gs_cluster.rake | 8 |
4 files changed, 30 insertions, 4 deletions
diff --git a/lib/freeswitch_event.rb b/lib/freeswitch_event.rb index b6e5cbc..68d9df2 100644 --- a/lib/freeswitch_event.rb +++ b/lib/freeswitch_event.rb @@ -44,8 +44,8 @@ class FreeswitchEventSocket @socket.close end - def read() - return @socket.recv(1024) + def read(read_bytes=1024) + return @socket.recv(read_bytes) end def result() @@ -130,4 +130,20 @@ class FreeswitchAPI return false end + + def self.channel_variable_get(channel_uuid, variable_name) + result = nil + event = FreeswitchEventSocket.new() + if event && event.connect() + event.command( "api uuid_getvar #{channel_uuid} #{variable_name}") + event_result = event.result() + if event_result && event_result["Content-Type"] == 'api/response' && event_result["Content-Length"].to_i > 0 + result = event.read(event_result["Content-Length"].to_i) + end + event.close() + end + + return result + end + end diff --git a/lib/tasks/backup.rake b/lib/tasks/backup.rake new file mode 100644 index 0000000..c285e1f --- /dev/null +++ b/lib/tasks/backup.rake @@ -0,0 +1,6 @@ +namespace :backup do + desc "Backup the system" + task :daily_backup => :environment do + # This would be the daily backup. + end +end
\ No newline at end of file diff --git a/lib/tasks/cvs_user_import.rake b/lib/tasks/csv_user_import.rake index 81959d5..81959d5 100644 --- a/lib/tasks/cvs_user_import.rake +++ b/lib/tasks/csv_user_import.rake diff --git a/lib/tasks/gs_cluster.rake b/lib/tasks/gs_cluster.rake index 7b49ebb..c248c32 100644 --- a/lib/tasks/gs_cluster.rake +++ b/lib/tasks/gs_cluster.rake @@ -201,10 +201,14 @@ namespace :gs_cluster do remote_objects(remote_site, local_node_id, last_sync, Softkey).each do |remote_object| attributes = make_hash(remote_object.attributes) attributes[:sip_account_id] = SipAccount.where(:uuid => attributes[:sip_account_uuid]).first.try(:id) - attributes[:call_forward_id] = CallForward.where(:uuid => attributes[:call_forward_uuid]).first.try(:id) + + if ! attributes[:softkeyable_uuid].blank? + attributes[:softkeyable_id] = attributes[:softkeyable_type].constantize.where(:uuid => attributes[:softkeyable_uuid]).first.try(:id) + end + attributes[:softkey_function_id] = SoftkeyFunction.where(:name => attributes[:function]).first.try(:id) attributes.delete(:sip_account_uuid) - attributes.delete(:call_forward_uuid) + attributes.delete(:softkeyable_uuid) attributes.delete(:softkey_function) process_object(Softkey, Softkey, Softkey.where(:uuid => attributes[:uuid]).first, attributes) end |