Commit e8c38b8f authored by Tomas Taraba's avatar Tomas Taraba

3162 Return HintWithOptions when querying for user hints

parent 00b36b25
......@@ -41,7 +41,7 @@ from xivo_dao.alchemy.func_key_mapping import FuncKeyMapping
from xivo_dao.alchemy.callfiltermember import Callfiltermember
from xivo_dao.alchemy.callfilter import Callfilter
from xivo_dao.resources.func_key.model import Hint
from xivo_dao.resources.func_key.model import Hint, HintWithOptions
def _find_extenfeatures(session, typeval):
......@@ -90,7 +90,8 @@ def user_hints(session, context):
(LineFeatures.protocol == 'sccp', literal_column("'SCCP/'") + SCCPLine.name),
(LineFeatures.protocol == 'custom', UserCustom.interface)
]).label('argument'),
LineFeatures.configregistrar.label('mediaserver'))
LineFeatures.configregistrar.label('mediaserver'),
UserSIP._options.label('options'))
.join(UserLine.userfeatures)
.join(UserLine.linefeatures)
.outerjoin(UserSIP,
......@@ -114,10 +115,11 @@ def user_hints(session, context):
.filter(Extension.context == context)
.filter(UserFeatures.enablehint == 1))
return tuple(Hint(user_id=row.user_id,
extension=row.extension,
argument=row.argument,
mediaserver=row.mediaserver)
return tuple(HintWithOptions(user_id=row.user_id,
extension=row.extension,
argument=row.argument,
mediaserver=row.mediaserver,
options=row.options)
for row in query)
......@@ -219,7 +221,7 @@ def bsfilter_hints(session, context):
bsfilter_extension = clean_extension(_find_extenfeatures(session, 'bsfilter'))
query = (session.query(sql.cast(FuncKeyDestBSFilter.filtermember_id, Unicode).label('argument'),
LineFeatures.configregistrar.label('mediaserver'))
LineFeatures.configregistrar.label('mediaserver'))
.join(Callfiltermember,
Callfiltermember.id == FuncKeyDestBSFilter.filtermember_id)
.join(Callfilter,
......
......@@ -226,4 +226,5 @@ class ForwardTypeConverter(object):
Hint = namedtuple('Hint', ['user_id', 'extension', 'argument', 'mediaserver'])
HintWithOptions = namedtuple('Hint', ['user_id', 'extension', 'argument', 'mediaserver', 'options'])
Forward = namedtuple('Forward', ['user_id', 'type', 'number'])
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