|
@@ -3134,6 +3134,23 @@ public class iMapServer extends Service {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public String getRemoteIPAddress(Socket Sock) {
|
|
|
+ try {
|
|
|
+// Log.i(TAG, "[getRemoteIPAddress] == START ==");
|
|
|
+ if (Sock == null) return "10.0.1.1";
|
|
|
+
|
|
|
+ String strRemoteIP = Sock.getRemoteSocketAddress().toString();
|
|
|
+ String[] strSplited_01 = strRemoteIP.split(":");
|
|
|
+ String[] strSplited_02 = strSplited_01[0].split("/");
|
|
|
+ strRemoteIP = strSplited_02[1];
|
|
|
+ return strRemoteIP;
|
|
|
+ } catch (Exception e) {
|
|
|
+ Log.e(TAG, "[Exception] getRemoteIPAddress(Sock)");
|
|
|
+ e.printStackTrace();
|
|
|
+ return "10.0.1.1";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// iMAP 서버 소켓 처리
|
|
|
public class iMapSverSocketThread extends Thread {
|
|
|
private final Socket iMAPSock;
|
|
@@ -3422,6 +3439,9 @@ public class iMapServer extends Service {
|
|
|
String sip_result = "fail";
|
|
|
ActivityManager manager = (ActivityManager)getSystemService(ACTIVITY_SERVICE);
|
|
|
List<ActivityManager.RunningServiceInfo> rsi = manager.getRunningServices(50);
|
|
|
+ //add KSJ 2021.11.02 socket addr 가져오기 위해 추가
|
|
|
+ String strIP = getRemoteIPAddress(iMAPSock);
|
|
|
+ //~add KSJ
|
|
|
|
|
|
// Jeff added below codes for call app (2018.01.25)
|
|
|
String strSIPPackageName = "kr.co.icontrols.callengine.sip.SIPStun";
|
|
@@ -3434,7 +3454,40 @@ public class iMapServer extends Service {
|
|
|
}
|
|
|
}
|
|
|
retXML = XMLHeader + "<service type=\"reply\" name=\"check_sip_activation\" result=\"" + sip_result + "\">\r\n <message>\"null\"</message>\r\n</service>\r\n</imap>\r\n";
|
|
|
+
|
|
|
+ //add KSJ 2021.11.02 check_sip_activation msg recv 이후 wallpadcall app start
|
|
|
+ String[] IP_Parse = strIP.split("\\.");
|
|
|
+ Log.d(TAG, "1" + strIP);
|
|
|
+ //Log.d(TAG, "2" + strSplit[1]);
|
|
|
+ //Log.d(TAG, "3" + strSplit[2]);
|
|
|
+ //Log.d(TAG, "4" + strSplit[3]);
|
|
|
+ CALLTYPE eCallType = CALLTYPE.LOBBY;
|
|
|
+ if(IP_Parse[2].equals("0"))
|
|
|
+ {
|
|
|
+
|
|
|
+ eCallType = CALLTYPE.LOBBY;
|
|
|
+
|
|
|
+ if(IP_Parse[3].equals("11"))
|
|
|
+ eCallType = CALLTYPE.FRONT;
|
|
|
+
|
|
|
+ }
|
|
|
+ else if(IP_Parse[2].equals("129"))
|
|
|
+ {
|
|
|
+ eCallType = CALLTYPE.FRONT;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ eCallType = CALLTYPE.RESIDENCE;
|
|
|
+ }
|
|
|
+
|
|
|
+ if((eCallType == CALLTYPE.LOBBY) || (eCallType == CALLTYPE.FRONT))
|
|
|
+ runCallMainActivity_moip(CALLEVENTTYPE.RECEIVE_CALL, eCallType, strIP);
|
|
|
}
|
|
|
+ //add KSJ 2021.11.02 stop_talking msg 추가 (wallpadcall 종료)
|
|
|
+ else if (cmd.equals("stop_talking")) {
|
|
|
+ Common.SendAppFinishReqBR(getApplicationContext());
|
|
|
+ }
|
|
|
+ //~add KSJ
|
|
|
else if (cmd.equalsIgnoreCase("remote_get_home_devices")) {
|
|
|
retXML = iCMDProcDevList(doc);
|
|
|
}
|
|
@@ -14305,6 +14358,7 @@ public class iMapServer extends Service {
|
|
|
public static String CALLOWNER = "CALLOWNER";
|
|
|
public static String CALLEVENTTYPE = "CALLEVENTTYPE";
|
|
|
public static String CALLTYPE = "CALLTYPE";
|
|
|
+ public static String REMOTEINFO = "REMOTEINFO"; //add KSJ 2021.11.02
|
|
|
public enum SOURCE {
|
|
|
USER,
|
|
|
CALL_RECEIVE,
|
|
@@ -14357,6 +14411,43 @@ public class iMapServer extends Service {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //add KSJ 2021.11.02
|
|
|
+ public void runCallMainActivity_moip(CALLEVENTTYPE eEventType, CALLTYPE eCallType, String strIP) {
|
|
|
+ try {
|
|
|
+ if (!bWallPadCallLive) {
|
|
|
+ // 통화어플을 실행시킨다.
|
|
|
+ Log.w(TAG, "[runCallMainActivity_moip] ########## START ##########");
|
|
|
+ sendLCDBacklightStatus(true);
|
|
|
+
|
|
|
+ WallpadStatusData mWallpadStatusData = new WallpadStatusData(getApplicationContext());
|
|
|
+ int nAlramStatus = mWallpadStatusData.GetAlarmStatus();
|
|
|
+ mWallpadStatusData.closeDB();
|
|
|
+
|
|
|
+ if (nAlramStatus != WallpadStatusData.GUARD_OUT) Common.SendAppFinishReqBR(getApplicationContext());
|
|
|
+
|
|
|
+ ComponentName mComponentName = new ComponentName("kr.co.icontrols.wallpadcall", "kr.co.icontrols.wallpadcall.MainActivity");
|
|
|
+ Intent mIntent = new Intent(Intent.ACTION_MAIN);
|
|
|
+ mIntent.putExtra(CALLTRIGGER.CALLOWNER, CALLOWNER.NONE.toString());
|
|
|
+ mIntent.putExtra(CALLTRIGGER.CALLEVENTTYPE, eEventType.toString());
|
|
|
+ mIntent.putExtra(CALLTRIGGER.CALLTYPE, eCallType.toString());
|
|
|
+ mIntent.putExtra(CALLTRIGGER.REMOTEINFO, strIP);
|
|
|
+ mIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
|
+ mIntent.setComponent(mComponentName);
|
|
|
+ startActivity(mIntent);
|
|
|
+ Thread.sleep(500); // Call app이 실행되는 시간을 기다려준다. (빨리 띄우면 이벤트를 수신 못함)
|
|
|
+ } else {
|
|
|
+ Log.w(TAG, "[runCallMainActivity_moip] WallPadCall is already running!!");
|
|
|
+ }
|
|
|
+ } catch (RuntimeException re) {
|
|
|
+ LogUtil.errorLogInfo("", TAG, re);
|
|
|
+ } catch (Exception e) {
|
|
|
+ Log.e(TAG, "[Exception] runCallMainActivity()");
|
|
|
+ //e.printStackTrace();
|
|
|
+ LogUtil.errorLogInfo("", TAG, e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //~add KSJ
|
|
|
+
|
|
|
private String getTopActivity() {
|
|
|
try {
|
|
|
ActivityManager mActivityManager = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
|