|
@@ -7,6 +7,8 @@ from flask import Flask, request, render_template_string
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
from flask_cors import CORS
|
|
from flask_cors import CORS
|
|
from .constant import error_response
|
|
from .constant import error_response
|
|
|
|
+# from .exception import BizException
|
|
|
|
+
|
|
db = SQLAlchemy()
|
|
db = SQLAlchemy()
|
|
|
|
|
|
|
|
|
|
@@ -20,42 +22,28 @@ def create_app():
|
|
# with app.app_context():
|
|
# with app.app_context():
|
|
# from . import views # Import routes
|
|
# from . import views # Import routes
|
|
|
|
|
|
- from src.core.voip.bot import BotAgent
|
|
|
|
- from .call import CallService
|
|
|
|
- from .agent import AgentService, AgentOperService
|
|
|
|
- from .esl.client import InboundClient, OutboundClient
|
|
|
|
-
|
|
|
|
- agent = BotAgent(_app.logger)
|
|
|
|
|
|
+ # # from src.core.voip.bot import BotAgent
|
|
|
|
+ # from .call import CallService
|
|
|
|
+ # from .agent import AgentService, AgentOperService
|
|
|
|
+ # from .esl.client import InboundClient, OutboundClient
|
|
|
|
+ #
|
|
|
|
+ # # agent = BotAgent(_app.logger)
|
|
# agent, _outbound_client = None, None
|
|
# agent, _outbound_client = None, None
|
|
- _inbound_client = InboundClient(agent, _app.logger)
|
|
|
|
- _outbound_client = OutboundClient(agent, _app.logger)
|
|
|
|
- _call_service = CallService(_inbound_client, _app.logger)
|
|
|
|
- _agent_service = AgentService(_inbound_client, _app.logger)
|
|
|
|
- _agent_oper_service = AgentOperService(_inbound_client, _app.logger)
|
|
|
|
- return _app, _inbound_client, _outbound_client, _call_service , _agent_service, _agent_oper_service
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-app, inbound_client, outbound_client, call_service , agent_service, agent_oper_service = create_app()
|
|
|
|
|
|
+ # _inbound_client = InboundClient(agent, _app.logger)
|
|
|
|
+ # _outbound_client = OutboundClient(agent, _app.logger)
|
|
|
|
+ # _call_service = CallService(_inbound_client, _app.logger)
|
|
|
|
+ # _agent_service = AgentService(_inbound_client, _app.logger)
|
|
|
|
+ # _agent_oper_service = AgentOperService(_inbound_client, _app.logger)
|
|
|
|
+ # return _app, _inbound_client, _outbound_client, _call_service , _agent_service, _agent_oper_service
|
|
|
|
+ return _app
|
|
|
|
|
|
|
|
+app = create_app()
|
|
|
|
|
|
-class BizException(Exception):
|
|
|
|
- def __init__(self, message, status_code=400):
|
|
|
|
- super().__init__(message)
|
|
|
|
- self.message = message
|
|
|
|
- self.status_code = status_code
|
|
|
|
|
|
|
|
-
|
|
|
|
-class SipUriSyntaxException(Exception):
|
|
|
|
- def __init__(self, message, status_code=400):
|
|
|
|
- super().__init__(message)
|
|
|
|
- self.message = message
|
|
|
|
- self.status_code = status_code
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-@app.errorhandler(BizException)
|
|
|
|
-def handle_biz_exception(error):
|
|
|
|
- traceback.print_exc()
|
|
|
|
- return error_response(msg=str(error), http_code=200)
|
|
|
|
|
|
+# @app.errorhandler(BizException)
|
|
|
|
+# def handle_biz_exception(error):
|
|
|
|
+# traceback.print_exc()
|
|
|
|
+# return error_response(msg=str(error), http_code=200)
|
|
|
|
|
|
# Generic error handler for uncaught exceptions
|
|
# Generic error handler for uncaught exceptions
|
|
@app.errorhandler(Exception)
|
|
@app.errorhandler(Exception)
|