DavidLiu 3 months ago
parent
commit
5fb378f041
1 changed files with 15 additions and 5 deletions
  1. 15 5
      src/core/voip/bot.py

+ 15 - 5
src/core/voip/bot.py

@@ -373,18 +373,26 @@ class MyCall(pj.Call):
 
     def release(self):
         self.logger.info('liuwei::debugger::release:: come in ')
-        if self.audio_player and self.aud_media:
+        if self.audio_player:
             try:
                 self.audio_player.stopTransmit(self.aud_media)
-                self.audio_player = None  # 或调用播放器停止方法
                 print("Success to stopTransmit:")
             except pj.Error as e:
                 print("Failed to stopTransmit:", e)
+            self.audio_player = None  # 或调用播放器停止方法
         if self.audio_port:
-            # self.audio_port.stopTransmit()
+            try:
+                self.aud_media.stopTransmit(self.audio_port)
+                print("Success to stopTransmit:")
+            except pj.Error as e:
+                print("Failed to stopTransmit:", e)
             self.audio_port = None  # 或调用相关销毁方法
         if self.aud_media:
-            # self.audio_media.stopTransmit()
+            try:
+                self.audio_media.stopTransmit()
+                print("Success to stopTransmit:")
+            except pj.Error as e:
+                print("Failed to stopTransmit:", e)
             self.aud_media = None
 
         self.asr.close()
@@ -633,7 +641,9 @@ class BotAgent:
             if acc:
                 for k, v in acc.calls.items():
                     try:
-                        v.hangup(call_op_param)
+                        self.logger.info('hangup, call_idx=%s, call_active=%s'%(k, v.isActive()))
+                        if v.isActive():
+                            v.hangup(call_op_param)
                     except:
                         pass
         except: