Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
scripts
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Benjamin Graillot
scripts
Commits
f8f4d7e9
Commit
f8f4d7e9
authored
Jun 16, 2013
by
Valentin Samir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[sip/sms] Indentation fail
parent
399bf75d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
28 deletions
+13
-28
sip/asterisk.py
sip/asterisk.py
+13
-27
sip/sms_queuing
sip/sms_queuing
+0
-1
No files found.
sip/asterisk.py
View file @
f8f4d7e9
...
...
@@ -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
sip/sms_queuing
View file @
f8f4d7e9
...
...
@@ -5,4 +5,3 @@ from asterisk import Sms
if
__name__
==
'__main__'
:
sms
=
Sms
(
'/var/spool/asterisk/sms/'
)
sms
.
sms_daemon
(
'localhost'
,
5038
,
'sms'
,
'6m6lTaEOTMsyM'
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment