From: Michael Tremer Date: Wed, 10 Oct 2018 11:34:50 +0000 (+0100) Subject: talk: Connect to FreeSWITCH X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=13e89ccc4f0d259dc7ce21f3539404ef556cbd19;p=ipfire.org.git talk: Connect to FreeSWITCH Signed-off-by: Michael Tremer --- diff --git a/src/backend/talk.py b/src/backend/talk.py index a77fcd0b..0d2e3b11 100644 --- a/src/backend/talk.py +++ b/src/backend/talk.py @@ -5,8 +5,26 @@ import re from . import database from .misc import Object +from .decorators import * + +class Freeswitch(Object): + @lazy_property + def db(self): + credentials = { + "host" : self.settings.get("freeswitch_database_host"), + "database" : self.settings.get("freeswitch_database_name", "freeswitch"), + "user" : self.settings.get("freeswitch_database_user"), + "password" : self.settings.get("freeswitch_database_password"), + } + + return database.Connection(**credentials) + class Talk(Object): + def init(self): + # Connect to FreeSWITCH + self.freeswitch = Freeswitch(self.backend) + def get_phonebook(self, account=None): accounts = [] for a in self.accounts.list():