|
@@ -1,15 +1,18 @@
|
|
|
#!/usr/bin/env python3
|
|
|
# encoding:utf-8
|
|
|
|
|
|
+import json
|
|
|
import threading
|
|
|
from logging.config import dictConfig
|
|
|
-
|
|
|
+import src.core.callcenter.cache as Cache
|
|
|
from src.core.callcenter.agent import AgentService
|
|
|
+from src.core.callcenter.constant import success
|
|
|
+from src.core.callcenter.enumeration import CallType
|
|
|
from src.core.callcenter.esl.client import InboundClient
|
|
|
from flask import Flask, request, render_template_string
|
|
|
|
|
|
from src.core.callcenter.call import CallService
|
|
|
-from src.core.callcenter.model import MakeCallRequest, AgentInfo, AgentActionRequest
|
|
|
+from src.core.callcenter.model import MakeCallRequest, AgentInfo, AgentActionRequest, HangupCallRequest
|
|
|
|
|
|
dictConfig({
|
|
|
"version": 1,
|
|
@@ -146,16 +149,31 @@ def agent_state():
|
|
|
@app.route('/open/agent/manual-call', methods=['POST'])
|
|
|
def manual_call():
|
|
|
"""外呼"""
|
|
|
- request = MakeCallRequest()
|
|
|
- agent = AgentInfo()
|
|
|
- call_service.call(request, agent)
|
|
|
- return 'Hello World!'
|
|
|
+ # agentId: string
|
|
|
+ # vccId: string
|
|
|
+ # password: string
|
|
|
+ # scene: string
|
|
|
+ # ctiFlowId?: string
|
|
|
+ # monitorScene?: string
|
|
|
+ # called: string
|
|
|
+ # circuitUid: string
|
|
|
+ # ext?: object
|
|
|
+ # callId: string
|
|
|
+ data = request.json()
|
|
|
+ agent = Cache.get_agent_info(data.get('agentId'))
|
|
|
+ req = MakeCallRequest(saas_id=data.get('vccId'), call_type=CallType.OUTBOUND_CALL, caller=agent.agent_number, called=data.get('called'), follow_data=data.get('ext'))
|
|
|
+ res = call_service.call(req, agent)
|
|
|
+ return success(res)
|
|
|
|
|
|
|
|
|
@app.route('/open/agent/manual-hang', methods=['POST'])
|
|
|
def manual_hang():
|
|
|
"""挂断"""
|
|
|
- return 'Hello World!'
|
|
|
+ data = request.json()
|
|
|
+ agent = Cache.get_agent_info(data.get('agentId'))
|
|
|
+ req = HangupCallRequest(saas_id=data.get('vccId'), call_id=data.get('callId'), agent_number=agent.agent_number)
|
|
|
+ call_service.hangup(req)
|
|
|
+ return success()
|
|
|
|
|
|
|
|
|
@app.route('/open/agent/listen', methods=['POST'])
|