asterisk_call_notifier 0.1.0 → 0.1.1

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: 94fc741e2690cc2163e112ceb8a790843d8acb33
4
- data.tar.gz: a49837303fe7816974ef6ce95132be42304ed2c9
3
+ metadata.gz: 4f838d0148648b5121c95f7d8027ec00f5bbe6f6
4
+ data.tar.gz: f5787a5cb385c3c638cc496240eaeefac5d494ff
5
5
  SHA512:
6
- metadata.gz: 8fcff0865a34721c819615f9ebe1cefaf5709d40e0fde3ec8def6ba9f58fb3eb3fe3c6bc4d95f879da77398e2eb9708964764ad3ba81c025d7130597414c5940
7
- data.tar.gz: 724c663087d87d68ad47a1686d94e436214b310c05e3a327a70a5dbac96b8e123b670cfd34148cfa8afd90afe7d34afed490eaf7b649366c7b09578d3e84aa03
6
+ metadata.gz: ccd8ed310011053daf148fd207818f7c1935a46d2b03d898d4796f716e3580711d11cca6db56a5377ce50c126d87c08568756a99e009875aada56b0c665398d6
7
+ data.tar.gz: 39e935bb5c0a6bfdeb4630baf05fa2eeb21d7b54040532e1650d0c1dc16377d88843cee845f25dd0a431781170c0a9e61b23d08fcaeadf718c809323666b8ef8
checksums.yaml.gz.sig CHANGED
@@ -1 +1 @@
1
- }b4��P�Z'����v#�g>���(��,M����>i�|Չc�C�auN��BJU���j�׼a@��cVU��p"o՜��8/Y�szsK.��%�z�OZY:qn��g�Ҭ�Eu,Q��,ծA�-y,h�዁:`���iЫ�E�HF܉ugkM�A;⺀��%�[%�er"���g&���k{h��,��d��}{��S�7��^��������d��Pu��?���1�~W_8�Љ�L�+>�
1
+ ��-�rA@C���|���"a*��k-q�]���"W��if��x��gUU��>�ɸ˸�PX��J ��>��n�����D�Ż�j���q!�Ů�����BA�`���!e�<�Z;9x�e$���m5{#��@hE1�emЄ�rxZ��J��8U^×0����!p��Y�� ai0a�$sa�w����A!u @<H��z��]oh��A�5�ל�-7������DXX̟��:��H?��F�mӯF7i���R
@@ -16,7 +16,7 @@ class AsteriskCallNotifier
16
16
 
17
17
  @csv_path = csv_path
18
18
 
19
- @sps = SPSPub.new(address: sps_address, port: sps_port)
19
+ @sps = sps_address ? SPSPub.new(address: sps_address, port: sps_port) : nil
20
20
  @sps_topic = sps_topic
21
21
 
22
22
  @command = 'tail -n 1 -f ' + csv_path
@@ -24,23 +24,32 @@ class AsteriskCallNotifier
24
24
  lastapp lastdata start answer end duration billsec disposition
25
25
  amaflags astid)
26
26
  end
27
+
28
+ def on_new_call(h)
29
+
30
+ # custom defined
31
+
32
+ end
27
33
 
28
34
  def start()
29
35
 
30
- #FileUtils.mv @csv_path, @csv_path + '.old'
31
- #File.write @csv_path, ''
32
36
  t = Time.now # using the time we can ignore existing entries
33
37
 
34
38
  IO.popen(@command).each_line do |x|
35
39
 
36
- if Time.now > t + 10 then
40
+ # anything after 5 seconds from start is new
41
+ if Time.now > t + 5 then
42
+
37
43
  raw_call_entry = x.lines.last
38
- json = Hash[@headings.zip(CSV.parse(raw_call_entry).first)].to_json
39
- @sps.notice @sps_topic+ ': ' + json
44
+ h = Hash[@headings.zip(CSV.parse(raw_call_entry).first)]
45
+ json = h.to_json
46
+
47
+ @sps.notice(@sps_topic + ': ' + json) if @sps
48
+ on_new_call(h)
40
49
  end
41
50
  end
42
51
 
43
- end
52
+ end
44
53
 
45
54
  end
46
55
 
@@ -48,4 +57,4 @@ if __FILE__ == $0 then
48
57
 
49
58
  AsteriskCallNotifier.new(sps_address: 'sps').start
50
59
 
51
- end
60
+ end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asterisk_call_notifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
@@ -1 +1 @@
1
- U}z#���f���k0$Fs*�B�)��H7G��"Pn也��e��Z��g(.�L.n4��W(t�Ŋ�j�Q�Qi�E�i�;�V��U���@@���"3KNS�Oj�ש<�uݴ�gXv0�,����c��Fߚ�'g+��1Ueb���Ľ�R
1
+ ��xy���̚�o�ţ�q� ��ʡ�o�Q*��M�^pMwP�?�e��.E���n����DO