asterisk-ami.cr
asterisk-ami
TODO: Write a description here
Installation
-
Add the dependency to your
shard.yml
:dependencies: asterisk-ami: github: bit4bit/asterisk-ami
-
Run
shards install
Usage
require "json"
require "asterisk-ami"
conn = Asterisk::Ami::Inbound.new("localhost", 5038, "demo", "demo")
if !conn.connect(1.second)
raise "fails authenticate to #{host}"
end
# example action and wait for response
puts conn.request(Asterisk::Action.new(
"Ping",
UUID.v4.hexstring
)
).inspect
events = Channel(Asterisk::Event).new(1024*16)
spawn name: "asterisk events" do
conn.pull_events do |event|
events.send(event)
end
rescue ex
STDERR.puts ex.inspect_with_backtrace
exit 1
end
loop do
event = events.receive
if event.get("Event") == "Shutdown"
STDERR.puts "asterisk shutdown"
exit 1
end
puts event.message.to_json
end
Development
TODO: Write development instructions here
Contributing
- Fork it (https://github.com/your-github-user/asterisk-ami/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Jovany Leandro G.C - creator and maintainer
Repository
asterisk-ami.cr
Owner
Statistic
- 1
- 0
- 0
- 0
- 0
- 22 days ago
- December 25, 2024
License
MIT License
Links
Synced at
Wed, 22 Jan 2025 02:15:41 GMT
Languages