Просмотр исходного кода

2021.11.02 VIP wallpadCall 통화 merge

DESKTOP-UNEGUH3\MadeinLab_SW_02 3 лет назад
Родитель
Сommit
a2909dc1e1
16 измененных файлов с 2073 добавлено и 675 удалено
  1. 1 1
      WallPadCall/build.gradle
  2. 47 5
      WallPadCall/src/main/java/kr/co/icontrols/callengine/engine/CallController.java
  3. 24 2
      WallPadCall/src/main/java/kr/co/icontrols/callengine/engine/CallManager.java
  4. 8 8
      WallPadCall/src/main/java/kr/co/icontrols/callengine/engine/SIPInterface.java
  5. 8 1
      WallPadCall/src/main/java/kr/co/icontrols/callengine/sip/SIPSound.java
  6. 23 9
      WallPadCall/src/main/java/kr/co/icontrols/callengine/sip/SIPStun.java
  7. 1 2
      WallPadCall/src/main/java/kr/co/icontrols/callengine/subphone/SubPhoneSerialManager.java
  8. 115 14
      WallPadCall/src/main/java/kr/co/icontrols/wallpadcall/MainActivity.java
  9. 162 5
      WallPadCall/src/main/java/kr/co/icontrols/wallpadcall/declare/DataClasses.java
  10. 7 1
      WallPadCall/src/main/java/kr/co/icontrols/wallpadcall/declare/Global.java
  11. 238 52
      WallPadCall/src/main/java/kr/co/icontrols/wallpadcall/screen/InquiryCallHistory.java
  12. 368 61
      WallPadCall/src/main/java/kr/co/icontrols/wallpadcall/screen/InquiryVisitorPictureHistory.java
  13. 324 374
      WallPadCall/src/main/java/kr/co/icontrols/wallpadcall/screen/TalkFront.java
  14. 164 8
      WallPadCall/src/main/java/kr/co/icontrols/wallpadcall/screen/TalkLobby.java
  15. 435 117
      WallPadCall/src/main/java/kr/co/icontrols/wallpadcall/screen/TalkResidence.java
  16. 148 15
      WallPadCall/src/main/java/kr/co/icontrols/wallpadcall/screen/VisitorPictureViewer.java

+ 1 - 1
WallPadCall/build.gradle

@@ -78,7 +78,7 @@ android {
 
 dependencies {
     implementation 'androidx.legacy:legacy-support-v4:1.0.0'
-    implementation files('libs/bssofthns.jar')
+    //implementation files('libs/bssofthns.jar')
     implementation files('libs/WallPadAPI.jar')
     implementation files('libs/WallPadSupport.jar')
     implementation files('libs/visitorcalllib-debug.aar')

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

@@ -363,6 +363,7 @@ public class CallController extends CallManager implements SIPEventListener {
             if (IP_Parse[2].equals("128")) strTailID = IP_Parse[3];   // 경비실
             else if (IP_Parse[2].equals("0")) strTailID = IP_Parse[3];   // 로비폰
             else if (IP_Parse[2].equals("201")) strTailID = IP_Parse[3];   // 아이허브
+            else if (IP_Parse[2].equals("129")) strTailID = IP_Parse[3];   // 아이허브
             else {
                 if (ConfigValues.bEnableHouseDivision) {
                     int nTailID = Integer.parseInt(IP_Parse[3]);
@@ -386,11 +387,16 @@ public class CallController extends CallManager implements SIPEventListener {
                 ((MainActivity) mContext).changeMenuNScreen(ID.MENU.MENU_TALKGUARD);
                 return CALLTYPE.GUARD;
             } else if (IP_Parse[2].equals("0")) {
+                if(IP_Parse[3].equals("11"))
+                    return CALLTYPE.FRONT;
                 // Lobby
                 return CALLTYPE.LOBBY;
             } else if (IP_Parse[2].equals("201")) {
                 // Ihub
                 return CALLTYPE.IHUB;
+            } else if (IP_Parse[2].equals("129")) {
+                // Ihub
+                return CALLTYPE.FRONT;
             } else {
                 int nType = Integer.parseInt(IP_Parse[2]);
                 if (0 < nType && nType < 100) {
@@ -658,10 +664,10 @@ public class CallController extends CallManager implements SIPEventListener {
                         if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
 //                            ((MainActivity) mContext).sendHandlerMsg(MainActivity.HANDLERMSG.SET_DINGDONG_VOLUME, 0, 0); // 현관띵똥 볼륨 고정(시스템 볼륨 따라가지 않도록)
 //                            sendHandlerMsg(HANDLERMSG.SETTALKPATH_DOORMUSIC, 0, 0);
-                            if (TalkFront.BTN_TALK != null) { // 현관 단일콜일 경우 띵똥 소리 출력 중인 경우에는 통화버튼 disable
-                                if (ConfigValues.bReliefCall) TalkFront.BTN_TALK.setButtonEventOffEnable(R.drawable.btn_call_disabled);
-                                else TalkFront.BTN_TALK.setButtonEventOffEnable(R.drawable.btn_front_call_disabled);
-                            }
+//                            if (TalkFront.BTN_TALK != null) { // 현관 단일콜일 경우 띵똥 소리 출력 중인 경우에는 통화버튼 disable
+//                                if (ConfigValues.bReliefCall) TalkFront.BTN_TALK.setButtonEventOffEnable(R.drawable.btn_call_disabled);
+//                                else TalkFront.BTN_TALK.setButtonEventOffEnable(R.drawable.btn_front_call_disabled);
+//                            }
                         }
 //                        ((MainActivity) mContext).mCallPathCheckHandler.sendEmptyMessage(0); // 대외향 월패드 현관카메라 띵똥을 WallPadMain으로 코드 이동
                         ((MainActivity) mContext).changeMenuNScreen(ID.MENU.MENU_TALKFRONT);
@@ -1072,8 +1078,44 @@ public class CallController extends CallManager implements SIPEventListener {
     @Override
     public void onSIPEvent(CALLEVENTTYPE eEventType, CALLTYPE eCallType, String strRemoteIP, String strRemoteSIPID, String strMessage) {
         try {
-            LOG("[onSIPEvent] eEventType [" + eEventType + "], eCallType [" + eCallType + "]");
+            LOG("[onSIPEvent] eEventType [" + eEventType + "], eCallType [" + eCallType + "]"+ "], strRemoteIP [" + strRemoteIP + "]"+ "], strRemoteSIPID [" + strRemoteSIPID + "]");
+
+            if(eEventType == CALLEVENTTYPE.TERMINATE_CALL)
+            {
+                if(strRemoteIP == null)
+                    strRemoteIP = RemoteIDInfo.strIP;
+            }
+
+            if(strRemoteIP != null)
+            {
+                strRemoteSIPID = makeSIPID(strRemoteIP);
+
+                //if(eEventType != CALLEVENTTYPE.RECEIVE_CALL)
+                {
+                    if (strRemoteSIPID.contains("_Guard_")) {
+                        eCallType = CALLTYPE.GUARD;
+                    } else if (strRemoteSIPID.contains("_Lobby_")) {
+
+                        eCallType = CALLTYPE.LOBBY;
+                    } else if (strRemoteSIPID.contains("_Resi_")) {
+
+                        eCallType = CALLTYPE.RESIDENCE;
+                    } else if (strRemoteSIPID.contains("_Front_")) {
+
+                        eCallType = CALLTYPE.FRONT;
+                    }else {
+
+                        eCallType = CALLTYPE.NONE;
+                    }
+                }
+            }
+
             CallScenarioManager(mCallInfo.getCallOwner(), eEventType, eCallType, strRemoteIP, strRemoteSIPID, strMessage);
+
+            if((eCallType == CALLTYPE.LOBBY) || (eCallType == CALLTYPE.FRONT))
+                acceptMoIPCall(false);
+
+
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
         } catch (Exception e) {

+ 24 - 2
WallPadCall/src/main/java/kr/co/icontrols/callengine/engine/CallManager.java

@@ -1069,10 +1069,18 @@ public class CallManager {
                 // 로비폰
                 strType = DEVICENAME.strType_Lobby;
                 ho = IP_Parse[3];
+
+                if(IP_Parse[3].equals("11"))
+                    strType = DEVICENAME.strType_Front;
+
             } else if (IP_Parse[2].equals("201")) {
                 // 아이허브
                 strType = DEVICENAME.strType_Ihub;
                 ho = IP_Parse[3];
+            } else if (IP_Parse[2].equals("129")) {
+                // Ihub
+                strType = DEVICENAME.strType_Front;
+                ho = IP_Parse[3];
             } else {
                 strType = Declare.DEVICENAME.strType_Resi;
                 ho = IP_Parse[2] + Global.ZeroPadding_Head(2, IP_Parse[3]);
@@ -1123,8 +1131,15 @@ public class CallManager {
             String[] IP_Parse = strIPAddress.split("\\.");
 
             if (IP_Parse[2].equals("128")) return CALLTYPE.GUARD;
-            else if (IP_Parse[2].equals("0")) return CALLTYPE.LOBBY;
+            else if (IP_Parse[2].equals("0"))
+            {
+                if(IP_Parse[3].equals("11"))
+                    return CALLTYPE.FRONT;
+
+                return CALLTYPE.LOBBY;
+            }
             else if (IP_Parse[2].equals("201")) return CALLTYPE.IHUB;
+            else if (IP_Parse[2].equals("129")) return CALLTYPE.FRONT;
             else return CALLTYPE.RESIDENCE;
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
@@ -1144,8 +1159,14 @@ public class CallManager {
             String[] IP_Parse = strIPAddress.split("\\.");
 
             if (IP_Parse[2].equals("128")) return CALLTYPE.GUARD;
-            else if (IP_Parse[2].equals("0")) return CALLTYPE.LOBBY;
+            else if (IP_Parse[2].equals("0"))
+            {
+                if(IP_Parse[3].equals("11"))
+                    return CALLTYPE.FRONT;
+                return CALLTYPE.LOBBY;
+            }
             else if (IP_Parse[2].equals("201")) return CALLTYPE.IHUB;
+            else if (IP_Parse[2].equals("129")) return CALLTYPE.FRONT;
             else return CALLTYPE.RESIDENCE;
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
@@ -1163,6 +1184,7 @@ public class CallManager {
     CALLTYPE eCallTypeTimer;
 
     public class CTT {   // CTT = Call Timeout Table, 단위 Sec
+        public int TIMEOUT_SEC_1 = 1;
         public int TIMEOUT_SEC_10 = 10;
         public int TIMEOUT_SEC_30 = 30;
         public int TIMEOUT_SEC_60 = 60;

+ 8 - 8
WallPadCall/src/main/java/kr/co/icontrols/callengine/engine/SIPInterface.java

@@ -1951,7 +1951,7 @@ public class SIPInterface {
             try {
                 LOG_INFO("[VideoRtpmanager] VideoRtpmanager started!");
                 try {
-                    RTP_PORT = SIPController.sipCall.sdp.audioM.mediaPort + 2;
+                    RTP_PORT = 3002;
                     LOG_INFO("[VideoRtpmanager] Video Port [" + RTP_PORT + "]");
 
                     theSocket = new DatagramSocket(RTP_PORT);
@@ -1969,19 +1969,19 @@ public class SIPInterface {
                     return;
                 }
 
-                LOG_INFO("[VideoRtpmanager] ------- videoenc.init() -------");
+                //LOG_INFO("[VideoRtpmanager] ------- videoenc.init() -------");
                 videoenc.init();
                 videoenc.bReceiveRunning = true;
                 runningSocket = theSocket;
                 videoenc.bService = true;
                 bOpenCover = false;
 
-                Log.e(TAG, "[VideoRtpmanager] videoenc.bReceiveRunning [" + videoenc.bReceiveRunning + "]");
+                //Log.e(TAG, "[VideoRtpmanager] videoenc.bReceiveRunning [" + videoenc.bReceiveRunning + "]");
                 if (runningSocket == null ) Log.e(TAG, "[VideoRtpmanager] runningSocket is null!!");
                 else Log.d(TAG, "[VideoRtpmanager] runningSocket is not null!!");
 
                 while (videoenc.bReceiveRunning == true && runningSocket != null) {
-//                    Log.e(TAG, "[VideoRtpmanager] ===== while =====");
+                    //Log.e(TAG, "[VideoRtpmanager] ===== while =====");
                     try {
                         if (videoManager == null) {
                             Log.e(TAG, "[VideoRtpmanager] videoManager == null");
@@ -2009,7 +2009,7 @@ public class SIPInterface {
 
                         if (SIPController.dp == null) Log.e(TAG, "[VideoRtpmanager] SIPController.dp is null!!!");
 
-//                        Log.e(TAG, "[VideoRtpmanager] ================= VIDEO RTP [1] =================");
+                        //Log.e(TAG, "[VideoRtpmanager] ================= VIDEO RTP [1] =================");
                         if (SIPController.dp != null && SIPController.dp.getLength() > 0) {
 //                            Log.e(TAG, "[VideoRtpmanager] ================= VIDEO RTP [2] =================");
                             if (false == videoenc.parseHNSRTPHeader()) {
@@ -2047,7 +2047,7 @@ public class SIPInterface {
                                 continue;
                             }
 
-//                            Log.e(TAG, "[VideoRtpmanager] ================= VIDEO RTP [6] =================");
+                            //Log.e(TAG, "[VideoRtpmanager] ================= VIDEO RTP [6] =================");
                             if (bOpenCover == false) {
 //                                Log.e(TAG, "[VideoRtpmanager] ================= VIDEO RTP [7] =================");
                                 if (videoenc.bIframeset == false) {
@@ -2074,7 +2074,7 @@ public class SIPInterface {
                                 }
                             }
 
-//                            Log.e(TAG, "[VideoRtpmanager] ================= VIDEO RTP [8] =================");
+                            //Log.e(TAG, "[VideoRtpmanager] ================= VIDEO RTP [8] =================");
                             byte[] field = new byte[4];
                             System.arraycopy(videoenc.buffer, 13, field, 0, 4);
                             int headerLen = getIntByByteArr(field);
@@ -2084,7 +2084,7 @@ public class SIPInterface {
                             int timeStamp = getIntByByteArr(field);
                             int frameSize = (frameLen > 0) ? frameLen : headerLen;
 
-//                            Log.e(TAG, "[VideoRtpmanager] ================= VIDEO RTP [9] =================");
+                            //Log.e(TAG, "[VideoRtpmanager] ================= VIDEO RTP [9] =================");
                             if (SIPController.dp.getLength() - 25 >= frameSize && bDecoderStarted == true) {
 //                                Log.e(TAG, "[VideoRtpmanager] ================= VIDEO RTP [10] =================");
                                 System.arraycopy(videoenc.buffer, 25, videoenc.data, 0, frameSize);

+ 8 - 1
WallPadCall/src/main/java/kr/co/icontrols/callengine/sip/SIPSound.java

@@ -563,8 +563,15 @@ public class SIPSound {
             Log.i(TAG, "[getCallType] strIPAddress [" + strIPAddress + "]");
             String[] IP_Parse = strIPAddress.split("\\.");
             if (IP_Parse[2].equals("128")) return CALLTYPE.GUARD;
-            else if (IP_Parse[2].equals("0")) return CALLTYPE.LOBBY;
+            else if (IP_Parse[2].equals("0"))
+            {
+                if(IP_Parse[3].equals("11"))
+                    return CALLTYPE.FRONT;
+
+                return CALLTYPE.LOBBY;
+            }
             else if (IP_Parse[2].equals("201")) return CALLTYPE.IHUB;
+            else if (IP_Parse[2].equals("129")) return CALLTYPE.FRONT;
             else return CALLTYPE.RESIDENCE;
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);

+ 23 - 9
WallPadCall/src/main/java/kr/co/icontrols/callengine/sip/SIPStun.java

@@ -2199,10 +2199,10 @@ public class SIPStun extends Service {
     public void INVITEParser(String strMessage, int nMSGType, String strRemoteIP, int strRemotePort) {
         try {
             Log.w(TAG, "[INVITEParser] bBLOCK_INVITE_MSG [" + bBLOCK_INVITE_MSG + "]");
-            if (bBLOCK_INVITE_MSG) {
-                rejectCall(strMessage, 486, strRemoteIP, strRemotePort);
-                return;
-            }
+//            if (bBLOCK_INVITE_MSG) {
+//                rejectCall(strMessage, 486, strRemoteIP, strRemotePort);
+//                return;
+//            }
 
             if (nMSGType == SIPStack.SIP_MSGTYPE_REQUEST) {
                 if (SIPController.sipCall != null) {
@@ -2271,7 +2271,9 @@ public class SIPStun extends Service {
                                                     fromId = sipHeader.getId().trim();
                                                 }
                                             }
-
+                                            Log.d(TAG, "[INVITEParser1] cmcore.id [" + cmcore.id + "], toId [" + toId + "]");
+                                            //toId = "12345678_Resi_0101_0103_01";
+                                            //fromId
                                             Log.d(TAG, "[INVITEParser] cmcore.id [" + cmcore.id + "], toId [" + toId + "]");
                                             if (cmcore.id != null && toId.compareTo(cmcore.id) == 0) {
                                                 // activate call handler
@@ -2351,7 +2353,8 @@ public class SIPStun extends Service {
                                 }
                             }
 
-                            Log.d(TAG, "[INVITEParser] cmcore.id [" + cmcore.id + "], toId [" + toId + "]");
+                            Log.d(TAG, "[INVITEParser3] cmcore.id [" + cmcore.id + "], toId [" + toId + "]");
+                            //toId = "12345678_Resi_0101_0103_01";
 
                             if (cmcore.id != null && toId.compareTo(cmcore.id) == 0) {
                                 // activate call handler
@@ -2366,7 +2369,8 @@ public class SIPStun extends Service {
                                 else {
                                     Log.i(TAG, "[INVITEParser] New call. Dialer awaken.");
                                     Log.i(TAG, "[INVITEParser] strRemoteIP [" + strRemoteIP + "], fromId [" + fromId + "]");
-                                    receiveNewCall(strRemoteIP, fromId);
+
+                                    receiveNewCall(strRemoteIP, makeSIPID(fromId));
                                     Log.d(TAG, "[INVITEParser] CMCore.bDialerActive [" + CMCore.bDialerActive + "]");
 
                                     // CMCore.bDialerActive는 GUI의 foreground 여부를 의미한다. (true: foreground)
@@ -4652,7 +4656,7 @@ public class SIPStun extends Service {
         RECEIVE,   // 수신
     }
 
-    boolean bPrintSIPMsg = false;
+    boolean bPrintSIPMsg = true;
     boolean bPrintSIPMsgIO = false;
 
     private void printSIPMessage(MESSAGE eType, String strMessage) {
@@ -4675,6 +4679,7 @@ public class SIPStun extends Service {
         public static String strType_Lobby = "Lobby";
         public static String strType_Guard = "Guard";
         public static String strType_Ihub = "Ihub";
+        public static String strType_Front = "Front";
     }
 
     public String[] makeDeviceName(String ipaddress) {
@@ -4745,10 +4750,18 @@ public class SIPStun extends Service {
                     // 로비폰
                     strType = DeviceString.strType_Lobby;
                     ho = IP_Parse[3];
+
+                    if(IP_Parse[3].equals("11"))
+                        strType = Declare.DEVICENAME.strType_Front;
                 } else if (IP_Parse[2].equals("201")) {
                     // 아이허브
                     strType = DeviceString.strType_Ihub;
                     ho = IP_Parse[3];
+                }
+                else if (IP_Parse[2].equals("129")) {
+                    // 아이허브
+                    strType = DeviceString.strType_Front;
+                    ho = IP_Parse[3];
                 } else {
                     int nIP_DClass = Integer.parseInt(IP_Parse[3]);
 
@@ -4886,7 +4899,8 @@ public class SIPStun extends Service {
                 return;
             }
 
-            runCallMainActivity(mCALLEVENTTYPE, mCALLTYPE);
+            if(mCALLTYPE == CALLTYPE.RESIDENCE)
+                runCallMainActivity(mCALLEVENTTYPE, mCALLTYPE);
 
             sendHandlerMsgDelayed(HANDLERMSG.RELEASE_BLOCK_INVITE_MSG, 0, 0, 0);
 

+ 1 - 2
WallPadCall/src/main/java/kr/co/icontrols/callengine/subphone/SubPhoneSerialManager.java

@@ -1369,8 +1369,7 @@ public class SubPhoneSerialManager extends Service {
             byte hDATA1 = 0x00, hDATA2 = 0x00, hDATA3 = 0x00, hDATA4 = 0x00;
             if (eCallType == CALLTYPE.FRONT) {
                 hDATA1 = SubPhoneCmds.CALLTYPE_FRONT;
-//                Log.e(TAG, "[sendNotifyNewCall] Build.VERSION.SDK_INT: " + Build.VERSION.SDK_INT);
-                if ((getSmartIoTCameraUsage() && ConfigValues.bSmartIOTCamFlip) || !(Build.VERSION.SDK_INT > 23)) hDATA4 = (byte) 0x01;
+                if (getSmartIoTCameraUsage() && ConfigValues.bSmartIOTCamFlip) hDATA4 = (byte) 0x01;
             }
             else if (eCallType == CALLTYPE.LOBBY) hDATA1 = SubPhoneCmds.CALLTYPE_LOBBY;
             else if (eCallType == CALLTYPE.GUARD) {

+ 115 - 14
WallPadCall/src/main/java/kr/co/icontrols/wallpadcall/MainActivity.java

@@ -53,6 +53,7 @@ import com.artncore.wallpadapi.IGW300API;
 import com.artncore.wallpadapi.Sdb_LivingRoomLightAPI;
 import com.artncore.wallpadapi.SmartKeyRfDoorAPI;
 import com.artncore.wallpadapi.WallPadAPI;
+import com.artncore.wallpadimap.RetProci;
 import com.util.LogUtil;
 
 import java.io.BufferedInputStream;
@@ -105,6 +106,7 @@ import kr.co.icontrols.wallpadcall.declare.Global.FRONTCAMERATYPE;
 import kr.co.icontrols.wallpadcall.declare.Global.SUBWALLPAD_PSTNTYPE;
 import kr.co.icontrols.wallpadcall.declare.Global.WALLPADTYPE;
 import kr.co.icontrols.wallpadcall.declare.ID;
+import kr.co.icontrols.wallpadcall.imap.Request_check_sip_activation;
 import kr.co.icontrols.wallpadcall.screen.InquiryCallHistory;
 import kr.co.icontrols.wallpadcall.screen.InquiryVisitorPictureHistory;
 import kr.co.icontrols.wallpadcall.screen.TalkFront;
@@ -238,6 +240,8 @@ public class MainActivity extends WpadActivity {
     private Menu mMenu = null; // WPadAPI의 Menu class
     private boolean MenuOpen = false;
 
+    public boolean mNewDanjiServer = false;
+
     // PopupActivityRun
     private static boolean PopupActivityRun = false;
 
@@ -625,6 +629,11 @@ public class MainActivity extends WpadActivity {
             getResidentSafetyCheckSetting();
 
             // 8. Window Resize
+
+            WallpadDeviceSet wallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
+            mNewDanjiServer =  wallpadDeviceSet.GetNewDanjiServer();
+            wallpadDeviceSet.closeDB();
+
             LOG_INFO("[Create] - Step8 : Window Resize");
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
@@ -1345,7 +1354,7 @@ public class MainActivity extends WpadActivity {
             switch (nScreenId) {
                 case API_Menu.SubMenuCall.Door:
                     setTitleText(API_Menu.SubMenuCall.Name_Door);
-                    ScreenTalkFront = new TalkFront(this, ScreenLayout, mWallPadAPI);
+                    ScreenTalkFront = new TalkFront(this, ScreenLayout);
                     super.setCurrentScreen(ScreenTalkFront);
                     break;
 
@@ -2297,6 +2306,42 @@ public class MainActivity extends WpadActivity {
         }
     }
 
+    private boolean send_check_sip_activation_request(final String strTargetIP) {
+        try {
+            Request_check_sip_activation check_sip_activation = new Request_check_sip_activation(mContext);
+            if (check_sip_activation.send_check_sip_activation(strTargetIP, null)) {
+                check_sip_activation.setResultCtrl(new RetProci() {
+
+                    @Override
+                    public void ProcSuccess() {
+                        LOG_INFO("[send_check_sip_activation_request] ProcSuccess()");
+                       // MainActivity.mCallController.mSIPInterface.requestCallForwardToStun(MainActivity.mCallController.makeCallForwarInfo(strTargetIP));
+                    }
+
+                    @Override
+                    public void ProcError() {
+                        LOG_INFO("[send_check_sip_activation_request] ProcError()");
+                       // MainActivity.mCallController.mSIPInterface.cancelCallForwardToStun();
+                    }
+
+                    @Override
+                    public void ProcDoing() {
+                        LOG_INFO("[send_check_sip_activation_request] ProcDoing()");
+                    }
+                });
+                return true;
+            }
+        } catch (RuntimeException re) {
+            LogUtil.errorLogInfo("", TAG, re);
+        } catch (Exception e) {
+            Log.e(TAG, "[Exception] send_check_sip_activation_request(String strTargetIP, String strMessage)");
+            //e.printStackTrace();
+            LogUtil.errorLogInfo("", TAG, e);
+            MainActivity.mCallController.mSIPInterface.cancelCallForwardToStun();
+        }
+        return false;
+    }
+
     String strCallOwner = "NONE";
     String strCallEvent = "NONE";
     String strCallType = "NONE";
@@ -2305,6 +2350,7 @@ public class MainActivity extends WpadActivity {
     private void generateCallEvent() {
         try {
             LOG_INFO("[generateCallEvent] ConfigValues.eWallPadType [" + ConfigValues.eWallPadType + "], strCallOwner [" + strCallOwner + "], strCallEvent [" + strCallEvent + "], strCallType [" + strCallType + "], strRemoteInfo [" + strRemoteInfo + "]");
+
             if (strCallEvent.equalsIgnoreCase("NONE")) setMenuBTNEnable(true);
             else setMenuBTNEnable(false);
 
@@ -2319,7 +2365,9 @@ public class MainActivity extends WpadActivity {
                     if (callowner == CALLOWNER.NONE) {
                         if (calltype == CALLTYPE.FRONT) {
                             if (calleventtype == CALLEVENTTYPE.RECEIVE_CALL) {
-                                if (mCallController != null) mCallController.CallScenarioManager(callowner, calleventtype, calltype, null, null, null);
+                                String strRemoteSIPID = mCallController.makeSIPID(strRemoteInfo);
+                                if (mCallController != null) mCallController.CallScenarioManager(callowner, calleventtype, calltype, strRemoteInfo, strRemoteSIPID, null);
+                                //if (mCallController != null) mCallController.CallScenarioManager(callowner, calleventtype, calltype, null, null, null);
                                 else Log.w(TAG, "[generateCallEvent] mCallController is null!!");
                             }
                             else {
@@ -2345,7 +2393,17 @@ public class MainActivity extends WpadActivity {
                             }
                         }
                         else {
+                            if (calleventtype == CALLEVENTTYPE.RECEIVE_CALL) {
+                                String strRemoteSIPID = mCallController.makeSIPID(strRemoteInfo);
+                                if (mCallController != null) mCallController.CallScenarioManager(callowner, calleventtype, calltype, strRemoteInfo, strRemoteSIPID, null);
+                                else Log.w(TAG, "[generateCallEvent] mCallController is null!!");
+                            }
+                            else {
+                                Log.w(TAG, "[generateCallEvent] not supported callevent!! -> " + calleventtype);
+                            }
+
                             Log.w(TAG, "[generateCallEvent] not supported calltype!! -> " + calltype);
+                            RemoteIDInfo.strIP = strRemoteInfo;
                         }
                     }
                     else if (callowner == CALLOWNER.WALLPAD) {
@@ -2353,7 +2411,16 @@ public class MainActivity extends WpadActivity {
                             if (calleventtype == CALLEVENTTYPE.REQUEST_FRONT_MONITORING) {
                                 if (mCallController != null) {
                                     mCallController.mCallInfo.setCallOwner(callowner);
-                                    mCallController.CallScenarioManager(callowner, calleventtype, calltype, null, null, null);
+
+                                    strRemoteInfo = "10.1.0.11";
+                                    String strRemoteSIPID = mCallController.makeSIPID(strRemoteInfo);
+                                    RemoteIDInfo.strIP = strRemoteInfo;
+
+                                    if (send_check_sip_activation_request(strRemoteInfo))
+                                        mCallController.CallScenarioManager(callowner, calleventtype, calltype, strRemoteInfo, strRemoteSIPID, null);
+                                    else
+                                        Log.d(TAG, callowner.toString() + "REQUEST_FRONT_MONITORING check_sip_activation ERROR");
+                                    //mCallController.CallScenarioManager(callowner, calleventtype, calltype, null, null, null);
                                 }
                                 else Log.w(TAG, "[generateCallEvent] mCallController is null!!");
                             }
@@ -2367,6 +2434,13 @@ public class MainActivity extends WpadActivity {
                             }
                             else Log.w(TAG, "[generateCallEvent] mCallController is null!!");
                         }
+
+//                        else if (calltype == CALLTYPE.LOBBY) {
+//                            if (mCallController != null) {
+//                                mCallController.mCallInfo.setCallOwner(callowner);
+//                                mCallController.CallScenarioManager(callowner, calleventtype, calltype, strRemoteInfo, null, null);
+//                            }
+//                        }
                     }
                     else if (callowner == CALLOWNER.MOBILE) {
                         if (calltype == CALLTYPE.FRONT) {
@@ -2374,7 +2448,14 @@ public class MainActivity extends WpadActivity {
                             if (calleventtype == CALLEVENTTYPE.REQUEST_FRONT_MONITORING) {
                                 if (mCallController != null) {
                                     mCallController.mCallInfo.setCallOwner(callowner);
-                                    mCallController.CallScenarioManager(callowner, calleventtype, calltype, null, null, null);
+                                    strRemoteInfo = "10.1.0.11";
+                                    String strRemoteSIPID = mCallController.makeSIPID(strRemoteInfo);
+                                    RemoteIDInfo.strIP = strRemoteInfo;
+
+                                    if (send_check_sip_activation_request(strRemoteInfo))
+                                        mCallController.CallScenarioManager(callowner, calleventtype, calltype, strRemoteInfo, strRemoteSIPID, null);
+                                    else
+                                        Log.d(TAG, callowner.toString() + "REQUEST_FRONT_MONITORING check_sip_activation ERROR");
                                 }
                                 else Log.w(TAG, "[generateCallEvent] mCallController is null!!");
                             }
@@ -2402,7 +2483,17 @@ public class MainActivity extends WpadActivity {
                     }
                     else if (Global.getKitchenTVIdx(callowner) >= 0 || Global.getBathPhoneIdx(callowner) >= 0 || callowner == CALLOWNER.SUB_WALLPAD || Global.getBathTVIdx(callowner) >= 0) {
                         if (calltype == CALLTYPE.FRONT) {
-                            if (mCallController != null) mCallController.onSubPhoneEvent(callowner, calleventtype, calltype, null, null);
+                            if (mCallController != null)
+                            {
+                                strRemoteInfo = "10.1.0.11";
+                                String strRemoteSIPID = mCallController.makeSIPID(strRemoteInfo);
+                                RemoteIDInfo.strIP = strRemoteInfo;
+                                //mCallController.onSubPhoneEvent(callowner, calleventtype, calltype, null, null);
+                                if (send_check_sip_activation_request(strRemoteInfo))
+                                    mCallController.onSubPhoneEvent(callowner, calleventtype, calltype, strRemoteSIPID, null);
+                                else
+                                    Log.d(TAG, callowner.toString() + "REQUEST_FRONT_MONITORING check_sip_activation ERROR");
+                            }
                             else Log.w(TAG, "[generateCallEvent] mCallController is null!!");
                         }
                         else if (calltype == CALLTYPE.GUARD || calleventtype == CALLEVENTTYPE.TRYING_CALL) {
@@ -2431,8 +2522,20 @@ public class MainActivity extends WpadActivity {
                             }
                             else Log.w(TAG, "[generateCallEvent] not supported calleventtype!! -> " + calleventtype);
                         }
+//                        else if(calltype == CALLTYPE.HISTORY_CALL)
+//                        {
+//                            strRemoteInfo = "10.1.0.110";
+//                            String strRemoteSIPID = mCallController.makeSIPID(strRemoteInfo);
+//                            RemoteIDInfo.strIP = strRemoteInfo;
+//
+//                            if (send_check_sip_activation_request(strRemoteInfo))
+//                                if (mCallController != null) mCallController.CallScenarioManager(callowner, calleventtype, calltype, strRemoteInfo, strRemoteSIPID, null);
+//                            else
+//                                Log.d(TAG, callowner.toString() + "REQUEST_FRONT_MONITORING check_sip_activation ERROR");
+//                        }
                         else {
                             Log.w(TAG, "[generateCallEvent] not supported calltype!! -> " + callowner);
+                            RemoteIDInfo.strIP = strRemoteInfo;
                         }
                     }
                     else if (callowner == CALLOWNER.SUB_WALLPAD) {
@@ -2441,6 +2544,8 @@ public class MainActivity extends WpadActivity {
                                 mCallController.mCallInfo.setCallOwner(callowner);
                                 mCallController.onSubWallPadEvent(callowner, calleventtype, calltype, null, null);
                                 mSubWallPadController.sendRequestFrontMonitoring(CALLOWNER.SUB_WALLPAD, CALLTYPE.FRONT);
+
+
                             }
                             else {
                                 Log.w(TAG, "[generateCallEvent] mCallController is null!!");
@@ -3815,7 +3920,7 @@ public class MainActivity extends WpadActivity {
     public Bitmap flipTakenIMG(Bitmap bitmap) {
         try {
             Matrix matrix = new Matrix();
-            if (ConfigValues.bSmartIOTCamFlip || !(Build.VERSION.SDK_INT > 23)) matrix.setScale(-1, 1);
+            if (ConfigValues.bSmartIOTCamFlip) matrix.setScale(-1, 1);
             else matrix.setScale(1, 1);
             return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, false);
         } catch (RuntimeException re) {
@@ -3886,7 +3991,7 @@ public class MainActivity extends WpadActivity {
                     Result = Bitmap.createBitmap(Result, 5, 5, nFixedIMGSize_Width, nFixedIMGSize_Height);
                     Result = reverseIMGColor(Result);
                     if (ConfigValues.eFrontCameraType == FRONTCAMERATYPE.SMARTIOT || ConfigValues.eFrontCameraType == FRONTCAMERATYPE.HD) {
-                        // 스마트IoT현관카메라의 경우 사진 좌우반전 옵션 확인하여 좌우반전 수행
+                        // 스마트IoT현관카메라의 경우 사진 색반전 코드 적용 (JEFF, 2020.08.11)
                         Result = flipTakenIMG(Result);
                     }
                 }
@@ -3900,11 +4005,6 @@ public class MainActivity extends WpadActivity {
                 else {
                     Result = getResizedBitmap(Original, nFixedIMGSize_Width + 5, nFixedIMGSize_Height + 5);
                     Result = Bitmap.createBitmap(Result, 5, 5, nFixedIMGSize_Width, nFixedIMGSize_Height);
-
-                    if (ConfigValues.eFrontCameraType == FRONTCAMERATYPE.SMARTIOT || ConfigValues.eFrontCameraType == FRONTCAMERATYPE.HD) {
-                        // 스마트IoT현관카메라의 경우 사진 좌우반전 옵션 확인하여 좌우반전 수행
-                        Result = flipTakenIMG(Result);
-                    }
                 }
             }
 
@@ -4470,8 +4570,8 @@ public class MainActivity extends WpadActivity {
 
                 case HANDLERMSG.SET_TALK_BTN_ENABLE:
                     Log.d(TAG, "[MainHandler] SET_TALK_BTN_ENABLE");
-                    if (TalkFront.BTN_TALK != null) TalkFront.BTN_TALK.setButtonEventOffDisable();
-                    else Log.w(TAG, "[MainHandler] TalkFront.BTN_TALK is null!! -> HANDLERMSG.SET_TALK_BTN_ENABLE");
+//                    if (TalkFront.BTN_TALK != null) TalkFront.BTN_TALK.setButtonEventOffDisable();
+//                    else Log.w(TAG, "[MainHandler] TalkFront.BTN_TALK is null!! -> HANDLERMSG.SET_TALK_BTN_ENABLE");
                     break;
 
                 case HANDLERMSG.REFRESH_HOMEICON:
@@ -4720,6 +4820,7 @@ public class MainActivity extends WpadActivity {
                 String strAction = intent.getAction();
                 Log.d(this.TAG, "[onReceive] strAction [" + strAction + "]");
                 if (strAction.equals(Declare.BR.APP_FINISH)) {
+                    mIOInterface.ctrlPopupGUI(true);
                     mCallController.setTalkPath(CALLPATH.NORMAL); // Finish BR 수신시 통화패스 Normal로 변경
                     if (mMainEventListener != null) {
                         String strCallOwner = intent.getStringExtra(CALLTRIGGER.CALLOWNER);

+ 162 - 5
WallPadCall/src/main/java/kr/co/icontrols/wallpadcall/declare/DataClasses.java

@@ -1715,18 +1715,97 @@ public final class DataClasses {
     }
 
     // 통화 내역 데이터 테이블
+    public static class AllCallHistoryInfoTable {
+        private ArrayList<AllCallHistoryInfo> AllCallHistoryInfoTables = new ArrayList<AllCallHistoryInfo>();
+//params event_time="0001.01.01.00.00.00" call_type="missed_call" send_device="homedev" send_id_high="101" send_id_low="101" recv_device="lobby" recv_id_high="101" recv_id_low="101" message="null"
+        public class AllCallHistoryInfo {
+            private String event_time = "";
+            private String call_type = ""; //send_device
+            private String send_device = ""; //call_type
+            private String send_id_high = ""; //recv_device
+            private String send_id_low = ""; //recv_id_high recv_id_low
+            private String recv_device = "";
+            private String recv_id_high = "";
+            private String recv_id_low = ""; //event_time
+            private String message = "";
+            private String mData = "";
+
+            public AllCallHistoryInfo(String strEvent_time, String strCall_type, String strSend_device, String strSend_id_high, String strSend_id_low, String strRecv_device, String strRecv_id_high, String strRecv_id_low, String strMessage) {
+                event_time = strEvent_time;
+                call_type = strCall_type;
+                send_device = strSend_device;
+                send_id_high = strSend_id_high;
+                send_id_low = strSend_id_low;
+                recv_device = strRecv_device;
+                recv_id_high = strRecv_id_high;
+                recv_id_low = strRecv_id_low;
+                message = strMessage;
+                mData = "<params event_time=\"" + event_time + "\" " +
+                        "call_type=\"" + call_type + "\" " +
+                        "send_device=\"" + send_device + "\" " +
+                        "send_id_high=\"" + send_id_high + "\" " +
+                        "send_id_low=\"" + send_id_low + "\" " +
+                        "recv_device=\"" + recv_device + "\" " +
+                        "recv_id_high=\"" + recv_id_high + "\" " +
+                        "recv_id_low=\"" + recv_id_low + "\" " +
+                        "message=\"" + message + "\"></params>";
+            }
+
+            public String getData() {
+        return mData;
+    }
+
+        }
+
+
+
+        public void addCallHistoryInfo(String strEvent_time, String strCall_type, String strSend_device, String strSend_id_high, String strSend_id_low, String strRecv_device, String strRecv_id_high, String strRecv_id_low, String strMessage) {
+            AllCallHistoryInfo NewCallHistoryInfo = new AllCallHistoryInfo(strEvent_time, strCall_type, strSend_device, strSend_id_high, strSend_id_low, strRecv_device, strRecv_id_high, strRecv_id_low, strMessage);
+            AllCallHistoryInfoTables.add(NewCallHistoryInfo);
+        }
+
+        public void removeCallHistoryInfo(int nIndex) {
+            AllCallHistoryInfoTables.remove(nIndex);
+        }
+
+        public AllCallHistoryInfo getCallHistoryInfo(int nIndex) {
+            if (getCnt() < nIndex) return null;
+            return (AllCallHistoryInfo) AllCallHistoryInfoTables.get(nIndex);
+        }
+
+        public void printValue() {
+            for (int i = 0; i < AllCallHistoryInfoTables.size(); i++) {
+                AllCallHistoryInfo item = getCallHistoryInfo(i);
+//                if(item!=null)
+//                {
+//                    LOG("[CallHistoryInfoTable] sID [" + item.getID() + "], sName [" + item.getName() + "], sCallResult [" + item.getCallResult() + "], sRemoteIP [" + item.getRemoteIP() + "], " +
+//                            "sSIPID [" + item.getSIPID() + "], sChecked [" + item.getChecked() + "], sETC [" + item.getETC() + "], sTimestamp [" + item.getTimestamp() + "]");
+//                }
+
+            }
+        }
+
+        public int getCnt() {
+            return AllCallHistoryInfoTables.size();
+        }
+
+        public void clearTable() {
+            AllCallHistoryInfoTables.clear();
+        }
+    }
+
     public static class CallHistoryInfoTable {
         private ArrayList<CallHistoryInfo> CallHistoryInfoTables = new ArrayList<CallHistoryInfo>();
 
         public class CallHistoryInfo {
             private String strID = "";
-            private String strName = "";
-            private String strCallResult = "";
-            private String strRemoteIP = "";
-            private String strSIPID = "";
+            private String strName = ""; //send_device
+            private String strCallResult = ""; //call_type
+            private String strRemoteIP = ""; //recv_device
+            private String strSIPID = ""; //recv_id_high recv_id_low
             private String strChecked = "";
             private String strETC = "";
-            private String strTimestamp = "";
+            private String strTimestamp = ""; //event_time
 
             public CallHistoryInfo(String sID, String sName, String sCallResult, String sRemoteIP, String sSIPID, String sChecked, String sETC, String sTimestamp) {
                 strID = sID;
@@ -1882,6 +1961,84 @@ public final class DataClasses {
         }
     }
 
+    public static class AllVisitorPictureHistoryInfoTable {
+        private ArrayList<AllVisitorPictureHistoryInfo> AllVisitorPictureHistoryInfoTables = new ArrayList<AllVisitorPictureHistoryInfo>();
+
+        public class AllVisitorPictureHistoryInfo {
+            private String dong = "";
+            private String ho = "";
+            private String time = "";
+            private String path = "";
+            private String filename = "";
+            private String message = "";
+            private String strData = "";
+
+            public AllVisitorPictureHistoryInfo(String strDong, String strHo, String strTime, String strPath, String strFilename, String strMessage) {
+                dong = strDong;
+                ho = strHo;
+                time = strTime;
+                path = strPath;
+                filename = strFilename;
+                message = strMessage;
+
+                strData = "<visitor_pic dong= \"" + strDong + "\" " +
+                        "ho= \"" + strHo + "\" " +
+                        "time= \"" + strTime + "\" " +
+                        "path=\"" + strPath + "\" " +
+                        "filename = \"" + strFilename + "\" " +
+                        "message= \"" + strMessage + "\"/>";
+
+            }
+
+            public String getData() {
+                return strData;
+            }
+            public String getPath() {
+                return path;
+            }
+            public String getFilename() {
+                return filename;
+            }
+
+        }
+
+        public void addVisitorPictureHistoryInfo(String strDong, String strHo, String strTime, String strPath, String strFilename, String strMessage) {
+            AllVisitorPictureHistoryInfo NewVisitorPictureHistoryInfo = new AllVisitorPictureHistoryInfo(strDong, strHo, strTime, strPath, strFilename, strMessage);
+            AllVisitorPictureHistoryInfoTables.add(NewVisitorPictureHistoryInfo);
+        }
+
+        public void removeVisitorPictureHistoryInfo(int nIndex) {
+            AllVisitorPictureHistoryInfoTables.remove(nIndex);
+        }
+
+        public AllVisitorPictureHistoryInfo getVisitorPictureHistoryInfo(int nIndex) {
+            if (getCnt() < nIndex) return null;
+            return (AllVisitorPictureHistoryInfo) AllVisitorPictureHistoryInfoTables.get(nIndex);
+        }
+
+        public void printValue() {
+            for (int i = 0; i < AllVisitorPictureHistoryInfoTables.size(); i++) {
+                AllVisitorPictureHistoryInfo item = getVisitorPictureHistoryInfo(i);
+                if(item!=null)
+                {
+//                    LOG("[CallHistoryInfoTable] ID [" + item.getID() + "], Name [" + item.getName() + "], RemoteSIPID [" + item.getRemoteSIPID() + "], " +
+//                            "Checked [" + item.getChecked() + "], Thief [" + item.getThief() + "], " +
+//                            "URI [" + item.getURI() + "], ETC [" + item.getETC() + "], " +
+//                            "Timestamp [" + item.getTimestamp() + "]");
+                }
+
+            }
+        }
+
+        public int getCnt() {
+            return AllVisitorPictureHistoryInfoTables.size();
+        }
+
+        public void clearTable() {
+            AllVisitorPictureHistoryInfoTables.clear();
+        }
+    }
+
     // 방문자 사진 데이터 테이블
     public static class VisitorPictureHistoryInfoTable {
         private ArrayList<VisitorPictureHistoryInfo> VisitorPictureHistoryInfoTables = new ArrayList<VisitorPictureHistoryInfo>();

+ 7 - 1
WallPadCall/src/main/java/kr/co/icontrols/wallpadcall/declare/Global.java

@@ -2730,8 +2730,14 @@ public final class Global {
             else {
                 String[] IP_Parse = strIPAddress.split("\\.");
                 if (IP_Parse[2].equals("128")) return CALLTYPE.GUARD;
-                else if (IP_Parse[2].equals("0")) return CALLTYPE.LOBBY;
+                else if (IP_Parse[2].equals("0"))
+                {
+                    if(IP_Parse[3].equals("11"))
+                        return CALLTYPE.FRONT;
+                    return CALLTYPE.LOBBY;
+                }
                 else if (IP_Parse[2].equals("201")) return CALLTYPE.IHUB;
+                else if (IP_Parse[2].equals("129")) return CALLTYPE.FRONT;
                 else return CALLTYPE.RESIDENCE;
             }
         } catch (RuntimeException re) {

+ 238 - 52
WallPadCall/src/main/java/kr/co/icontrols/wallpadcall/screen/InquiryCallHistory.java

@@ -10,6 +10,7 @@ import android.view.MotionEvent;
 import android.view.View;
 import android.widget.RelativeLayout;
 
+import com.artncore.wallpadimap.RetProci;
 import com.util.LogUtil;
 
 import java.util.ArrayList;
@@ -23,7 +24,9 @@ import kr.co.icontrols.wallpadcall.MainActivity.MAINEVENT;
 import kr.co.icontrols.wallpadcall.MainActivity.MainEventListener;
 import kr.co.icontrols.wallpadcall.R;
 import kr.co.icontrols.wallpadcall.declare.Common;
+import kr.co.icontrols.wallpadcall.declare.DataClasses;
 import kr.co.icontrols.wallpadcall.declare.DataClasses.CallHistoryInfoTable;
+import kr.co.icontrols.wallpadcall.declare.DataClasses.AllCallHistoryInfoTable;
 import kr.co.icontrols.wallpadcall.declare.Declare;
 import kr.co.icontrols.wallpadcall.declare.Declare.DEVICENAME;
 import kr.co.icontrols.wallpadcall.declare.Declare.DeviceType;
@@ -31,6 +34,9 @@ import kr.co.icontrols.wallpadcall.declare.Global;
 import kr.co.icontrols.wallpadcall.declare.Global.CALLRESULT;
 import kr.co.icontrols.wallpadcall.declare.Global.ConfigValues;
 import kr.co.icontrols.wallpadcall.declare.ID;
+import kr.co.icontrols.wallpadcall.imap.Request_call_history_delete;
+import kr.co.icontrols.wallpadcall.imap.Request_call_history_inquiry;
+import kr.co.icontrols.wallpadcall.imap.Request_visitor_picture_inquiry;
 import kr.co.icontrols.wallpadsupport.WpadImageView;
 import kr.co.icontrols.wallpadsupport.WpadImageView.TOUCH_KIND;
 import kr.co.icontrols.wallpadsupport.WpadScreen;
@@ -79,6 +85,8 @@ public class InquiryCallHistory extends WpadScreen implements CallEventListener,
     static int LIST_CNT_EASYMODE = 3; // 간편모드UX 적용할 경우
 
     LIST[] mLIST = new LIST[LIST_CNT];
+    CallHistoryInfoTable mInfoTable = new CallHistoryInfoTable();
+    AllCallHistoryInfoTable mAllInfoTable = new AllCallHistoryInfoTable();
 
     class LIST {
         WpadImageView BTN_CHECK;
@@ -221,7 +229,7 @@ public class InquiryCallHistory extends WpadScreen implements CallEventListener,
 
                 nViewGuide_Y += 90 + idx * 90;
             }
-            getHistoryFromDB();
+
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
         } catch (Exception e) {
@@ -244,6 +252,7 @@ public class InquiryCallHistory extends WpadScreen implements CallEventListener,
             if (ConfigValues.bEasyModeUse) LIST_CNT = LIST_CNT_EASYMODE;
 
             initHistoryPageInfo();
+
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
         } catch (Exception e) {
@@ -417,17 +426,22 @@ public class InquiryCallHistory extends WpadScreen implements CallEventListener,
                     LOG_INFO("[onPopupResult] ID.POPUP.DELETE_ITEMS.ELEMENT.BUTTON.CONFIRM");
                     if (strItemType.equals("CallHistoryItems_All")) {
                         deleteAllItems();
-                        getHistoryFromDB();
+                        deleteSelectedItems();
+                        resetCheckBox();
+                        initHistoryPageInfo();
+                        //getHistoryFromDB();
                     } else if (strItemType.equals("CallHistoryItems")) {
                         deleteSelectedItems();
                         resetCheckBox();
                         initHistoryPageInfo();
-                        getHistoryFromDB();
+                        //send_call_history_inquiry("all", "60");
+                        //getHistoryFromDB();
                     }
                 } else if (nID == ID.POPUP.DELETE_ITEMS.ELEMENT.BUTTON.CANCEL) {
                     LOG_INFO("[onPopupResult] ID.POPUP.DELETE_ITEMS.ELEMENT.BUTTON.CANCEL");
                     resetCheckBox();
-                    getHistoryFromDB();
+
+                    //getHistoryFromDB();
                 }
             }
         } catch (RuntimeException re) {
@@ -439,6 +453,79 @@ public class InquiryCallHistory extends WpadScreen implements CallEventListener,
         }
     }
 
+    private boolean send_call_history_inquiry(String strType, String strCount) {
+        try {
+            LOG_INFO("[send_call_history_inquiry] strType() "+ strType + " strCount " + strCount);
+            final Request_call_history_inquiry call_history_inquiry = new Request_call_history_inquiry(mContext);
+            if (call_history_inquiry.send_call_history_inquiry("101", "101", strType, strCount)) {
+                call_history_inquiry.setResultCtrl(new RetProci() {
+
+                    @Override
+                    public void ProcSuccess() {
+
+                        LOG_INFO("[send_call_history_inquiry] ProcSuccess() ");
+
+                        call_history_inquiry.SetItem("count");
+                        nHistoryCnt = Integer.parseInt(call_history_inquiry.GetItemVal(0));
+                        LOG("[send_call_history_inquiry] nHistoryCnt = " + nHistoryCnt);
+                        nTotalPage = ((nHistoryCnt + LIST_CNT - 1) / LIST_CNT);
+                        call_history_inquiry.SetItem("params");
+
+                        mInfoTable.clearTable();
+                        mAllInfoTable.clearTable();
+                        for(int i = 0; i < nHistoryCnt; i++)
+                        {
+                            //LOG_INFO("[send_call_history_inquiry] " + i + " " + call_history_inquiry.GetAttributeVal(i, "event_time"));
+                            String strName = call_history_inquiry.GetAttributeVal(i, "send_device");
+                            String strCallResult = call_history_inquiry.GetAttributeVal(i, "call_type");
+                            String strRemoteIP = call_history_inquiry.GetAttributeVal(i, "recv_device");
+                            String strSIPID = call_history_inquiry.GetAttributeVal(i, "recv_id_high") + "동" + call_history_inquiry.GetAttributeVal(i, "recv_id_low") + "호";
+                            String strTimestamp = call_history_inquiry.GetAttributeVal(i, "event_time");
+
+                            mInfoTable.addCallHistoryInfo("", strName, strCallResult, strRemoteIP, strSIPID, "", "", strTimestamp);
+
+                            mAllInfoTable.addCallHistoryInfo(call_history_inquiry.GetAttributeVal(i, "event_time"),
+                                    call_history_inquiry.GetAttributeVal(i, "call_type"),
+                                    call_history_inquiry.GetAttributeVal(i, "send_device"),
+                                    call_history_inquiry.GetAttributeVal(i, "send_id_high"),
+                                    call_history_inquiry.GetAttributeVal(i, "send_id_low"),
+                                    call_history_inquiry.GetAttributeVal(i, "recv_device"),
+                                    call_history_inquiry.GetAttributeVal(i, "recv_id_high"),
+                                    call_history_inquiry.GetAttributeVal(i, "recv_id_low"),
+                                    call_history_inquiry.GetAttributeVal(i, "message")
+                                    );
+
+                        }
+
+
+                        getHistoryFromDB();
+//                        visitor_picture_inquiry.SetItem("ftp_info");
+//                        strReply_User = visitor_access_info.GetAttributeVal(0, "user");
+//                        strReply_PW = visitor_access_info.GetAttributeVal(0, strPass_Key);
+//                        strReply_Path = visitor_access_info.GetAttributeVal(0, "path");
+                        //MainActivity.mCallController.mSIPInterface.requestCallForwardToStun(MainActivity.mCallController.makeCallForwarInfo(strTargetIP));
+                    }
+
+                    @Override
+                    public void ProcError() {
+                        LOG_INFO("[send_call_history_inquiry] ProcError()");
+                        //MainActivity.mCallController.mSIPInterface.cancelCallForwardToStun();
+                    }
+
+                    @Override
+                    public void ProcDoing() {
+                        LOG_INFO("[send_call_history_inquiry] ProcDoing()");
+                    }
+                });
+                return true;
+            }
+        } catch (Exception e) {
+            Log.e(TAG, "[Exception] send_call_history_inquiry(String strTargetIP, String strMessage)");
+            e.printStackTrace();
+        }
+        return false;
+    }
+
     boolean bProcessing = false;
 
     private boolean tryAutoCall(int nSelectedItem) {
@@ -574,18 +661,11 @@ public class InquiryCallHistory extends WpadScreen implements CallEventListener,
 
     private String makeUnitTimestamp(String strTimestamp) {
         try {
-//            LOG("[makeUnitTimestamp] strTimestamp = " + strTimestamp);
-            String[] strParse_01 = strTimestamp.split(" ");
-//            LOG_DEBUG("[makeUnitTimestamp] strParse_01.length = " + strParse_01.length);
+            String strResult = "";
 
-            String strDate = strParse_01[0].replace("-", ".");
-//            LOG_DEBUG("[makeUnitTimestamp] strDate = " + strDate);
-            String[] strParse_02 = strParse_01[1].split(":");
-//            LOG_DEBUG("[makeUnitTimestamp] strParse_02.length = " + strParse_02.length);
+            String[] strSplit = strTimestamp.split("\\.");
 
-            String strTime = strParse_02[0] + ":" + strParse_02[1];
-            String strResult = strDate + " " + strTime;
-            LOG("[makeUnitTimestamp] strResult = " + strResult);
+            strResult = strSplit[0] + "." + strSplit[1] + "." + strSplit[2] + " " + strSplit[3] + ":" + strSplit[4];
             return strResult;
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
@@ -598,15 +678,57 @@ public class InquiryCallHistory extends WpadScreen implements CallEventListener,
         }
     }
 
+    private String makeResiType(String strResultType) {
+        try {
+            LOG("[makeResiType] strResultType = " + strResultType);
+            String strResult = "NONE";
+            if (strResultType.contains("101호")) {
+                strResult = "1층";
+            }
+            else if (strResultType.contains("201호")) {
+                strResult = "2층";
+            }
+            else if (strResultType.contains("301호")) {
+                strResult = "3층";
+            }
+            else if (strResultType.contains("102호")) {
+                strResult = "메이드";
+            }
+            else if (strResultType.contains("103호")) {
+                strResult = "기사";
+            }
+            else if (strResultType.contains("302호")) {
+                strResult = "안방";
+            }
+            else if (strResultType.contains("202호")) {
+                strResult = "주방";
+            }else
+            {
+                strResult = "";
+            }
+
+            LOG("[makeUnitType] strResult = " + strResult);
+            return strResult;
+        } catch (RuntimeException re) {
+            LogUtil.errorLogInfo("", TAG, re);
+            return "ERROR";
+        } catch (Exception e) {
+            Log.e(TAG, "[Exception] makeUnitType(strResultType) : " + e);
+            //e.printStackTrace();
+            LogUtil.errorLogInfo("", TAG, e);
+            return "ERROR";
+        }
+    }
+
     private String makeUnitType(String strResultType) {
         try {
             LOG("[makeUnitType] strResultType = " + strResultType);
             String strResult = "NONE";
-            if (strResultType.equalsIgnoreCase(CALLRESULT.IN_MISS.toString())) {
+            if (strResultType.equalsIgnoreCase("missed_call")) {
                 strResult = "부재중";
             } else if (strResultType.equalsIgnoreCase(CALLRESULT.OUT_MISS.toString())) {
                 strResult = "발신";
-            } else if (strResultType.equalsIgnoreCase(CALLRESULT.IN_TALK.toString())) {
+            } else if (strResultType.equalsIgnoreCase("call")) {
                 strResult = "수신";
             } else if (strResultType.equalsIgnoreCase(CALLRESULT.IN_TALK_DOOR.toString())) {
                 strResult = "수신";
@@ -616,7 +738,7 @@ public class InquiryCallHistory extends WpadScreen implements CallEventListener,
                 strResult = "발신";
             } else if (strResultType.equalsIgnoreCase(CALLRESULT.OUT_HONEVIEW.toString())) {
                 strResult = "발신";
-            } else if (strResultType.equalsIgnoreCase(CALLRESULT.IN_REJECT.toString())) {
+            } else if (strResultType.equalsIgnoreCase("reject_call")) {
                 strResult = "수신(거절)";
             } else if (strResultType.equalsIgnoreCase(CALLRESULT.OUT_REJECT.toString())) {
                 strResult = "발신";
@@ -664,14 +786,21 @@ public class InquiryCallHistory extends WpadScreen implements CallEventListener,
 
     private void deleteSelectedItems() {
         try {
+            int iListCount = (nCurrentPage-1) * 6;
+            int iCount = 0;
+            String strMsg = "";
             ArrayList<String> SelectedIDs = new ArrayList<String>();
             for (int i = 0; i < nActivatedListCnt; i++) {
                 if (mLIST_VALUE[i].CHECK) {
-                    SelectedIDs.add(mLIST_VALUE[i].ID);
+                    strMsg += mAllInfoTable.getCallHistoryInfo(i + iListCount).getData() + "\r\n";
+                    iCount++;
+                    //SelectedIDs.add(mLIST_VALUE[i].ID);
                 }
                 mLIST_VALUE[i].CHECK = false;
             }
-            MainActivity.mCallHistoryManager.deleteHistoryList(Declare.DBInfo.TABLE_NAME_HISTORY_CALL, SelectedIDs);
+
+            send_call_history_delete(strMsg, String.valueOf(iCount));
+            //MainActivity.mCallHistoryManager.deleteHistoryList(Declare.DBInfo.TABLE_NAME_HISTORY_CALL, SelectedIDs);
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
         } catch (Exception e) {
@@ -681,10 +810,42 @@ public class InquiryCallHistory extends WpadScreen implements CallEventListener,
         }
     }
 
+    private boolean send_call_history_delete(String strMsg, String strCount) {
+        try {
+            LOG_INFO("[send_call_history_inquiry] strType() "+ strMsg + " strCount " + strCount);
+            final Request_call_history_delete call_history_delete = new Request_call_history_delete(mContext);
+            if (call_history_delete.send_call_history_delete(strMsg, strCount)) {
+                call_history_delete.setResultCtrl(new RetProci() {
+
+                    @Override
+                    public void ProcSuccess() {
+
+                        LOG_INFO("[send_call_history_delete] ProcSuccess() ");
+                    }
+
+                    @Override
+                    public void ProcError() {
+                        LOG_INFO("[send_call_history_delete] ProcError()");
+                        //MainActivity.mCallController.mSIPInterface.cancelCallForwardToStun();
+                    }
+
+                    @Override
+                    public void ProcDoing() {
+                        LOG_INFO("[send_call_history_delete] ProcDoing()");
+                    }
+                });
+                return true;
+            }
+        } catch (Exception e) {
+            Log.e(TAG, "[Exception] send_call_history_delete(String strTargetIP, String strMessage)");
+            e.printStackTrace();
+        }
+        return false;
+    }
+
     private void deleteAllItems() {
         try {
-            MainActivity.mCallHistoryManager.deleteDBFile();
-            MainActivity.mCallHistoryManager.initCallHistory(mContext);
+            send_call_history_delete("", "all");
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
         } catch (Exception e) {
@@ -800,17 +961,13 @@ public class InquiryCallHistory extends WpadScreen implements CallEventListener,
 
     private String getNameImgText(String strIPAddress) {
         try {
-            CALLTYPE eCallType = Global.getCallType(strIPAddress);
+            //CALLTYPE eCallType = Global.getCallType(strIPAddress);
 
-            if (eCallType == CALLTYPE.FRONT) return "현관";
-            else if (eCallType == CALLTYPE.LOBBY)
+            if (strIPAddress.equals("front")) return "현관";
+            else if (strIPAddress.equals("lobby"))
                 return "로비";
-            else if (eCallType == CALLTYPE.GUARD)
-                return "경비";
-            else if (eCallType == CALLTYPE.RESIDENCE)
+            else if (strIPAddress.equals("homedev"))
                 return "이웃";
-            else if (eCallType == CALLTYPE.PSTN)
-                return "전화";
             else return "경비실";
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
@@ -826,6 +983,7 @@ public class InquiryCallHistory extends WpadScreen implements CallEventListener,
     private boolean activateTalkBTN(String strName) {
         try {
             if (strName.contains("로비")) return false;
+            else if (strName.contains("현관")) return false;
             else if (strName.contains("발신번호 없음")) return false;
             else if (strName.contains("발신번호제한")) return false;
             else if (strName.contains("번호정보없음")) return false;
@@ -842,6 +1000,8 @@ public class InquiryCallHistory extends WpadScreen implements CallEventListener,
         }
     }
 
+
+
     private void getHistoryFromDB() {
         try {
             LOG_DEBUG("[getHistoryFromDB] nCurrentPage = " + nCurrentPage + ", nTotalPage = " + nTotalPage);
@@ -861,11 +1021,12 @@ public class InquiryCallHistory extends WpadScreen implements CallEventListener,
             if (nStartIndex + (LIST_CNT - 1) > nHistoryCnt) {
                 nCnt = LIST_CNT - ((nStartIndex + (LIST_CNT - 1)) - nHistoryCnt);
             }
-            CallHistoryInfoTable InfoTable = new CallHistoryInfoTable();
-            InfoTable.clearTable();
-            InfoTable = MainActivity.mCallHistoryManager.getCallHistory(nStartIndex - 1, nCnt);
-            LOG_DEBUG("[getHistoryFromDB] nStartIndex = " + nStartIndex + ", nCnt = " + nCnt);
-            if (InfoTable == null) {
+
+//            CallHistoryInfoTable InfoTable = new CallHistoryInfoTable();
+//            InfoTable.clearTable();
+//            InfoTable = MainActivity.mCallHistoryManager.getCallHistory(nStartIndex - 1, nCnt);
+//            LOG_DEBUG("[getHistoryFromDB] nStartIndex = " + nStartIndex + ", nCnt = " + nCnt);
+            if (nHistoryCnt == 0) {
                 BTN_DELETE.setButtonEventOffEnable(R.drawable.btn_ch_del_disabled);
                 BTN_DELETE_ALL.setButtonEventOffEnable(R.drawable.btn_ch_all_del_disabled);
                 BTN_PAGE_PREV.setButtonEventOffEnable(R.drawable.btn_back_disabled);
@@ -881,19 +1042,40 @@ public class InquiryCallHistory extends WpadScreen implements CallEventListener,
 //                BTN_PAGE_NEXT.setButtonEventOffEnable(R.drawable.btn_next_disabled);
 //            }
 
-            int nInfoCnt = InfoTable.getCnt();
+            int nInfoCnt = 0;
+
+            int iListCount = (nCurrentPage-1) * 6;
+
+            if (nCurrentPage == nTotalPage)
+            {
+                nInfoCnt = nHistoryCnt - iListCount;
+            }
+            else
+                nInfoCnt = 6;
+
+
             nActivatedListCnt = nInfoCnt;
+
+
             LOG_DEBUG("[getHistoryFromDB] nInfoCnt = " + nInfoCnt);
+            LOG_DEBUG("[getHistoryFromDB] iListCount = " + iListCount);
             for (int i = 0; i < nInfoCnt; i++) {
                 mLIST_VALUE[i] = new LIST_VALUE();
                 mLIST_VALUE[i].CHECK = false;
                 if (i < nInfoCnt) {
-                    mLIST_VALUE[i].ID = InfoTable.getCallHistoryInfo(i).getID();
-                    mLIST_VALUE[i].NAME = makeUnitName(InfoTable.getCallHistoryInfo(i).getName());
-                    mLIST_VALUE[i].TIME = makeUnitTimestamp(InfoTable.getCallHistoryInfo(i).getTimestamp());
-                    mLIST_VALUE[i].TYPE = makeUnitType(InfoTable.getCallHistoryInfo(i).getCallResult());
-                    mLIST_VALUE[i].REMOTE_IP = InfoTable.getCallHistoryInfo(i).getRemoteIP();
-                    mLIST_VALUE[i].NEW = InfoTable.getCallHistoryInfo(i).getChecked();
+                    mLIST_VALUE[i].ID = mInfoTable.getCallHistoryInfo(i+iListCount).getID();
+                    if (mInfoTable.getCallHistoryInfo(i).getName().equals("lobby")) {
+                        mLIST_VALUE[i].NAME =  "101동 10번 로비";
+                    }
+                    else if (mInfoTable.getCallHistoryInfo(i+iListCount).getName().equals("homedev")) {
+                        //String[] strEndIP = {"10.1.1.1", "10.1.2.1", "10.1.3.1", "10.1.3.2", "10.1.1.3", "10.1.1.2", "10.1.2.2"};
+                        mLIST_VALUE[i].NAME = makeResiType(mInfoTable.getCallHistoryInfo(i+iListCount).getSIPID());
+                    }
+
+                    mLIST_VALUE[i].TIME = makeUnitTimestamp(mInfoTable.getCallHistoryInfo(i+iListCount).getTimestamp());
+                    mLIST_VALUE[i].TYPE = makeUnitType(mInfoTable.getCallHistoryInfo(i+iListCount).getCallResult());
+                    mLIST_VALUE[i].REMOTE_IP = mInfoTable.getCallHistoryInfo(i+iListCount).getName();
+                    mLIST_VALUE[i].NEW = "";
                     nStartIndex++;
                 } else {
                     mLIST_VALUE[i].ID = "";
@@ -926,28 +1108,32 @@ public class InquiryCallHistory extends WpadScreen implements CallEventListener,
                     mLIST[i].IMG_NEW.setVisibility(View.VISIBLE);
             }
 
-            if (nInfoCnt > 0)
-                MainActivity.mCallHistoryManager.updateNewCheck(mLIST_VALUE[nInfoCnt - 1].ID, mLIST_VALUE[0].ID);
+//            if (nInfoCnt > 0)
+//                MainActivity.mCallHistoryManager.updateNewCheck(mLIST_VALUE[nInfoCnt - 1].ID, mLIST_VALUE[0].ID);
 
             strText_PageNo = nCurrentPage + "/" + nTotalPage;
             TXT_PAGE.setText(strText_PageNo);
         } catch (RuntimeException re) {
-            LogUtil.errorLogInfo("", TAG, re);
+            //LogUtil.errorLogInfo("", TAG, re);
+            re.printStackTrace();
         } catch (Exception e) {
-            Log.e(TAG, "[Exception] getHistoryFromDB()");
-            //e.printStackTrace();
-            LogUtil.errorLogInfo("", TAG, e);
+            //Log.e(TAG, "[Exception] getHistoryFromDB()");
+            e.printStackTrace();
+            //LogUtil.errorLogInfo("", TAG, e);
         }
     }
 
     private void initHistoryPageInfo() {
         try {
-            LOG("[initHistoryPageInfo");
-            nHistoryCnt = MainActivity.mCallHistoryManager.getHistoryCnt(Declare.DBInfo.TABLE_NAME_HISTORY_CALL);
-            LOG("[initHistoryPageInfo] nHistoryCnt = " + nHistoryCnt);
-            nTotalPage = ((nHistoryCnt + LIST_CNT - 1) / LIST_CNT);
-            LOG("[initHistoryPageInfo] nTotalPage = " + nTotalPage);
+            LOG("[initHistoryPageInfo]");
+            send_call_history_inquiry("all", "60");
+//            nHistoryCnt = MainActivity.mCallHistoryManager.getHistoryCnt(Declare.DBInfo.TABLE_NAME_HISTORY_CALL);
+//            LOG("[initHistoryPageInfo] nHistoryCnt = " + nHistoryCnt);
+//            nTotalPage = ((nHistoryCnt + LIST_CNT - 1) / LIST_CNT);
+//            LOG("[initHistoryPageInfo] nTotalPage = " + nTotalPage);
             nCurrentPage = 1;
+
+
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
         } catch (Exception e) {

+ 368 - 61
WallPadCall/src/main/java/kr/co/icontrols/wallpadcall/screen/InquiryVisitorPictureHistory.java

@@ -11,27 +11,38 @@ import android.view.View;
 import android.widget.ImageView;
 import android.widget.RelativeLayout;
 
+import com.artncore.WallPadDataMgr.WallpadDeviceSet;
+import com.artncore.commons.define;
+import com.artncore.wallpadimap.RetProci;
 import com.util.LogUtil;
 
+import org.apache.commons.net.ftp.FTP;
+
 import java.io.File;
 import java.util.ArrayList;
 
+import kr.co.icontrols.callengine.engine.AutoSaveVisitorPicture;
 import kr.co.icontrols.callengine.engine.CallController.CallEventListener;
 import kr.co.icontrols.callengine.engine.CallManager.CALLOWNER;
 import kr.co.icontrols.callengine.engine.CallManager.CALLSTATUS;
 import kr.co.icontrols.callengine.engine.CallManager.CALLTYPE;
+import kr.co.icontrols.hdcftp.HDCFTPManager;
 import kr.co.icontrols.wallpadcall.MainActivity;
 import kr.co.icontrols.wallpadcall.MainActivity.MAINEVENT;
 import kr.co.icontrols.wallpadcall.MainActivity.MainEventListener;
 import kr.co.icontrols.wallpadcall.R;
 import kr.co.icontrols.wallpadcall.declare.Common;
 import kr.co.icontrols.wallpadcall.declare.DataClasses.VisitorPictureHistoryInfoTable;
+import kr.co.icontrols.wallpadcall.declare.DataClasses.AllVisitorPictureHistoryInfoTable;
 import kr.co.icontrols.wallpadcall.declare.Declare;
 import kr.co.icontrols.wallpadcall.declare.Declare.DEVICENAME;
 import kr.co.icontrols.wallpadcall.declare.Declare.DeviceType;
 import kr.co.icontrols.wallpadcall.declare.Global;
 import kr.co.icontrols.wallpadcall.declare.Global.ConfigValues;
 import kr.co.icontrols.wallpadcall.declare.ID;
+import kr.co.icontrols.wallpadcall.imap.Request_start_talking;
+import kr.co.icontrols.wallpadcall.imap.Request_visitor_picture_delete;
+import kr.co.icontrols.wallpadcall.imap.Request_visitor_picture_inquiry;
 import kr.co.icontrols.wallpadsupport.WpadImageView;
 import kr.co.icontrols.wallpadsupport.WpadImageView.TOUCH_KIND;
 import kr.co.icontrols.wallpadsupport.WpadScreen;
@@ -128,6 +139,7 @@ public class InquiryVisitorPictureHistory extends WpadScreen implements CallEven
 
     String strText_PageNo = "1/1";
     VisitorPictureHistoryInfoTable mVisitorPictureHistoryInfoTable = new VisitorPictureHistoryInfoTable();
+    AllVisitorPictureHistoryInfoTable mAllVisitorPictureHistoryInfoTable = new AllVisitorPictureHistoryInfoTable();
 
     public InquiryVisitorPictureHistory(Context context, RelativeLayout layout) {
         super(context, layout);
@@ -225,7 +237,7 @@ public class InquiryVisitorPictureHistory extends WpadScreen implements CallEven
             BTN_DELETE_ALL = new WpadImageView(context, TOUCH_KIND.BUTTON, 230, 272, R.drawable.btn_visitor_all_del_normal, R.drawable.btn_visitor_all_del_pressed, ID.SCREEN.INQUIRYVISITORPICTUREHISTORY.ELEMENT.BUTTON.DELETE_ALL);
             ViewRegistration(layout, BTN_DELETE_ALL, Common.ImgPosition.GetX(980), Common.ImgPosition.GetY(382));
 
-            getHistoryFromDB();
+            //getHistoryFromDB();
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
         } catch (Exception e) {
@@ -268,6 +280,7 @@ public class InquiryVisitorPictureHistory extends WpadScreen implements CallEven
             ((MainActivity) mContext).finishManual(ID.MANUAL.MANUAL_ALL);
             ((MainActivity) mContext).releaseMainEventListener();
             ((MainActivity) mContext).setTopSetBtnVisible(false);
+            setDirEmpty(define.VISITOR_PICTURE_LOCATION);
 //            ((MainActivity) mContext).checkMemoryUsage(); // 메모리 체크
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
@@ -426,12 +439,13 @@ public class InquiryVisitorPictureHistory extends WpadScreen implements CallEven
                     LOG_INFO("[onPopupResult] ID.POPUP.DELETE_ITEMS.ELEMENT.BUTTON.CONFIRM");
                     if (strItemType.equals("VisitorPictures_All")) {
                         deleteAllItems();
-                        getHistoryFromDB();
+                        initHistoryPageInfo();
+                        //getHistoryFromDB();
                     } else if (strItemType.equals("VisitorPictures")) {
                         deleteSelectedItems();
                         resetCheckBox();
                         initHistoryPageInfo();
-                        getHistoryFromDB();
+                        //getHistoryFromDB();
                     }
                 } else if (nID == ID.POPUP.DELETE_ITEMS.ELEMENT.BUTTON.CANCEL) {
                     LOG_INFO("[onPopupResult] ID.POPUP.DELETE_ITEMS.ELEMENT.BUTTON.CANCEL");
@@ -482,25 +496,28 @@ public class InquiryVisitorPictureHistory extends WpadScreen implements CallEven
                 }
             } else if (strName.contains("Front")) {
                 strResult = "현관";
-            } else {
-                String[] strParse_01 = strName.split("/");
-                String strType = strParse_01[0];
-                String[] strParse_02 = strParse_01[1].split("-");
-                String strDong = strParse_02[0];
-                String strHo = strParse_02[1];
-
-                if (strType.equalsIgnoreCase(DEVICENAME.strType_Lobby)) {
-                    strResult = strDong + "동 " + strHo + "번 로비";
-                } else if (strType.equalsIgnoreCase(DEVICENAME.strType_Guard)) {
-                    String strRemoteIP = Global.makeIPAddress(DeviceType.GUARD, strDong, strHo);
-                    strResult = getGuardName(strRemoteIP);
-                    if (strResult.equals("NONE") || strResult.equals("ERROR")) {
-                        strResult = strDong + "동 " + strHo + "번 경비";
-                    }
-                } else {
-                    strResult = strDong + "동 " + strHo + "호";
-                }
-            }
+            } else if (strName.contains("LOBBY")) {
+                strResult = "101동 10번 로비";
+            } 
+//            } else {
+//                String[] strParse_01 = strName.split("/");
+//                String strType = strParse_01[0];
+//                String[] strParse_02 = strParse_01[1].split("-");
+//                String strDong = strParse_02[0];
+//                String strHo = strParse_02[1];
+//
+//                if (strType.equalsIgnoreCase(DEVICENAME.strType_Lobby)) {
+//                    strResult = strDong + "동 " + strHo + "번 로비";
+//                } else if (strType.equalsIgnoreCase(DEVICENAME.strType_Guard)) {
+//                    String strRemoteIP = Global.makeIPAddress(DeviceType.GUARD, strDong, strHo);
+//                    strResult = getGuardName(strRemoteIP);
+//                    if (strResult.equals("NONE") || strResult.equals("ERROR")) {
+//                        strResult = strDong + "동 " + strHo + "번 경비";
+//                    }
+//                } else {
+//                    strResult = strDong + "동 " + strHo + "호";
+//                }
+//            }
 
             if (ConfigValues.bEasyModeUse) {
                 return String.format("[%s] ", strResult);
@@ -546,21 +563,26 @@ public class InquiryVisitorPictureHistory extends WpadScreen implements CallEven
     // 방문자 사진 파일의 파일명에서 방문자 사진 시간을 구한다.
     private String makeUnitTimestampFromFile(String strTimestamp) {
         try {
-//            LOG("[makeUnitTimestampFromFile] strTimestamp [" + strTimestamp + "]");
-            String[] strParse_01 = strTimestamp.split("/");   // 파일경로명 파싱
-            strParse_01 = strParse_01[strParse_01.length - 1].split("\\.");   // 파일명을 추출하여 확장자 제거
-            strParse_01 = strParse_01[0].split("_");   // 파일명에서 시간정보 분리
-            StringBuffer strDate = new StringBuffer(strParse_01[5]);   // 날짜
-            StringBuffer strTime = new StringBuffer(strParse_01[6]);   // 시간
-//            LOG("[makeUnitTimestampFromFile] strDate [" + strDate + "], strTime [" + strTime + "]");
-            strDate.insert(6, ".");
-            strDate.insert(4, ".");
+////            LOG("[makeUnitTimestampFromFile] strTimestamp [" + strTimestamp + "]");
+//            String[] strParse_01 = strTimestamp.split("/");   // 파일경로명 파싱
+//            strParse_01 = strParse_01[strParse_01.length - 1].split("\\.");   // 파일명을 추출하여 확장자 제거
+//            strParse_01 = strParse_01[0].split("_");   // 파일명에서 시간정보 분리
+//            StringBuffer strDate = new StringBuffer(strParse_01[5]);   // 날짜
+//            StringBuffer strTime = new StringBuffer(strParse_01[6]);   // 시간
+////            LOG("[makeUnitTimestampFromFile] strDate [" + strDate + "], strTime [" + strTime + "]");
+//            strDate.insert(6, ".");
+//            strDate.insert(4, ".");
+//
+//            strTime.insert(4, ":");
+//            strTime.insert(2, ":");
+//
+//            String strResult = strDate + " " + strTime;
+//            LOG("[makeUnitTimestampFromFile] strResult = " + strResult);
+            String strResult = "";
 
-            strTime.insert(4, ":");
-            strTime.insert(2, ":");
+            String[] strSplit = strTimestamp.split("\\.");
 
-            String strResult = strDate + " " + strTime;
-            LOG("[makeUnitTimestampFromFile] strResult = " + strResult);
+            strResult = strSplit[0] + "." + strSplit[1] + "." + strSplit[2] + " " + strSplit[3] + ":" + strSplit[4] + ":" + strSplit[5];
             return strResult;
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
@@ -575,6 +597,9 @@ public class InquiryVisitorPictureHistory extends WpadScreen implements CallEven
 
     private void runPictureViewer(int nID) {
         try {
+
+            int iListCount = (nCurrentPage-1) * 6;
+            nID = nID + iListCount;
             LOG("[runPictureViewer] nID [" + nID + "]");
             Global.strVisitorPictureID = mVisitorPictureHistoryInfoTable.getVisitorPictureHistoryInfo(nID).getID();
             super.setChangeScreen(ID.SCREEN.SCREEN_VISITORPICTUREVIEWER);
@@ -727,19 +752,57 @@ public class InquiryVisitorPictureHistory extends WpadScreen implements CallEven
         }
     }
 
+    private boolean send_visitor_picture_delete(String strMsg, String strCount) {
+        try {
+            LOG_INFO("[send_visitor_picture_delete] strType() "+ strMsg + " strCount " + strCount);
+            final Request_visitor_picture_delete visitor_picture_delete = new Request_visitor_picture_delete(mContext);
+            if (visitor_picture_delete.send_visitor_picture_delete(strMsg, strCount)) {
+                visitor_picture_delete.setResultCtrl(new RetProci() {
+
+                    @Override
+                    public void ProcSuccess() {
+
+                        LOG_INFO("[send_visitor_picture_delete] ProcSuccess() ");
+                    }
+
+                    @Override
+                    public void ProcError() {
+                        LOG_INFO("[send_visitor_picture_delete] ProcError()");
+                        //MainActivity.mCallController.mSIPInterface.cancelCallForwardToStun();
+                    }
+
+                    @Override
+                    public void ProcDoing() {
+                        LOG_INFO("[send_visitor_picture_delete] ProcDoing()");
+                    }
+                });
+                return true;
+            }
+        } catch (Exception e) {
+            Log.e(TAG, "[Exception] send_visitor_picture_delete(String strTargetIP, String strMessage)");
+            e.printStackTrace();
+        }
+        return false;
+    }
+
     private void deleteSelectedItems() {
         try {
-            ArrayList<String> SelectedIDs = new ArrayList<String>();
-            ArrayList<String> SelectedURIs = new ArrayList<String>();
+            int iListCount = (nCurrentPage-1) * 6;
+            int iCount = 0;
+            String strMsg = "";
             for (int i = 0; i < nActivatedListCnt; i++) {
                 if (mLIST_VALUE[i].CHECK) {
-                    SelectedIDs.add(mLIST_VALUE[i].ID);
-                    SelectedURIs.add(mLIST_VALUE[i].URI);
+                    //SelectedIDs.add(mLIST_VALUE[i].ID);
+                    //SelectedURIs.add(mLIST_VALUE[i].URI);
+                    strMsg += mAllVisitorPictureHistoryInfoTable.getVisitorPictureHistoryInfo(i + iListCount).getData() + "\r\n";
+                    iCount++;
                 }
                 mLIST_VALUE[i].CHECK = false;
             }
-            MainActivity.mVisitorPictureHistoryManager.deleteHistoryList(Declare.DBInfo.TABLE_NAME_HISTORY_VISITORPICTURE, SelectedIDs);
-            MainActivity.mVisitorPictureHistoryManager.deleteHistoryList(SelectedURIs);
+            send_visitor_picture_delete(strMsg, String.valueOf(iCount));
+
+            //MainActivity.mVisitorPictureHistoryManager.deleteHistoryList(Declare.DBInfo.TABLE_NAME_HISTORY_VISITORPICTURE, SelectedIDs);
+            //MainActivity.mVisitorPictureHistoryManager.deleteHistoryList(SelectedURIs);
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
         } catch (Exception e) {
@@ -751,9 +814,10 @@ public class InquiryVisitorPictureHistory extends WpadScreen implements CallEven
 
     private void deleteAllItems() {
         try {
-            MainActivity.mVisitorPictureHistoryManager.deleteDBFile();
-            MainActivity.mVisitorPictureHistoryManager.deleteVisitorPictureDirectory();
-            MainActivity.mVisitorPictureHistoryManager.initVisitorPictureHistory(mContext);
+            send_visitor_picture_delete("", "all");
+//            MainActivity.mVisitorPictureHistoryManager.deleteDBFile();
+//            MainActivity.mVisitorPictureHistoryManager.deleteVisitorPictureDirectory();
+//            MainActivity.mVisitorPictureHistoryManager.initVisitorPictureHistory(mContext);
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
         } catch (Exception e) {
@@ -791,6 +855,237 @@ public class InquiryVisitorPictureHistory extends WpadScreen implements CallEven
         }
     }
 
+    HDCFTPManager mFTPManager;
+    String strRemoteIP = "10.0.1.1";
+
+    public class DownloadVisitorPicture extends Thread {
+
+        boolean bMainServer2dot0 = false;
+
+        public DownloadVisitorPicture() {
+            LOG_INFO("[DownloadVisitorPicture] ===== START =====");
+            WallpadDeviceSet wallpadDeviceSet = new WallpadDeviceSet(mContext);
+            try {
+                bMainServer2dot0 = wallpadDeviceSet.GetNewDanjiServer();
+                LOG_INFO("[DownloadVisitorPicture] bMainServer2dot0 [" + bMainServer2dot0 + "]");
+                wallpadDeviceSet.closeDB();
+            } catch (RuntimeException re) {
+                LogUtil.errorLogInfo("", TAG, re);
+            } catch (Exception e) {
+                Log.e(TAG, "[Exception] UploadVisitorPicture()");
+                //e.printStackTrace();
+                LogUtil.errorLogInfo("", TAG, e);
+                wallpadDeviceSet.closeDB();
+            }
+        }
+
+        public void run() {
+            try {
+                mFTPManager = new HDCFTPManager();
+                if (!mFTPManager.connectFTP(strRemoteIP)) {
+                    Log.w(TAG, "[DownloadVisitorPicture.run()] FAIL!! -> connectFTP(...)");
+                    return;
+                }
+
+                if (!mFTPManager.loginFTP(strReply_User, strReply_PW)) {
+                    Log.w(TAG, "[DownloadVisitorPicture.run()] FAIL!! -> loginFTP(...)");
+                    return;
+                }
+
+                if (!bMainServer2dot0) {
+                    if (!mFTPManager.setPassiveMode()) {
+                        Log.w(TAG, "[DownloadVisitorPicture.run()] FAIL!! -> setPassiveMode(...)");
+                        disconnectFTP();
+                        return;
+                    }
+                }
+
+                if (!mFTPManager.setCtrlEncoding(mFTPManager.ENCODING_TYPE_EUC_KR)) {
+                    Log.w(TAG, "[DownloadVisitorPicture.run()] FAIL!! -> setCtrlEncoding(...)");
+                    disconnectFTP();
+                    return;
+                }
+
+                if (!mFTPManager.setFileType(FTP.BINARY_FILE_TYPE)) {
+                    Log.w(TAG, "[DownloadVisitorPicture.run()] FAIL!! -> setFileType(...)");
+                    disconnectFTP();
+                    return;
+                }
+
+                int iCount = mAllVisitorPictureHistoryInfoTable.getCnt();
+
+
+                for(int i = 0; i < iCount; i++)
+                {
+                    String strRemoteURI = mAllVisitorPictureHistoryInfoTable.getVisitorPictureHistoryInfo(i).getPath() + "/" +
+                            mAllVisitorPictureHistoryInfoTable.getVisitorPictureHistoryInfo(i).getFilename();
+                    String strLocalURI = mVisitorPictureHistoryInfoTable.getVisitorPictureHistoryInfo(i).getURI();
+                    if (!mFTPManager.downloadFile(strRemoteURI, strLocalURI)) {
+                        Log.w(TAG, "[DownloadVisitorPicture.run()] FAIL!! -> uploadFile(...) " + i);
+                        disconnectFTP();
+                        return;
+                    }
+
+                    //
+                }
+                //
+
+
+                Thread.sleep(500);
+                disconnectFTP();
+                LOG_INFO("[DownloadVisitorPicture.run()] Complete upload!!!");
+
+            } catch (RuntimeException re) {
+                LogUtil.errorLogInfo("", TAG, re);
+            } catch (Exception e) {
+                Log.e(TAG, "[Exception] DownloadVisitorPicture.run()");
+                //e.printStackTrace();
+                LogUtil.errorLogInfo("", TAG, e);
+            }
+        }
+    }
+
+    public boolean disconnectFTP() {
+        try {
+            if (mFTPManager.logoutFTP()) {
+                if (mFTPManager.disconnectFTP()) {
+                    LOG_INFO("[disconnectFTP] disconnectFTP OK!!");
+                    return true;
+                }
+            }
+            LOG_INFO("[disconnectFTP] disconnectFTP FAIL!!");
+            return false;
+        } catch (RuntimeException re) {
+            LogUtil.errorLogInfo("", TAG, re);
+            return false;
+        } catch (Exception e) {
+            Log.e(TAG, "[Exception] disconnectFTP()");
+            //e.printStackTrace();
+            LogUtil.errorLogInfo("", TAG, e);
+            return false;
+        }
+    }
+
+    String strReply_User = "";
+    String strReply_PW = "";
+    String strReply_Path = "";
+
+    private boolean send_visitor_picture_inquiry(String strPage, String strCount) {
+        try {
+            LOG_INFO("[send_visitor_picture_inquiry] strPage() "+ strPage + " strCount " + strCount);
+            final Request_visitor_picture_inquiry visitor_picture_inquiry = new Request_visitor_picture_inquiry(mContext);
+            if (visitor_picture_inquiry.send_visitor_picture_inquiry("101", "101", strPage, strCount)) {
+                visitor_picture_inquiry.setResultCtrl(new RetProci() {
+
+                    @Override
+                    public void ProcSuccess() {
+                        //nHistoryCnt = MainActivity.mVisitorPictureHistoryManager.getHistoryCnt(Declare.DBInfo.TABLE_NAME_HISTORY_VISITORPICTURE);
+                        //LOG("[initHistoryPageInfo] nHistoryCnt = " + nHistoryCnt);
+                        //nTotalPage = ((nHistoryCnt + LIST_CNT - 1) / LIST_CNT);
+                        //LOG("[initHistoryPageInfo] nTotalPage = " + nTotalPage);
+                        LOG_INFO("[send_visitor_picture_inquiry] ProcSuccess()");
+                        visitor_picture_inquiry.SetItem("homeaddr");
+                        strReply_User = visitor_picture_inquiry.GetAttributeVal(0, "user");
+                        strReply_PW = visitor_picture_inquiry.GetAttributeVal(0, "passwd");
+
+                        visitor_picture_inquiry.SetItem("inquiry_info");
+                        nHistoryCnt = Integer.parseInt(visitor_picture_inquiry.GetAttributeVal(0, "total"));
+                        LOG("[send_visitor_picture_inquiry] nHistoryCnt = " + nHistoryCnt);
+                        nTotalPage = ((nHistoryCnt + LIST_CNT - 1) / LIST_CNT);
+                        LOG("[send_visitor_picture_inquiry] nTotalPage = " + nTotalPage);
+
+                        int nQuantity = Integer.parseInt(visitor_picture_inquiry.GetAttributeVal(0, "quantity"));
+
+                        mVisitorPictureHistoryInfoTable.clearTable();
+                        mAllVisitorPictureHistoryInfoTable.clearTable();
+
+                        visitor_picture_inquiry.SetItem("visitor_pic");
+
+                        for(int i = 0; i < nQuantity; i++)
+                        {
+                            //LOG_INFO("[send_call_history_inquiry] " + i + " " + call_history_inquiry.GetAttributeVal(i, "event_time"));
+
+                            String strName = visitor_picture_inquiry.GetAttributeVal(i, "filename");
+                            String strPath = visitor_picture_inquiry.GetAttributeVal(i, "path");
+                            String strReply_Path = strPath;
+                            String strTimestamp = visitor_picture_inquiry.GetAttributeVal(i, "time");
+                            String strURI = define.VISITOR_PICTURE_LOCATION + "/" + strName;
+                            LOG_INFO("[send_call_history_inquiry] strURI " + i + " " + strURI);
+                            File VisitorDirectory = new File(define.VISITOR_PICTURE_LOCATION);
+                            if (!VisitorDirectory.exists()) {
+                                VisitorDirectory.mkdirs();
+                            }
+
+                            mVisitorPictureHistoryInfoTable.addVisitorPictureHistoryInfo(String.valueOf(i), strName, "", "", "", strURI, "", strTimestamp);
+
+                            mAllVisitorPictureHistoryInfoTable.addVisitorPictureHistoryInfo(visitor_picture_inquiry.GetAttributeVal(i, "dong"),
+                                    visitor_picture_inquiry.GetAttributeVal(i, "ho"),
+                                    visitor_picture_inquiry.GetAttributeVal(i, "time"),
+                                    visitor_picture_inquiry.GetAttributeVal(i, "path"),
+                                    visitor_picture_inquiry.GetAttributeVal(i, "filename"),
+                                    visitor_picture_inquiry.GetAttributeVal(i, "message")
+                            );
+
+                        }
+
+                        DownloadVisitorPicture mDownloadVisitorPicture = new DownloadVisitorPicture();
+                        mDownloadVisitorPicture.start();
+
+//                        visitor_picture_inquiry.SetItem("ftp_info");
+//                        strReply_User = visitor_access_info.GetAttributeVal(0, "user");
+//                        strReply_PW = visitor_access_info.GetAttributeVal(0, strPass_Key);
+//                        strReply_Path = visitor_access_info.GetAttributeVal(0, "path");
+                        //MainActivity.mCallController.mSIPInterface.requestCallForwardToStun(MainActivity.mCallController.makeCallForwarInfo(strTargetIP));
+
+                        try {
+                            Thread.sleep(1500);
+//                            Thread.sleep(500);
+                        } catch (InterruptedException e) {
+                            e.printStackTrace();
+                        }
+
+                        getHistoryFromDB();
+                    }
+
+                    @Override
+                    public void ProcError() {
+                        LOG_INFO("[send_visitor_picture_inquiry] ProcError()");
+                        //MainActivity.mCallController.mSIPInterface.cancelCallForwardToStun();
+                    }
+
+                    @Override
+                    public void ProcDoing() {
+                        LOG_INFO("[send_visitor_picture_inquiry] ProcDoing()");
+                    }
+                });
+                return true;
+            }
+        } catch (Exception e) {
+            Log.e(TAG, "[Exception] send_visitor_picture_inquiry(String strTargetIP, String strMessage)");
+            e.printStackTrace();
+        }
+        return false;
+    }
+
+    public void setDirEmpty(String dirName){
+        String path = dirName;
+        File dir = new File(path);
+        File[] childFileList = dir.listFiles();
+        if (dir.exists())
+        {
+            for (File childFile : childFileList)
+            {
+                if (childFile.isDirectory())
+                {
+                    setDirEmpty(childFile.getAbsolutePath()); //하위 디렉토리
+                } else {
+                    childFile.delete(); //하위 파일
+                }
+            }
+            //dir.delete();
+        }
+    }
+
     private void getHistoryFromDB() {
         try {
             LOG_DEBUG("[getHistoryFromDB] nCurrentPage = " + nCurrentPage + ", nTotalPage = " + nTotalPage);
@@ -811,9 +1106,9 @@ public class InquiryVisitorPictureHistory extends WpadScreen implements CallEven
                 nCnt = LIST_CNT - ((nStartIndex + (LIST_CNT - 1)) - nHistoryCnt);
             }
 
-            mVisitorPictureHistoryInfoTable.clearTable();
-            mVisitorPictureHistoryInfoTable = MainActivity.mVisitorPictureHistoryManager.getVisitorPictureHistory(nStartIndex - 1, nCnt);
-            if (mVisitorPictureHistoryInfoTable == null) {
+            //mVisitorPictureHistoryInfoTable.clearTable();
+            //mVisitorPictureHistoryInfoTable = MainActivity.mVisitorPictureHistoryManager.getVisitorPictureHistory(nStartIndex - 1, nCnt);
+            if (nHistoryCnt == 0) {
                 BTN_DELETE.setButtonEventOffEnable(R.drawable.btn_visitor_del_disabled);
                 BTN_DELETE_ALL.setButtonEventOffEnable(R.drawable.btn_visitor_all_del_disabled);
                 BTN_PAGE_PREV.setButtonEventOffEnable(R.drawable.btn_back_disabled);
@@ -829,28 +1124,39 @@ public class InquiryVisitorPictureHistory extends WpadScreen implements CallEven
 //                BTN_PAGE_NEXT.setButtonEventOffEnable(R.drawable.btn_next_disabled);
 //            }
 
-            int nInfoCnt = mVisitorPictureHistoryInfoTable.getCnt();
+            int nInfoCnt = 0;
+
+            int iListCount = (nCurrentPage-1) * 6;
+
+            if (nCurrentPage == nTotalPage)
+            {
+                nInfoCnt = nHistoryCnt - iListCount;
+            }
+            else
+                nInfoCnt = 6;
+
             nActivatedListCnt = nInfoCnt;
             LOG_DEBUG("[getHistoryFromDB] nInfoCnt = " + nInfoCnt);
+            
             for (int i = 0; i < nInfoCnt; i++) {
                 mLIST_VALUE[i] = new LIST_VALUE();
                 mLIST_VALUE[i].CHECK = false;
                 if (i < nInfoCnt) {
-                    mLIST_VALUE[i].ID = mVisitorPictureHistoryInfoTable.getVisitorPictureHistoryInfo(i).getID();
+                    mLIST_VALUE[i].ID = mVisitorPictureHistoryInfoTable.getVisitorPictureHistoryInfo(i+iListCount).getID();
                     // 방문자 사진의 시간은 DB 추출방식에서 File 추출방식으로 변경한다. (JEFF, 2021.05.15)
                     // 기존: 방문자 내역 DB에 저장된 Timestamp를 표시 -> 실제 사진 저장시간과 상이하여, 파일의 저장시간을 이용하는 모바일 연동간에 시차가 발생한다.
                     // 개선: 방문자 사진 파일명에 명기된 파일저장시간을 추출하여 표시 -> 월패드와 모바일에 조회시 모두 동일한 시간으로 조회된다.
                     if (ConfigValues.bEasyModeUse) {
-                        mLIST_VALUE[i].INFO = makeUnitName(mVisitorPictureHistoryInfoTable.getVisitorPictureHistoryInfo(i).getName()) + "\n"
-                                + makeUnitTimestampFromFile(mVisitorPictureHistoryInfoTable.getVisitorPictureHistoryInfo(i).getURI());
+                        mLIST_VALUE[i].INFO = makeUnitName(mVisitorPictureHistoryInfoTable.getVisitorPictureHistoryInfo(i+iListCount).getName()) + "\n"
+                                + makeUnitTimestampFromFile(mVisitorPictureHistoryInfoTable.getVisitorPictureHistoryInfo(i+iListCount).getTimestamp());
                     }
                     else {
-                        mLIST_VALUE[i].INFO = makeUnitName(mVisitorPictureHistoryInfoTable.getVisitorPictureHistoryInfo(i).getName())
-                                + makeUnitTimestampFromFile(mVisitorPictureHistoryInfoTable.getVisitorPictureHistoryInfo(i).getURI());
+                        mLIST_VALUE[i].INFO = makeUnitName(mVisitorPictureHistoryInfoTable.getVisitorPictureHistoryInfo(i+iListCount).getName())
+                                + makeUnitTimestampFromFile(mVisitorPictureHistoryInfoTable.getVisitorPictureHistoryInfo(i+iListCount).getTimestamp());
                     }
-                    mLIST_VALUE[i].URI = mVisitorPictureHistoryInfoTable.getVisitorPictureHistoryInfo(i).getURI();
-                    mLIST_VALUE[i].NEW = mVisitorPictureHistoryInfoTable.getVisitorPictureHistoryInfo(i).getChecked();
-                    mLIST_VALUE[i].THIEF = mVisitorPictureHistoryInfoTable.getVisitorPictureHistoryInfo(i).getThief();
+                    mLIST_VALUE[i].URI = mVisitorPictureHistoryInfoTable.getVisitorPictureHistoryInfo(i+iListCount).getURI();
+                    mLIST_VALUE[i].NEW = "";
+                    mLIST_VALUE[i].THIEF = "";
                     nStartIndex++;
                 } else {
                     mLIST_VALUE[i].ID = "";
@@ -872,7 +1178,7 @@ public class InquiryVisitorPictureHistory extends WpadScreen implements CallEven
                 drawVisitorPicture(i, mLIST_VALUE[i].URI);
             }
 
-            if (nInfoCnt > 0) MainActivity.mVisitorPictureHistoryManager.updateNewCheck(mLIST_VALUE[nInfoCnt - 1].ID, mLIST_VALUE[0].ID);
+            //if (nInfoCnt > 0) MainActivity.mVisitorPictureHistoryManager.updateNewCheck(mLIST_VALUE[nInfoCnt - 1].ID, mLIST_VALUE[0].ID);
             showCheckBox(false);
             strText_PageNo = nCurrentPage + "/" + nTotalPage;
             TXT_PAGE.setText(strText_PageNo);
@@ -888,11 +1194,12 @@ public class InquiryVisitorPictureHistory extends WpadScreen implements CallEven
     private void initHistoryPageInfo() {
         try {
             LOG("[initHistoryPageInfo]");
-            nHistoryCnt = MainActivity.mVisitorPictureHistoryManager.getHistoryCnt(Declare.DBInfo.TABLE_NAME_HISTORY_VISITORPICTURE);
-            LOG("[initHistoryPageInfo] nHistoryCnt = " + nHistoryCnt);
-            nTotalPage = ((nHistoryCnt + LIST_CNT - 1) / LIST_CNT);
-            LOG("[initHistoryPageInfo] nTotalPage = " + nTotalPage);
+            //nHistoryCnt = MainActivity.mVisitorPictureHistoryManager.getHistoryCnt(Declare.DBInfo.TABLE_NAME_HISTORY_VISITORPICTURE);
+            //LOG("[initHistoryPageInfo] nHistoryCnt = " + nHistoryCnt);
+            //nTotalPage = ((nHistoryCnt + LIST_CNT - 1) / LIST_CNT);
+            //LOG("[initHistoryPageInfo] nTotalPage = " + nTotalPage);
             nCurrentPage = 1;
+            send_visitor_picture_inquiry("1", "60");
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
         } catch (Exception e) {

Разница между файлами не показана из-за своего большого размера
+ 324 - 374
WallPadCall/src/main/java/kr/co/icontrols/wallpadcall/screen/TalkFront.java


+ 164 - 8
WallPadCall/src/main/java/kr/co/icontrols/wallpadcall/screen/TalkLobby.java

@@ -53,7 +53,10 @@ import kr.co.icontrols.wallpadcall.declare.Global.ConfigValues;
 import kr.co.icontrols.wallpadcall.declare.Global.DOORLOCKTYPE;
 import kr.co.icontrols.wallpadcall.declare.ID;
 import kr.co.icontrols.wallpadcall.imap.Request_check_sip_activation;
+import kr.co.icontrols.wallpadcall.imap.Request_lobby_capture;
 import kr.co.icontrols.wallpadcall.imap.Request_lobby_open;
+import kr.co.icontrols.wallpadcall.imap.Request_start_talking;
+import kr.co.icontrols.wallpadcall.imap.Request_stop_talking;
 import kr.co.icontrols.wallpadsupport.WpadImageView;
 import kr.co.icontrols.wallpadsupport.WpadImageView.TOUCH_KIND;
 import kr.co.icontrols.wallpadsupport.WpadScale;
@@ -268,6 +271,9 @@ public class TalkLobby extends WpadScreen implements CallEventListener, MainEven
 //            bEnableVisitorPic = false;   // 부재중 방문객 사진 저장은 임시로 삭제한다.
 
             MainActivity.mIOInterface.ctrlPopupGUI(false);
+            MainActivity.mCallController.mSIPInterface.videoSet(true, false, true);
+
+            sendHandlerMsgDelayed(HANDLERMSG.ENABLE_SAVE_VISITORPICTURE, 0, 0, null, 3000);
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
         } catch (Exception e) {
@@ -297,6 +303,7 @@ public class TalkLobby extends WpadScreen implements CallEventListener, MainEven
         super.onClose();
         try {
             LOG_INFO("[onClose]");
+            MainActivity.mIOInterface.ctrlPopupGUI(true);
             if (MainActivity.mIOInterface != null) MainActivity.mIOInterface.ctrlWallPadLED_Call(false);
             nSelectedFilter = 0;
             sendReliefFilterSelectBR(nSelectedFilter);
@@ -360,15 +367,21 @@ public class TalkLobby extends WpadScreen implements CallEventListener, MainEven
                     } else if (nID == ID.SCREEN.TALKLOBBY.ELEMENT.BUTTON.END) {
                         bEnableVisitorPic = false;
                         doEnd();
+                        send_stop_talking_request(RemoteIDInfo.strIP);
                     } else if (nID == ID.SCREEN.TALKLOBBY.ELEMENT.BUTTON.SAVE_PICTURE) {
-                        String strVisitorPicResult = MainActivity.mCallController.saveVisitorPicture(CALLTYPE.LOBBY, MainActivity.mCallController.mCallInfo.getLOBBY(), RemoteIDInfo.strSIPID, true, false, false);
-                        LOG_INFO("[onTouchEvent] strVisitorPicResult [" + strVisitorPicResult + "]");
+                        //String strVisitorPicResult = MainActivity.mCallController.saveVisitorPicture(CALLTYPE.LOBBY, MainActivity.mCallController.mCallInfo.getLOBBY(), RemoteIDInfo.strSIPID, true, false, false);
+                        //LOG_INFO("[onTouchEvent] strVisitorPicResult [" + strVisitorPicResult + "]");
+
+                        send_lobby_capture_request(RemoteIDInfo.strIP);
+
                         enableSavePicBTN(false);
                         sendHandlerMsgDelayed(HANDLERMSG.ENABLE_SAVE_VISITORPICTURE, 0, 0, null, 3000);
                     } else if (nID == ID.SCREEN.TALKLOBBY.ELEMENT.BUTTON.DOOROPEN) {
                         if (!bSentiMAP) {
                             sendHandlerMsg(HANDLERMSG.HIDE_LOBBYVIDEO, 0, 0, null); // 문열림으로 통화 종료시 로비 영상 노이즈가 생기므로 영상을 GUI 아래로 내림
                             doDoorOpen();
+                            //doEnd();
+                            //send_stop_talking_request(RemoteIDInfo.strIP);
                         }
                     } else if (ID.SCREEN.TALKLOBBY.ELEMENT.BUTTON.RELIEF_FILTER_01 <= nID && nID <= ID.SCREEN.TALKLOBBY.ELEMENT.BUTTON.RELIEF_FILTER_04) {
                         LOG_INFO("[onTouchEvent] [RELIEF_FILTER] BUTTON");
@@ -505,7 +518,7 @@ public class TalkLobby extends WpadScreen implements CallEventListener, MainEven
                 else if (eCallStatus == CALLSTATUS.END) {
                     bEnableVisitorPic = false;
                     bReliefCallInit = false;
-                    Global.stopMelodyRepeat();
+                    //Global.stopMelodyRepeat();
                     MainActivity.mCallController.setTalkPath(CALLPATH.NORMAL);
                     ((MainActivity) mContext).finishPopUp(ID.POPUP.POPUP_ALL);
                     ((MainActivity) mContext).finishManual(ID.MANUAL.MANUAL_ALL);
@@ -953,9 +966,10 @@ public class TalkLobby extends WpadScreen implements CallEventListener, MainEven
 
     private void doTalk(CALLOWNER eCallOwner) {
         try {
-            LOG_INFO("[doTalk] eCallOwner [" + eCallOwner + "], nSelectedFilter [" + nSelectedFilter + "]");
+            LOG_INFO("[doTalk] eCallOwner [" + eCallOwner + "], nSelectedFilter [" + nSelectedFilter + "]" + "RemoteIDInfo.strIP [" + RemoteIDInfo.strIP + "]");
             if (MainActivity.mCallController.mCallInfo.getLOBBY() == CALLSTATUS.CALLED) {
-                MainActivity.mCallController.acceptMoIPCall(false);
+                send_start_talking_request(RemoteIDInfo.strIP);
+               //MainActivity.mCallController.acceptMoIPCall(false);
                 MainActivity.mCallController.mCallInfo.setCallOwner(eCallOwner);
             } else {
                 LOG_INFO("[doTalk] Invalid CALLSTATUS [" + MainActivity.mCallController.mCallInfo.getLOBBY() + "]");
@@ -974,10 +988,28 @@ public class TalkLobby extends WpadScreen implements CallEventListener, MainEven
             if (MainActivity.mCallController.mCallInfo.getIDLECnt() != MainActivity.mCallController.mCallInfo.IDLECNT_MAX) {
                 LOG_INFO("[doEnd] CALLSTATUS [" + MainActivity.mCallController.mCallInfo.getLOBBY() + "]");
                 sendHandlerMsg(HANDLERMSG.HIDE_LOBBYVIDEO, 0, 0, null); // 통화 종료시 로비 영상 노이즈가 생기므로 영상을 GUI 아래로 내림
+
                 if (MainActivity.mCallController.mCallInfo.getLOBBY() == CALLSTATUS.CALLED) {
                     Global.change1stCallLogAction(CALLACTION.REJECT);
+                    //Global.stopMelodyRepeat();
+                    //MainActivity.mCallController.rejectMoIPCall();
+
+                    bEnableVisitorPic = false;
+                    bReliefCallInit = false;
                     Global.stopMelodyRepeat();
-                    MainActivity.mCallController.rejectMoIPCall();
+                    MainActivity.mCallController.setTalkPath(CALLPATH.NORMAL);
+                    ((MainActivity) mContext).displayRemoteID(null);
+                    //MainActivity.mSound.PlayMent(SND.setting.RETRY_ACTION);
+                    MainActivity.mCallController.mCallInfo.setCallStatus(CALLTYPE.LOBBY, CALLSTATUS.IDLE);
+                    MainActivity.mCallController.stop1stCallTimer();
+                    MainActivity.mCallController.stop2ndCallTimer();
+                    ((MainActivity) mContext).finishPopUp(ID.POPUP.POPUP_NOTICE_SUBPHONETALK);
+                    Global.change1stCallLogAction(CALLACTION.REJECT);
+                    Global.add1stCallHistoryInfoFinal();
+                    nSelectedFilter = 0;
+                    sendReliefFilterSelectBR(nSelectedFilter);
+                    MainActivity.mCallController.MultiCallScenarioManager();
+                    //send_stop_talking_request(RemoteIDInfo.strIP);
                 }
                 else if (MainActivity.mCallController.mCallInfo.getLOBBY() == CALLSTATUS.TALKING) {
                     if (MainActivity.mCallController.mCallInfo.getCallOwner() == CALLOWNER.MOBILE)
@@ -1033,6 +1065,7 @@ public class TalkLobby extends WpadScreen implements CallEventListener, MainEven
                 Global.change1stCallLogAction(CALLACTION.DOOR);
             } else if (MainActivity.mCallController.mCallInfo.getLOBBY() == CALLSTATUS.TALKING) {
 //                Global.changeVolumeMoIPMode(CALLTYPE.NONE);
+                Global.stopMelodyRepeat();
                 if (!send_lobby_open_request(RemoteIDInfo.strIP)) {
                     MainActivity.mSound.Play(SND.setting.RETRY_ACTION);
                 }
@@ -1439,7 +1472,7 @@ public class TalkLobby extends WpadScreen implements CallEventListener, MainEven
 //                        if (MainActivity.mCallController.getTalkPath() == CALLPATH.NORMAL) {
 //                            MainActivity.mIOInterface.setMICGain(0);   // 월패드에 출력되는 문열림 멘트가 월패드 마이크를 통해 로비폰에 전달되므로, 멘트 출력전에 Micgain을 0으로 설정한다.
 //                        }
-                        MainActivity.mCallController.setTalkPath(CALLPATH.NORMAL);
+                        //MainActivity.mCallController.setTalkPath(CALLPATH.NORMAL);
 //                        MainActivity.mSound.Play(SND.mode.OPENDOOR);
                         mPathCheckHandler.sendEmptyMessage(2); // 통화패스 Normal로 변경 확인 후 멘트 출력 seulki
 
@@ -1457,6 +1490,7 @@ public class TalkLobby extends WpadScreen implements CallEventListener, MainEven
 //                            BTN_RELIEF_FILTER_03.setButtonEventOffEnable(R.drawable.btn_filter_3_normal);
 //                            BTN_RELIEF_FILTER_04.setButtonEventOffEnable(R.drawable.btn_filter_4_normal);
                         }
+                        doEnd();
                     }
 
                     @Override
@@ -1485,6 +1519,44 @@ public class TalkLobby extends WpadScreen implements CallEventListener, MainEven
         return false;
     }
 
+    private boolean send_lobby_capture_request(String strTargetIP) {
+        LOG_INFO("[send_lobby_capture_request] strTargetIP [" + strTargetIP + "]");
+
+        try {
+            Request_lobby_capture lobby_capture = new Request_lobby_capture(mContext);
+            if (lobby_capture.send_lobby_capture(strTargetIP, null)) {
+                lobby_capture.setResultCtrl(new RetProci() {
+
+                    @Override
+                    public void ProcSuccess() {
+                        LOG_INFO("[send_lobby_capture_request] ProcSuccess()");
+
+                    }
+
+                    @Override
+                    public void ProcError() {
+                        LOG_INFO("[send_lobby_capture_request] ProcError()");
+
+                    }
+
+                    @Override
+                    public void ProcDoing() {
+                        LOG_INFO("[send_lobby_capture_request] ProcDoing()");
+
+                    }
+                });
+                return true;
+            }
+        } catch (RuntimeException re) {
+            LogUtil.errorLogInfo("", TAG, re);
+        } catch (Exception e) {
+            Log.e(TAG, "[Exception] send_lobby_capture_request(String strTargetIP, String strMessage)");
+            //e.printStackTrace();
+            LogUtil.errorLogInfo("", TAG, e);
+        }
+        return false;
+    }
+
     // 방문자 사진 자동 저장
     boolean bEnableVisitorPic = false;
 
@@ -1551,6 +1623,81 @@ public class TalkLobby extends WpadScreen implements CallEventListener, MainEven
         }
     }
 
+    private boolean send_stop_talking_request(String strTargetIP) {
+        try {
+            LOG_INFO("[send_stop_talking_request] strTargetIP() " + strTargetIP);
+            //Request_start_talking request_start_talking = new Request_start_talking(mContext);
+            Request_stop_talking request_stop_talking = new Request_stop_talking(mContext);
+            if (request_stop_talking.send_stop_talking(strTargetIP, null)) {
+                request_stop_talking.setResultCtrl(new RetProci() {
+
+                    @Override
+                    public void ProcSuccess() {
+                        LOG_INFO("[send_stop_talking_request] ProcSuccess()");
+                        //MainActivity.mCallController.mSIPInterface.requestCallForwardToStun(MainActivity.mCallController.makeCallForwarInfo(strTargetIP));
+                    }
+
+                    @Override
+                    public void ProcError() {
+                        LOG_INFO("[send_stop_talking_request] ProcError()");
+                        //MainActivity.mCallController.mSIPInterface.cancelCallForwardToStun();
+                    }
+
+                    @Override
+                    public void ProcDoing() {
+                        LOG_INFO("[send_stop_talking_request] ProcDoing()");
+                    }
+                });
+                return true;
+            }
+
+        } catch (Exception e) {
+            Log.e(TAG, "[Exception] send_check_sip_activation_request(String strTargetIP, String strMessage)");
+            e.printStackTrace();
+            MainActivity.mCallController.mSIPInterface.cancelCallForwardToStun();
+        }
+        return false;
+
+
+    }
+
+
+    private boolean send_start_talking_request(String strTargetIP) {
+        try {
+            LOG_INFO("[send_start_talking_request] strTargetIP() "+ strTargetIP);
+            Request_start_talking request_start_talking = new Request_start_talking(mContext);
+            if (request_start_talking.send_start_talking(strTargetIP, null)) {
+                request_start_talking.setResultCtrl(new RetProci() {
+
+                    @Override
+                    public void ProcSuccess() {
+                        LOG_INFO("[send_start_talking_request] ProcSuccess()");
+                        //MainActivity.mCallController.mSIPInterface.requestCallForwardToStun(MainActivity.mCallController.makeCallForwarInfo(strTargetIP));
+                    }
+
+                    @Override
+                    public void ProcError() {
+                        LOG_INFO("[send_start_talking_request] ProcError()");
+                        //MainActivity.mCallController.mSIPInterface.cancelCallForwardToStun();
+                    }
+
+                    @Override
+                    public void ProcDoing() {
+                        LOG_INFO("[send_start_talking_request] ProcDoing()");
+                    }
+                });
+                return true;
+            }
+        } catch (Exception e) {
+            Log.e(TAG, "[Exception] send_check_sip_activation_request(String strTargetIP, String strMessage)");
+            e.printStackTrace();
+            MainActivity.mCallController.mSIPInterface.cancelCallForwardToStun();
+        }
+        return false;
+
+
+    }
+
     private boolean send_check_sip_activation_request(final String strTargetIP) {
         try {
             Request_check_sip_activation check_sip_activation = new Request_check_sip_activation(mContext);
@@ -2109,7 +2256,14 @@ public class TalkLobby extends WpadScreen implements CallEventListener, MainEven
                 }
             }
             else if (msg.what == 3) {
-                Log.d(TAG, "[mPathCheckHandler.handleMessage] Handler finish!! PATH [NORMAL] -> play dooropen ment!");
+                Log.d(TAG, "[stopMelodyRepeat.handleMessage] Handler finish!! PATH [NORMAL] -> play dooropen ment!");
+                try {
+
+                    Thread.sleep(3000);
+                } catch (InterruptedException e) {
+                    //e.printStackTrace();
+                    LogUtil.errorLogInfo("", TAG, e);
+                }
                 int nMentDuration = MainActivity.mSound.PlayMent(SND.mode.OPENDOOR);
                 try {
                     Log.d(TAG, "[mPathCheckHandler.handleMessage] nMentDuration -> " + nMentDuration);
@@ -2126,8 +2280,10 @@ public class TalkLobby extends WpadScreen implements CallEventListener, MainEven
     private void finishWallpadCallApp() {
         try {
             doEnd();
+            //send_stop_talking_request(RemoteIDInfo.strIP);
             if (MainActivity.mCallController.mCallInfo.getPSTNCallHold()) return;
             ((MainActivity) mContext).finishWallPadCall();
+
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
         } catch (Exception e) {

+ 435 - 117
WallPadCall/src/main/java/kr/co/icontrols/wallpadcall/screen/TalkResidence.java

@@ -24,6 +24,8 @@ import com.util.LogUtil;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 
 import kr.co.icontrols.callengine.engine.CallController.CallEventListener;
 import kr.co.icontrols.callengine.engine.CallManager.CALLEVENTTYPE;
@@ -51,7 +53,9 @@ import kr.co.icontrols.wallpadcall.declare.Global.CALLDIRECTION;
 import kr.co.icontrols.wallpadcall.declare.Global.CALLRESULT;
 import kr.co.icontrols.wallpadcall.declare.Global.ConfigValues;
 import kr.co.icontrols.wallpadcall.declare.ID;
+import kr.co.icontrols.wallpadcall.imap.Request_call_history_save;
 import kr.co.icontrols.wallpadcall.imap.Request_check_sip_activation;
+import kr.co.icontrols.wallpadcall.imap.Request_visitor_picture_delete;
 import kr.co.icontrols.wallpadsupport.Version;
 import kr.co.icontrols.wallpadsupport.WpadImageView;
 import kr.co.icontrols.wallpadsupport.WpadImageView.TOUCH_KIND;
@@ -100,21 +104,23 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
     WpadImageView BTN_PORTRAIT;
     WpadImageView BTN_DELETE;
     WpadImageView BTN_DIVISION;
-    WpadImageView[] BTN_TENKEY = new WpadImageView[12];
+    WpadImageView[] BTN_TENKEY = new WpadImageView[6];
     int[][] TENKEYS = {
-            {R.drawable.btn_num_1_normal, R.drawable.btn_num_1_pressed},
-            {R.drawable.btn_num_2_normal, R.drawable.btn_num_2_pressed},
-            {R.drawable.btn_num_3_normal, R.drawable.btn_num_3_pressed},
-            {R.drawable.btn_num_4_normal, R.drawable.btn_num_4_pressed},
-            {R.drawable.btn_num_5_normal, R.drawable.btn_num_5_pressed},
-            {R.drawable.btn_num_6_normal, R.drawable.btn_num_6_pressed},
-            {R.drawable.btn_num_7_normal, R.drawable.btn_num_7_pressed},
-            {R.drawable.btn_num_8_normal, R.drawable.btn_num_8_pressed},
-            {R.drawable.btn_num_9_normal, R.drawable.btn_num_9_pressed},
-            {R.drawable.btn_num_dong_normal, R.drawable.btn_num_dong_pressed},
-            {R.drawable.btn_num_0_normal, R.drawable.btn_num_0_pressed},
-            {R.drawable.btn_num_ho_normal, R.drawable.btn_num_ho_pressed}
+            {R.drawable.btn_floor_1_normal, R.drawable.btn_floor_1_pressed, R.drawable.btn_floor_1_selected}, //10.1.1.1
+            {R.drawable.btn_floor_2_normal, R.drawable.btn_floor_2_pressed, R.drawable.btn_floor_2_selected}, //10.1.2.1
+            {R.drawable.btn_floor_3_normal, R.drawable.btn_floor_3_pressed, R.drawable.btn_floor_3_selected}, //10.1.3.1
+            {R.drawable.btn_main_room_normal, R.drawable.btn_main_room_pressed, R.drawable.btn_main_room_selected}, //10.1.3.2
+            {R.drawable.btn_driver_normal, R.drawable.btn_driver_pressed, R.drawable.btn_driver_selected}, //10.1.1.3
+            {R.drawable.btn_maid_normal, R.drawable.btn_maid_pressed, R.drawable.btn_maid_selected}, //10.1.1.2
+            {R.drawable.btn_kitchen_normal, R.drawable.btn_kitchen_pressed, R.drawable.btn_kitchen_selected}, //10.1.2.2
+            {R.drawable.btn_floor_1_normal, R.drawable.btn_floor_1_normal, R.drawable.btn_floor_1_normal},
+            {R.drawable.btn_floor_1_normal, R.drawable.btn_floor_1_normal, R.drawable.btn_floor_1_normal},
+            {R.drawable.btn_floor_1_normal, R.drawable.btn_floor_1_normal, R.drawable.btn_floor_1_normal},
+            {R.drawable.btn_floor_1_normal, R.drawable.btn_floor_1_normal, R.drawable.btn_floor_1_normal},
+            {R.drawable.btn_floor_1_normal, R.drawable.btn_floor_1_normal, R.drawable.btn_floor_1_normal}
     };
+
+    String[] strEndIP = {"10.1.1.1", "10.1.2.1", "10.1.3.1", "10.1.3.2", "10.1.1.3", "10.1.1.2", "10.1.2.2"};
     WpadTextView TXT_RESIDENCEINFO;   // 세대정보
     WpadTextView TXT_INSTRUCTION;   // 안내문구
 
@@ -124,6 +130,9 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
     SeekBar SEEKBAR_VOLUME;
     WpadTextView TXT_VOLUME_LEVEL;
 
+    int m_nIDCnt_type = 0;
+    boolean m_bCallStateThreadStop = true;
+
     class TextResources {
         static final String strDong = "동";
         static final String strHo = "호";
@@ -144,6 +153,8 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
     int MINLENGTH_HO = 3;
     int KEYBALANCE = ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_01 - 1;
 
+
+
     int nCurrentVolume = 0;
 
     boolean bshowMyVideo = false;
@@ -162,21 +173,22 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
 
             IMG_RESIDENCE_BACKGROUND = new WpadImageView(context, TOUCH_KIND.NONE, 724, 544, R.drawable.bg_residence, 0, ID.SCREEN.TALKRESIDENCE.ELEMENT.IMAGE.BACKGROUND);
             ViewRegistration(layout, IMG_RESIDENCE_BACKGROUND, Common.ImgPosition.GetX(142), Common.ImgPosition.GetY(110));
+            IMG_RESIDENCE_BACKGROUND.setVisibility(View.INVISIBLE);
 
             IMG_VIDEO_MODULE = new WpadImageView(context, TOUCH_KIND.NONE, 720, 540, R.drawable.image_neig, 0, ID.SCREEN.TALKRESIDENCE.ELEMENT.IMAGE.VIDEO_MODULE);
             ViewRegistration(layout, IMG_VIDEO_MODULE, Common.ImgPosition.GetX(144), Common.ImgPosition.GetY(112));
-
+            IMG_VIDEO_MODULE.setVisibility(View.INVISIBLE);
             IMG_VOLUME = new WpadImageView(context, TOUCH_KIND.NONE, 40, 40, R.drawable.bar_icon_sound, 0, ID.SCREEN.TALKRESIDENCE.ELEMENT.IMAGE.VOLUME);
-            ViewRegistration(layout, IMG_VOLUME, Common.ImgPosition.GetX(454), Common.ImgPosition.GetY(707));
+            ViewRegistration(layout, IMG_VOLUME, Common.ImgPosition.GetX(318), Common.ImgPosition.GetY(707));
 
             TXT_VOLUME_LEVEL = new WpadTextView(context, false, 40, 40, Gravity.CENTER, Color.WHITE, Common.fontsize._30, false, ID.SCREEN.TALKFRONT.ELEMENT.TEXT.VOLUME_LEVEL);
-            ViewRegistration(layout, TXT_VOLUME_LEVEL, Common.ImgPosition.GetX(785), Common.ImgPosition.GetY(705));
+            ViewRegistration(layout, TXT_VOLUME_LEVEL, Common.ImgPosition.GetX(644), Common.ImgPosition.GetY(705));
 
             if (WpadScale.getWidthPixels() == WpadScale.DEFAULT_WIDTH_PIXELS) {
                 LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                 LinearLayout volumeLayout = (LinearLayout) inflater.inflate(R.layout.volume_seekbar_1280, null);
                 LayoutParams volumeParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
-                int volMarginLeft = WpadScale.getWidth(Common.ImgPosition.GetX(507));
+                int volMarginLeft = WpadScale.getWidth(Common.ImgPosition.GetX(359));
                 int volMarginTop = WpadScale.getHeight(Common.ImgPosition.GetY(707));
                 volumeParams.setMargins(volMarginLeft, volMarginTop, 0, 0);
                 volumeLayout.setLayoutParams(volumeParams);
@@ -189,7 +201,7 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
                 LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                 LinearLayout volumeLayout = (LinearLayout) inflater.inflate(R.layout.volume_seekbar, null);
                 LayoutParams volumeParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
-                int volMarginLeft = WpadScale.getWidth(Common.ImgPosition.GetX(502));
+                int volMarginLeft = WpadScale.getWidth(Common.ImgPosition.GetX(366));
                 int volMarginTop = WpadScale.getHeight(Common.ImgPosition.GetY(703));
                 volumeParams.setMargins(volMarginLeft, volMarginTop, 0, 0);
                 volumeLayout.setLayoutParams(volumeParams);
@@ -199,18 +211,36 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
                 layout.addView(volumeLayout);
             }
 
-            int nTenKeyGuide_X = Common.ImgPosition.GetX(460);
-            int nTenKeyGuide_Y = Common.ImgPosition.GetY(112);
+            int nTenKeyGuide_X = Common.ImgPosition.GetX(142);
+            int nTenKeyGuide_Y = Common.ImgPosition.GetY(148);
             int nIDCnt = 0;
-            for (int i = 0; i < 4; i++) {
+
+            //String[] strEndIP = {"10.1.1.1", "10.1.1.2", "10.1.1.3", "10.1.1.4", "10.1.1.5", "10.1.1.6", "10.1.1.7"};
+
+
+            int nIDCnt_img = -1;
+            for(int i = 0; i < strEndIP.length; i++)
+            {
+                if (ConfigValues.strDeviceIPaddress.equals(strEndIP[i])) {
+                    m_nIDCnt_type = i;
+                    break;
+                }
+            }
+
+            for (int i = 0; i < 2; i++) {
                 for (int j = 0; j < 3; j++) {
-                    BTN_TENKEY[nIDCnt] = new WpadImageView(context, TOUCH_KIND.BUTTON, 132, 132, TENKEYS[nIDCnt][0], TENKEYS[nIDCnt][1], ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_01 + nIDCnt);
+                    if(m_nIDCnt_type == nIDCnt)
+                        nIDCnt_img +=2;
+                    else
+                        nIDCnt_img++;
+                    BTN_TENKEY[nIDCnt] = new WpadImageView(context, TOUCH_KIND.BUTTON, 236, 230, TENKEYS[nIDCnt_img][0], TENKEYS[nIDCnt_img][1], ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_01 + nIDCnt_img);
                     ViewRegistration(layout, BTN_TENKEY[nIDCnt], nTenKeyGuide_X, nTenKeyGuide_Y);
-                    nTenKeyGuide_X += 136;
+
+                    nTenKeyGuide_X += 244;
                     nIDCnt++;
                 }
-                nTenKeyGuide_X = Common.ImgPosition.GetX(460);
-                nTenKeyGuide_Y += 136;
+                nTenKeyGuide_X = Common.ImgPosition.GetX(142);
+                nTenKeyGuide_Y += 238;
             }
 
             LOG("[TalkResidence] bWallPadCameraEnable [" + ConfigValues.bWallPadCameraEnable + "]");
@@ -236,25 +266,27 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
             }
 
             // 부분 임대세대 적용여부 판단
-            if (ConfigValues.bEnableHouseDivision) {
-                Log.d(TAG, "[TalkResidenceScreen] bEnableHouseDivision TRUE 분리세대");
-                BTN_DELETE = new WpadImageView(context, TOUCH_KIND.BUTTON_LC, 154, 132, R.drawable.btn_num_del_normal2, R.drawable.btn_num_del_pressed2, ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.DELETE);
-                ViewRegistration(layout, BTN_DELETE, Common.ImgPosition.GetX(144), Common.ImgPosition.GetY(520));
-
-                BTN_DIVISION = new WpadImageView(context, TOUCH_KIND.BUTTON, 154, 132, R.drawable.btn_num_separation_normal, R.drawable.btn_num_separation_pressed, ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.DIVISION);
-                ViewRegistration(layout, BTN_DIVISION, Common.ImgPosition.GetX(302), Common.ImgPosition.GetY(520));
-            } else {
-                BTN_DELETE = new WpadImageView(context, TOUCH_KIND.BUTTON_LC, 312, 132, R.drawable.btn_num_del_normal, R.drawable.btn_num_del_pressed, ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.DELETE);
-                ViewRegistration(layout, BTN_DELETE, Common.ImgPosition.GetX(144), Common.ImgPosition.GetY(520));
-            }
-
+//            if (ConfigValues.bEnableHouseDivision) {
+//                Log.d(TAG, "[TalkResidenceScreen] bEnableHouseDivision TRUE 분리세대");
+//                BTN_DELETE = new WpadImageView(context, TOUCH_KIND.BUTTON_LC, 154, 132, R.drawable.btn_num_del_normal2, R.drawable.btn_num_del_pressed2, ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.DELETE);
+//                ViewRegistration(layout, BTN_DELETE, Common.ImgPosition.GetX(144), Common.ImgPosition.GetY(520));
+//
+//                BTN_DIVISION = new WpadImageView(context, TOUCH_KIND.BUTTON, 154, 132, R.drawable.btn_num_separation_normal, R.drawable.btn_num_separation_pressed, ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.DIVISION);
+//                ViewRegistration(layout, BTN_DIVISION, Common.ImgPosition.GetX(302), Common.ImgPosition.GetY(520));
+//            } else {
+//                BTN_DELETE = new WpadImageView(context, TOUCH_KIND.BUTTON_LC, 312, 132, R.drawable.btn_num_del_normal, R.drawable.btn_num_del_pressed, ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.DELETE);
+//                ViewRegistration(layout, BTN_DELETE, Common.ImgPosition.GetX(144), Common.ImgPosition.GetY(520));
+//            }
+//
             TXT_RESIDENCEINFO = new WpadTextView(context, false, 292, 284, Gravity.LEFT, context.getResources().getColor(R.color.orange), Common.fontsize._46, false, ID.SCREEN.TALKRESIDENCE.ELEMENT.TEXT.RESIDENCEINFO);
             ViewRegistration(layout, TXT_RESIDENCEINFO, Common.ImgPosition.GetX(155), Common.ImgPosition.GetY(111));
             TXT_RESIDENCEINFO.setText(strTXT_RESIDENCEINFO);
+            //TXT_RESIDENCEINFO.setVisibility(View.GONE);
 
             TXT_INSTRUCTION = new WpadTextView(context, false, 317, 364, Gravity.CENTER, context.getResources().getColor(R.color.orange), Common.fontsize._52, true, ID.SCREEN.TALKRESIDENCE.ELEMENT.TEXT.INSTRUCTION);
             ViewRegistration(layout, TXT_INSTRUCTION, Common.ImgPosition.GetX(142), Common.ImgPosition.GetY(255));
             TXT_INSTRUCTION.setText(strTXT_INSTRUCTION);
+            //TXT_INSTRUCTION.setVisibility(View.GONE);
 
             displayScreenValues();
             sendHandlerMsg(HANDLERMSG.PROC_ADDCALL, 0, 0);
@@ -289,7 +321,7 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
             if (MainActivity.bFFMPEGEnable) ((MainActivity)mContext).showRemoteVideo(false, false);
 
             MainActivity.mCallController.mVideoJNI.setDecoderInfo_V40(116, 85, 576, 405); // 세대통화시 영상 좌표 재설정
-            MainActivity.mIOInterface.ctrlPopupGUI_Resi(false, bshowMyVideo); // 세대통화 시작시 초기화
+            //MainActivity.mIOInterface.ctrlPopupGUI_Resi(false, bshowMyVideo); // 세대통화 시작시 초기화
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
         } catch (Exception e) {
@@ -324,6 +356,7 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
                 mPathCheckHandler.removeMessages(0);
                 mPathCheckHandler.removeMessages(1);
             }
+            mbCallState = false;
             initCallVariables();
             MainActivity.mCallController.mSIPInterface.videoSet(false, false, false);
             MainActivity.mCallController.selectVideoSourceToSubPhone(CALLTYPE.NONE, true);
@@ -436,19 +469,25 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
                     }
                     else if (ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_01 <= nID && nID <= ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_09) {
                         int nPressedNum = nID - KEYBALANCE;
-                        if (Global.TargetInputStep == TARGETINFOINPUTSTEP.DONG) {
-                            RemoteIDInfo.strDong += nPressedNum;
-                            if (RemoteIDInfo.strDong.length() > MAXLENGTH_DONG) {
-                                RemoteIDInfo.strDong = RemoteIDInfo.strDong.substring(1, 5);
-                            }
-                            playTenkeyNo(nID);
-                        } else if (Global.TargetInputStep == TARGETINFOINPUTSTEP.HO) {
-                            RemoteIDInfo.strHo += nPressedNum;
-                            if (RemoteIDInfo.strHo.length() > MAXLENGTH_HO) {
-                                RemoteIDInfo.strHo = RemoteIDInfo.strHo.substring(1, 5);
-                            }
-                            playTenkeyNo(nID);
-                        }
+                        Global.TargetInputStep = TARGETINFOINPUTSTEP.DONG;
+
+                        playTenkeyNo(nID);
+                        Global.TargetInputStep = TARGETINFOINPUTSTEP.DONE;
+
+
+//                        if (Global.TargetInputStep == TARGETINFOINPUTSTEP.DONG) {
+//                            RemoteIDInfo.strDong += nPressedNum;
+//                            if (RemoteIDInfo.strDong.length() > MAXLENGTH_DONG) {
+//                                RemoteIDInfo.strDong = RemoteIDInfo.strDong.substring(1, 5);
+//                            }
+//                            playTenkeyNo(nID);
+//                        } else if (Global.TargetInputStep == TARGETINFOINPUTSTEP.HO) {
+//                            RemoteIDInfo.strHo += nPressedNum;
+//                            if (RemoteIDInfo.strHo.length() > MAXLENGTH_HO) {
+//                                RemoteIDInfo.strHo = RemoteIDInfo.strHo.substring(1, 5);
+//                            }
+//                            playTenkeyNo(nID);
+//                        }
                         updateResidenceInfo();
                     } else if (nID == ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_00) {
                         int nPressedNum = 0;
@@ -554,6 +593,41 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
         super.onKeyDown(keyCode, event);
     }
 
+    private boolean send_call_history_save(String strType, String strTime) {
+        try {
+            LOG_INFO("[send_call_history_save] strType() "+ strType + " strTime " + strTime);
+            final Request_call_history_save call_history_save = new Request_call_history_save(mContext);
+            if (call_history_save.send_call_history_save(RemoteIDInfo.strDong, RemoteIDInfo.strHo, strType, strTime)) {
+                call_history_save.setResultCtrl(new RetProci() {
+
+                    @Override
+                    public void ProcSuccess() {
+
+                        LOG_INFO("[send_call_history_save] ProcSuccess() ");
+                    }
+
+                    @Override
+                    public void ProcError() {
+                        LOG_INFO("[send_call_history_save] ProcError()");
+                        //MainActivity.mCallController.mSIPInterface.cancelCallForwardToStun();
+                    }
+
+                    @Override
+                    public void ProcDoing() {
+                        LOG_INFO("[send_call_history_save] ProcDoing()");
+                    }
+                });
+                return true;
+            }
+        } catch (Exception e) {
+            Log.e(TAG, "[Exception] send_call_history_save(String strTargetIP, String strMessage)");
+            e.printStackTrace();
+        }
+        return false;
+    }
+
+    boolean mbCallState = false;
+
     @Override
     public void onCallEvent(CALLOWNER eCallOwner, CALLSTATUS eCallStatus, CALLTYPE eCallType, String strRemoteIP, String strRemoteSIPID, String strMessage) {
         try {
@@ -564,6 +638,7 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
                 MainActivity.mCallController.setRemoteInfo(strRemoteSIPID, strRemoteIP);
                 setBTNStatus();
                 if (eCallStatus == CALLSTATUS.CALLING) {
+                    mbCallState = true;
                     bRcvEnd = false;
                     Global.playMelodyRepeat(eCallType);
                     super.setFinishTimerDestroy();
@@ -573,6 +648,20 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
                     MainActivity.mCallController.set1stCallTimer(eCallType, MainActivity.mCallController.mCTT.CALLING);
                     updateInstruction();
                     Global.make1stCallHistoryInfo(strRemoteIP, strRemoteSIPID, CALLDIRECTION.OUT, CALLACTION.MISS, CALLRESULT.OUT_MISS);
+
+//                    String[] strEndIP = {"10.1.1.1", "10.1.1.2", "10.1.1.3", "10.1.1.4", "10.1.1.5", "10.1.1.6", "10.1.1.7"};
+//
+//                    for(int i = 0; i < strEndIP.length; i++)
+//                    {
+//                        if (strRemoteIP.equals(strEndIP[i])) {
+//
+//                            CallStateThread nr = new CallStateThread(i) ;
+//                            Thread t = new Thread(nr) ;
+//                            t.start() ;
+//                            break;
+//                        }
+//                    }
+
                 } else if (eCallStatus == CALLSTATUS.CALLED) {
                     bRcvEnd = false;
                     Global.playMelodyRepeat(eCallType);
@@ -584,6 +673,19 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
                     MainActivity.mCallController.set1stCallTimer(eCallType, MainActivity.mCallController.mCTT.CALLED);
                     updateScreen();
                     Global.make1stCallHistoryInfo(strRemoteIP, strRemoteSIPID, CALLDIRECTION.IN, CALLACTION.MISS, CALLRESULT.IN_MISS);
+
+
+
+                    for(int i = 0; i < strEndIP.length; i++)
+                    {
+                        if (strRemoteIP.equals(strEndIP[i])) {
+
+                            CallStateThread nr = new CallStateThread(i) ;
+                            Thread t = new Thread(nr) ;
+                            t.start() ;
+                            break;
+                        }
+                    }
                 }
                 else if (eCallStatus == CALLSTATUS.TALKING) {
                     Global.stopMelodyRepeat();
@@ -608,6 +710,24 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
                     updateInstruction();
                     Global.change1stCallLogAction(CALLACTION.TALK);
                     Global.add1stCallHistoryInfoFinal();
+                    if(mbCallState)
+                    {
+                        String strTimeStamp = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss").format(new Date());
+                        send_call_history_save("call", strTimeStamp);
+                        mbCallState = false;
+                    }
+
+                    //String[] strEndIP = {"10.1.1.1", "10.1.1.2", "10.1.1.3", "10.1.1.4", "10.1.1.5", "10.1.1.6", "10.1.1.7"};
+
+                    for(int i = 0; i < strEndIP.length; i++)
+                    {
+                        if (strRemoteIP.equals(strEndIP[i])) {
+                            m_bCallStateThreadStop = false;
+                            Thread.sleep(1000);
+                            setTunkeyImage(i);
+                            break;
+                        }
+                    }
                 }
                 else if (eCallStatus == CALLSTATUS.HOMEVIEW) {
                     LOG_WARN("[onCallEvent] MOBILE HOMEVIEW!!!!");
@@ -634,7 +754,7 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
                     bRcvEnd = true;
 
                     if (eCallOwner != CALLOWNER.WALLPAD) {
-                        ((MainActivity) mContext).showRemoteCallNoticeText(false);
+                        //((MainActivity) mContext).showRemoteCallNoticeText(false);
                         ((MainActivity) mContext).finishPopUp(ID.POPUP.POPUP_NOTICE_SUBPHONETALK);
                     }
                     MainActivity.mCallController.mCallInfo.setCallStatus(CALLTYPE.RESIDENCE, CALLSTATUS.IDLE);
@@ -646,6 +766,13 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
                     MainActivity.mCallController.MultiCallScenarioManager();
                 } else if (eCallStatus == CALLSTATUS.REJECT) {
                     Global.stopMelodyRepeat();
+                    if(mbCallState)
+                    {
+                        String strTimeStamp = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss").format(new Date());
+                        send_call_history_save("reject_call", strTimeStamp);
+                        mbCallState = false;
+                    }
+
                     bRemoteVideoShow = false;
                     if (ConfigValues.bWallPadCameraEnable) {
                         prepareMyVideo(false);
@@ -667,6 +794,7 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
                     Global.change1stCallLogAction(CALLACTION.REJECT);
                     showMyVideo(false);
                     MainActivity.mCallController.MultiCallScenarioManager();
+
                 }
                 else if (eCallStatus == CALLSTATUS.BUSY) {
                     Global.stopMelodyRepeat();
@@ -718,6 +846,12 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
                     MainActivity.mCallController.stop1stCallTimer();
                     tryAutoCall(strMessage);
                 } else if (eCallStatus == CALLSTATUS.TIMEOUT_1STCALL) {
+                    if(mbCallState)
+                    {
+                        String strTimeStamp = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss").format(new Date());
+                        send_call_history_save("missed_call", strTimeStamp);
+                        mbCallState = false;
+                    }
                     Global.stopMelodyRepeat();
                     bRemoteVideoShow = false;
                     if (ConfigValues.bWallPadCameraEnable) {
@@ -736,6 +870,7 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
                     updateScreen();
                     showMyVideo(false);
                     MainActivity.mCallController.MultiCallScenarioManager();
+
                 } else {
                     Log.w(TAG, "[onCallEvent] Incorrect eCallStatus!!! eCallStatus = " + eCallStatus);
                 }
@@ -782,10 +917,10 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
                                 if (MainActivity.mPSTNController != null) MainActivity.mPSTNController.stopPSTNRingCntThread(); // PSTN 멀티콜 거절시 ring cnt 초기화
                                 MainActivity.mCallController.stop2ndCallTimer();
                                 doMultiCallReject();
-                                if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT
-                                        || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
-                                    MainActivity.mIOInterface.ctrlPopupGUI_Resi(false, bshowMyVideo); // 현재 통화패스가 IHN-1010 이웃통화일 경우 멀티콜 거절시 GUI 화면이 아래로(영상이 위로)
-                                }
+//                                if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT
+//                                        || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
+//                                    MainActivity.mIOInterface.ctrlPopupGUI_Resi(false, bshowMyVideo); // 현재 통화패스가 IHN-1010 이웃통화일 경우 멀티콜 거절시 GUI 화면이 아래로(영상이 위로)
+//                                }
                                 sendHandlerMsgDelayed(HANDLERMSG.REFRESH_BTNLED_STATUS, 0, 0, 1000);
 
                                 if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT
@@ -845,10 +980,10 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
                                 if (MainActivity.mPSTNController != null) MainActivity.mPSTNController.stopPSTNRingCntThread(); // PSTN 멀티콜 거절시 ring cnt 초기화
                                 MainActivity.mCallController.stop2ndCallTimer();
                                 doMultiCallReject();
-                                if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT
-                                        || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
-                                    MainActivity.mIOInterface.ctrlPopupGUI_Resi(false, bshowMyVideo); // 현재 통화패스가 IHN-1010 이웃통화일 경우 멀티콜 거절시 GUI 화면이 아래로(영상이 위로)
-                                }
+//                                if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT
+//                                        || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
+//                                    MainActivity.mIOInterface.ctrlPopupGUI_Resi(false, bshowMyVideo); // 현재 통화패스가 IHN-1010 이웃통화일 경우 멀티콜 거절시 GUI 화면이 아래로(영상이 위로)
+//                                }
                                 sendHandlerMsgDelayed(HANDLERMSG.REFRESH_BTNLED_STATUS, 0, 0, 1000);
 
                                 if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT
@@ -1114,10 +1249,10 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
                     if (MainActivity.mPSTNController != null) MainActivity.mPSTNController.stopPSTNRingCntThread(); // PSTN 멀티콜 거절시 ring cnt 초기화
                     MainActivity.mCallController.stop2ndCallTimer();
                     doMultiCallReject();
-                    if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT
-                            || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
-                        MainActivity.mIOInterface.ctrlPopupGUI_Resi(false, bshowMyVideo); // 현재 통화패스가 IHN-1010 이웃통화일 경우 멀티콜 거절시 GUI 화면이 아래로(영상이 위로)
-                    }
+//                    if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT
+//                            || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
+//                        MainActivity.mIOInterface.ctrlPopupGUI_Resi(false, bshowMyVideo); // 현재 통화패스가 IHN-1010 이웃통화일 경우 멀티콜 거절시 GUI 화면이 아래로(영상이 위로)
+//                    }
                     sendHandlerMsgDelayed(HANDLERMSG.REFRESH_BTNLED_STATUS, 0, 0, 1000);
 
                     if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT
@@ -1127,11 +1262,11 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
                         else ctrlAlphaBlending(false);
                     }
                 }
-                if (bFinish
-                        && (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40
-                        || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT
-                        || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT))
-                    MainActivity.mIOInterface.ctrlPopupGUI_Resi(false, bshowMyVideo); // 현재 통화패스가 IHN-1010 이웃통화일 경우 멀티콜 거절시 GUI 화면이 아래로(영상이 위로)
+//                if (bFinish
+//                        && (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40
+//                        || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT
+//                        || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT))
+                    //MainActivity.mIOInterface.ctrlPopupGUI_Resi(false, bshowMyVideo); // 현재 통화패스가 IHN-1010 이웃통화일 경우 멀티콜 거절시 GUI 화면이 아래로(영상이 위로)
             } else if (nScreen == ID.POPUP.POPUP_NOTICE_SUBPHONETALK) {
                 if (nID == ID.POPUP.NOTICE_SUBPHONETALK.ELEMENT.BUTTON.END) {
                     LOG_INFO("[onPopupResult] ID.POPUP.NOTICE_SUBPHONETALK.ELEMENT.BUTTON.END");
@@ -1141,10 +1276,10 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
             } else if (nScreen == ID.POPUP.POPUP_MULTICALL_NOTICE) {
                 if (nID == ID.POPUP.MUTICALL_NOTICE.ELEMENT.BUTTON.CONFIRM) {
                     LOG_INFO("[onPopupResult] ID.POPUP.POPUP_MULTICALL_NOTICE.ELEMENT.BUTTON.CONFIRM");
-                    if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT
-                            || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
-                        MainActivity.mIOInterface.ctrlPopupGUI_Resi(false, bshowMyVideo); // 현재 통화패스가 IHN-1010 이웃통화일 경우 멀티콜 거절시 GUI 화면이 아래로(영상이 위로)
-                    }
+//                    if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT
+//                            || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
+//                        MainActivity.mIOInterface.ctrlPopupGUI_Resi(false, bshowMyVideo); // 현재 통화패스가 IHN-1010 이웃통화일 경우 멀티콜 거절시 GUI 화면이 아래로(영상이 위로)
+//                    }
 
                     /**
                      * JEFF, 2020.01.01
@@ -1153,10 +1288,10 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
                     if (MainActivity.mPSTNController != null) MainActivity.mPSTNController.stopPSTNRingCntThread(); // PSTN 멀티콜 거절시 ring cnt 초기화
                     MainActivity.mCallController.stop2ndCallTimer();
                     doMultiCallReject();
-                    if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT
-                            || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
-                        MainActivity.mIOInterface.ctrlPopupGUI_Resi(false, bshowMyVideo); // 현재 통화패스가 IHN-1010 이웃통화일 경우 멀티콜 거절시 GUI 화면이 아래로(영상이 위로)
-                    }
+//                    if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT
+//                            || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
+//                        MainActivity.mIOInterface.ctrlPopupGUI_Resi(false, bshowMyVideo); // 현재 통화패스가 IHN-1010 이웃통화일 경우 멀티콜 거절시 GUI 화면이 아래로(영상이 위로)
+//                    }
                     sendHandlerMsgDelayed(HANDLERMSG.REFRESH_BTNLED_STATUS, 0, 0, 1000);
 
                     if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT
@@ -1226,7 +1361,7 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
                     Log.e(TAG, "[Exception] doTalk -> EthernetCtrl.makeIPAddress(...)");
                     ((MainActivity) mContext).setMenuBTNEnable(true);
                     //e.printStackTrace();
-            LogUtil.errorLogInfo("", TAG, e);
+                    LogUtil.errorLogInfo("", TAG, e);
                 }
 
                 if (!send_check_sip_activation_request(RemoteIDInfo.strIP)) {
@@ -1237,6 +1372,7 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
                     return;
                 }
 
+
                 MainActivity.mCallController.mCallInfo.setCallOwner(eCallOwner);
                 MainActivity.mCallController.mCallInfo.setCallStatus(CALLTYPE.RESIDENCE, CALLSTATUS.TRYING_CALL);
             }
@@ -1585,14 +1721,14 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
             int BOARDTYPE = ConfigValues.DEVICE_BOARDTYPE;
             if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40 || BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
                 if (bON) {
-                    IMG_VIDEO_MODULE.setImageResource(R.drawable.video_black_back);
+                    //IMG_VIDEO_MODULE.setImageResource(R.drawable.video_black_back);
                     MainActivity.mCallController.mVideoJNI.setPreviewInfo_V40(116, 85, 240, 160);
                 }
                 else {
-                    IMG_VIDEO_MODULE.setImageResource(R.drawable.image_neig);
+                    //IMG_VIDEO_MODULE.setImageResource(R.drawable.image_neig);
                     MainActivity.mCallController.mVideoJNI.setPreviewInfo_V40(0, 0, 0, 0);
                 }
-                MainActivity.mIOInterface.ctrlPopupGUI_Resi(!bON, bshowMyVideo);
+                //MainActivity.mIOInterface.ctrlPopupGUI_Resi(!bON, bshowMyVideo);
             }
             else {
                 Log.w(TAG, "[ctrlAlphaBlending] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
@@ -1649,6 +1785,7 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
                     BTN_TALK.setButtonEventOffEnable(R.drawable.btn_residence_call_disabled2);
                 }
                 showTalkMode(true);
+
                 setOnCallLED();
             } else if (MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.HOMEVIEW) {
                 ((MainActivity) mContext).setMenuBTNEnable(false);
@@ -1659,6 +1796,7 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
                     BTN_TALK.setButtonEventOffEnable(R.drawable.btn_residence_call_disabled2);
                 }
                 showTalkMode(true);
+
             } else {
                 ((MainActivity) mContext).setMenuBTNEnable(true);
                 // 버튼 이미지 조작
@@ -1854,36 +1992,56 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
             LOG("[showTalkMode] bTalk [" + bTalk + "]");
             if (bTalk) {
                 // 세대정보/안내문구
-                TXT_RESIDENCEINFO.setVisibility(View.INVISIBLE);
-                TXT_INSTRUCTION.setVisibility(View.INVISIBLE);
+//                TXT_RESIDENCEINFO.setVisibility(View.VISIBLE);
+//                TXT_INSTRUCTION.setVisibility(View.VISIBLE);
 
                 // 텐키 이미지 조작
-                IMG_VIDEO_MODULE.setVisibility(View.VISIBLE);
-                BTN_DELETE.setVisibility(View.INVISIBLE);
-                if (ConfigValues.bEnableHouseDivision) {
-                    if(BTN_DIVISION!=null)
-                        BTN_DIVISION.setVisibility(View.INVISIBLE);
-                }for (int i = 0; i < BTN_TENKEY.length; i++) {
-                    BTN_TENKEY[i].setVisibility(View.INVISIBLE);
-                }
+                //IMG_VIDEO_MODULE.setVisibility(View.VISIBLE);
+//                TXT_RESIDENCEINFO.setVisibility(View.VISIBLE);
+//                TXT_INSTRUCTION.setVisibility(View.VISIBLE);
+                //BTN_DELETE.setVisibility(View.INVISIBLE);
+//                if (ConfigValues.bEnableHouseDivision) {
+//                    if(BTN_DIVISION!=null)
+//                        BTN_DIVISION.setVisibility(View.INVISIBLE);
+//                }
+//                for (int i = 0; i < BTN_TENKEY.length; i++) {
+//                    BTN_TENKEY[i].setVisibility(View.INVISIBLE);
+//                }
 
                 // 통화상대 정보
-                ((MainActivity) mContext).displayRemoteID(RemoteIDInfo.strName);
+                ((MainActivity) mContext).displayRemoteID(null);
             } else {
                 // 세대정보/안내문구
-                TXT_RESIDENCEINFO.setVisibility(View.VISIBLE);
-                TXT_INSTRUCTION.setVisibility(View.VISIBLE);
 
-                // 텐키 이미지 조작
-                BTN_DELETE.setVisibility(View.VISIBLE);
-                if (ConfigValues.bEnableHouseDivision) {
-                    if(BTN_DIVISION!=null)
-                        BTN_DIVISION.setVisibility(View.VISIBLE);
-                }
-                for (int i = 0; i < BTN_TENKEY.length; i++) {
-                    if(BTN_TENKEY[i]!=null)
+                if(MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.IDLE)
+                {
+                    TXT_RESIDENCEINFO.setVisibility(View.INVISIBLE);
+                    TXT_INSTRUCTION.setVisibility(View.INVISIBLE);
+
+                    for (int i = 0; i < BTN_TENKEY.length; i++) {
                         BTN_TENKEY[i].setVisibility(View.VISIBLE);
+                    }
+
+                }
+                else
+                {
+//                    TXT_RESIDENCEINFO.setVisibility(View.VISIBLE);
+//                    TXT_INSTRUCTION.setVisibility(View.VISIBLE);
+                    for (int i = 0; i < BTN_TENKEY.length; i++) {
+                        BTN_TENKEY[i].setButtonEventOffEnable();
+                    }
                 }
+
+                // 텐키 이미지 조작
+                //BTN_DELETE.setVisibility(View.VISIBLE);
+//                if (ConfigValues.bEnableHouseDivision) {
+//                    if(BTN_DIVISION!=null)
+//                        BTN_DIVISION.setVisibility(View.VISIBLE);
+//                }
+//                for (int i = 0; i < BTN_TENKEY.length; i++) {
+//                    if(BTN_TENKEY[i]!=null)
+//                        BTN_TENKEY[i].setVisibility(View.VISIBLE);
+//                }
                 IMG_VIDEO_MODULE.setVisibility(View.INVISIBLE);
 
                 // 통화상대 정보
@@ -1916,7 +2074,7 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
                 } else {
                     BTN_PORTRAIT.setImageResource(R.drawable.btn_residence_me_normal3);
                 }
-                MainActivity.mIOInterface.ctrlPopupGUI_Resi(!bRemoteVideoShow, bshowMyVideo); // 세대통화 시작시 초기화
+                //MainActivity.mIOInterface.ctrlPopupGUI_Resi(!bRemoteVideoShow, bshowMyVideo); // 세대통화 시작시 초기화
             }
             else {
                 LOG_WARN("[showMyVideo] BTN_PORTRAIT is null!!");
@@ -1951,58 +2109,218 @@ public class TalkResidence extends WpadScreen implements CallEventListener, Main
             //e.printStackTrace();
             LogUtil.errorLogInfo("", TAG, e);
         }
+
+
+    }
+
+//    Handler mHandler = new Handler() ;
+//
+//    class CallStateThread extends Thread {
+//        Handler handler = mHandler ;
+//        int m_iVal = 0;
+//        int m_iVal1 = 0;
+//        boolean m_bImageSet = false;
+//        boolean m_bStop = true;
+//
+//        public void CallStateThread(int val)
+//        {
+//            m_iVal = val;
+//            if(m_nIDCnt_type < val)
+//                m_iVal1 = val - 1;
+//        }
+//
+//        public void ThreadStop()
+//        {
+//            m_bStop = false;
+//        }
+//
+//        @Override
+//        public void run() {
+//            while (m_bStop) {
+//                // create Runnable instance.
+//                Runnable runnable = new Runnable() {
+//                    @Override
+//                    public void run() {
+//                        // TODO : 실행 코드 작성.
+//                        if(m_bImageSet)
+//                        {
+//                            BTN_TENKEY[m_iVal1].setButtonDefaultImageID();
+//                            m_bImageSet = false;
+//                        }
+//                        else
+//                        {
+//                            BTN_TENKEY[m_iVal1].setButtonPressedImageID();
+//                            m_bImageSet = true;
+//                        }
+//
+//                        //BTN_TENKEY[m_iVal1].setImageResource(TENKEYS[m_iVal][2]);
+//                    }
+//                };
+//
+//                // send runnable object.
+//                handler.post(runnable) ;
+//
+//                try {
+//                    Thread.sleep(500);
+//                } catch (InterruptedException e) {
+//                    e.printStackTrace();
+//                }
+//            }
+//        }
+//
+//    }
+
+    class CallStateThread implements Runnable {
+
+        int m_iVal = 0;
+        int m_iImageSet = 0;
+
+        CallStateThread(int val) {
+
+            if(m_nIDCnt_type < val)
+                m_iVal = val - 1;
+            else
+                m_iVal = val;
+        }
+
+        public void run() {
+            // TODO : thread running codes.
+            while (m_bCallStateThreadStop) {
+
+                Message msg = handler.obtainMessage();
+
+                msg.arg1 = m_iVal;
+                msg.arg2 = m_iImageSet;
+                handler.sendMessage(msg);
+
+                if(m_iImageSet == 0) m_iImageSet = 1;
+                else if(m_iImageSet == 1) m_iImageSet = 0;
+
+                try {
+                    Thread.sleep(500);
+                } catch (InterruptedException e) {
+                    e.printStackTrace();
+                }
+            }
+
+        }
+    }
+
+    final Handler handler = new Handler()
+
+    {
+        public void handleMessage(Message msg)
+        {
+            if(msg.arg2 == 0)
+            {
+                BTN_TENKEY[msg.arg1].setButtonPressedImageID();
+            }
+            else if(msg.arg2 == 1)
+            {
+                BTN_TENKEY[msg.arg1].setButtonDefaultImageID();
+            }
+        }
+
+    };
+
+
+    private void setTunkeyImage(int val)
+    {
+
+        int ival = 0;
+        if(m_nIDCnt_type < val)
+            ival = val - 1;
+        else
+            ival = val;
+
+
+        for(int i = 0; i < BTN_TENKEY.length; i++)
+        {
+
+            if(ival == i)
+            {
+                BTN_TENKEY[i].setImageResource(TENKEYS[val][2]);
+            }
+            else
+            {
+                BTN_TENKEY[i].setButtonDefaultImageID();
+            }
+        }
+
     }
 
     private void playTenkeyNo(int nBTN) {
         try {
-            int nSoundIndex = SND.number.NUM0;
+            int nSoundIndex = SND.effect.TOUCH_LATCHED;
             switch (nBTN) {
                 case ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_00:
-                    nSoundIndex = SND.number.NUM0;
+                    //nSoundIndex = SND.number.NUM0;
                     break;
-
+//String[] strEndIP = {"10.1.1.1", "10.1.2.1", "10.1.3.1", "10.1.3.2", "10.1.1.3", "10.1.1.2", "10.1.2.2"};
                 case ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_01:
-                    nSoundIndex = SND.number.NUM1;
+                    //nSoundIndex = SND.number.NUM1;
+                    RemoteIDInfo.strDong = "101";
+                    RemoteIDInfo.strHo = "101";
+
+                    setTunkeyImage(0);
                     break;
 
                 case ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_02:
-                    nSoundIndex = SND.number.NUM2;
+                    //nSoundIndex = SND.number.NUM2;
+                    RemoteIDInfo.strDong = "101";
+                    RemoteIDInfo.strHo = "201";
+                    setTunkeyImage(1);
                     break;
 
                 case ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_03:
-                    nSoundIndex = SND.number.NUM3;
+                    //nSoundIndex = SND.number.NUM3;
+                    RemoteIDInfo.strDong = "101";
+                    RemoteIDInfo.strHo = "301";
+                    setTunkeyImage(2);
                     break;
 
                 case ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_04:
-                    nSoundIndex = SND.number.NUM4;
+                    //nSoundIndex = SND.number.NUM4;
+                    RemoteIDInfo.strDong = "101";
+                    RemoteIDInfo.strHo = "302";
+                    setTunkeyImage(3);
                     break;
 
                 case ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_05:
-                    nSoundIndex = SND.number.NUM5;
+                    //nSoundIndex = SND.number.NUM5;
+                    RemoteIDInfo.strDong = "101";
+                    RemoteIDInfo.strHo = "103";
+                    setTunkeyImage(4);
                     break;
 
                 case ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_06:
-                    nSoundIndex = SND.number.NUM6;
+                    //nSoundIndex = SND.number.NUM6;
+                    RemoteIDInfo.strDong = "101";
+                    RemoteIDInfo.strHo = "102";
+                    setTunkeyImage(5);
                     break;
 
                 case ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_07:
-                    nSoundIndex = SND.number.NUM7;
+                    //nSoundIndex = SND.number.NUM7;
+                    RemoteIDInfo.strDong = "101";
+                    RemoteIDInfo.strHo = "202";
+                    setTunkeyImage(6);
                     break;
 
                 case ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_08:
-                    nSoundIndex = SND.number.NUM8;
+                    //nSoundIndex = SND.number.NUM8;
                     break;
 
                 case ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_09:
-                    nSoundIndex = SND.number.NUM9;
+                    //nSoundIndex = SND.number.NUM9;
                     break;
 
                 case ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_DONG:
-                    nSoundIndex = SND.setting.DONG;
+                    //nSoundIndex = SND.setting.DONG;
                     break;
 
                 case ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_HO:
-                    nSoundIndex = SND.setting.HO;
+                    //nSoundIndex = SND.setting.HO;
                     break;
             }
 

+ 148 - 15
WallPadCall/src/main/java/kr/co/icontrols/wallpadcall/screen/VisitorPictureViewer.java

@@ -11,6 +11,8 @@ import android.view.View;
 import android.widget.ImageView;
 import android.widget.RelativeLayout;
 
+import com.artncore.commons.define;
+import com.artncore.wallpadimap.RetProci;
 import com.util.LogUtil;
 
 import java.io.File;
@@ -25,11 +27,16 @@ import kr.co.icontrols.wallpadcall.MainActivity.MAINEVENT;
 import kr.co.icontrols.wallpadcall.MainActivity.MainEventListener;
 import kr.co.icontrols.wallpadcall.R;
 import kr.co.icontrols.wallpadcall.declare.Common;
+import kr.co.icontrols.wallpadcall.declare.DataClasses;
 import kr.co.icontrols.wallpadcall.declare.DataClasses.VisitorPictureHistoryInfoTable;
+import kr.co.icontrols.wallpadcall.declare.DataClasses.AllVisitorPictureHistoryInfoTable;
 import kr.co.icontrols.wallpadcall.declare.Declare;
 import kr.co.icontrols.wallpadcall.declare.Global;
 import kr.co.icontrols.wallpadcall.declare.Global.ConfigValues;
 import kr.co.icontrols.wallpadcall.declare.ID;
+import kr.co.icontrols.wallpadcall.imap.Request_call_history_delete;
+import kr.co.icontrols.wallpadcall.imap.Request_visitor_picture_delete;
+import kr.co.icontrols.wallpadcall.imap.Request_visitor_picture_inquiry;
 import kr.co.icontrols.wallpadsupport.Version.MODEL_TYPE;
 import kr.co.icontrols.wallpadsupport.WpadImageView;
 import kr.co.icontrols.wallpadsupport.WpadImageView.TOUCH_KIND;
@@ -82,6 +89,7 @@ public class VisitorPictureViewer extends WpadScreen implements CallEventListene
     String strText_PageNo = "1/1";
 
     VisitorPictureHistoryInfoTable mVisitorPictureHistoryInfoTable = new VisitorPictureHistoryInfoTable();
+    AllVisitorPictureHistoryInfoTable mAllVisitorPictureHistoryInfoTable = new AllVisitorPictureHistoryInfoTable();
 
     public VisitorPictureViewer(Context context, RelativeLayout layout) {
         super(context, layout);
@@ -113,7 +121,9 @@ public class VisitorPictureViewer extends WpadScreen implements CallEventListene
             ViewRegistration(layout, TXT_PAGE, Common.ImgPosition.GetX(372), Common.ImgPosition.GetY(670));
 
             Initialize();
-            initVisitorPictureInfo(true);
+            m_bShowCount = true;
+            send_visitor_picture_inquiry("1", "60");
+
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
         } catch (Exception e) {
@@ -234,7 +244,9 @@ public class VisitorPictureViewer extends WpadScreen implements CallEventListene
                     LOG_INFO("[onPopupResult] ID.POPUP.DELETE_ITEMS.ELEMENT.BUTTON.CONFIRM");
                     if (strItemType.equals("VisitorPictureViewer_Delete")) {
                         deleteVisitorPicture(nCurrentPicture);
-                        initVisitorPictureInfo(false);
+                        m_bShowCount = false;
+                        send_visitor_picture_inquiry("1", "60");
+                        //initVisitorPictureInfo(false);
                     }
                 } else if (nID == ID.POPUP.DELETE_ITEMS.ELEMENT.BUTTON.CANCEL) {
                     LOG_INFO("[onPopupResult] ID.POPUP.DELETE_ITEMS.ELEMENT.BUTTON.CANCEL");
@@ -305,18 +317,102 @@ public class VisitorPictureViewer extends WpadScreen implements CallEventListene
         }
     }
 
+    int m_iCnt = 0;
+    boolean m_bShowCount = false;
+
+    private boolean send_visitor_picture_inquiry(String strPage, String strCount) {
+        try {
+            LOG_INFO("[send_visitor_picture_inquiry] strPage() "+ strPage + " strCount " + strCount);
+            final Request_visitor_picture_inquiry visitor_picture_inquiry = new Request_visitor_picture_inquiry(mContext);
+            if (visitor_picture_inquiry.send_visitor_picture_inquiry("101", "101", strPage, strCount)) {
+                visitor_picture_inquiry.setResultCtrl(new RetProci() {
+
+                    @Override
+                    public void ProcSuccess() {
+                        //nHistoryCnt = MainActivity.mVisitorPictureHistoryManager.getHistoryCnt(Declare.DBInfo.TABLE_NAME_HISTORY_VISITORPICTURE);
+                        //LOG("[initHistoryPageInfo] nHistoryCnt = " + nHistoryCnt);
+                        //nTotalPage = ((nHistoryCnt + LIST_CNT - 1) / LIST_CNT);
+                        //LOG("[initHistoryPageInfo] nTotalPage = " + nTotalPage);
+                        LOG_INFO("[send_visitor_picture_inquiry] ProcSuccess()");
+                        visitor_picture_inquiry.SetItem("inquiry_info");
+                        int nQuantity = Integer.parseInt(visitor_picture_inquiry.GetAttributeVal(0, "quantity"));
+                        mVisitorPictureHistoryInfoTable.clearTable();
+                        mAllVisitorPictureHistoryInfoTable.clearTable();
+                        visitor_picture_inquiry.SetItem("visitor_pic");
+                        for(int i = 0; i < nQuantity; i++)
+                        {
+                            //LOG_INFO("[send_call_history_inquiry] " + i + " " + call_history_inquiry.GetAttributeVal(i, "event_time"));
+
+                            String strName = visitor_picture_inquiry.GetAttributeVal(i, "filename");
+                            String strPath = visitor_picture_inquiry.GetAttributeVal(i, "path");
+                            String strReply_Path = strPath;
+                            String strTimestamp = visitor_picture_inquiry.GetAttributeVal(i, "time");
+                            String strURI = define.VISITOR_PICTURE_LOCATION + "/" + strName;
+                            //LOG_INFO("[send_call_history_inquiry] strURI " + i + " " + strURI);
+
+                            mVisitorPictureHistoryInfoTable.addVisitorPictureHistoryInfo(String.valueOf(i), strName, "", "", "", strURI, "", strTimestamp);
+
+                            mAllVisitorPictureHistoryInfoTable.addVisitorPictureHistoryInfo(visitor_picture_inquiry.GetAttributeVal(i, "dong"),
+                                    visitor_picture_inquiry.GetAttributeVal(i, "ho"),
+                                    visitor_picture_inquiry.GetAttributeVal(i, "time"),
+                                    visitor_picture_inquiry.GetAttributeVal(i, "path"),
+                                    visitor_picture_inquiry.GetAttributeVal(i, "filename"),
+                                    visitor_picture_inquiry.GetAttributeVal(i, "message")
+                            );
+                        }
+
+                        m_iCnt = nQuantity;
+
+                        initVisitorPictureInfo(m_bShowCount);
+                        LOG_INFO("[send_visitor_picture_inquiry] m_iCnt " + m_iCnt);
+
+                    }
+
+                    @Override
+                    public void ProcError() {
+                        LOG_INFO("[send_visitor_picture_inquiry] ProcError()");
+                        //MainActivity.mCallController.mSIPInterface.cancelCallForwardToStun();
+                    }
+
+                    @Override
+                    public void ProcDoing() {
+                        LOG_INFO("[send_visitor_picture_inquiry] ProcDoing()");
+                    }
+                });
+                return true;
+            }
+        } catch (Exception e) {
+            Log.e(TAG, "[Exception] send_visitor_picture_inquiry(String strTargetIP, String strMessage)");
+            e.printStackTrace();
+        }
+        return false;
+    }
+
     private void initVisitorPictureInfo(boolean bScreenCreated) {
         try {
             LOG_INFO("[initVisitorPictureInfo]");
-            mVisitorPictureHistoryInfoTable.clearTable();
-            mVisitorPictureHistoryInfoTable = MainActivity.mVisitorPictureHistoryManager.getVisitorPictureHistory_All();
-            if (mVisitorPictureHistoryInfoTable == null) {
+            //mVisitorPictureHistoryInfoTable.clearTable();
+            //mVisitorPictureHistoryInfoTable = MainActivity.mVisitorPictureHistoryManager.getVisitorPictureHistory_All();
+
+//            int iCount = 0;
+//            while (iCount < 100)
+//            {
+//                if(m_bResponse == true)
+//                    break;
+//                Thread.sleep(100);
+//                iCount++;
+//            }
+//            m_bResponse = false;
+
+            LOG_INFO("[send_visitor_picture_inquiry]  1 m_iCnt " + m_iCnt);
+            nTotalPicture = m_iCnt;
+            if (nTotalPicture == 0) {
                 strText_PageNo = "0/0";
                 TXT_PAGE.setText(strText_PageNo);
                 IMG_PICTURE.setImageResource(R.drawable.visitor_picture_bg);
                 return;
             }
-            nTotalPicture = mVisitorPictureHistoryInfoTable.getCnt();
+
             if (bScreenCreated) nCurrentPicture = getStartPictureIndex(Global.strVisitorPictureID);
             if (nCurrentPicture > nTotalPicture) nCurrentPicture = nTotalPicture;
             LOG_INFO("[initVisitorPictureInfo] nCurrentPicture = " + nCurrentPicture + ", nTotalPicture = " + nTotalPicture);
@@ -333,8 +429,8 @@ public class VisitorPictureViewer extends WpadScreen implements CallEventListene
 
     private int getStartPictureIndex(String strID) {
         try {
-            LOG_INFO("[drawInitVisitorPicture] strID [" + strID + "]");
-            int nCnt = mVisitorPictureHistoryInfoTable.getCnt();
+            LOG_INFO("[drawInitVisitorPicture] strID [" + strID + "] m_iCnt [" + m_iCnt + "]");
+            int nCnt = m_iCnt;
             for (int i = 0; i < nCnt; i++) {
                 if (strID.equals(mVisitorPictureHistoryInfoTable.getVisitorPictureHistoryInfo(i).getID())) {
                     return i + 1;
@@ -400,15 +496,52 @@ public class VisitorPictureViewer extends WpadScreen implements CallEventListene
         }
     }
 
-    private void deleteVisitorPicture(int nIndex) {
+    private boolean send_visitor_picture_delete(String strMsg, String strCount) {
         try {
-            ArrayList<String> SelectedIDs = new ArrayList<String>();
-            ArrayList<String> SelectedURIs = new ArrayList<String>();
-            SelectedIDs.add(mVisitorPictureHistoryInfoTable.getVisitorPictureHistoryInfo(nIndex - 1).getID());
-            SelectedURIs.add(mVisitorPictureHistoryInfoTable.getVisitorPictureHistoryInfo(nIndex - 1).getURI());
+            LOG_INFO("[send_visitor_picture_delete] strType() "+ strMsg + " strCount " + strCount);
+            final Request_visitor_picture_delete visitor_picture_delete = new Request_visitor_picture_delete(mContext);
+            if (visitor_picture_delete.send_visitor_picture_delete(strMsg, strCount)) {
+                visitor_picture_delete.setResultCtrl(new RetProci() {
+
+                    @Override
+                    public void ProcSuccess() {
+
+                        LOG_INFO("[send_visitor_picture_delete] ProcSuccess() ");
+                    }
+
+                    @Override
+                    public void ProcError() {
+                        LOG_INFO("[send_visitor_picture_delete] ProcError()");
+                        //MainActivity.mCallController.mSIPInterface.cancelCallForwardToStun();
+                    }
 
-            MainActivity.mVisitorPictureHistoryManager.deleteHistoryList(Declare.DBInfo.TABLE_NAME_HISTORY_VISITORPICTURE, SelectedIDs);
-            MainActivity.mVisitorPictureHistoryManager.deleteHistoryList(SelectedURIs);
+                    @Override
+                    public void ProcDoing() {
+                        LOG_INFO("[send_visitor_picture_delete] ProcDoing()");
+                    }
+                });
+                return true;
+            }
+        } catch (Exception e) {
+            Log.e(TAG, "[Exception] send_visitor_picture_delete(String strTargetIP, String strMessage)");
+            e.printStackTrace();
+        }
+        return false;
+    }
+
+    private void deleteVisitorPicture(int nIndex) {
+        try {
+            LOG_INFO("[deleteVisitorPicture] nIndex " + nIndex);
+
+            String strMsg = mAllVisitorPictureHistoryInfoTable.getVisitorPictureHistoryInfo(nIndex-1).getData();
+            send_visitor_picture_delete(strMsg,"1");
+//            ArrayList<String> SelectedIDs = new ArrayList<String>();
+//            ArrayList<String> SelectedURIs = new ArrayList<String>();
+//            SelectedIDs.add(mVisitorPictureHistoryInfoTable.getVisitorPictureHistoryInfo(nIndex - 1).getID());
+//            SelectedURIs.add(mVisitorPictureHistoryInfoTable.getVisitorPictureHistoryInfo(nIndex - 1).getURI());
+//
+//            MainActivity.mVisitorPictureHistoryManager.deleteHistoryList(Declare.DBInfo.TABLE_NAME_HISTORY_VISITORPICTURE, SelectedIDs);
+//            MainActivity.mVisitorPictureHistoryManager.deleteHistoryList(SelectedURIs);
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
         } catch (Exception e) {

Некоторые файлы не были показаны из-за большого количества измененных файлов