Skip to content

Commit

Permalink
Add version about button (circle-exclamation)
Browse files Browse the repository at this point in the history
Normalize some app.cfg.example settings to correspond to expected OOTB behavior
Cleanup modem-data debug trace output
  • Loading branch information
thess committed Mar 6, 2024
1 parent 33320ac commit 4e5393b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 9 deletions.
8 changes: 4 additions & 4 deletions callattendant/app.cfg.example
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ BLOCK_SERVICE_THRESHOLD = 2
# a keypress is required to leave message
# BLOCKED_ACTIONS = ("answer", "greeting", "voice_mail")
#
BLOCKED_ACTIONS = ("answer", "greeting", "voice_mail")
BLOCKED_ACTIONS = ("answer", "greeting")

# BLOCKED_GREETING_FILE: The wav file to be played to blocked callers.
# Example: "Your number has been blocked."
Expand All @@ -167,7 +167,7 @@ BLOCKED_RINGS_BEFORE_ANSWER = 0
# SCREENED_ACTIONS: A tuple containing a combination of the following actions:
# "ignore" OR a combo of "answer", "greeting", "record_message", "voice_mail".
# See BLOCKED_ACTIONS for more info.
SCREENED_ACTIONS = ("answer", "greeting", "record_message")
SCREENED_ACTIONS = ("answer", "greeting", "voice_mail")

# SCREENED_GREETING_FILE: The wav file to be played to allowed callers.
# Example: "I'm sorry, I can't take your call."
Expand All @@ -180,15 +180,15 @@ SCREENED_RINGS_BEFORE_ANSWER = 0
# PERMITTED_ACTIONS: A tuple containing a combination of the following actions:
# "ignore" OR a combo of "answer", "greeting", "record_message", "voice_mail".
# See BLOCKED_ACTIONS for more info.
PERMITTED_ACTIONS = ("ignore",)
PERMITTED_ACTIONS = ("answer", "greeting", "record_message")

# PERMITTED_GREETING_FILE: The wav file to be played to allowed callers.
# Example: "I'm sorry, I can't take your call."
PERMITTED_GREETING_FILE = "general_greeting.wav"

# PERMITTED_RINGS_BEFORE_ANSWER: The number of rings to wait before answering a call.
# Example: 4 to allow the callee to pick up the phone before going to voice mail.
PERMITTED_RINGS_BEFORE_ANSWER = 0
PERMITTED_RINGS_BEFORE_ANSWER = 4

# VOICE_MAIL_GOODBYE_FILE: The wav file play just before hanging up
# Example: "Goodbye"
Expand Down
13 changes: 8 additions & 5 deletions callattendant/hardware/modem.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
# Modem DLE shielded codes - DCE to DTE modem data
DLE_BYTE_CODE = DLE_CODE.encode()

DCE_ANSWER_TONE = chr(97) # <DLE>-a
DCE_ANSWER_TONE = chr(97) # <DLE>-a
DCE_BUSY_TONE = chr(98) # <DLE>-b
DCE_FAX_CALLING_TONE = chr(99) # <DLE>-c
DCE_DIAL_TONE = chr(100) # <DLE>-d
Expand All @@ -99,7 +99,7 @@
DCE_PHONE_ON_HOOK = chr(104) # <DLE>-h
DCE_PHONE_OFF_HOOK = chr(72) # <DLE>-H
DCE_PHONE_OFF_HOOK2 = chr(80) # <DLE>-P (Conexant)
DCE_PHONE_OFF_HOOK3 = chr(112) # <DLE>-p (Conexant)
DCE_PHONE_OFF_HOOK3 = chr(112) # <DLE>-p (Conexant)
DCE_QUIET_DETECTED = chr(113) # <DLE>-q (Conexant)
DCE_RING = chr(82) # <DLE>-R
DCE_SILENCE_DETECTED = chr(115) # <DLE>-s
Expand All @@ -118,7 +118,8 @@
CRLF = (chr(13) + chr(10))

TEST_DATA = [
b"RING", b"DATE=0801", b"TIME=1801", b"NMBR=8055554567", b"NAME=Test1 - Permitted", b"RING", b"RING", b"RING", b"RING",
b"RING", b"DATE=0801", b"TIME=1801", b"NMBR=8055554567", b"NAME=Test1 - Permitted",
b"RING", b"RING", b"RING", b"RING",
b"RING", b"DATE=0802", b"TIME=1802", b"NMBR=5551234567", b"NAME=Test2 - Spammer",
b"RING", b"DATE=0803", b"TIME=1803", b"NMBR=3605554567", b"NAME=Test3 - Blocked",
b"RING", b"DATE=0804", b"TIME=1804", b"NMBR=8005554567", b"NAME=V123456789012345",
Expand Down Expand Up @@ -516,7 +517,7 @@ def record_audio(self, audio_file_name, detect_silence=True):
if (idx != -1) and (idx < len(audio_data) - 1):
# Found a DLE code, check for specific escapes
escaped_code = chr(audio_data[idx + 1])
if escaped_code == DCE_END_VOICE_DATA_TX :
if escaped_code == DCE_END_VOICE_DATA_TX:
# <DLE><ETX> is in the stream
print(">> <DLE><ETX> Char Recieved... Stop recording.")
break
Expand Down Expand Up @@ -627,7 +628,9 @@ def wait_for_keypress(self, wait_time_secs=15):
continue
modem_data += modem_char
if debugging and len(modem_data) > 1:
print(">> Keypress Data: {}".format(modem_data))
print(">> Keypress Data: {}".format(
"".join(map(lambda x: '<DLE>' if x == DLE_CODE else
'<ETX>' if x == ETX_CODE else x, modem_data))))

if ((DLE_CODE + DCE_PHONE_OFF_HOOK) in modem_data) or \
((DLE_CODE + DCE_PHONE_OFF_HOOK2) in modem_data) or \
Expand Down
10 changes: 10 additions & 0 deletions callattendant/userinterface/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,16 @@
</span>
</a>
</li>
<li class="nav-item" id="about">
<a class="nav-link" href="/about">
<span>
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-exclamation-circle" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"/>
<path d="M7.002 11a1 1 0 1 1 2 0 1 1 0 0 1-2 0M7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0z"/>
</svg>
</span>
</a>
</li>

</ul>
</div>
Expand Down
5 changes: 5 additions & 0 deletions callattendant/userinterface/webapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,11 @@ def dashboard():
blocked_calls='{:,}'.format(total_blocked),
percent_blocked='{0:.0f}%'.format(percent_blocked))

@app.route('/about', methods=['GET'])
def about():
# El-cheapo version number display
flash('Call Attendant version: ' + current_app.config.get("MASTER_CONFIG").get("VERSION"))
return redirect(request.referrer, code=303) # Other

@app.route('/calls', methods=['GET'])
def calls():
Expand Down

0 comments on commit 4e5393b

Please sign in to comment.