Skip to content

Commit ef687fb

Browse files
committed
First code commit
1 parent c210904 commit ef687fb

26 files changed

+1593
-0
lines changed

.gitignore

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
venv/
2+
*.pyc
3+
__pycache__
4+
.idea/
5+
temp/
6+
venv/
7+
local-settings.conf
8+
prova*
9+
# Unit test / coverage reports
10+
htmlcov/
11+
.tox/
12+
.coverage
13+
.coverage.*
14+
.cache
15+
nosetests.xml
16+
coverage.xml
17+
*.cover
18+
.hypothesis/
19+

INSTALL.md

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
### voipwardialer ###
2+
3+
##### What's inside:
4+
5+
- asterisk-conf : Asterisk 13.28.0 configuration files
6+
- scripts : Netcat basic socket listener for testing
7+
- dialer : Wardialer Python code
8+
9+
10+
##### How to build it on Linux:
11+
12+
*Requirements (Tested with):*
13+
14+
- Python >= 3.6
15+
- PJProject 2.9 (https://www.pjsip.org/download.htm)
16+
- PJSua Python3 Bindings (https://github.com/mgwilliams/python3-pjsip)
17+
- Asterisk 13.28 (https://downloads.asterisk.org/pub/telephony/asterisk/old-releases/asterisk-13.28.0.tar.gz)
18+
- asterisk-Softmodem fork by irrelevantdotcom with added parity bits (https://github.com/irrelevantdotcom/asterisk-Softmodem)
19+
20+
*Build:*
21+
22+
- Create a Python 3.6 Virtual Environment (virtualenv -p python3.6 venv)
23+
- Download and install Asterisk 13.28 sources
24+
- Follow build instructions for the asterisk-Softmodem DSP (put app_softmodem.c in the Asterisk apps/ dir and do make apps).
25+
More details in the asterisk-Softmodem README.
26+
- Build and install Asterisk
27+
- Download and install PJSip 2.9 Sources
28+
- Follow build instructions for the PJSua Python3 Bindings using the virtual environment instead of the global interpreter.
29+
More details in the PJSua Python3 Bindings README.
30+
- Configure asterisk
31+
- mv /etc/asterisk/ /etc/asterisk.backup
32+
- cp -pr asterisk-conf /etc/asterisk
33+
- service asterisk restart
34+
35+
36+
##### How to call a modem:
37+
38+
Activate the virtual environment:
39+
```bash
40+
$ . venv/bin/activate
41+
```
42+
43+
Run the test socket listener (bounded on localhost:8290 according Asterisk' extension.conf) to receive the remote modem data.
44+
45+
```bash
46+
$ bash scripts/modem_socket
47+
```
48+
49+
Finally run the dialer script and check the output of the test socket listener, after moving into python/dialer directory.
50+
51+
```bash
52+
53+
$ python dialer.py call
54+
Usage: dialer.py call [OPTIONS] SIP_URI SIP_REG_URI SIP_USERNAME SIP_PASSWORD
55+
PHONE_NUMBER MODEM_VERSION MODEM_PARITY
56+
57+
58+
$ python3 dialer.py call sip:username@sip.example.com sip:sip.example.com username password +1555123456 V22 8n1
59+
```
60+
61+
Available MODEM_VERSION:
62+
63+
- v21
64+
- v23
65+
- bell103
66+
- v22
67+
- v22bis
68+
69+
Available MODEM_PARITY:
70+
71+
- 7e1
72+
- 8n1
73+
74+
Hit Ctrl+C to exit or wait the 60 seconds limit.
75+

asterisk-conf/acl.conf

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
;
2+
; Named Access Control Lists (ACLs)
3+
;
4+
; A convenient way to share acl definitions
5+
;
6+
; This configuration file is read on startup
7+
;
8+
; CLI Commands
9+
; -----------------------------------------------------------
10+
; acl show Show all named ACLs configured
11+
; acl show <name> Show contents of a particular named ACL
12+
; reload acl Reload configuration file
13+
;
14+
; Any configuration that uses ACLs which has been made to be able to use named
15+
; ACLs will specify a named ACL with the 'acl' option in its configuration in
16+
; a similar fashion to the usual 'permit' and 'deny' options. Example:
17+
; acl=my_named_acl
18+
;
19+
; Multiple named ACLs can be applied by either comma separating the arguments or
20+
; just by adding additional ACL lines. Example:
21+
; acl=my_named_acl
22+
; acl=my_named_acl2
23+
;
24+
; or
25+
;
26+
; acl=my_named_acl,my_named_acl2
27+
;
28+
; ACLs specified by name are evaluated independently from the ACL specified via
29+
; permit/deny. In order for an address to pass a given ACL, it must pass both
30+
; the ACL specified by permit/deny for a given item as well as any named ACLs
31+
; that were specified.
32+
;
33+
;[example_named_acl1]
34+
;deny=0.0.0.0/0.0.0.0
35+
;permit=209.16.236.0
36+
;permit=209.16.236.1
37+
;
38+
;[example_named_acl2]
39+
;permit=0.0.0.0/0.0.0.0
40+
;deny=10.24.20.171
41+
;deny=10.24.20.103
42+
;deny=209.16.236.1
43+
;
44+
; example_named_acl1 above shows an example of whitelisting. When whitelisting, the
45+
; named ACLs should follow a deny that blocks everything (like deny=0.0.0.0/0.0.0.0)
46+
; The following example explains how combining the ACLs works:
47+
; <in another configuration>
48+
; [example_item_with_acl]
49+
; acl=example_named_acl1
50+
; acl=example_named_acl2
51+
;
52+
; Suppose 209.16.236.0 tries to communicate and the ACL for that example is applied to it...
53+
; First, example_named_acl1 is evaluated. The address is allowed by that ACL.
54+
; Next, example_named_acl2 is evaluated. The address isn't blocked by example_named_acl2
55+
; either, so it passes.
56+
;
57+
; Suppose instead 209.16.236.1 tries to communicate and the same ACL is applied.
58+
; First, example_named_acl1 is evaluated and the address is allowed.
59+
; However, it is blocked by example_named_acl2, so the address is blocked from the combined
60+
; ACL.
61+
;
62+
; Similarly, the permits/denies in specific configurations that make up an ACL definition
63+
; are also treated as a separate ACL for evaluation. So if we change the example above to:
64+
; <in another configuration>
65+
; [example_item_with_acl]
66+
; acl=example_named_acl1
67+
; acl=example_named_acl2
68+
; deny=209.16.236.0
69+
;
70+
; Then 209.16.236.0 will be rejected by the non-named component of the combined ACL even
71+
; though it passes the two named components.
72+
;
73+
;
74+
; Named ACLs can use ipv6 addresses just like normal ACLs.
75+
;[ipv6_example_1]
76+
;deny = ::
77+
;permit = ::1/128
78+
;
79+
;[ipv6_example_2]
80+
;permit = fe80::21d:bad:fad:2323

asterisk-conf/alsa.conf

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
;
2+
; Open Sound System Console Driver Configuration File
3+
;
4+
[general]
5+
;
6+
; Automatically answer incoming calls on the console? Choose yes if
7+
; for example you want to use this as an intercom.
8+
;
9+
autoanswer=yes
10+
;
11+
; Default context (is overridden with @context syntax)
12+
;
13+
context=local
14+
;
15+
; Default extension to call
16+
;
17+
extension=s
18+
;
19+
; Default language
20+
;
21+
;language=en
22+
;
23+
; Default Music on Hold class to use when this channel is placed on hold in
24+
; the case that the music class is not set on the channel with
25+
; Set(CHANNEL(musicclass)=whatever) in the dialplan and the peer channel
26+
; putting this one on hold did not suggest a class to use.
27+
;
28+
;mohinterpret=default
29+
;
30+
; Silence suppression can be enabled when sound is over a certain threshold.
31+
; The value for the threshold should probably be between 500 and 2000 or so,
32+
; but your mileage may vary. Use the echo test to evaluate the best setting.
33+
;silencesuppression = yes
34+
;silencethreshold = 1000
35+
;
36+
; To set which ALSA device to use, change this parameter
37+
;input_device=hw:0,0
38+
;output_device=hw:0,0
39+
40+
;
41+
; Default mute state (can also be toggled via CLI)
42+
;mute=true
43+
44+
;
45+
; If enabled, no audio capture device will be opened. This is useful on
46+
; systems where there will be no return audio path, such as overhead pagers.
47+
;noaudiocapture=true
48+
49+
; ----------------------------- JITTER BUFFER CONFIGURATION --------------------------
50+
; jbenable = yes ; Enables the use of a jitterbuffer on the receiving side of an
51+
; ALSA channel. Defaults to "no". An enabled jitterbuffer will
52+
; be used only if the sending side can create and the receiving
53+
; side can not accept jitter. The ALSA channel can't accept jitter,
54+
; thus an enabled jitterbuffer on the receive ALSA side will always
55+
; be used if the sending side can create jitter.
56+
57+
; jbmaxsize = 200 ; Max length of the jitterbuffer in milliseconds.
58+
59+
; jbresyncthreshold = 1000 ; Jump in the frame timestamps over which the jitterbuffer is
60+
; resynchronized. Useful to improve the quality of the voice, with
61+
; big jumps in/broken timestamps, usually sent from exotic devices
62+
; and programs. Defaults to 1000.
63+
64+
; jbimpl = fixed ; Jitterbuffer implementation, used on the receiving side of a SIP
65+
; channel. Two implementations are currently available - "fixed"
66+
; (with size always equals to jbmax-size) and "adaptive" (with
67+
; variable size, actually the new jb of IAX2). Defaults to fixed.
68+
69+
; jbtargetextra = 40 ; This option only affects the jb when 'jbimpl = adaptive' is set.
70+
; The option represents the number of milliseconds by which the new
71+
; jitter buffer will pad its size. the default is 40, so without
72+
; modification, the new jitter buffer will set its size to the jitter
73+
; value plus 40 milliseconds. increasing this value may help if your
74+
; network normally has low jitter, but occasionally has spikes.
75+
76+
; jblog = no ; Enables jitterbuffer frame logging. Defaults to "no".
77+
; ----------------------------------------------------------------------------------

0 commit comments

Comments
 (0)