Skip to content

Commit 0682040

Browse files
committed
wip add support for dtmf
1 parent af0ab87 commit 0682040

File tree

20 files changed

+615
-79
lines changed

20 files changed

+615
-79
lines changed

.github/workflows/ci.yml

Lines changed: 81 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -14,74 +14,85 @@ jobs:
1414
name: CI on OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
1515
strategy:
1616
matrix:
17-
otp: ['27']
18-
elixir: ['1.17']
17+
otp: ["27"]
18+
elixir: ["1.17"]
1919
steps:
20-
- name: Set up Elixir
21-
uses: erlef/setup-beam@v1
22-
with:
23-
otp-version: ${{matrix.otp}}
24-
elixir-version: ${{matrix.elixir}}
25-
26-
- name: Checkout the code
27-
uses: actions/checkout@v4
28-
29-
- name: Cache dependencies
30-
uses: actions/cache@v4
31-
with:
32-
path: deps
33-
key: ${{ runner.os }}-mix-deps-${{ hashFiles('**/mix.lock') }}
34-
restore-keys: |
35-
${{ runner.os }}-mix-deps-
36-
37-
- name: Cache compiled build
38-
uses: actions/cache@v4
39-
with:
40-
path: _build
41-
key: ${{ runner.os }}-mix-build-${{ hashFiles('**/mix.lock') }}
42-
restore-keys: |
43-
${{ runner.os }}-mix-build-
44-
${{ runner.os }}-mix-
45-
46-
- name: Cache dialyzer artifacts
47-
uses: actions/cache@v4
48-
with:
49-
path: _dialyzer
50-
key: ${{ runner.os }}-dialyzer-${{ hashFiles('**/mix.lock') }}
51-
restore-keys: |
52-
${{ runner.os }}-dialyzer-
53-
54-
- name: Install dependencies
55-
run: mix deps.get
56-
57-
- name: Compile without warnings
58-
id: compile
59-
run: mix compile --warnings-as-errors
60-
61-
- name: Check formatting
62-
if: ${{ !cancelled() && steps.compile.outcome == 'success' }}
63-
run: mix format --check-formatted
64-
65-
- name: Check with credo
66-
if: ${{ !cancelled() && steps.compile.outcome == 'success' }}
67-
run: mix credo
68-
69-
- name: Check with dialyzer
70-
if: ${{ !cancelled() && steps.compile.outcome == 'success' }}
71-
run: mix dialyzer
72-
73-
- name: Check docs
74-
if: ${{ !cancelled() && steps.compile.outcome == 'success' }}
75-
run: mix docs 2>&1 | (! grep -q "warning:")
76-
77-
- name: Run tests and check test coverage
78-
if: ${{ !cancelled() && steps.compile.outcome == 'success' }}
79-
id: test
80-
run: mix coveralls.json
81-
82-
- name: Upload test coverage results to Codecov
83-
if: ${{ !cancelled() && steps.test.outcome == 'success' }}
84-
uses: codecov/codecov-action@v4
85-
with:
86-
fail_ci_if_error: true,
87-
token: ${{ secrets.CODECOV_TOKEN }}
20+
- name: "Interfaces"
21+
run: |
22+
echo "Listing Network Interfaces:"
23+
ip link show
24+
25+
- name: Check if Docker is installed and running on Linux
26+
run: |
27+
echo "Checking Docker..."
28+
docker -v
29+
systemctl status docker.service --no-pager
30+
31+
- name: Set up Elixir
32+
uses: erlef/setup-beam@v1
33+
with:
34+
otp-version: ${{matrix.otp}}
35+
elixir-version: ${{matrix.elixir}}
36+
37+
- name: Checkout the code
38+
uses: actions/checkout@v4
39+
40+
- name: Cache dependencies
41+
uses: actions/cache@v4
42+
with:
43+
path: deps
44+
key: ${{ runner.os }}-mix-deps-${{ hashFiles('**/mix.lock') }}
45+
restore-keys: |
46+
${{ runner.os }}-mix-deps-
47+
48+
- name: Cache compiled build
49+
uses: actions/cache@v4
50+
with:
51+
path: _build
52+
key: ${{ runner.os }}-mix-build-${{ hashFiles('**/mix.lock') }}
53+
restore-keys: |
54+
${{ runner.os }}-mix-build-
55+
${{ runner.os }}-mix-
56+
57+
- name: Cache dialyzer artifacts
58+
uses: actions/cache@v4
59+
with:
60+
path: _dialyzer
61+
key: ${{ runner.os }}-dialyzer-${{ hashFiles('**/mix.lock') }}
62+
restore-keys: |
63+
${{ runner.os }}-dialyzer-
64+
65+
- name: Install dependencies
66+
run: mix deps.get
67+
68+
- name: Compile without warnings
69+
id: compile
70+
run: mix compile --warnings-as-errors
71+
72+
- name: Check formatting
73+
if: ${{ !cancelled() && steps.compile.outcome == 'success' }}
74+
run: mix format --check-formatted
75+
76+
- name: Check with credo
77+
if: ${{ !cancelled() && steps.compile.outcome == 'success' }}
78+
run: mix credo
79+
80+
- name: Check with dialyzer
81+
if: ${{ !cancelled() && steps.compile.outcome == 'success' }}
82+
run: mix dialyzer
83+
84+
- name: Check docs
85+
if: ${{ !cancelled() && steps.compile.outcome == 'success' }}
86+
run: mix docs 2>&1 | (! grep -q "warning:")
87+
88+
- name: Run tests and check test coverage
89+
if: ${{ !cancelled() && steps.compile.outcome == 'success' }}
90+
id: test
91+
run: mix coveralls.json
92+
93+
- name: Upload test coverage results to Codecov
94+
if: ${{ !cancelled() && steps.test.outcome == 'success' }}
95+
uses: codecov/codecov-action@v4
96+
with:
97+
fail_ci_if_error: true,
98+
token: ${{ secrets.CODECOV_TOKEN }}

examples/dtmf/.formatter.exs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Used by "mix format"
2+
[
3+
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
4+
]

examples/dtmf/.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# The directory Mix will write compiled artifacts to.
2+
/_build/
3+
4+
# If you run "mix test --cover", coverage assets end up here.
5+
/cover/
6+
7+
# The directory Mix downloads your dependencies sources to.
8+
/deps/
9+
10+
# Where third-party dependencies like ExDoc output generated docs.
11+
/doc/
12+
13+
# If the VM crashes, it generates a dump, let's ignore it too.
14+
erl_crash.dump
15+
16+
# Also ignore archive artifacts (built via "mix archive.build").
17+
*.ez
18+
19+
# Ignore package tarball (built via "mix hex.build").
20+
dtmf-*.tar
21+
22+
# Temporary files, for example, from tests.
23+
/tmp/

examples/dtmf/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Dtmf
2+
3+
**TODO: Add description**
4+
5+
## Installation
6+
7+
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
8+
by adding `dtmf` to your list of dependencies in `mix.exs`:
9+
10+
```elixir
11+
def deps do
12+
[
13+
{:dtmf, "~> 0.1.0"}
14+
]
15+
end
16+
```
17+
18+
Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
19+
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
20+
be found at <https://hexdocs.pm/dtmf>.
21+

examples/dtmf/config/config.exs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import Config
2+
3+
config :logger, level: :info
4+
5+
# normally you take these from env variables in `config/runtime.exs`
6+
config :dtmf,
7+
ip: {127, 0, 0, 1},
8+
port: 8829

examples/dtmf/lib/dtmf.ex

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
defmodule Dtmf do
2+
use Application
3+
4+
@ip Application.compile_env!(:dtmf, :ip)
5+
@port Application.compile_env!(:dtmf, :port)
6+
7+
@impl true
8+
def start(_type, _args) do
9+
children = [
10+
{Bandit, plug: __MODULE__.Router, ip: @ip, port: @port}
11+
]
12+
13+
Supervisor.start_link(children, strategy: :one_for_one)
14+
end
15+
end

0 commit comments

Comments
 (0)