Initial commit
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
08000330000 Telekom Hotline
|
||||
0123456789 Testanrufer
|
||||
09831358533 Arno Nym
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import telnetlib
|
||||
import os
|
||||
import sys
|
||||
|
||||
HOST = "172.16.254.254" # "fritz.box"
|
||||
PORT = 1012
|
||||
ESPEAK_BINARY = "/usr/bin/espeak -v german+f2"
|
||||
|
||||
print( "Started in %s" % sys.path[0] )
|
||||
f = open( sys.path[0] + "/callclient.list", "rt" )
|
||||
|
||||
pb = {}
|
||||
for line in f:
|
||||
line = line.strip(" \n")
|
||||
( number, sep, name ) = line.partition(' ')
|
||||
name = name.strip()
|
||||
pb[number] = name
|
||||
print( "Loaded %s entries from local phonebook." % len( pb ) )
|
||||
print( pb )
|
||||
|
||||
tn = telnetlib.Telnet( HOST, PORT )
|
||||
try:
|
||||
while True:
|
||||
event = tn.read_until( b"\n" ).decode( "utf-8" )
|
||||
edata = event.split( ';' )
|
||||
print( edata )
|
||||
if edata[1] == "RING":
|
||||
caller = edata[3]
|
||||
print( "Incoming call from %s" % caller )
|
||||
if caller in pb:
|
||||
caller = pb[caller]
|
||||
print( "Caller found in phonebook: %s" % caller )
|
||||
# os.system( "/usr/bin/play /usr/share/sounds/ubuntu/stereo/message-new-instant.ogg" )
|
||||
os.system( ESPEAK_BINARY + " \"Anruf von " + caller + ".\"" )
|
||||
|
||||
except EOFError as eof:
|
||||
print( "Connection closed by remote host." )
|
||||
|
||||
print( "All done." )
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
export LC_CTYPE="en_US.UTF-8"
|
||||
export LANG="en_US.UTF-8"
|
||||
export LANGUAGE="en_US:en"
|
||||
HERE=`dirname $0`
|
||||
env > $HERE/callclient.log
|
||||
/usr/bin/python3 $HERE/callclient.py >>$HERE/callclient.log 2>&1
|
||||
Reference in New Issue
Block a user