ast_call 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +45 -0
- data/Rakefile +2 -0
- data/ast_call.gemspec +24 -0
- data/bin/ast-call +5 -0
- data/lib/ast_call.rb +40 -0
- data/lib/ast_call/version.rb +3 -0
- metadata +97 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2b26e1a7d2cc824de19c2df672d7db42d8198f11
|
4
|
+
data.tar.gz: 63fa823257977f346b0a5159fe16e28c246dc27a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f10ac3207cc7f0b4d3634833538201c1e60cd0d1a0159c469c47b5d3a051c544fb09c72cc083976f771b436b0caea31c758e01e9a89a7b9dbb498139740ae116
|
7
|
+
data.tar.gz: 30cdc02df604afbe1fbd2b0a741a8bce9f5e65f390d959376ac8778102c9ee879aef71c53ee92626f164890b069ee791e01cde56f840474b825fdd5af423f3f2
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Romain Tartière
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# AstCall
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Run:
|
8
|
+
|
9
|
+
$ gem install ast_call
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
Configure `ast_call` in one of the following files (only the first one found is read):
|
14
|
+
* `$HOME/.config/ast-call/config.yml`
|
15
|
+
* `/usr/local/etc/ast-call.yml`
|
16
|
+
* `/etc/ast-call.yml`
|
17
|
+
|
18
|
+
Use the following snippet as a starter:
|
19
|
+
~~~yaml
|
20
|
+
manager:
|
21
|
+
host: 127.0.0.1
|
22
|
+
port: 5038
|
23
|
+
|
24
|
+
login:
|
25
|
+
username: john
|
26
|
+
secret: password
|
27
|
+
|
28
|
+
originate:
|
29
|
+
channel: SIP/100
|
30
|
+
context: internal
|
31
|
+
priority: 1
|
32
|
+
callerid: ast-call
|
33
|
+
~~~
|
34
|
+
|
35
|
+
Originating calls is now as easy as:
|
36
|
+
|
37
|
+
$ ast-call '*1'
|
38
|
+
|
39
|
+
## Contributing
|
40
|
+
|
41
|
+
1. Fork it ( https://github.com/sante-link/ast_call/fork )
|
42
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
43
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
44
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
45
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/ast_call.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'ast_call/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'ast_call'
|
8
|
+
spec.version = AstCall::VERSION
|
9
|
+
spec.authors = ['Romain Tartière']
|
10
|
+
spec.email = ['romain@blogreen.org']
|
11
|
+
spec.summary = %q{Originate calls through Asterisk AMI.}
|
12
|
+
spec.homepage = 'https://github.com/sante-link/ast_call'
|
13
|
+
spec.license = 'MIT'
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ['lib']
|
19
|
+
|
20
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
21
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
22
|
+
|
23
|
+
spec.add_dependency 'ruby-asterisk', '~> 0.1.0'
|
24
|
+
end
|
data/bin/ast-call
ADDED
data/lib/ast_call.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require "ast_call/version"
|
2
|
+
|
3
|
+
require 'ruby-asterisk'
|
4
|
+
require 'yaml'
|
5
|
+
|
6
|
+
class RubyAsterisk::AMI
|
7
|
+
def originate2(caller, context, callee, priority, callerid)
|
8
|
+
execute 'Originate', {'Channel' => caller, 'Context' => context, 'Exten' => callee, 'Priority' => priority.to_s, 'Callerid' => "\"#{callerid}\" <#{callee}>", 'Timeout' => '30000'}
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
module AstCall
|
13
|
+
class Caller
|
14
|
+
def config
|
15
|
+
return @config if @config
|
16
|
+
|
17
|
+
files = [ "#{ENV['HOME']}/.config/ast-call/config.yml", '/usr/local/etc/ast-call.yml', '/etc/ast-call.yml' ]
|
18
|
+
files.each do |file|
|
19
|
+
if File.exists?(file) then
|
20
|
+
@config = YAML.load_file(file)
|
21
|
+
return @config
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
raise 'No suitable configuration file found'
|
26
|
+
end
|
27
|
+
|
28
|
+
def connect
|
29
|
+
@ami = RubyAsterisk::AMI.new(config['manager']['host'], config['manager']['port'])
|
30
|
+
@ami.login(config['login']['username'], config['login']['secret'])
|
31
|
+
@ami
|
32
|
+
end
|
33
|
+
|
34
|
+
def originate(exten)
|
35
|
+
@ami ||= connect
|
36
|
+
res = @ami.originate2(config['originate']['channel'], config['originate']['context'], exten, config['originate']['priority'], config['originate']['callerid'])
|
37
|
+
raise res.message unless res.success
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ast_call
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Romain Tartière
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: ruby-asterisk
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.1.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.1.0
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- romain@blogreen.org
|
58
|
+
executables:
|
59
|
+
- ast-call
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE.txt
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- ast_call.gemspec
|
69
|
+
- bin/ast-call
|
70
|
+
- lib/ast_call.rb
|
71
|
+
- lib/ast_call/version.rb
|
72
|
+
homepage: https://github.com/sante-link/ast_call
|
73
|
+
licenses:
|
74
|
+
- MIT
|
75
|
+
metadata: {}
|
76
|
+
post_install_message:
|
77
|
+
rdoc_options: []
|
78
|
+
require_paths:
|
79
|
+
- lib
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
requirements: []
|
91
|
+
rubyforge_project:
|
92
|
+
rubygems_version: 2.2.3
|
93
|
+
signing_key:
|
94
|
+
specification_version: 4
|
95
|
+
summary: Originate calls through Asterisk AMI.
|
96
|
+
test_files: []
|
97
|
+
has_rdoc:
|