|
@@ -639,8 +639,7 @@ class BotAgent:
|
|
|
for k, v in acc.calls.items():
|
|
|
self.logger.info('hangup, call_idx=%s, call_active=%s'%(k, v.isActive()))
|
|
|
if v.isActive():
|
|
|
- self.hangup_with_timeout(v, call_op_param)
|
|
|
- # v.hangup(call_op_param)
|
|
|
+ v.hangup(call_op_param)
|
|
|
acc.calls.clear()
|
|
|
except:
|
|
|
traceback.print_exc()
|
|
@@ -648,21 +647,6 @@ class BotAgent:
|
|
|
# 机器人主动挂机回收分机号
|
|
|
self.release(user_part)
|
|
|
|
|
|
- def hangup_with_timeout(self, call, call_op_param, timeout=5):
|
|
|
- def hangup_call():
|
|
|
- try:
|
|
|
- print("daviddebugger::begin hangup call")
|
|
|
- call.hangup(call_op_param)
|
|
|
- print("daviddebugger::success hangup call")
|
|
|
- except Exception as e:
|
|
|
- print(f"Failed to hangup call: {e}")
|
|
|
-
|
|
|
- hangup_thread = threading.Thread(target=hangup_call)
|
|
|
- hangup_thread.start()
|
|
|
- hangup_thread.join(timeout)
|
|
|
- if hangup_thread.is_alive():
|
|
|
- print("Hangup operation timed out. Proceeding to force stop.")
|
|
|
-
|
|
|
def register(self, **kwargs):
|
|
|
self.logger.info('register,come in, pool.size :%d', self.user_part_pool.qsize())
|
|
|
user_part = self.user_part_pool.get()
|