Ajout des script pour asterisk
This commit is contained in:
parent
e9bae60ef9
commit
124d4a83e1
12 changed files with 286 additions and 0 deletions
27
sip/num_to_callerid.py
Executable file
27
sip/num_to_callerid.py
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
import psycopg2
|
||||
sys.path.append('/usr/scripts/gestion')
|
||||
sys.path.append('/usr/scripts/lc_ldap')
|
||||
sys.path.append('/etc/crans/secrets/')
|
||||
|
||||
import lc_ldap
|
||||
|
||||
try:
|
||||
conn = psycopg2.connect("dbname='django' user='crans' host='pgsql.adm.crans.org'")
|
||||
cur = conn.cursor()
|
||||
cur.execute("""SELECT caller_id from voip_profile WHERE num='%s'""" % sys.argv[1])
|
||||
caller_id = cur.fetchall()[0][0]
|
||||
|
||||
if caller_id == 'full_name' or caller_id == 'both':
|
||||
conn=lc_ldap.lc_ldap_admin()
|
||||
aid=int(sys.argv[1][1:])
|
||||
adh=conn.search('aid=%s' % aid)[0]
|
||||
sys.stdout.write('%s %s' % (adh['prenom'][0],adh['nom'][0]))
|
||||
else:
|
||||
sys.stdout.write(sys.argv[1])
|
||||
except:
|
||||
sys.stdout.write(sys.argv[1])
|
Loading…
Add table
Add a link
Reference in a new issue