diff -r 4a33882f3a49 -r f25033cf93e0 iro/anbieter/sipgate.py --- a/iro/anbieter/sipgate.py Wed Oct 28 03:36:27 2009 +0100 +++ b/iro/anbieter/sipgate.py Sat Oct 31 03:20:59 2009 +0100 @@ -59,6 +59,7 @@ def __connect(self): """connect to sipgate XMLRPC Server""" + self.samurai=xmlrpclib.Server(self.url%(self.user,self.password)).samurai args_identify = { "ClientName" : "anbieter.py", @@ -70,6 +71,7 @@ def __send_method(self, func, args=None): """execute $func and test weather if the func ran successfully or not""" + if args==None: xmlrpc_result = func() else: @@ -77,11 +79,13 @@ if xmlrpc_result['StatusCode'] != 200: raise NoValidStatusCode("There was an error during identification to the server! %d %s"% (xmlrpc_result['StatusCode'], xmlrpc_result['StatusString'])) + return xmlrpc_result def __send(self,args,recipients): """main sending method - sending the args to $recipients""" sended=[] + self.__connect() for recipient in recipients: try: @@ -90,7 +94,7 @@ if tel in sended: #only send message once per recipient continue sended.append(tel) - + args["RemoteUri"]="sip:%s%s@sipgate.net"%(tel.land,tel.number) xmlrpc_result = self.__send_method(self.samurai.SessionInitiate, args) self.updateStatus(arranged=recipient)