iro/anbieter/sipgate.py
changeset 30 5253631a8dd3
parent 23 0180b538ed74
child 32 935f9a4da503
equal deleted inserted replaced
29:49ffb1f6cdbf 30:5253631a8dd3
    41         self.user=cp.get(self.section, 'user')
    41         self.user=cp.get(self.section, 'user')
    42         self.password=cp.get(self.section, 'password')
    42         self.password=cp.get(self.section, 'password')
    43 
    43 
    44     def sendSMS(self,sms,recipients):
    44     def sendSMS(self,sms,recipients):
    45         """send SMS with $sms to $recipients"""
    45         """send SMS with $sms to $recipients"""
    46         logger.debug('sipgate.sendSMS(%s,%s)'%(sms,  str(recipients)))
    46         logger.debug('sipgate.sendSMS(%s,%s)'%(sms.getContent(),  str(recipients)))
    47         args={
    47         args={
    48                 "TOS" : "text",
    48                 "TOS" : "text",
    49                 "Content" : sms.content
    49                 "Content" : sms.getContent()
    50                 }
    50                 }
    51         self.__send(args,recipients)
    51         self.__send(args,recipients)
    52 
    52 
    53     def sendFAX(self,fax,recipients):
    53     def sendFAX(self,fax,recipients):
    54         """send the PDF file $fax  to $recipients"""
    54         """send the PDF file $fax  to $recipients"""
    92 
    92 
    93         self.__connect()
    93         self.__connect()
    94         for recipient in recipients:
    94         for recipient in recipients:
    95             try:
    95             try:
    96                 tel = telnumber(recipient)
    96                 tel = telnumber(recipient)
    97                 
    97 
    98                 if tel in sended:                                                                           #only send message once per recipient
    98                 if tel in sended:                                                                           #only send message once per recipient
    99                   continue
    99                     continue
   100                 sended.append(tel)
   100                 sended.append(tel)
   101 
   101 
   102                 args["RemoteUri"]="sip:%s%s@sipgate.net"%(tel.land,tel.number)
   102                 args["RemoteUri"]="sip:%s%s@sipgate.net"%(tel.land,tel.number)
   103                 xmlrpc_result = self.__send_method(self.samurai.SessionInitiate, args)
   103                 xmlrpc_result = self.__send_method(self.samurai.SessionInitiate, args)
   104                 self.updateStatus(arranged=recipient)
   104                 self.updateStatus(arranged=recipient)