...
 
Commits (6)
xivo-dao (2019.05.00) xivo-callisto; urgency=medium
[ Tomas Tartaba ]
[ Tomas Taraba ]
* 2443 Route tables missing in dao init
[ Vojtech Sodoma ]
* 2428 Migrate outcalls to routes
[ Jean-Pierre Thomasset ]
* 2397 - Add helper to get extension list and mds of a given user and group
......
......@@ -41,7 +41,6 @@ from xivo_dao.alchemy.ctisheetevents import CtiSheetEvents
from xivo_dao.alchemy.ctistatus import CtiStatus
from xivo_dao.alchemy.dhcp import Dhcp
from xivo_dao.alchemy.dialaction import Dialaction
from xivo_dao.alchemy.dialpattern import DialPattern
from xivo_dao.alchemy.directories import Directories
from xivo_dao.alchemy.entity import Entity
from xivo_dao.alchemy.extension import Extension
......@@ -72,12 +71,11 @@ from xivo_dao.alchemy.ldapfilter import LdapFilter
from xivo_dao.alchemy.ldapserver import LdapServer
from xivo_dao.alchemy.linefeatures import LineFeatures
from xivo_dao.alchemy.mail import Mail
from xivo_dao.alchemy.mediaserver import MediaServer
from xivo_dao.alchemy.meetmefeatures import MeetmeFeatures
from xivo_dao.alchemy.monitoring import Monitoring
from xivo_dao.alchemy.musiconhold import MusicOnHold
from xivo_dao.alchemy.netiface import Netiface
from xivo_dao.alchemy.outcall import Outcall
from xivo_dao.alchemy.outcalltrunk import OutcallTrunk
from xivo_dao.alchemy.paging import Paging
from xivo_dao.alchemy.paginguser import PagingUser
from xivo_dao.alchemy.phonebook import Phonebook
......@@ -144,8 +142,8 @@ from xivo_dao.alchemy.voicemail import Voicemail
from xivo_dao.alchemy.xc_queue_members_default import XCQueueMembersDefault
from xivo_dao.alchemy.xc_queues import XCQueues
from xivo_dao.alchemy.xc_users import XCUsers
from xivo_dao.alchemy.mediaserver import MediaServer
from xivo_dao.alchemy.route import Route
from xivo_dao.alchemy.routecontext import RouteContext
from xivo_dao.alchemy.routemediaserver import RouteMediaServer
from xivo_dao.alchemy.routepattern import RoutePattern
from xivo_dao.alchemy.routetrunk import RouteTrunk
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 Avencall
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
from sqlalchemy.schema import Column, PrimaryKeyConstraint, UniqueConstraint
from sqlalchemy.types import Integer, String, Text
from xivo_dao.helpers.db_manager import Base
class Outcall(Base):
__tablename__ = 'outcall'
__table_args__ = (
PrimaryKeyConstraint('id'),
UniqueConstraint('name'),
)
id = Column(Integer, nullable=False)
name = Column(String(128), nullable=False)
context = Column(String(39), nullable=False)
useenum = Column(Integer, nullable=False, server_default='0')
internal = Column(Integer, nullable=False, server_default='0')
preprocess_subroutine = Column(String(39))
hangupringtime = Column(Integer, nullable=False, server_default='0')
commented = Column(Integer, nullable=False, server_default='0')
description = Column(Text)
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 Avencall
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
from sqlalchemy.schema import Column, PrimaryKeyConstraint, Index
from sqlalchemy.types import Integer
from xivo_dao.helpers.db_manager import Base
class OutcallTrunk(Base):
__tablename__ = 'outcalltrunk'
__table_args__ = (
PrimaryKeyConstraint('outcallid', 'trunkfeaturesid'),
Index('outcalltrunk__idx__priority', 'priority'),
)
outcallid = Column(Integer, nullable=False, server_default='0')
trunkfeaturesid = Column(Integer, nullable=False, server_default='0')
priority = Column(Integer, nullable=False, server_default='0')
......@@ -28,8 +28,6 @@ class Route(Base):
)
id = Column(Integer, nullable=False)
pattern = Column(String, nullable=False)
regexp = Column(String, nullable=True)
subroutine = Column(String, nullable=True)
description = Column(Text)
priority = Column(Integer, nullable=False)
......@@ -15,24 +15,25 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
from sqlalchemy.schema import Column, PrimaryKeyConstraint
from sqlalchemy.schema import Column, PrimaryKeyConstraint, ForeignKeyConstraint
from sqlalchemy.types import Integer, String
from xivo_dao.helpers.db_manager import Base
class DialPattern(Base):
class RoutePattern(Base):
__tablename__ = 'dialpattern'
__tablename__ = 'routepattern'
__table_args__ = (
PrimaryKeyConstraint('id'),
ForeignKeyConstraint(('routeid',),
('route.id',),
ondelete='RESTRICT'),
)
id = Column(Integer)
type = Column(String(32), nullable=False)
typeid = Column(Integer, nullable=False)
externprefix = Column(String(64))
prefix = Column(String(32))
exten = Column(String(40), nullable=False)
stripnum = Column(Integer)
callerid = Column(String(80))
pattern = Column(String, nullable=False)
regexp = Column(String, nullable=True)
target = Column(String, nullable=True)
callerid = Column(String(80), nullable=True)
routeid = Column(Integer, nullable=False)
......@@ -404,12 +404,10 @@ class TestDelete(DAOTestCase):
mediaserver = self.add_mediaserver()
group = self.add_groupfeatures(mediaserverid=mediaserver.id)
incall = self.add_incall()
outcall = self.add_outcall()
call_permission = call_permission_dao.create(CallPermission(name='Delete'))
self.add_right_call_member(rightcallid=call_permission.id, type='user', typeval=str(user.id))
self.add_right_call_member(rightcallid=call_permission.id, type='group', typeval=str(group.id))
self.add_right_call_member(rightcallid=call_permission.id, type='incall', typeval=str(incall.id))
self.add_right_call_member(rightcallid=call_permission.id, type='outcall', typeval=str(outcall.id))
call_permission_dao.delete(call_permission)
......
......@@ -37,7 +37,6 @@ from xivo_dao.alchemy.contextnumbers import ContextNumbers
from xivo_dao.alchemy.ctidirectories import CtiDirectories
from xivo_dao.alchemy.cti_contexts import CtiContexts
from xivo_dao.alchemy.dialaction import Dialaction
from xivo_dao.alchemy.dialpattern import DialPattern
from xivo_dao.alchemy.directories import Directories
from xivo_dao.alchemy.entity import Entity as EntitySchema
from xivo_dao.alchemy.extension import Extension
......@@ -65,7 +64,6 @@ from xivo_dao.alchemy.queueinfo import QueueInfo
from xivo_dao.alchemy.queuemember import QueueMember
from xivo_dao.alchemy.queueskill import QueueSkill
from xivo_dao.alchemy.queueskillrule import QueueSkillRule
from xivo_dao.alchemy.outcall import Outcall
from xivo_dao.alchemy.rightcall import RightCall as CallPermission
from xivo_dao.alchemy.rightcallmember import RightCallMember as UserCallPermission
from xivo_dao.alchemy.sccpdevice import SCCPDevice as SCCPDeviceSchema
......@@ -406,14 +404,6 @@ class DAOTestCase(unittest.TestCase):
self.add_me(incall)
return incall
def add_outcall(self, **kwargs):
kwargs.setdefault('name', 'outcall_name')
kwargs.setdefault('context', 'to-extern')
outcall = Outcall(**kwargs)
self.add_me(outcall)
return outcall
def add_user(self, **kwargs):
if 'func_key_private_template_id' not in kwargs:
func_key_template = self.add_func_key_template(private=True)
......@@ -551,15 +541,6 @@ class DAOTestCase(unittest.TestCase):
self.add_me(pickup_member)
return pickup_member
def add_dialpattern(self, **kwargs):
kwargs.setdefault('id', self._generate_int())
kwargs.setdefault('type', 'outcall')
kwargs.setdefault('typeid', self._generate_int())
kwargs.setdefault('exten', ''.join(random.choice('0123456789_*X.') for _ in range(6)))
dialpattern = DialPattern(**kwargs)
self.add_me(dialpattern)
return dialpattern
def add_dialaction(self, **kwargs):
dialaction = Dialaction(**kwargs)
self.add_me(dialaction)
......