Commit f8f4d7e9 authored by Valentin Samir's avatar Valentin Samir

[sip/sms] Indentation fail

parent 399bf75d
......@@ -66,7 +66,7 @@ class Sms(object):
except (socket.error, asterisk.NullRecv):
pass
def _mkdirs(path):
def _mkdirs(self, path):
try:
os.makedirs(path)
except OSError as exc:
......@@ -77,18 +77,18 @@ class Sms(object):
def sms_delay(self, src, dst, body, user, body_type='str'):
if not body_type in ["str", "base64"]:
raise EnvironmentError("body_type sould be 'str' ou 'base64' not %r" % body_type)
date = datetime.now().strftime('%Y%m%d%H%M%S.%f')
path = self.sms_dir + user + '/' + date + '/'
self._mkdirs(path)
with open(path + 'from') as f:
f.write(src)
with open(path + 'to') as f:
f.write(dst)
with open(path + 'body') as f:
if body_type=='str':
f.write(body)
elif body_type=='base64':
f.write(base64.encodestring(body).strip())
date = datetime.now().strftime('%Y%m%d%H%M%S.%f')
path = self.sms_dir + user + '/' + date + '/'
self._mkdirs(path)
with open(path + 'from', 'w') as f:
f.write(src)
with open(path + 'to', 'w') as f:
f.write(dst)
with open(path + 'body', 'w') as f:
if body_type=='str':
f.write(body)
elif body_type=='base64':
f.write(base64.encodestring(body).strip())
......@@ -311,17 +311,3 @@ class Manager(object):
if body_type == "str":
body = base64.encodestring(body).strip()
return self._action('messageSend', {'to':dst, 'from':src, 'base64body':body})
\ No newline at end of file
......@@ -5,4 +5,3 @@ from asterisk import Sms
if __name__ == '__main__' :
sms=Sms('/var/spool/asterisk/sms/')
sms.sms_daemon('localhost',5038,'sms','6m6lTaEOTMsyM')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment