asterisk_call_notifier 0.1.0
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 +7 -0
- checksums.yaml.gz.sig +1 -0
- data.tar.gz.sig +2 -0
- data/lib/asterisk_call_notifier.rb +51 -0
- metadata +88 -0
- metadata.gz.sig +1 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 94fc741e2690cc2163e112ceb8a790843d8acb33
|
4
|
+
data.tar.gz: a49837303fe7816974ef6ce95132be42304ed2c9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8fcff0865a34721c819615f9ebe1cefaf5709d40e0fde3ec8def6ba9f58fb3eb3fe3c6bc4d95f879da77398e2eb9708964764ad3ba81c025d7130597414c5940
|
7
|
+
data.tar.gz: 724c663087d87d68ad47a1686d94e436214b310c05e3a327a70a5dbac96b8e123b670cfd34148cfa8afd90afe7d34afed490eaf7b649366c7b09578d3e84aa03
|
checksums.yaml.gz.sig
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
}b4��P�Z'����v#�g>���(��,M����>i�|Չc�C�auN��BJU���j�a@��c�VU��p�"�o՜��8/Y�s�zsK.��%�z�O�ZY:qn��g�Ҭ�Eu,Q��,ծA�-y,h�:`���iЫ�E�H�F܉u�gkM�A;⺀��%�[%�er"���g&���k{h��,��d��}�{��S�7��^��������d��Pu��?���1�~W_8�Љ�L�+>�
|
data.tar.gz.sig
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# file: asterisk_call_notifier.rb
|
4
|
+
|
5
|
+
|
6
|
+
require 'csv'
|
7
|
+
require 'json'
|
8
|
+
require 'sps-pub'
|
9
|
+
require 'fileutils'
|
10
|
+
|
11
|
+
|
12
|
+
class AsteriskCallNotifier
|
13
|
+
|
14
|
+
def initialize(csv_path: '/var/log/asterisk/cdr-csv/Master.csv', \
|
15
|
+
sps_address: nil, sps_port: 59000, sps_topic: 'asterisk')
|
16
|
+
|
17
|
+
@csv_path = csv_path
|
18
|
+
|
19
|
+
@sps = SPSPub.new(address: sps_address, port: sps_port)
|
20
|
+
@sps_topic = sps_topic
|
21
|
+
|
22
|
+
@command = 'tail -n 1 -f ' + csv_path
|
23
|
+
@headings = %i(accountcode src dst dcontet clid channel dstchannel
|
24
|
+
lastapp lastdata start answer end duration billsec disposition
|
25
|
+
amaflags astid)
|
26
|
+
end
|
27
|
+
|
28
|
+
def start()
|
29
|
+
|
30
|
+
#FileUtils.mv @csv_path, @csv_path + '.old'
|
31
|
+
#File.write @csv_path, ''
|
32
|
+
t = Time.now # using the time we can ignore existing entries
|
33
|
+
|
34
|
+
IO.popen(@command).each_line do |x|
|
35
|
+
|
36
|
+
if Time.now > t + 10 then
|
37
|
+
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
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
if __FILE__ == $0 then
|
48
|
+
|
49
|
+
AsteriskCallNotifier.new(sps_address: 'sps').start
|
50
|
+
|
51
|
+
end
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: asterisk_call_notifier
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Robertson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
|
14
|
+
YXN0ZXIxHjAcBgoJkiaJk/IsZ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
|
29
|
+
BWJC5OcJfBi+dt5Zs9ak6ku2nE7v65ama3XF20euAXxvbf7quwgpAdZO/fG0E9ti
|
30
|
+
JgDCgZEnQgTpbEfxFKZPMlglJB/7PEu/iCcXXd4kYCRNgvNOYWNdgjIbn9hZ1h8R
|
31
|
+
TOq4oEZGmQYqLE+/6K/3Z4QqN0a/89AyrfcilQexJxZsMybPy+q5teSgsjS9V3Rx
|
32
|
+
kjEWeWENl0d6Jg==
|
33
|
+
-----END CERTIFICATE-----
|
34
|
+
date: 2015-10-03 00:00:00.000000000 Z
|
35
|
+
dependencies:
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: sps-pub
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0.4'
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.4.0
|
46
|
+
type: :runtime
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0.4'
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 0.4.0
|
56
|
+
description:
|
57
|
+
email: james@r0bertson.co.uk
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- lib/asterisk_call_notifier.rb
|
63
|
+
homepage: https://github.com/jrobertson/asterisk_call_notifier
|
64
|
+
licenses:
|
65
|
+
- MIT
|
66
|
+
metadata: {}
|
67
|
+
post_install_message:
|
68
|
+
rdoc_options: []
|
69
|
+
require_paths:
|
70
|
+
- lib
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
requirements: []
|
82
|
+
rubyforge_project:
|
83
|
+
rubygems_version: 2.4.8
|
84
|
+
signing_key:
|
85
|
+
specification_version: 4
|
86
|
+
summary: This gem actively monitors Asterisk's CDR CSV file (using tail -f) and publishes
|
87
|
+
the latest entry to a SimplePubSub messaging broker.
|
88
|
+
test_files: []
|
metadata.gz.sig
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
U}z#���f���k0$Fs*�B�)��H7G��"Pn也��e��Z��g�(.�L.n4��W(�t�Ŋ�j�Q�Q�i�E�i�;�V��U���@@���"3KNS�Oj�ש<�uݴ�gXv0�,����c��Fߚ�'g+��1Ueb���Ľ�R
|