|
@@ -65,16 +65,7 @@ def get_cdn_url():
|
|
|
def get_init_config():
|
|
|
"""获取初始化配置"""
|
|
|
try:
|
|
|
- print("Request Object: %s", request)
|
|
|
- print("Headers: %s", request.headers)
|
|
|
- print("JSON Data: %s", request.get_json())
|
|
|
- print("Data: %s", request.data)
|
|
|
- print("Method: %s", request.method)
|
|
|
- print("URL: %s", request.url)
|
|
|
-
|
|
|
data = request.get_json()
|
|
|
- print("Parsed Data: %s", data)
|
|
|
-
|
|
|
param = AgentActionRequest.from_json(data=data)
|
|
|
res = agent_service.get_and_check(param)
|
|
|
return success_response(res)
|
|
@@ -87,60 +78,88 @@ def get_init_config():
|
|
|
@app.route('/open/agent/check-in', methods=['POST'])
|
|
|
def check_in():
|
|
|
"""坐席签入"""
|
|
|
- data = request.get_json()
|
|
|
- param = AgentActionRequest.from_json(data=data)
|
|
|
- res = agent_oper_service.checkin(param)
|
|
|
- return success_response(res)
|
|
|
+ try:
|
|
|
+ data = request.get_json()
|
|
|
+ param = AgentActionRequest.from_json(data=data)
|
|
|
+ res = agent_oper_service.checkin(param)
|
|
|
+ return success_response(res)
|
|
|
+ except Exception as e:
|
|
|
+ print("Exception occurred: %s", str(e))
|
|
|
+ return {"error": "An error occurred", "details": str(e)}, 500
|
|
|
|
|
|
|
|
|
@app.route('/open/agent/check-out', methods=['POST'])
|
|
|
def check_out():
|
|
|
"""坐席签出"""
|
|
|
- data = request.get_json()
|
|
|
- param = AgentActionRequest.from_json(data=data)
|
|
|
- return agent_oper_service.checkout(param)
|
|
|
+ try:
|
|
|
+ data = request.get_json()
|
|
|
+ param = AgentActionRequest.from_json(data=data)
|
|
|
+ return agent_oper_service.checkout(param)
|
|
|
+ except Exception as e:
|
|
|
+ print("Exception occurred: %s", str(e))
|
|
|
+ return {"error": "An error occurred", "details": str(e)}, 500
|
|
|
|
|
|
|
|
|
@app.route('/open/agent/busy', methods=['POST'])
|
|
|
def busy():
|
|
|
"""坐席置忙"""
|
|
|
- data = request.get_json()
|
|
|
- param = AgentActionRequest.from_json(data=data)
|
|
|
- return agent_oper_service.busy(param)
|
|
|
+ try:
|
|
|
+ data = request.get_json()
|
|
|
+ param = AgentActionRequest.from_json(data=data)
|
|
|
+ return agent_oper_service.busy(param)
|
|
|
+ except Exception as e:
|
|
|
+ print("Exception occurred: %s", str(e))
|
|
|
+ return {"error": "An error occurred", "details": str(e)}, 500
|
|
|
|
|
|
|
|
|
@app.route('/open/agent/idle', methods=['POST'])
|
|
|
def idle():
|
|
|
"""坐席置闲"""
|
|
|
- data = request.get_json()
|
|
|
- param = AgentActionRequest.from_json(data=data)
|
|
|
- return agent_oper_service.idle(param)
|
|
|
+ try:
|
|
|
+ data = request.get_json()
|
|
|
+ param = AgentActionRequest.from_json(data=data)
|
|
|
+ return agent_oper_service.idle(param)
|
|
|
+ except Exception as e:
|
|
|
+ print("Exception occurred: %s", str(e))
|
|
|
+ return {"error": "An error occurred", "details": str(e)}, 500
|
|
|
|
|
|
|
|
|
@app.route('/open/agent/turn-on', methods=['POST'])
|
|
|
def turn_on():
|
|
|
"""接通"""
|
|
|
- data = request.get_json()
|
|
|
- param = AgentActionRequest.from_json(data=data)
|
|
|
- return agent_oper_service.checkin(param)
|
|
|
+ try:
|
|
|
+ data = request.get_json()
|
|
|
+ param = AgentActionRequest.from_json(data=data)
|
|
|
+ return agent_oper_service.checkin(param)
|
|
|
+ except Exception as e:
|
|
|
+ print("Exception occurred: %s", str(e))
|
|
|
+ return {"error": "An error occurred", "details": str(e)}, 500
|
|
|
|
|
|
|
|
|
@app.route('/open/agent/hang-up', methods=['POST'])
|
|
|
def hang_up():
|
|
|
"""挂断"""
|
|
|
- data = request.get_json()
|
|
|
- param = AgentActionRequest.from_json(data=data)
|
|
|
- res = call_service.hangup(param)
|
|
|
- return success_response(res)
|
|
|
+ try:
|
|
|
+ data = request.get_json()
|
|
|
+ param = AgentActionRequest.from_json(data=data)
|
|
|
+ res = call_service.hangup(param)
|
|
|
+ return success_response(res)
|
|
|
+ except Exception as e:
|
|
|
+ print("Exception occurred: %s", str(e))
|
|
|
+ return {"error": "An error occurred", "details": str(e)}, 500
|
|
|
|
|
|
|
|
|
@app.route('/open/agent/agent-state', methods=['POST'])
|
|
|
def agent_state():
|
|
|
"""获取坐席状态"""
|
|
|
- data = request.get_json()
|
|
|
- param = HumanServiceQueryRequest.from_json(data)
|
|
|
- res = agent_service.watch_agent_state(param)
|
|
|
- return success_response(res)
|
|
|
+ try:
|
|
|
+ data = request.get_json()
|
|
|
+ param = HumanServiceQueryRequest.from_json(data)
|
|
|
+ res = agent_service.watch_agent_state(param)
|
|
|
+ return success_response(res)
|
|
|
+ except Exception as e:
|
|
|
+ print("Exception occurred: %s", str(e))
|
|
|
+ return {"error": "An error occurred", "details": str(e)}, 500
|
|
|
|
|
|
|
|
|
@app.route('/open/agent/manual-call', methods=['POST'])
|