Ver código fonte

[WallPadCall]
1. 모바일 원격 통화 코드 적용
- 원래버전 모바일 원격통화 스레드 인터럽트 내용 동일하게 적용
2. 버전업
- 2024.03.22.01 -> 2024.05.08.01

jglee 11 meses atrás
pai
commit
a1a04690ab

+ 1 - 1
WallPadCall/src/main/AndroidManifest.xml

@@ -1,7 +1,7 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="kr.co.icontrols.wallpadcall"
     package="kr.co.icontrols.wallpadcall"
     android:versionCode="17"
     android:versionCode="17"
-    android:versionName="2023.03.22.01">
+    android:versionName="2024.05.08.01">
 
 
     <!--android:sharedUserId="android.uid.system"-->
     <!--android:sharedUserId="android.uid.system"-->
     <!--<uses-sdk-->
     <!--<uses-sdk-->

+ 5 - 5
WallPadCall/src/main/java/kr/co/icontrols/callengine/engine/AudioRecordController.java

@@ -282,7 +282,7 @@ public class AudioRecordController {
     // 현관 녹음 음성(디지털로 변화된 녹음 음성) -> 모바일로 전송
     // 현관 녹음 음성(디지털로 변화된 녹음 음성) -> 모바일로 전송
     private void sendDoorAudioToMobile(byte[] data, int size) {
     private void sendDoorAudioToMobile(byte[] data, int size) {
         try {
         try {
-            Log.d(TAG, "[sendDoorAudioToMobile] data.length [" + data.length + "], size [" + size + "]");
+//            Log.d(TAG, "[sendDoorAudioToMobile] data.length [" + data.length + "], size [" + size + "]");
             if (MainActivity.mDataSender != null) {
             if (MainActivity.mDataSender != null) {
                 AVPacket avp = new AVPacket();
                 AVPacket avp = new AVPacket();
                 avp.avType = 1; // 0:video, 1:audio
                 avp.avType = 1; // 0:video, 1:audio
@@ -292,8 +292,8 @@ public class AudioRecordController {
 
 
                 try {
                 try {
 //                    Log.d(TAG, "[sendDoorAudioToMobile] mDataSender.que.put()");
 //                    Log.d(TAG, "[sendDoorAudioToMobile] mDataSender.que.put()");
-                    MainActivity.mDataSender.blockingQueue.put(avp);
-                } catch (InterruptedException e) {
+                    if(MainActivity.mDataSender!=null )MainActivity.mDataSender.InputData(avp);
+                } catch (Exception e) {
                     Log.e(TAG, "[InterruptedException] sendDoorAudioToMobile()");
                     Log.e(TAG, "[InterruptedException] sendDoorAudioToMobile()");
                     //e.printStackTrace();
                     //e.printStackTrace();
             LogUtil.errorLogInfo("", TAG, e);
             LogUtil.errorLogInfo("", TAG, e);
@@ -313,8 +313,8 @@ public class AudioRecordController {
     // 모바일 음성 -> 현관
     // 모바일 음성 -> 현관
     public void receiveMobileAudio_door(AVPacket avPacket) {
     public void receiveMobileAudio_door(AVPacket avPacket) {
         try {
         try {
-            Log.d(TAG, "[receiveMobileAudio_door] avPacket.length [" + avPacket.length + "]");
-            Log.d(TAG, "[receiveMobileAudio_door] avPacket.avType [" + avPacket.avType + "], avPacket.frameType [" + avPacket.frameType + "]");
+//            Log.d(TAG, "[receiveMobileAudio_door] avPacket.length [" + avPacket.length + "]");
+//            Log.d(TAG, "[receiveMobileAudio_door] avPacket.avType [" + avPacket.avType + "], avPacket.frameType [" + avPacket.frameType + "]");
             if (avPacket.data == null || avPacket.length <= 0) {
             if (avPacket.data == null || avPacket.length <= 0) {
                 return;
                 return;
             }
             }

+ 39 - 6
WallPadCall/src/main/java/kr/co/icontrols/callengine/engine/CallController.java

@@ -581,7 +581,12 @@ public class CallController extends CallManager implements SIPEventListener {
                             mCallInfo.setCallStatus(eCallType, CALLSTATUS.CALLING);
                             mCallInfo.setCallStatus(eCallType, CALLSTATUS.CALLING);
                             if (eCallOwner == CALLOWNER.MOBILE) {
                             if (eCallOwner == CALLOWNER.MOBILE) {
                                 LOG("[CallScenarioManager] CALLOWNER [" + eCallOwner + "]");
                                 LOG("[CallScenarioManager] CALLOWNER [" + eCallOwner + "]");
-                                if (MainActivity.mDataSender != null) MainActivity.mDataSender.start();
+                                //jglee - 2023.02.02 데이터 초기화 후, 시작하는 것으로 수정
+                                if(MainActivity.mDataSender !=null)
+                                {
+                                    MainActivity.mDataSender.Init();
+                                    MainActivity.mDataSender.start();
+                                }
                             }
                             }
                             mCallEventListener.onCallEvent(eCallOwner, CALLSTATUS.CALLING, eCallType, strRemoteIP, strRemoteSIPID, strMessage);
                             mCallEventListener.onCallEvent(eCallOwner, CALLSTATUS.CALLING, eCallType, strRemoteIP, strRemoteSIPID, strMessage);
                             MainActivity.mSubPhoneController.sendACKFrontMonitoring(eCallOwner, eCallType);
                             MainActivity.mSubPhoneController.sendACKFrontMonitoring(eCallOwner, eCallType);
@@ -595,7 +600,12 @@ public class CallController extends CallManager implements SIPEventListener {
                     else if (eCallType == CALLTYPE.RESIDENCE) {
                     else if (eCallType == CALLTYPE.RESIDENCE) {
                         if (eCallOwner == CALLOWNER.MOBILE) {
                         if (eCallOwner == CALLOWNER.MOBILE) {
                             ((MainActivity) mContext).changeMenuNScreen(ID.MENU.MENU_TALKRESIDENCE);
                             ((MainActivity) mContext).changeMenuNScreen(ID.MENU.MENU_TALKRESIDENCE);
-                            if (MainActivity.mDataSender != null) MainActivity.mDataSender.start(); // 모바일에서 홈뷰어 요청하였을 때
+                            //jglee - 2023.02.02 데이터 초기화 후, 시작하는 것으로 수정
+                            if(MainActivity.mDataSender !=null)
+                            {
+                                MainActivity.mDataSender.Init();
+                                MainActivity.mDataSender.start();
+                            }// 모바일에서 홈뷰어 요청하였을 때
 
 
                             if (mCallEventListener != null) {
                             if (mCallEventListener != null) {
                                 mCallInfo.setCallStatus(eCallType, CALLSTATUS.HOMEVIEW);
                                 mCallInfo.setCallStatus(eCallType, CALLSTATUS.HOMEVIEW);
@@ -702,7 +712,12 @@ public class CallController extends CallManager implements SIPEventListener {
                             RemoteCallMSG.REMOTE_CALLTYPE = eCallType;
                             RemoteCallMSG.REMOTE_CALLTYPE = eCallType;
                             RemoteCallMSG.REMOTE_CALLSTATUS = CALLSTATUS.CALLED;
                             RemoteCallMSG.REMOTE_CALLSTATUS = CALLSTATUS.CALLED;
                             MainActivity.mRemoteCallController.sendOpenRemoteCall(RemoteCallMSG.REMOTE_CALLTYPE, RemoteCallMSG.REMOTE_CALLSTATUS);
                             MainActivity.mRemoteCallController.sendOpenRemoteCall(RemoteCallMSG.REMOTE_CALLTYPE, RemoteCallMSG.REMOTE_CALLSTATUS);
-                            if (MainActivity.mDataSender != null) MainActivity.mDataSender.start();
+                            //jglee - 2023.02.02 데이터 초기화 후, 시작하는 것으로 수정
+                            if(MainActivity.mDataSender !=null)
+                            {
+                                MainActivity.mDataSender.Init();
+                                MainActivity.mDataSender.start();
+                            }
                         }
                         }
                     }
                     }
                     else if (eCallType == CALLTYPE.LOBBY) {
                     else if (eCallType == CALLTYPE.LOBBY) {
@@ -712,7 +727,12 @@ public class CallController extends CallManager implements SIPEventListener {
                             RemoteCallMSG.REMOTE_CALLTYPE = eCallType;
                             RemoteCallMSG.REMOTE_CALLTYPE = eCallType;
                             RemoteCallMSG.REMOTE_CALLSTATUS = CALLSTATUS.CALLED;
                             RemoteCallMSG.REMOTE_CALLSTATUS = CALLSTATUS.CALLED;
                             MainActivity.mRemoteCallController.sendOpenRemoteCall(RemoteCallMSG.REMOTE_CALLTYPE, RemoteCallMSG.REMOTE_CALLSTATUS);
                             MainActivity.mRemoteCallController.sendOpenRemoteCall(RemoteCallMSG.REMOTE_CALLTYPE, RemoteCallMSG.REMOTE_CALLSTATUS);
-                            if (MainActivity.mDataSender != null) MainActivity.mDataSender.start();
+                            //jglee - 2023.02.02 데이터 초기화 후, 시작하는 것으로 수정
+                            if(MainActivity.mDataSender !=null)
+                            {
+                                MainActivity.mDataSender.Init();
+                                MainActivity.mDataSender.start();
+                            }
                         }
                         }
                     }
                     }
                     else if (eCallType == CALLTYPE.GUARD) {
                     else if (eCallType == CALLTYPE.GUARD) {
@@ -720,7 +740,12 @@ public class CallController extends CallManager implements SIPEventListener {
                         if (ConfigValues.bRemoteCall) {
                         if (ConfigValues.bRemoteCall) {
                             RemoteCallMSG.REMOTE_CALLTYPE = eCallType;
                             RemoteCallMSG.REMOTE_CALLTYPE = eCallType;
                             MainActivity.mRemoteCallController.sendOpenRemoteCall(RemoteCallMSG.REMOTE_CALLTYPE, strRemoteSIPID, strRemoteIP);
                             MainActivity.mRemoteCallController.sendOpenRemoteCall(RemoteCallMSG.REMOTE_CALLTYPE, strRemoteSIPID, strRemoteIP);
-                            if (MainActivity.mDataSender != null) MainActivity.mDataSender.start();
+                            //jglee - 2023.02.02 데이터 초기화 후, 시작하는 것으로 수정
+                            if (MainActivity.mDataSender != null)
+                            {
+                                MainActivity.mDataSender.Init();
+                                MainActivity.mDataSender.start();
+                            }
                         }
                         }
                     }
                     }
                     else if (eCallType == CALLTYPE.RESIDENCE) {
                     else if (eCallType == CALLTYPE.RESIDENCE) {
@@ -856,7 +881,11 @@ public class CallController extends CallManager implements SIPEventListener {
                         if (RemoteCallMSG.REMOTE_CALLTYPE == CALLTYPE.LOBBY) {
                         if (RemoteCallMSG.REMOTE_CALLTYPE == CALLTYPE.LOBBY) {
                             if (mSIPInterface != null) mSIPInterface.videoSet(false, false, false); // 모바일에서 로비통화 종료시 영상 먼저 종료
                             if (mSIPInterface != null) mSIPInterface.videoSet(false, false, false); // 모바일에서 로비통화 종료시 영상 먼저 종료
                         }
                         }
-                        if (MainActivity.mDataSender != null) MainActivity.mDataSender.interrupt();
+                        //jglee - 2023.02.02 데이터 초기화 후, 시작하는 것으로 수정
+                        if (MainActivity.mDataSender != null) {
+                            MainActivity.mDataSender.onClose();
+                            MainActivity.mDataSender.interrupt();
+                        }
                         RemoteCallMSG.REMOTE_CALLTYPE = CALLTYPE.NONE;
                         RemoteCallMSG.REMOTE_CALLTYPE = CALLTYPE.NONE;
                         RemoteCallMSG.REMOTE_CALLSTATUS = CALLSTATUS.IDLE;
                         RemoteCallMSG.REMOTE_CALLSTATUS = CALLSTATUS.IDLE;
                         RemoteCallMSG.REMOTE_CALLOWNER = CALLOWNER.NONE;
                         RemoteCallMSG.REMOTE_CALLOWNER = CALLOWNER.NONE;
@@ -2844,6 +2873,10 @@ public class CallController extends CallManager implements SIPEventListener {
         } finally {
         } finally {
             try {
             try {
                 mFileOutputStream.close();
                 mFileOutputStream.close();
+                //여기서 비트맵 리소스 해제
+                //2023.04.21 jglee 메모리 해제
+                if(bitmap!=null) bitmap.recycle();
+                bitmap = null;
             } catch (IOException e) {
             } catch (IOException e) {
                 Log.e(TAG, "[IOException] saveBMPtoJPG(Bitmap bitmap, String strFilePath)");
                 Log.e(TAG, "[IOException] saveBMPtoJPG(Bitmap bitmap, String strFilePath)");
                 //e.printStackTrace();
                 //e.printStackTrace();

+ 3 - 2
WallPadCall/src/main/java/kr/co/icontrols/callengine/engine/VideoController.java

@@ -341,10 +341,11 @@ public class VideoController {
                 avp.frameType = iFrame; // pictype (I-Frame: 0)
                 avp.frameType = iFrame; // pictype (I-Frame: 0)
                 try {
                 try {
 //                    Log.d(TAG, "[sendFrontVideoToMobile] mDataSender.que.put()");
 //                    Log.d(TAG, "[sendFrontVideoToMobile] mDataSender.que.put()");
-                    MainActivity.mDataSender.blockingQueue.put(avp);
+                    //jglee - 2023.02.02 모바일 원격통화로 데이터를 넣는 경우 함수를 이용하여 현재 쓰레드가 종료가 됬는지 확인하기 위해 함수 형태로 변경
+                    if(MainActivity.mDataSender.blockingQueue!=null ) MainActivity.mDataSender.InputData(avp);
                 } catch (RuntimeException re) {
                 } catch (RuntimeException re) {
                     LogUtil.errorLogInfo("", TAG, re);
                     LogUtil.errorLogInfo("", TAG, re);
-                } catch (InterruptedException e) {
+                } catch (Exception e) {
                     Log.e(TAG, "[InterruptedException] sendFrontVideoToMobile()");
                     Log.e(TAG, "[InterruptedException] sendFrontVideoToMobile()");
                     //e.printStackTrace();
                     //e.printStackTrace();
                     LogUtil.errorLogInfo("", TAG, e);
                     LogUtil.errorLogInfo("", TAG, e);

+ 98 - 14
WallPadCall/src/main/java/kr/co/icontrols/callengine/remotecall/DataSender.java

@@ -7,6 +7,7 @@ import com.util.LogUtil;
 
 
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
 
 
 import kr.co.icontrols.wallpadcall.MainActivity;
 import kr.co.icontrols.wallpadcall.MainActivity;
 
 
@@ -16,41 +17,124 @@ public class DataSender extends Thread {
 
 
     public BlockingQueue<AVPacket> blockingQueue = new LinkedBlockingQueue<AVPacket>();
     public BlockingQueue<AVPacket> blockingQueue = new LinkedBlockingQueue<AVPacket>();
 
 
+    private boolean mbisClose  = false;
+
+    private boolean isCallFront = false;
+
+    public boolean isCalledFront(){
+        return isCallFront;
+    }
+
+    public boolean mbLoobyCalled = false;
+
+    public void InputData(AVPacket packet)
+    {
+        try
+        {
+            if(blockingQueue!=null && !mbisClose)
+            {
+                blockingQueue.put(packet);
+            }
+        }
+        catch (Exception e)
+        {
+
+        }
+    }
+
+    public void onClose(){
+        mbisClose = true;
+    };
+
+    public void onCalledFront(){
+        Log.d(TAG, "jglee Remote onCalledFront()");
+        isCallFront = true;
+    }
+
+    public boolean isClose() {
+        Log.d(TAG, "jglee Remote isClose()");
+        boolean temp = mbisClose;
+        return temp;
+    };
+
+    public void Init()
+    {
+        mbisClose  = false;
+        if(blockingQueue == null)
+            blockingQueue = new LinkedBlockingQueue<AVPacket>();
+    }
+
+    protected void Release()
+    {
+        Log.d(TAG, "jglee Remote Release()");
+        if(blockingQueue!=null)
+            blockingQueue.clear();
+        blockingQueue = null;
+
+        MainActivity.mRemoteCallController.sendCloseRemoteCall();
+    }
+
     public void run() {
     public void run() {
+
         try {
         try {
-            //Log.e(TAG, "DataSender =============== [1] ===============");
+            //String currentDate = new SimpleDateFormat("HH:mm:ss z yyyy", Locale.getDefault()).format(new Date());
+            //Log.d(TAG, "CallDataSender : Instance Start Time : " + currentDate);
             VisitorCallLib mVisitorCallLib = VisitorCallLib.getInstance();
             VisitorCallLib mVisitorCallLib = VisitorCallLib.getInstance();
+            //currentDate = new SimpleDateFormat("HH:mm:ss z yyyy", Locale.getDefault()).format(new Date());
+            //Log.d(TAG, "CallDataSender : Instance Start Send Packet TIme : " + currentDate);
+//            i= 0;
+//            long Thread_ID = Thread.currentThread().getId();
+//            int ThreadCount = Thread.activeCount();
             for (;;) {
             for (;;) {
                 try {
                 try {
-                    //Log.e(TAG, "DataSender =============== [2] ===============");
-                    AVPacket avPacket = blockingQueue.take();
-                    //Log.e(TAG, "DataSender =============== [3] ===============");
-                    if (mVisitorCallLib != null) {
-//                        Log.e(TAG, "DataSender =============== [3] ===============");
-                       //Log.d(TAG, "[DataSender.run()] ndkHandle [" + mVisitorCallLib.ndkHandle + "], avType [" + avPacket.avType + "], length [" + avPacket.length + "], frameType [" + avPacket.frameType + "]");
+                    if(mbisClose)
+                    {
+                        break;
+                    }
+
+
+                    AVPacket avPacket = null;
+
+                    if (blockingQueue != null) {
+                        if (!blockingQueue.isEmpty() ) avPacket = blockingQueue.poll(10, TimeUnit.MILLISECONDS);;//blockingQueue.take();
+                    }
+
+//                    if (blockingQueue != null) {
+//                        if ( blockingQueue.size() > 0 ) avPacket = blockingQueue.poll(10, TimeUnit.MILLISECONDS);
+//                    }
+
+
+                    if (avPacket != null && mVisitorCallLib != null) {
+//                        Log.d(TAG, "Count : " + ThreadCount + "ID : " + Thread_ID + ", jglee - CallDataSender********************************************************" + i++);
+//                        Log.d(TAG, "[DataSender.run()] ndkHandle [" + mVisitorCallLib.ndkHandle + "], avType [" + avPacket.avType + "], length [" + avPacket.length + "], frameType [" + avPacket.frameType + "]");
                         int sendMediaResult = mVisitorCallLib.SendMedia(mVisitorCallLib.ndkHandle, avPacket.avType, avPacket.data, avPacket.length, avPacket.frameType);
                         int sendMediaResult = mVisitorCallLib.SendMedia(mVisitorCallLib.ndkHandle, avPacket.avType, avPacket.data, avPacket.length, avPacket.frameType);
-//                        Log.d(TAG, "[DataSender.run()] EVENT_sendMediaResult [" + sendMediaResult + "]");
-                        if (sendMediaResult == -2) { // define.SendMediaFail
+                        Log.d(TAG, "[DataSender.run()] EVENT_sendMediaResult [" + sendMediaResult + "]");
+                        if (sendMediaResult == -2) {
+                            // define.SendMediaFail
                             Log.w(TAG, "[DataSender.run()] RemoteCall SendMedia FAIL!!!");
                             Log.w(TAG, "[DataSender.run()] RemoteCall SendMedia FAIL!!!");
                             MainActivity.mRemoteCallController.sendCloseRemoteCall();
                             MainActivity.mRemoteCallController.sendCloseRemoteCall();
                             break;
                             break;
                         }
                         }
-//                        Log.e(TAG, "DataSender =============== [3-1] ===============");
                     }
                     }
+                } catch (RuntimeException re) {
+                    Log.e(TAG, "[RuntimeException] DataSender.run()");
+                    LogUtil.errorLogInfo("", TAG, re);
                 } catch (InterruptedException e) {
                 } catch (InterruptedException e) {
-//                    Log.e(TAG, "DataSender =============== [5] ===============");
                     Log.e(TAG, "[InterruptedException] DataSender.run()");
                     Log.e(TAG, "[InterruptedException] DataSender.run()");
-                    //e.printStackTrace();
                     LogUtil.errorLogInfo("", TAG, e);
                     LogUtil.errorLogInfo("", TAG, e);
                 }
                 }
             }
             }
+
+            Release();
+
         } catch (RuntimeException re) {
         } catch (RuntimeException re) {
+            Log.e(TAG, "[RuntimeException] DataSender.run()");
             LogUtil.errorLogInfo("", TAG, re);
             LogUtil.errorLogInfo("", TAG, re);
+            Release();
         } catch (Exception e) {
         } catch (Exception e) {
-//            Log.e(TAG, "DataSender =============== [6] ===============");
             Log.e(TAG, "[Exception] DataSender.run()");
             Log.e(TAG, "[Exception] DataSender.run()");
-            //e.printStackTrace();
             LogUtil.errorLogInfo("", TAG, e);
             LogUtil.errorLogInfo("", TAG, e);
+            Release();
         }
         }
     }
     }
 }
 }

+ 17 - 1
WallPadCall/src/main/java/kr/co/icontrols/callengine/remotecall/RemoteCallManager.java

@@ -47,6 +47,7 @@ import kr.co.icontrols.callengine.remotecall.RemoteCallMSG.REMOTECALL_CALLER;
 import kr.co.icontrols.callengine.remotecall.RemoteCallMSG.REMOTECALL_CALLOWNER;
 import kr.co.icontrols.callengine.remotecall.RemoteCallMSG.REMOTECALL_CALLOWNER;
 import kr.co.icontrols.callengine.remotecall.RemoteCallMSG.REMOTECALL_CALLTYPE;
 import kr.co.icontrols.callengine.remotecall.RemoteCallMSG.REMOTECALL_CALLTYPE;
 import kr.co.icontrols.callengine.sip.SIPStun;
 import kr.co.icontrols.callengine.sip.SIPStun;
+import kr.co.icontrols.wallpadcall.MainActivity;
 import kr.co.icontrols.wallpadcall.declare.DataClasses.GuardListTable;
 import kr.co.icontrols.wallpadcall.declare.DataClasses.GuardListTable;
 import kr.co.icontrols.wallpadcall.declare.DataClasses.RemoteIDInfo;
 import kr.co.icontrols.wallpadcall.declare.DataClasses.RemoteIDInfo;
 import kr.co.icontrols.wallpadcall.declare.Declare;
 import kr.co.icontrols.wallpadcall.declare.Declare;
@@ -69,6 +70,8 @@ public class RemoteCallManager extends Service implements VisitorCallLib.Callbac
 
 
     GuardListTable mGuardListTable = null; // 경비실기 목록
     GuardListTable mGuardListTable = null; // 경비실기 목록
 
 
+    boolean bBLOCK_REQUEST_CALL = false;   // 원격통화 요청 거절 flag, 원격통화가 종료된 후에 백그라운드 리소스 정리중 요청이 오면 꼬임 (true: 거절, false: 수락)
+
     @Override
     @Override
     public IBinder onBind(Intent intent) {
     public IBinder onBind(Intent intent) {
         return mMessenger.getBinder();
         return mMessenger.getBinder();
@@ -630,6 +633,18 @@ public class RemoteCallManager extends Service implements VisitorCallLib.Callbac
                     }
                     }
                 } else if (msg.what == VisitorCallEvent.EVENT_START_CALLING) {
                 } else if (msg.what == VisitorCallEvent.EVENT_START_CALLING) {
                     Log.d(TAG, "[VisitorCallEventHandler] REMOTE_CALLTYPE [" + RemoteCallMSG.REMOTE_CALLTYPE + "]");
                     Log.d(TAG, "[VisitorCallEventHandler] REMOTE_CALLTYPE [" + RemoteCallMSG.REMOTE_CALLTYPE + "]");
+                    //jglee - 2023.02.02 여기서 해당 Sender가 종료되면 정지
+                    if(MainActivity.mDataSender!=null && MainActivity.mDataSender.isClose())
+                    {
+                        Log.d(TAG, "[VisitorCallEventHandler] Sender Close");
+                        return;
+                    }
+                    //jglee - 2023.02.02 여기서 통화가 걸려오는 경우나, 거동수상자 녹화중일 경우만 사용할 수 있도록 체크
+                    if(MainActivity.mCallController.mCallInfo.getCalledCnt() == 0  && !Global.getRecordingStatus() && MainActivity.mCallController.mCallInfo.getFRONT() != CALLSTATUS.CALLING)
+                    {
+                        Log.d(TAG, "[VisitorCallEventHandler] CheckCalled and StrangeRecord");
+                        return;
+                    }
                     if (RemoteCallMSG.REMOTE_CALLTYPE != CALLTYPE.NONE) sendMsgToRemoteMsns(REMOTECALLMSG.RECEIVE_EVENT_START_CALL, RemoteCallMSG.REMOTE_CALLTYPE);
                     if (RemoteCallMSG.REMOTE_CALLTYPE != CALLTYPE.NONE) sendMsgToRemoteMsns(REMOTECALLMSG.RECEIVE_EVENT_START_CALL, RemoteCallMSG.REMOTE_CALLTYPE);
                 } else if (msg.what == VisitorCallEvent.EVENT_AUDIO_DATA) {
                 } else if (msg.what == VisitorCallEvent.EVENT_AUDIO_DATA) {
                     AVPacket avp = (AVPacket) msg.obj;
                     AVPacket avp = (AVPacket) msg.obj;
@@ -958,6 +973,8 @@ public class RemoteCallManager extends Service implements VisitorCallLib.Callbac
             List<String[]> GuardList = null;
             List<String[]> GuardList = null;
             WallpadDeviceSet deviceSet = new WallpadDeviceSet(getApplicationContext());
             WallpadDeviceSet deviceSet = new WallpadDeviceSet(getApplicationContext());
             GuardList = deviceSet.GetGuardList();
             GuardList = deviceSet.GetGuardList();
+            deviceSet.closeDB();
+
             mGuardListTable = new GuardListTable();
             mGuardListTable = new GuardListTable();
             mGuardListTable.clearTable();
             mGuardListTable.clearTable();
             Log.d(TAG, "[getGuardList] GuardList.size [" + GuardList.size() + "]");
             Log.d(TAG, "[getGuardList] GuardList.size [" + GuardList.size() + "]");
@@ -966,7 +983,6 @@ public class RemoteCallManager extends Service implements VisitorCallLib.Callbac
                 Log.d(TAG, "[getGuardList] GuardList [" + i + "] = " + GuardList.get(i)[0]);
                 Log.d(TAG, "[getGuardList] GuardList [" + i + "] = " + GuardList.get(i)[0]);
                 mGuardListTable.addGuardTable(GuardList.get(i)[0], Global.makeGuardIP(GuardList.get(i)[1]), null);
                 mGuardListTable.addGuardTable(GuardList.get(i)[0], Global.makeGuardIP(GuardList.get(i)[1]), null);
             }
             }
-            deviceSet.closeDB();
 
 
             int nGuardCnt = mGuardListTable.getCnt();
             int nGuardCnt = mGuardListTable.getCnt();
             if (nGuardCnt > 0) {
             if (nGuardCnt > 0) {

+ 2 - 0
WallPadCall/src/main/java/kr/co/icontrols/wallpadcall/MainActivity.java

@@ -2409,6 +2409,8 @@ public class MainActivity extends WpadActivity {
                 if (ConfigValues.bSubPhoneEnable) mSubPhoneController.releaseSubPhoneController();
                 if (ConfigValues.bSubPhoneEnable) mSubPhoneController.releaseSubPhoneController();
                 if (ConfigValues.bRemoteCall) {
                 if (ConfigValues.bRemoteCall) {
                     mRemoteCallController.releaseRemoteCallController();
                     mRemoteCallController.releaseRemoteCallController();
+                    //2022.10.27 jglee - 해당 쓰레드 정상 종료를 위해 코드 추가
+                    mDataSender.onClose();
                     mDataSender.interrupt();
                     mDataSender.interrupt();
                     mDataSender = null;
                     mDataSender = null;
                 }
                 }