Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
David Hamner
IVRBBS
Commits
95198719
Commit
95198719
authored
Nov 30, 2022
by
David Hamner
Browse files
Update to use serial
parent
22f11b05
Changes
2
Hide whitespace changes
Inline
Side-by-side
IVRBBS
View file @
95198719
...
...
@@ -25,10 +25,12 @@ import datetime
import
pty
import
tempfile
import
mmap
import
serial
mainDir
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
callDir
=
mainDir
+
"/calls"
DTMFs
=
[]
modem
=
serial
.
Serial
(
"/dev/ttyUSB3"
,
"9600"
)
#pacat --format=s16ne --channels=1 --rate=48000 --record -d alsa_output.platform-sound.Audio__hw_CARD_wm8962__sink.monitor | sox -t raw -r 48000 -e signed-integer -b 16 -c 1 - -t raw -r 22050 - | multimon-ng -t raw -a DTMF -
#tail -f -n +1 ./recode.wav | play -
...
...
@@ -303,49 +305,57 @@ os.system(bashCMD2)
bashCMD
=
f
'cat /dev/ttyUSB3'
#bashCMD = bashCMD + f"| grep CLIP"
"""
runningHandle = subprocess.Popen(bashCMD,
preexec_fn=os.setsid,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
universal_newlines=True, shell=True)
"""
#Fix for https://source.puri.sm/Librem5/librem5-base/-/blob/pureos/byzantium/default/audio/pulse/librem5.pa#L22
setup_audio
()
line
=
""
while
True
:
output
=
runningHandle
.
stdout
.
readline
()
if
output
==
""
:
continue
print
(
f
"Modem:
{
output
}
"
)
if
output
:
if
"+DTMF:"
in
output
:
DTMFs
.
append
(
output
.
split
(
":"
)[
-
1
].
strip
())
print
(
f
"DTMF:
{
DTMFs
[
-
1
]
}
"
)
if
"DISC"
in
output
:
print
(
"Call ended! Stoping IVR"
)
IVR_thread
.
terminate
=
True
elif
"RING"
in
output
:
#phone_number = output.split('"')[1]
#print("Call from: " + phone_number)
#answer call
time
.
sleep
(
1.5
)
os
.
system
(
'echo -ne "ATA
\r\n
" | tee /dev/ttyUSB3'
)
#Run ivr_script
try
:
exec
(
script
)
except
Exception
as
e
:
print
(
'Error Loading IVR'
+
ivr_script
)
#Error loading, Exit with error
raise
e
#exit()
#Run IVR() from ivr_script
IVR_thread
=
threading
.
Thread
(
target
=
IVR
,
args
=
())
IVR_thread
.
daemon
=
True
IVR_thread
.
start
()
#else:
#print("Debug: " + output)
#print(dir(modem))
char
=
modem
.
read
().
decode
()
line
=
line
+
char
if
line
==
""
:
continue
if
char
==
"
\r
"
or
char
==
"
\n
"
or
(
line
.
startswith
(
"+DTMF:"
)
and
not
line
.
endswith
(
":"
)):
print
(
f
"Full CMD:
{
line
}
"
)
else
:
continue
#ProcessCMD:
if
"+DTMF:"
in
line
:
DTMFs
.
append
(
line
.
split
(
":"
)[
-
1
].
strip
())
print
(
f
"DTMF:
{
DTMFs
[
-
1
]
}
"
)
if
"DISC"
in
line
:
print
(
"Call ended! Stoping IVR"
)
IVR_thread
.
terminate
=
True
elif
"RING"
in
line
:
#phone_number = output.split('"')[1]
#print("Call from: " + phone_number)
#answer call
time
.
sleep
(
1.5
)
os
.
system
(
'echo -ne "ATA
\r\n
" | tee /dev/ttyUSB3'
)
#Run ivr_script
try
:
exec
(
script
)
except
Exception
as
e
:
print
(
'Error Loading IVR'
+
ivr_script
)
#Error loading, Exit with error
raise
e
#exit()
#Run IVR() from ivr_script
IVR_thread
=
threading
.
Thread
(
target
=
IVR
,
args
=
())
IVR_thread
.
daemon
=
True
IVR_thread
.
start
()
#else:
#print("Debug: " + output)
#Reset line
line
=
""
README.md
View file @
95198719
# IVRBBS
(Interactive Voice Response and Bulletin Board System)
This GPL3 IVR (Interactive Voice Response) and BBS (Bulletin Board System) targeted at the L5 running PureOS.
This
a
GPL3 IVR (Interactive Voice Response) and BBS (Bulletin Board System) targeted at the L5 running PureOS.
# Setup:
```
sudo apt install espeak multimon-ng sox pulseaudio-utils minimodem git
git clone <this repo>
cd ivrbbs
sudo chmod 777 /dev/ttyUSB3
./IVRBBS
```
---
Copyright (C) 2020-202
1
David Hamner
Copyright (C) 2020-202
2
David Hamner
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
it under the terms of the GNU
Affero
General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see
<http://www.gnu.org/licenses/>
.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment