Hi everybody,
I was searching for an Addon (Service) to perform some events in case there is an incoming call on my FritzBox.
The only addon I could find was this
FritzBox Caller(sorry its in german).
It works, but I tried to bring it to a more mordern shape. Not a big deal beside its Perl core. - works fine on XBMCbuntu but Openelec seems to be shipped without it.

Any way to translate this 'open socket' to python?
What I found so far in the python wiki was beyond my skills. Listening and serving sockets ...

Nothing compared to my PHP-ish view
this is my 'idea' of the default.py ...
#!/usr/bin/python
import os;
import xbmc;
import xbmcaddon;
import socket;
__settings__ = xbmcaddon.Addon(id='fritz.box.call.id')
def react_inc(nr):
show_time = __settings__.getSetting("show_time");
xbmc.executebuiltin('XBMC.Notification(Telefon,Anruf von '+ nr +','+ show_time +')');
def react_out():
xbmc.executebuiltin('XBMC.Notification(Telefon,Anruf Beendet)');
def listen_Box(ip):
mysock = open_tcp_socket(ip,'1012');
file = mysock.makefile();
while (line = file.readline()){
c = line.split(';');
if (c[1] == 'RING') {
nr = c[3];
react_inc(nr);
}
if (c[1] == 'DISCONNECT'){
react_inc();
}
}
file.close();
mysocket.close();
return true;
while (not xbmc.abortRequested):
listen_Box(__settings__.getSetting("box"));