[sip] Scripts appelé par asterisk dans un sous dossier
This commit is contained in:
parent
4060df409c
commit
db5de1a8cc
6 changed files with 9 additions and 8 deletions
1
sip/scripts/README
Normal file
1
sip/scripts/README
Normal file
|
@ -0,0 +1 @@
|
|||
Contient des script appelé par asterisk qui lit leur résultat sur stdin
|
12
sip/scripts/alias_to_num
Executable file
12
sip/scripts/alias_to_num
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash /usr/scripts/python.sh
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
from sip.asterisk import Profile
|
||||
|
||||
if __name__ == '__main__' :
|
||||
if len(sys.argv)>1:
|
||||
profile = Profile()
|
||||
sys.stdout.write(profile.alias_to_num(sys.argv[1]))
|
||||
else:
|
||||
print >> sys.stderr, "Usage %s {alias}" % sys.argv[0]
|
29
sip/scripts/code_impression.py
Executable file
29
sip/scripts/code_impression.py
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
sys.path.append('/usr/scripts/')
|
||||
|
||||
import lc_ldap.shortcuts
|
||||
from lc_ldap.attributs import imprimeur, nounou
|
||||
from impression import digicode
|
||||
|
||||
conn = lc_ldap.shortcuts.lc_ldap_readonly()
|
||||
|
||||
try:
|
||||
aid=int(sys.argv[1][1:])
|
||||
|
||||
adh = conn.search(u"aid=%s" % aid)[0]
|
||||
login = str(adh.get('uid',['NONE'])[0])
|
||||
codes = digicode.get_codes(login)
|
||||
if codes:
|
||||
sys.stdout.write(codes[0])
|
||||
else:
|
||||
droits = [str(d) for d in adh.get('droits', [])]
|
||||
if imprimeur in droits or nounou in droits:
|
||||
code = digicode.gen_code(login)
|
||||
sys.stdout.write(str(code))
|
||||
else:
|
||||
sys.stdout.write('NONE')
|
||||
|
||||
except ValueError, IndexError:
|
||||
sys.stdout.write('NONE')
|
12
sip/scripts/num_to_callerid
Executable file
12
sip/scripts/num_to_callerid
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash /usr/scripts/python.sh
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
from sip.asterisk import Profile
|
||||
|
||||
if __name__ == '__main__' :
|
||||
if len(sys.argv)>1:
|
||||
profile = Profile("dbname='django' user='crans' host='pgsql.adm.crans.org'", "voip_profile")
|
||||
sys.stdout.write(profile.num_to_callerid(sys.argv[1]))
|
||||
else:
|
||||
print >> sys.stderr, "Usage %s {user}" % sys.argv[0]
|
11
sip/scripts/update_pin
Executable file
11
sip/scripts/update_pin
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash /usr/scripts/python.sh
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
from sip.asterisk import Profile
|
||||
|
||||
if __name__ == '__main__' :
|
||||
if len(sys.argv)>3:
|
||||
profile = Profile("dbname='django' user='crans' host='pgsql.adm.crans.org'", "voip_profile")
|
||||
profile.update_pin(sys.argv[2], sys.argv[3])
|
||||
else:
|
||||
print >> sys.stderr, "Usage %s {seed} {number} {pin}" % sys.argv[0]
|
20
sip/scripts/user_exist.py
Executable file
20
sip/scripts/user_exist.py
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
sys.path.append('/usr/scripts/')
|
||||
|
||||
import lc_ldap.shortcuts
|
||||
|
||||
conn=lc_ldap.shortcuts.lc_ldap_readonly()
|
||||
try:
|
||||
if len(sys.argv[1])==5:
|
||||
aid=int(sys.argv[1][1:])
|
||||
else:
|
||||
raise ValueError('Pas un numero valide')
|
||||
except ValueError:
|
||||
sys.stdout.write('FALSE')
|
||||
exit(0)
|
||||
if conn.search(u"aid=%s" % aid):
|
||||
sys.stdout.write('TRUE')
|
||||
else:
|
||||
sys.stdout.write('FALSE')
|
Loading…
Add table
Add a link
Reference in a new issue