#!/usr/bin/env python3 # encoding:utf-8 from enum import Enum class DelayActionEnum(Enum): CALL_TIMEOUT_HANGUP = ('CALL_TIMEOUT_HANGUP', "超时挂机") PLAY_TIMEOUT_HANGUP = ('PLAY_TIMEOUT_HANGUP','播放超时挂机') NOTICE_TIMEOUT_HANGUP = ('NOTICE_TIMEOUT_HANGUP', '') CALL_TIMEOUT_DECR = ('CALL_TIMEOUT_DECR', '呼叫超时重试'), ACD_TIMEOUT_PLAY = ('ACD_TIMEOUT_PLAY','排队等待音超时') def __init__(self, code=None, description=None): self.code = code self.description = description @classmethod def get_by_code(cls, code): return next((member for member in cls if member.code == code), None) class HumanState(Enum): DEFAULT = (0, "默认") IDLE = (1, "空闲") BUSY = (2, "忙碌") def __init__(self, code=None, description=None): self.code = code self.description = description @classmethod def get_by_code(cls, code): return next((member for member in cls if member.code == code), None) class AgentState(Enum): ENABLE = (0, '可用') DISABLE = (1, '禁用') def __init__(self, code=None, description=None): self.code = code self.description = description @classmethod def get_by_code(cls, code): return next((member for member in cls if member.code == code), None) class AgentCheck(Enum): IN = (0, "签入") OUT = (1, "签出") def __init__(self, code=None, description=None): self.code = code self.description = description @classmethod def get_by_code(cls, code): return next((member for member in cls if member.code == code), None) class AgentHeartState(Enum): DEFAULT = (0, "默认") NORMAL = (1, "正常") ABNORMAL = (2, "异常") def __init__(self, code=None, description=None): self.code = code self.description = description class AgentServiceState(Enum): LOGOUT = (0, "未登录") BUSY = (1, "忙碌") IDLE = (2, "空闲") CALLING = (3, "通话中") REPROCESSING = (4, "后处理") DIALING = (5, "拨号中") HANGING = (6, "挂机回调") def __init__(self, code=None, description=None): self.code = code self.description = description @classmethod def get_by_code(cls, code): return next((member for member in cls if member.code == code), None) class AgentLogState(Enum): CREATE = (0, "创建") UPDATE = (1, "修改") DELETE = (2, "删除") CHECKIN = (10, "签入") CHECKOUT = (11, "签出") BUSY = (12, "置忙") IDLE = (13, "置闲") CHANNEL_TURN_ON = (14, "事件接通") CHANNEL_HANG_UP = (15, "事件挂断") ENABLE = (16, "启用") DISABLE = (17, "禁用") REPROCESSING_IDLE = (18, "后处理置闲") DIALING = (19, "拨号中") BIZ_DIALING_IDLE = (21, "业务拨号中置闲") MANUAL_HANG_UP = (22, "手动挂断") TURN_ON = (23, "接通") HANG_UP = (24, "挂断") LISTEN = (25, "监听") LISTEN_TURN_ON = (26, "监听接通") LISTEN_HANG_UP = (27, "监听挂断") EVENT_CHECKOUT = (30, "事件签出") RELOAD_PHONE = (41, "重新分配分机号") DELAY_HEART_ABNORMAL = (51, "延时心跳异常") ACTIVE_HUMAN_SERVICE = (54, "人工组激活") DEL_HUMAN_SERVICE = (55, "人工组成员删除") FS_DISCONNECT = (56, "FS检测断开") def __init__(self, code, description): self.code = code self.description = description @classmethod def get_by_code(cls, code): return next((member for member in cls if member.code == code), None) class AgentScene(Enum): MANUAL = (1, "manual", "手动外呼") ROBOT = (2, "robot", "机器人外呼") MONITOR = (3, "monitor", "监听") WECHAT = (4, "wechat", "微信语音") def __init__(self, idx, code, description): self.idx = idx self.code = code self.description = description @classmethod def get_by_code(cls, code): return next((member for member in cls if member.code == code), None) class WorkStatus(Enum): NO_INIT = (-1, "没有初始化") LOGIN_SUCCESS = (0, "登录CTI 成功") AGENT_READY = (2, "座席就绪") AGENT_BUSY = (3, "座席忙碌") AGENT_DIALING = (4, "座席外拨") AGENT_RINGING = (5, "座席振铃!") AGENT_HANG_IDLE = (7, "座席挂机处于空闲状态") AGENT_HANG_REPROCESSING = (8, "座席挂机处于后处理状态") AGENT_ANSWER_INCOMING = (10, "座席接通呼入电话") AGENT_ANSWER_OUTGOING = (11, "座席接通呼出电话!") AGENT_CONSULTING = (12, "座席正在咨询中") AGENT_IN_CONFERENCE = (13, "座席在会议中") USER_HOLDING = (14, "用户处于保持中") AGENT_LISTENING = (16, "坐席正在监听中!") AGENT_ASSISTING = (17, "座席正在辅助中") AGENT_INSERTING = (18, "座席正在强插中") AGENT_CALLING_RINGING = (20, "座席外呼,对方正在振铃!") AGENT_CONSULTING_RINGING = (21, "座席咨询,对方正在振铃") ORIGINATING = (22, "桥接中,座席处于保持状态") AGENT_CALLING = (23, "座席外呼中!") AGENT_INNER_CALLING = (24, "座席内呼中") CONSULTING_FAIL = (25, "咨询失败,用户保持状态") AGENT_CALLING_RINGING_BEFORE = (26, "外呼后座席振铃前状态") AGENT_INNER_CALLING_RINGING_BEFORE = (27, "内呼后座席振铃前状态") MULTI_IN_CONFERENCE = (28, "会议后座席振铃前状态") ANSWER_COMPENSATE = (101, "坐席接通补偿!") def __init__(self, code=None, description=None): self.code = code self.description = description @classmethod def get_by_code(cls, code): return next((member for member in cls if member.code == code), None) class DownEvent(Enum): ON_INITAL_SUCCESS = ("OnInitalSuccess","初始化成功回调,无特殊逻辑") ON_INITAL_FAILURE = ("OnInitalFailure","初始化失败") ON_CALLRING = ("OnCallRing","来电振铃") ON_AGENT_WORK_REPORT = ("OnAgentWorkReport","电话条工作状态事件报告") ON_CALL_END = ("OnCallEnd","电话结束") ON_PROMPT = ("OnPrompt", "电话条提示事件报告") ON_AGENT_REPORT = ("OnAgentReport", "坐席") ON_CALL_REPORT_INFO = ("OnCallReportInfo", "获取呼叫汇总信息报告") ON_AGENT_GROUP_QUERY = ("OnAgentGroupQuery", "监控组件加载完毕通知事件") ANSWER_CALL = ("OnCallAnswer", "坐席接电话事件") ON_RING_Start = ("OnRingStart", "提示音开始") ON_RING_END = ("OnRingEnd", "提示音结束") ON_DETECTED_TONE = ("OnDetectedTone", "收到振铃") ON_METHOD_RESPONSE_EVENT = ("OnMethodResponseEvent", "方法响应"), ON_SERVER_TERMINATED = ("ServerTerminated", "服务器不可用错误,重新初始化"), ON_SERVER_ERROR = ("ServerError", "服务器普通错误") def __init__(self, code=None, description=None): self.code = code self.description = description @classmethod def get_by_code(cls, code): return next((member for member in cls if member.code == code), None) class ServiceDirect(Enum): NORMAL = (0, "正常呼叫") JQ_CALL_OUTSIDE = (1, "精确式外呼") YL_CALL_OUTSIDE = (2, "预览式外呼") MANUAL_CALL = (3, "人工外呼") ROBOT_CALL = (4, "IVR,机器人外呼") CALL_INSIDE = (5, "内部呼叫") CONSULT = (6, "咨询") SINGLE_TRANSFER = (7, "单步转移") ORIGINATE = (8, "桥接") LISTEN = (9, "监听") INTERCEPT = (10, "拦截") INSERT = (11, "强插") JJ_CALL_OUTSIDE = (12, "渐进式外呼") YC_CALL_OUTSIDE = (13, "预测式外呼") JQYL_CALL_OUTSIDE = (14, "精确预览外呼") ASSIST = (19, "辅助") FORCE_REMOVE = (20, "强拆") FORCE_IDLE = (21, "强制置闲") FORCE_BUSY = (22, "强制置忙") FORCE_LOGOUT = (23, "强制登出") def __init__(self, service_direct=None, description=None): self.service_direct = service_direct self.description = description @classmethod def get_by_code(cls, code): return next((member for member in cls if member.code == code), None) class AnswerFlag(Enum): INIT = (0, "均未拨通") USER_ANSWER = (1, "用户接通") ROBOT_ANSWER = (2, "机器人接通") USER_AND_ROBOT_BRIDGE = (3, "用户与机器人bridge") TRANSFER_TO_AGENT = (4, "开始转接到坐席") AGENT_ANSWER = (5, "坐席接通") USER_AND_AGENT_BRIDGE = (6, "用户与坐席bridge") def __init__(self, code=None, description=None): self.code = code self.description = description @classmethod def get_by_code(cls, code): return next((member for member in cls if member.code == code), None) class DeviceType(Enum): AGENT = (1, "坐席") CUSTOMER = (2, "客户") ROBOT = (4, "机器人") LISTENER = (5, "监听者") VIRTUAL_AGENT = (6, "虚拟坐席") def __init__(self, code=None, description=None): self.code = code self.description = description @classmethod def get_by_code(cls, code): return next((member for member in cls if member.code == code), None) class CallType(Enum): AGENT_CALL = (1, '手动外呼') BOT_CALL = (2, '机器人外呼') BOTH_CALL = (3, '双向外呼') def __init__(self, code=None, description=None): self.code = code self.description = description @classmethod def get_by_code(cls, code): return next((member for member in cls if member.code == code), None) class CallStage(Enum): ROBOT = (1, "机器人") AGENT = (2, "人工坐席") ALL = (3, "总") def __init__(self, code=None, description=None): self.code = code self.description = description @classmethod def get_by_code(cls, code): return next((member for member in cls if member.code == code), None) class Direction(Enum): INBOUND = (1, '呼入') OUTBOUND = (2, '外呼') def __init__(self, code=None, description=None): self.code = code self.description = description @classmethod def get_by_code(cls, code): return next((member for member in cls if member.code == code), None) class NextType(Enum): NORNAL = (1, '默认') NEXT_CALL_OTHER = (2, '呼叫另外一测') NEXT_CALL_BRIDGE = (3, '桥接') NEXT_CONSULT_AGENT = (4, '咨询坐席') NEXT_CONSULT_CALLOUT = (5, '咨询外线') NEXT_CALL_AGENT = (6, '转到坐席') NEXT_TRANSFER_SUCCESS = (7, '完成转接') NEXT_TRANSFER_BRIDGE = (8, '转接后桥接') NEXT_TRANSFER_CALL = (9, '电话转接') NEXT_INSERT_CALL = (10, '强插电话') NEXT_LISTEN_CALL = (11, '监听电话') NEXT_WHISPER_CALL = (12, '耳语电话') NEXT_VDN = (13, '进vdn') NEXT_GROUP = (14, '进技能组') NEXT_IVR = (15, '进ivr') NEXT_HANGUP = (16, '挂机处理') NEXT_QUEUE_PLAY = (17, '放音queue') NEXT_QUEUE_OVERFLOW_GROUP = (18, '溢出队列') NEXT_QUEUE_OVERFLOW_IVR = (19, '溢出进IVR') NEXT_QUEUE_OVERFLOW_VDN = (20, '溢出进vdn') NEXT_PLAY_START = (21, '播放音频') NEXT_WAIT_KEY = (22, '等待按键播放音频') NEXT_NOTICE_MUSIC_DONE = (23, '通知音频播放结束') NEXT_PLAY_KEY_MUSIC = (24, '播放音频') NEXT_QUEUE_PLAY_STOP = (25, '停止放音') def __init__(self, code=None, description=None): self.code = code self.description = description @classmethod def get_by_code(cls, code): return next((member for member in cls if member.code == code), None) class CallCause(Enum): DEFAULT = (0, "默认") RESTART = (2, "服务重启") CALL_TIMEOUT = (3, "呼叫超时") PLAY_TIMEOUT = (5, "播放音超时") WAITING_TIMEOUT = (6, "等待超时") AGENT_HANGUP_CALL = (7, "坐席挂断请求") HANGUP_EVENT = (8, "挂断事件") PLAYBACK_STOP = (9, "等待音结束") ROBOT_MONITOR = (10, "机器人挂断监听") LINE_BREAK = (11, "线路故障") ROBOT_TRANSFER = (12, "机器人转接") ROBOT_FULL = (13, "机器人话路数满额") NO_MUSIC_HANGUP = (14, "无挂断播放音挂断") PLAY_KEY_DONE_HANGUP = (15, "按键播放音播完挂断") PLAY_TIMEOUT_HANGUP = (16, "通知播放超时挂断") WAITING_KEY_TIMEOUT_HANGUP = (17, "等待按键超时挂断") def __init__(self, code=None, description=None): self.code = code self.description = description @classmethod def get_by_code(cls, code): return next((member for member in cls if member.code == code), None) class CdrType(Enum): INBOUND = (1, "呼入") OUTBOUND = (2, "外呼") INTERNAL_CALL = (3, "内呼") TRANSFER = (4, "转接") CONSULT = (5, "咨询") LISTENER = (6, "监听") INTRUSION = (7, "强插") WHISPER = (8, "耳语") ROBOT_LISTENER = (9, "机器人质检监听") def __init__(self, code=None, description=None): self.code = code self.description = description @classmethod def get_by_code(cls, code): return next((member for member in cls if member.code == code), None) class HangupDir(Enum): HOST_HANGUP = (1, "主叫挂断") CUSTOMER_HANGUP = (2, "被叫挂断") PLATFORM_HANGUP = (3, "平台挂机") def __init__(self, code=None, description=None): self.code = code self.description = description @classmethod def get_by_code(cls, code): return next((member for member in cls if member.code == code), None) class BizErrorCode(Enum): PARAM_ERROR = (10001, "参数错误") RECORD_NOT_EXIST_ERROR = (10002, "记录不存在") OUT_ID_EXIST = (10003, "外部Id已经被占用") SYSTEM_ERROR = (10004, "系统错误") NOT_ALLOW_ERROR = (10005, "不允许此操作") PHONE_NUM_USED = (20003, "分机号已经被占用") AGENT_CHECK_IN_DELETE_ERROR = (20004, "签入状态坐席不允许当前删除") AGENT_DISABLE_NOT_ALLOW_OPERATE = (20005, "禁用状态坐席不允许当前操作") AGENT_CALLING_NOT_ALLOW_OPERATE = (20006, "通话中坐席不允许当前操作") AGENT_CHECK_OUT_NOT_ALLOW_OPERATE = (20007, "签出状态坐席不允许当前操作") AGENT_ALREADY_ANOTHER_GROUP = (20008, "坐席已经在其他组") AGENT_GET_PHONE_ERROR = (20009, "获取分机号错误") AGENT_CALL_ERROR = (20010, "当前状态不允许外呼") AGENT_LISTEN_ERROR = (20011, "当前状态不允许监听") AGENT_NOT_EXIST = (20010, "坐席不存在或已删除") AGENT_CALLING_NOT_HANG = (20012, "正在通话中,请先挂断再进行当前操作") AGENT_GROUP_HAS_AGENT = (20103, "坐席组有坐席不能删除") AGENT_GROUP_AGENT_CHECK_IN = (20104, "签入状态的坐席不允许从组内删除") CIRCUIT_CAN_NOT_DELETE_ERROR = (20501, "线路存在正在执行/等待执行中的任务") CALENDARS_SUMMARY_DUPLICATE = (20500, "日常名称不能重复") CALENDARS_DATE_ERROR = (20501, "日期不能为空") CALENDARS_DATE_PERIOD_ERROR = (20502, "结束日期必须大于等于开始日期") CALENDARS_TIME_ERROR = (20503, "时间不能为空") CALENDARS_TIME_PERIOD_ERROR = (20504, "结束时间必须大于开始时间") CALENDARS_OUT_ID_NUM_DIS_ALLOW_UPDATE = (20505, "日程编号和外部日程关联不允许变更") BLACKLIST_MOBILE_EXIST = (20601, "手机号已经存在") SCHEDULE_ITEM_DATE_ERROR = (20701, "条目开始日期不能大于结束日期") SCHEDULE_ITEM_DATE_FORMAT_ERROR = (20702, "条目时间格式错误") SCHEDULE_ITEM_WEEK_NO_AVAILABLE = (20703, "条目没有可用的星期") SCHEDULE_ITEM_TIME_ERROR = (20704, "条目开始时间不能大于结束时间") CIRCUIT_POOL_PARALLEL_OVERSIZE = (20705, "并发超过限制") CIRCUIT_POOL_PARALLEL_ILLEGAL = (20706, "线路池并发不能小于0") FS_CLUSTER_PULL_SERVER_ERROR = (20801, "拉取FS集群失败") TASK_START_ERROR = (30001, "任务启动失败") ERROR_FLOW_ID_NULL = (40001, "ctiFlowId 不能为空") ERROR_FLOW_ID_NOT_CORRECT = (40002, "ctiFlowId 不正确") ERROR_FLOW_ID_CALL_ID_NOT_MATCH = (40003, "ctiFlowId callId 不匹配") DISTRIBUTE_LOCK_TIME_OUT_ERROR = (90000, "请稍等,正在为您处理中") THIRD_RESPONSE_ERROR = (90001, "外部响应异常") TERMINATED_AGENT_STATUS = (300001, "对不起,网络状况暂时不佳,请刷新后重试。") TERMINATED_LISTEN_AGENT_STATUS = (300002, "监听坐席状态错误") ERROR_ENGINE = (400001, "请求引擎错误") ERROR_NOT_FOLLOW_CHECK_IN = (400002, "禁用状态坐席不允许签入操作") WAIT_REPROCESSING = (400003, "请稍等,正在为您加载中。") WAIT_STATUS_CHANGE = (400004, "正在为您连接客户,请稍等") AGENT_NOT_CALLING = (400005, "坐席不再通话中") NOT_ALLOW_STATUS = (400006, "非可修改的状态") def __init__(self, code, message): self.code = code self.message = message @classmethod def get_by_code(cls, code): return next((member for member in cls if member.code == code), None)