equal
deleted
inserted
replaced
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 self.__send_method(self.samurai.SessionInitiate, args) |
104 self.updateStatus(arranged=recipient) |
104 self.updateStatus(arranged=recipient) |
105 except NotATelNumber,NoValidStatusCode : |
105 |
|
106 except NotATelNumber, NoValidStatusCode: |
106 self.updateStatus(failed=recipient) |
107 self.updateStatus(failed=recipient) |
107 |
108 |
108 self.__disconnect() |
109 self.__disconnect() |
109 |
110 |
110 def updateStatus(self, arranged=None, failed=None): |
111 def updateStatus(self, arranged=None, failed=None): |