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
a83dba0d
Commit
a83dba0d
authored
Nov 06, 2013
by
Daniel STAN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
send_sms: shabang + secrets_new
parent
336b2eaf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
10 deletions
+6
-10
sip/send_sms.py
sip/send_sms.py
+6
-10
No files found.
sip/send_sms.py
View file @
a83dba0d
#!/
usr/bin/env python
#!/
bin/bash /usr/scripts/python.sh
# -*- coding: utf-8 -*-
"""
...
...
@@ -13,9 +13,7 @@ https://github.com/grengojbo/sipclients
"""
import
sys
sys
.
path
.
append
(
'/usr/scripts/gestion/secrets'
)
from
secrets
import
asterisk_sms_passwd
sys
.
path
.
pop
()
import
gestion.secrets_new
as
secrets
import
os
import
getpass
import
sys
...
...
@@ -26,10 +24,7 @@ parser.add_argument('-d', '--dst', default=None,
help
=
"Destinataire, peut être de la forme sip:13570. (Défaut: soi-même)"
)
# Attention: on a besoin d'importer le module sip de /usr/scripts
# il existe déjà un module sip dans les libs python.
# il faut donc mettre notre path, avant
sys
.
path
.
insert
(
0
,
'/usr/scripts/'
)
# et non celui des libs python
import
lc_ldap.shortcuts
from
sip.asterisk
import
Manager
...
...
@@ -43,7 +38,8 @@ if __name__ == '__main__':
# rajouter @crans.org ne semble pas marcher, pourquoi ?
own
=
"sip:1"
+
str
(
adh
[
'aid'
][
0
])
+
"@crans.org"
# TODO utiliser le vrai caller id
# profile_manager = Profile("dbname='django' user='crans' host='pgsql.adm.crans.org'", "voip_profile")
# profile_manager = Profile("dbname='django' user='crans' " +
# "host='pgsql.adm.crans.org'", "voip_profile")
# callerid = profile_manager.num_to_callerid(own)
callerid
=
os
.
path
.
basename
(
__file__
)
caller
=
'"%s" <%s>'
%
(
callerid
,
own
)
...
...
@@ -52,7 +48,7 @@ if __name__ == '__main__':
if
not
dst
:
dst
=
"sip:1"
+
str
(
adh
[
'aid'
][
0
])
ast_manager
=
Manager
(
'sms'
,
asterisk_sms_passwd
)
ast_manager
=
Manager
(
'sms'
,
secrets
.
get
(
'asterisk_sms_passwd'
)
)
# TODO mode hors ligne
ast_manager
.
messageSend
(
caller
,
dst
,
sys
.
stdin
.
read
())
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