Commit cdb556e7 authored by Valentin Samir's avatar Valentin Samir

[sip/asterisk] AsteriskError plus détaillée

parent c1e60086
......@@ -21,7 +21,13 @@ class NullRecv(EnvironmentError):
pass
class AsteriskError(ValueError):
pass
def __init__(self, message, action, params):
self.message=message
self.action=action
self.params=params
def __str__(self):
return '%s, Action:%s, params:%s' % (self.message, self.action, self.params)
class Profile(object):
def __init__(self, sql_params=None, database=None):
......@@ -60,7 +66,7 @@ class Profile(object):
caller_id = cur.fetchall()[0][0]
cur.close()
conn.close()
if caller_id == 'full_name' or caller_id == 'both':
conn=lc_ldap.shortcuts.lc_ldap_readonly()
aid=int(num[1:])
......@@ -243,7 +249,7 @@ class Manager(object):
del(self._response[id])
self._pending_action.remove(id)
if response[0] == 'Error':
raise AsteriskError('%s. Action:%s params:%s' % (response[1]['Message'], name, params))
raise AsteriskError(response[1]['Message'], name, params)
return response
def action(self, name, **params):
......
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