774056846 4 months ago
parent
commit
10dfb3a72a
2 changed files with 7 additions and 7 deletions
  1. 6 6
      src/core/callcenter/call.py
  2. 1 1
      src/core/callcenter/esl/client.py

+ 6 - 6
src/core/callcenter/call.py

@@ -49,12 +49,12 @@ class CallService:
 
     def hold(self, call_info: CallInfo, device_id):
         devices = call_info.device_list
-        # try:
-        #     devices.remove(device_id)
-        # except:
-        #     pass
-        # custom_device_id = devices[0]
-        custom_device_id = device_id
+        try:
+            self.client.hangup_call(call_info.call_id, device_id, case_enum=CallCause.HANGUP_EVENT)
+            devices.remove(device_id)
+        except:
+            pass
+        custom_device_id = devices[0]
         print('debugger::hold, custom_device_id=%s'%custom_device_id, flush=True)
         # self.client.sync_invoke_method("bridge_break", method_args=(custom_device_id,))
         # self.client.sync_invoke_method("hold_play", method_args=(custom_device_id,HOLD_MUSIC_PATH))

+ 1 - 1
src/core/callcenter/esl/client.py

@@ -585,7 +585,7 @@ class OutboundClient:
 
                     kwargs = json.loads(info.serialize('json'))
                     kwargs['variable_sip_h_P-LIBRA-CallId'] = call_id
-                    kwargs['variable_sip_h_P-LIBRA-DeviceId'] = device_id
+                    kwargs['variable_sip_h_P-LIBRA-DeviceId'] = new_device_id
                     destination = self.server.agent.register(**kwargs)
                     self.server.logger.info("debugger::device_id=%s, destination=%s, new_device_id=%s", device_id, destination, new_device_id)