Commit fe0462bd authored by Vojtech Sodoma's avatar Vojtech Sodoma

2936 Generate only enabled users in dialplan

parent 7f76a406
......@@ -334,10 +334,12 @@ def _find_user_exten_settings(session, context_name):
UserLine.main_user == True,
UserLine.main_line == True))
.join(LineFeatures, LineFeatures.id == UserLine.line_id)
.join(UserFeatures, UserFeatures.id == UserLine.user_id)
.filter(and_(Extension.context == context_name,
Extension.commented == 0,
Extension.type == 'user',
LineFeatures.commented == 0))
LineFeatures.commented == 0,
UserFeatures.commented == 0))
.order_by(Extension.exten)
.all())
......
......@@ -590,6 +590,18 @@ class TestAsteriskConfDAO(DAOTestCase, PickupHelperMixin):
assert_that(result, contains())
def test_find_exten_settings_when_user_disabled(self):
user_row = self.add_user(commented=1)
line_row = self.add_line()
extension_row = self.add_extension(exten='14', context='default')
self.add_user_line(user_id=user_row.id,
extension_id=extension_row.id,
line_id=line_row.id)
result = asterisk_conf_dao.find_exten_settings('default')
assert_that(result, contains())
def test_find_exten_settings_multiple_extensions(self):
user1 = self.add_user()
line1 = self.add_line()
......
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