asterisk_call_notifier 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +1 -1
- data/lib/asterisk_call_notifier.rb +17 -8
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4f838d0148648b5121c95f7d8027ec00f5bbe6f6
|
|
4
|
+
data.tar.gz: f5787a5cb385c3c638cc496240eaeefac5d494ff
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ccd8ed310011053daf148fd207818f7c1935a46d2b03d898d4796f716e3580711d11cca6db56a5377ce50c126d87c08568756a99e009875aada56b0c665398d6
|
|
7
|
+
data.tar.gz: 39e935bb5c0a6bfdeb4630baf05fa2eeb21d7b54040532e1650d0c1dc16377d88843cee845f25dd0a431781170c0a9e61b23d08fcaeadf718c809323666b8ef8
|
checksums.yaml.gz.sig
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
��-�rA@C���|���"a*��k-q�]���"W��if��x��gUU��>�ɸ˸�PX��J ��>��n�����D�Ż�j���q!�Ů�����BA�`���!e�<�Z;9x�e$���m5{#��@h�E�1�e�mЄ�rxZ��J��8U^×0����!p��Y��a�i�0a�$sa�w����A!u @<H��z��]�o�h��A�5�ל�-7������DXX̟��:��H?��F�mӯF7�i���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
|
-
|
|
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
|
-
|
|
39
|
-
|
|
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
metadata.gz.sig
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
��x�y���̚�o�ţ�q� ��ʡ�o�Q*��M�^pMw�P�?�e��.E���n����DO
|