[sip/asterisk] AsteriskError plus détaillée
This commit is contained in:
parent
c1e600862b
commit
cdb556e74e
1 changed files with 9 additions and 3 deletions
|
@ -21,7 +21,13 @@ class NullRecv(EnvironmentError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class AsteriskError(ValueError):
|
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):
|
class Profile(object):
|
||||||
def __init__(self, sql_params=None, database=None):
|
def __init__(self, sql_params=None, database=None):
|
||||||
|
@ -60,7 +66,7 @@ class Profile(object):
|
||||||
caller_id = cur.fetchall()[0][0]
|
caller_id = cur.fetchall()[0][0]
|
||||||
cur.close()
|
cur.close()
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
if caller_id == 'full_name' or caller_id == 'both':
|
if caller_id == 'full_name' or caller_id == 'both':
|
||||||
conn=lc_ldap.shortcuts.lc_ldap_readonly()
|
conn=lc_ldap.shortcuts.lc_ldap_readonly()
|
||||||
aid=int(num[1:])
|
aid=int(num[1:])
|
||||||
|
@ -243,7 +249,7 @@ class Manager(object):
|
||||||
del(self._response[id])
|
del(self._response[id])
|
||||||
self._pending_action.remove(id)
|
self._pending_action.remove(id)
|
||||||
if response[0] == 'Error':
|
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
|
return response
|
||||||
|
|
||||||
def action(self, name, **params):
|
def action(self, name, **params):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue