iro/anbieter/sipgate.py
changeset 36 178fd966423d
parent 32 935f9a4da503
child 37 6e5bd561ddd0
equal deleted inserted replaced
35:cf22ec25ec23 36:178fd966423d
    61         pdf.close()
    61         pdf.close()
    62         self.__send(args,recipients)
    62         self.__send(args,recipients)
    63 
    63 
    64     def __connect(self):
    64     def __connect(self):
    65         """connect to sipgate XMLRPC Server"""
    65         """connect to sipgate XMLRPC Server"""
    66 
    66         logger.debug("sipgate.__connect()-"+self.url%(self.user,"XXXXXXXX"))
       
    67    
    67         self.samurai=xmlrpclib.Server(self.url%(self.user,self.password)).samurai
    68         self.samurai=xmlrpclib.Server(self.url%(self.user,self.password)).samurai
    68         args_identify = {
    69         args_identify = {
    69                 "ClientName"    : "anbieter.py",
    70                 "ClientName"    : "anbieter.py",
    70                 "ClientVersion" : "V1.0",
    71                 "ClientVersion" : "V1.0",
    71                 "ClientVendor"  : "Sandro Knauss"
    72                 "ClientVendor"  : "Sandro Knauss"
    89     def __send(self,args,recipients):
    90     def __send(self,args,recipients):
    90         """main sending method - sending the args to $recipients"""
    91         """main sending method - sending the args to $recipients"""
    91         sended=[]
    92         sended=[]
    92 
    93 
    93         self.__connect()
    94         self.__connect()
       
    95         logger.debug('sipgate.__send(%s,%s)'%(str(args),  str(recipients)))
    94         for recipient in recipients:
    96         for recipient in recipients:
    95             try:
    97             try:
    96                 tel = telnumber(recipient)
    98                 tel = telnumber(recipient)
    97 
    99 
    98                 if tel in sended:                                                                           #only send message once per recipient
   100                 if tel in sended:                                                                           #only send message once per recipient
    99                     continue
   101                     continue
   100                 sended.append(tel)
   102                 sended.append(tel)
   101 
   103 				
   102                 args["RemoteUri"]="sip:%s%s@sipgate.net"%(tel.land,tel.number)
   104                 args["RemoteUri"]="sip:%s%s@sipgate.net"%(tel.land,tel.number)
   103                 self.__send_method(self.samurai.SessionInitiate, args)
   105                 self.__send_method(self.samurai.SessionInitiate, args)
   104                 self.updateStatus(arranged=recipient)
   106                 self.updateStatus(arranged=recipient)
   105             
   107             
   106             except NotATelNumber, NoValidStatusCode:
   108             except NotATelNumber, NoValidStatusCode: