|
@@ -3134,6 +3134,23 @@ public class iMapServer extends Service {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public String getRemoteIPAddress(Socket Sock) {
|
|
|
|
+ try {
|
|
|
|
+
|
|
|
|
+ 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";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
public class iMapSverSocketThread extends Thread {
|
|
public class iMapSverSocketThread extends Thread {
|
|
private final Socket iMAPSock;
|
|
private final Socket iMAPSock;
|
|
@@ -3422,6 +3439,9 @@ public class iMapServer extends Service {
|
|
String sip_result = "fail";
|
|
String sip_result = "fail";
|
|
ActivityManager manager = (ActivityManager)getSystemService(ACTIVITY_SERVICE);
|
|
ActivityManager manager = (ActivityManager)getSystemService(ACTIVITY_SERVICE);
|
|
List<ActivityManager.RunningServiceInfo> rsi = manager.getRunningServices(50);
|
|
List<ActivityManager.RunningServiceInfo> rsi = manager.getRunningServices(50);
|
|
|
|
+
|
|
|
|
+ String strIP = getRemoteIPAddress(iMAPSock);
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
String strSIPPackageName = "kr.co.icontrols.callengine.sip.SIPStun";
|
|
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";
|
|
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";
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ String[] IP_Parse = strIP.split("\\.");
|
|
|
|
+ Log.d(TAG, "1" + strIP);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ 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);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ else if (cmd.equals("stop_talking")) {
|
|
|
|
+ Common.SendAppFinishReqBR(getApplicationContext());
|
|
|
|
+ }
|
|
|
|
+
|
|
else if (cmd.equalsIgnoreCase("remote_get_home_devices")) {
|
|
else if (cmd.equalsIgnoreCase("remote_get_home_devices")) {
|
|
retXML = iCMDProcDevList(doc);
|
|
retXML = iCMDProcDevList(doc);
|
|
}
|
|
}
|
|
@@ -14305,6 +14358,7 @@ public class iMapServer extends Service {
|
|
public static String CALLOWNER = "CALLOWNER";
|
|
public static String CALLOWNER = "CALLOWNER";
|
|
public static String CALLEVENTTYPE = "CALLEVENTTYPE";
|
|
public static String CALLEVENTTYPE = "CALLEVENTTYPE";
|
|
public static String CALLTYPE = "CALLTYPE";
|
|
public static String CALLTYPE = "CALLTYPE";
|
|
|
|
+ public static String REMOTEINFO = "REMOTEINFO";
|
|
public enum SOURCE {
|
|
public enum SOURCE {
|
|
USER,
|
|
USER,
|
|
CALL_RECEIVE,
|
|
CALL_RECEIVE,
|
|
@@ -14357,6 +14411,43 @@ public class iMapServer extends Service {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ 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);
|
|
|
|
+ } 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()");
|
|
|
|
+
|
|
|
|
+ LogUtil.errorLogInfo("", TAG, e);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
private String getTopActivity() {
|
|
private String getTopActivity() {
|
|
try {
|
|
try {
|
|
ActivityManager mActivityManager = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
|
|
ActivityManager mActivityManager = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
|