+# Copyright (c) Stas Shtin, 2010
+
+# This file is part of IPyPBX.
+
+# IPyPBX 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.
+
+# IPyPBX 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 IPyPBX. If not, see <http://www.gnu.org/licenses/>.
+
+
+from PyQt import QtNetwork
+
+
+class FreeswitchConfigServer(QTcpServer):
+ """
+ This is a server that gets instantiated for every connection.
+ """
+ def __init__(self, host, port, parent=None):
+ super(FreeswitchConfig, self).__init__(self, parent)
+
+ self.newConnection.connect(self, handleClientConnection)
+ self.listen(host, port)
+
+ def handleClientConnection(self):
+ if self.hasPendingConnections():
+ connectionClient = self.nextClientConnection()
+ connectionClient.readyRead.connect(self.receiveData)