avaya 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 89dd622f3f777a6471b03bb18ec315e01a645814
4
- data.tar.gz: 632b4719fe77e52d99e599305fcf23df4031eb0d
3
+ metadata.gz: 082bb6b5a31180c9f3e830d88c030345128d6b7d
4
+ data.tar.gz: 4f3eec6f3fc9dbf8b70fee594c6b1abd4b8bc798
5
5
  SHA512:
6
- metadata.gz: a81ef409cd60c01a8cea2a4ca21991a0ff702713748d5e7269ffd8e9dabaf81eba28da4fa441324cabf23b88ec93fbc51d8567b5bb1e8b211fbf0903b37873f3
7
- data.tar.gz: 9c24025f1046626d511b95020ab463d142e746a385acc133335dbcd7898c2f7ff2c70b2c99931973ccf7baab94fb5caca14962d308e8a8687f15e783835fec96
6
+ metadata.gz: a2d7386171698b8034e85562a9df3ab2e6be0d850b483d3a1dd028565b80da6c81ef70f3a63a2baa255adb96c2daaab2bafa7db55ba1b91cfc19dc07ec7513b0
7
+ data.tar.gz: a9623e7c9b17631df471dd628ee5e5a111f449de8fc1a9246a50db62fc5875fa6f1f7266fcc8ef79c3943e5c77d8f0ec32b0bd652c552ff2c01e72858bc86b11
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # Avaya Ip Office integration
2
+ [![Gem Version](https://badge.fury.io/rb/avaya.svg)](http://badge.fury.io/rb/avaya)
2
3
 
3
4
  This gem gives limted read only integration from your IPOFFICE (only tested on ip office 500v2)
4
5
 
@@ -6,6 +7,10 @@ This gem gives limted read only integration from your IPOFFICE (only tested on i
6
7
 
7
8
  Add this line to your application's Gemfile:
8
9
 
10
+ gem 'avaya'
11
+
12
+ or bleeding edge
13
+
9
14
  gem 'avaya' , :git => 'git://github.com/freibuis/Avaya-IP-Office.git' ,branch: master
10
15
 
11
16
  And then execute:
@@ -23,7 +28,7 @@ For rails support just run the following command. This will create the initializ
23
28
  ## Usage
24
29
 
25
30
  1st create the connection
26
- $ Avaya::Configuration.config {|config| config.host = "ip_office_server_ipaddress"}
31
+ $ Avaya::Configuration.host = "ip_office_server_ipaddress"
27
32
 
28
33
  Once you have set up the connection. you can use the helpers to get data out
29
34
 
@@ -53,7 +58,7 @@ an array of :name,:ext,:queue,:voice_mails,:hunt_id is returned
53
58
 
54
59
  ## Todo:
55
60
 
56
- Currently CallList not working as I need to reverse engineer the values from the phone platform
61
+ Currently user_info not working as I need to reverse engineer the values from the phone platform
57
62
 
58
63
 
59
64
  ## Contributing
data/avaya.gemspec CHANGED
@@ -20,5 +20,5 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.6"
22
22
  spec.add_development_dependency "rake", "~> 0"
23
- spec.add_development_dependency "net-tftp", ">= 0.1.0"
23
+ spec.add_development_dependency "net-tftp", "~> 0.1.0"
24
24
  end
@@ -1,39 +1,45 @@
1
1
  module Avaya
2
2
  class CallList
3
- attr_reader :all_calls, :name, :ras, :pots, :sip, :q93
3
+ attr_reader :raw,
4
+ :name,
5
+ :ras,
6
+ :pots,
7
+ :sip,
8
+ :q93,
9
+ :calls
4
10
 
5
11
  def initialize
6
12
 
7
- @ras = []
8
- @pots = []
9
- @sip = []
10
- @q93 = []
11
- @all_calls = Avaya::TFTP.read(:call_list)
13
+ @ras = []
14
+ @pots = []
15
+ @sip = []
16
+ @q93 = []
17
+ @calls = []
18
+ @raw = Avaya::TFTP.read(:call_list)
12
19
 
13
20
  end
14
21
 
15
22
  def self.get
16
23
  call_list = self.new
17
24
  call_list.get
18
-
25
+ call_list
19
26
  end
20
27
 
21
28
  def get
22
29
 
23
30
  #items = @all_calls.collect { |row| row.gsub(/Line /, 'Line_').split(' ') }
24
- @all_calls.each do |call|
25
- case call
26
- when call.starts_with? "NAME:"
27
- @name = call.gsub!("NAME: ", '').gsub!('"', '')
28
- when call.starts_with? "RAS:"
29
- ras_line(call)
30
- when call.starts_with? "SIPLine:"
31
- sip_line(call)
32
- when call.starts_with? "Q93Line:"
33
- q93_line(call)
34
-
35
- when call.starts_with? "CALL:"
36
- call_line(call)
31
+ @raw.each do |call|
32
+ if call.start_with?("NAME: ")
33
+ @name = call.gsub!('NAME: ', '').gsub!('"', '')
34
+ elsif call.start_with? "RAS:"
35
+ ras_line(call)
36
+ elsif call.start_with? "SIPLine:"
37
+ sip_line(call)
38
+ elsif call.start_with? "Q931Line:"
39
+ q93_line(call)
40
+
41
+ elsif call.start_with? "CALL:"
42
+ call_line(call)
37
43
  end
38
44
 
39
45
  end
@@ -41,46 +47,52 @@ module Avaya
41
47
  end
42
48
 
43
49
  def ras_line(line)
44
- line = line.split(' ')
45
50
  ras_det = {
46
- id: line[0].gsub!(/NAME: /, ''),
47
- count: line[0].gsub!(/Chans=/, '')
51
+ id: line.match(/^RAS: [0-9]*/).to_s.gsub!(/RAS: /, ''),
52
+ count: line.match(/Chans=[0-9]*/).to_s.gsub!(/Chans=/, '')
48
53
  }
49
- @ras.merge! ras_det
54
+ @ras << ras_det
50
55
 
51
56
  end
52
57
 
53
58
  def sip_line(line)
54
- line = line.split(' ')
55
59
  pots_det = {
56
- id: line[0].gsub!(/POTS: /, ''),
57
- count: line[1].gsub!(/Chans=/, ''),
58
- used: line[2].gsub!(/Used=/, ''),
60
+ id: line.match(/^SIPLine: [0-9]*/).to_s.gsub!(/SIPLine: /, ''),
61
+ count: line.match(/Chans=[0-9]*/).to_s.gsub!(/Chans=/, ''),
62
+ used: line.match(/Used=[0-9]*/).to_s.gsub!(/Used=/, ''),
59
63
  }
60
- @pots.merge! pots_det
64
+ @pots << pots_det
61
65
  end
62
66
 
63
67
  def q93_line(line)
64
68
 
65
- line = line.split.gsub(/Q931 PRI TE Version /, 'Q931_PRI_TE_Version_').split(' ')
66
69
  q93_det = {
67
- id: line[0].gsub!(/NAME: /, ''),
68
- count: line[1].gsub!(/Chans=/, ''),
69
- used: line[2].gsub!(/Used=/, ''),
70
- version: line[4].gsub!(/Version=/, '').gsub!('_', ' ')
70
+ id: line.match(/^Q931Line: [0-9]*/).to_s.gsub!(/Q931Line: /, ''),
71
+ count: line.match(/Chans=[0-9]*/).to_s.gsub!(/Chans=/, ''),
72
+ used: line.match(/Used=[0-9]*/).to_s.gsub!(/Used=/, ''),
73
+ version: line.match(/Version=.*/).to_s.gsub!(/Version=/, '')
71
74
  }
72
- @q93.merge! q93_det
75
+ @q93 << q93_det
73
76
  end
74
77
 
75
78
  def call_line(line)
76
- line = line.gsub(/Line /, 'Line_').split(' ')
77
- call_det = {
78
-
79
-
79
+ puts line
80
+ call_det= {
81
+ call_id: line.match(/^CALL: [0-9.]*/).to_s.gsub!(/CALL: /, ''),
82
+ state: line.match(/ State=[0-9]*/).to_s.gsub!(/ State=/, ''),
83
+ cut: line.match(/Cut=[0-9]*/).to_s.gsub!(/Cut=/, ''),
84
+ music: line.match(/Music=[0-9.]*/).to_s.gsub!(/Music=/, ''),
85
+ a_end: line.match(/Aend=[a-zA-Z0-9"()]*\s[()0-9.]*/).to_s.gsub!(/Aend=/, ''),
86
+ b_end: line.match(/Bend=[a-zA-Z0-9"()]*\s[\[\]a-zA-Z0-9()]*\s[0-9().]*/).to_s.gsub!(/Bend=/, ''),
87
+ called_num: line.match(/CalledNum=[0-9]*\s[()a-zA-Z0-9]*/).to_s.gsub!(/CalledNum=/, ''),
88
+ calling_num: line.match(/CallingNum=[0-9]*\s[()a-zA-Z0-9]*/).to_s.gsub!(/CallingNum=/, ''),
89
+ internal: line.match(/Internal=[0-9]*/).to_s.gsub!(/Internal=/, '').to_i,
90
+ time: line.match(/Time=[0-9]*/).to_s.gsub!(/Time=/, '').to_i,
91
+ astate: line.match(/AState=[0-9]*/).to_s.gsub!(/AState=/, '').to_i
80
92
  }
81
- end
82
93
 
94
+ @calls << call_det
83
95
 
96
+ end
84
97
  end
85
-
86
98
  end
@@ -9,7 +9,16 @@ module Avaya
9
9
  :forward_unconditional_number,
10
10
  :forward_unconditional_all_calls,
11
11
  :forward_busy,
12
- :dnd
12
+ :dnd,
13
+ :logged_in,
14
+ :connected_party,
15
+ :phone_state,
16
+ :absent_option,
17
+ :absent_extra_info,
18
+ :absent_enabled,
19
+ :ext_template,
20
+ :twinning_number,
21
+ :twinning_enabled
13
22
 
14
23
  def initialize(ext)
15
24
  @ext = ext
@@ -27,14 +36,23 @@ module Avaya
27
36
 
28
37
  @login_name = @user_info[0]
29
38
  @full_name = @user_info[1]
30
- @ext = @user_info[2]
31
- @forward_busy = @user_info[3] == "1" ? true : false
32
- @forward_no_answer = @user_info[4] == "1" ? true : false
33
- @forward_unconditional = @user_info[5] == "1" ? true : false
39
+ @ext = Integer(@user_info[2])
40
+ @forward_busy = @user_info[3] == "1"
41
+ @forward_no_answer = @user_info[4] == "1"
42
+ @forward_unconditional = @user_info[5] == "1"
34
43
  @forward_unconditional_number = @user_info[6]
35
- @dnd = @user_info[8] == "1" ? true : false
36
- @forward_unconditional_all_calls = @user_info[25] == "1" ? true : false
37
- @voicemail_count = @user_info[11]
44
+ @dnd = @user_info[8] == "1"
45
+ #Phone State "no" onhook ,"og" Out Going,"in" Incoming
46
+ @phone_state = @user_info[19]
47
+ @connected_party = @user_info[20]
48
+ @forward_unconditional_all_calls = @user_info[25] == "1"
49
+ @logged_in = @user_info[44] == "1"
50
+ @absent_option = Integer(@user_info[37])
51
+ @absent_extra_info = @user_info[38]
52
+ @absent_enabled = @user_info[39] == "1"
53
+ @ext_template = @user_info[53]
54
+ @twinning_number = @user_info[67]
55
+ @twinning_enabled = @user_info[68]== "1"
38
56
  self
39
57
  end
40
58
 
data/lib/avaya/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avaya
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/avaya.rb CHANGED
@@ -11,7 +11,7 @@ require 'avaya/hunt_info'
11
11
  require 'avaya/user_list'
12
12
  require 'avaya/member_of'
13
13
  require 'avaya/user_info'
14
- #require 'avaya/call_list'
14
+ require 'avaya/call_list'
15
15
 
16
16
 
17
17
  module Avaya
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avaya
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Freibuis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-22 00:00:00.000000000 Z
11
+ date: 2014-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -42,14 +42,14 @@ dependencies:
42
42
  name: net-tftp
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 0.1.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.1.0
55
55
  description: If you are looking to talk to you Avaya Ip Office then this is the gem