def __parseMessage(self, msgstr): msg=None rs=msgstr.split(";") if len(rs)>3: msg=CallMonitorMessage() msg.tmstmp=self.__convertTimestamp(rs[0]) msg.typ=rs[1] msg.conid=rs[2] if msg.typ=="CALL": msg.tel=rs[3] msg.tel_pb=self.__numIntToName(rs[3]) msg.num_int=rs[4] msg.num_ext=self.__stripFollowingHash(rs[5]) if len(rs)>=7: msg.sip=rs[6] elif msg.typ=="RING": msg.num_ext=rs[3] msg.num_int=rs[4] if len(rs)>=6: msg.sip=rs[5] elif msg.typ=="CONNECT": msg.tel=rs[3] msg.tel_pb=self.__numIntToName(rs[3]) msg.num_ext=rs[4] elif msg.typ=="DISCONNECT": msg.dur=rs[3] else: msg=None print "Error: unknown type" return(msg)
def __fillCallMonitorMessage(self, c): msg=CallMonitorMessage() msg.tmstmp=c[1] if c[2]=="RING": msg.typ+=self.msgtyp.ring elif c[2]=="CALL": msg.typ+=self.msgtyp.call else: print "__fillCallMonitorMessage: illegaler Aufruf!", c[2] msg.conid=c[3] msg.tel=c[4] msg.tel_pb=c[5] if c[6]==None: # NULL ... msg.tel_name=u"" # ... nach "" else: msg.tel_name=c[6] msg.num_int=c[7] msg.num_ext=c[8] if c[9]==None: # wenn join zum Fritzbox-Telefonbuch nix geliefert hat n, e=self.getName11880FromNumber(msg.num_ext) # im 11880-Telefonbuch nachsehen... if n!=None: msg.num_ext_name=n # ...und einsetzen else: msg.num_ext_name=u"" # ...bzw. auf <leer> setzen, wenn dort auch kein Name drin ist else: msg.num_ext_name=c[9] # Namen aus dem Fritzbox-Telefonbuch einsetzen msg.dur=c[10] msg.sip=c[11] msg.finished=c[12] return(msg)
def onShowPopup(self, event=0): self.cnt+=1 msg=CallMonitorMessage() msg.tmstmp=u"2014-12-07 08:42:18" msg.typ=u"<-" msg.conid=u"1" msg.tel=u"0" msg.tel_pb=u"**1" msg.tel_name=u"Büro" msg.num_ext=u"04xxxxxxx1" msg.num_int=u"04xxxxxxxx6" msg.sip=u"SIP0" msg.num_ext_name=u"O&O xxxxxx" msg.dur=u"64" if self.cnt==1: self.popup.showNew(msg) msg.typ=u"<- bla" if self.cnt==2: self.popup.showNew(msg) #self.popup.showNew(msg) msg.typ=u"<- bla -X" if self.cnt==3: self.popup.showNew(msg) msg.typ=u"<- -X" msg.dur="" if self.cnt==4: self.popup.showNew(msg) msg.dur=u"64" msg.typ=u"->" if self.cnt==5: self.popup.showNew(msg) msg.typ=u"-> bla" if self.cnt==6: self.popup.showNew(msg) msg.typ=u"-> bla -X" if self.cnt==7: self.popup.showNew(msg) msg.typ=u"-> -X" msg.dur=u"" if self.cnt==8: self.popup.showNew(msg) errMsg=u"Der CallMonServer auf 11w:26260 " txt=errMsg+u"hat die Verbindung zur Fritzbox verloren!" if self.cnt==9: self.popup.showNew(None, txt) self.cnt=0