4 Commits a2ee1ccfb9 ... 40270d73d0

Author SHA1 Message Date
  herlanS_ 40270d73d0 send dx message 3 years ago
  herlanS_ ac9703c6d4 Merge branch 'master' of http://139.162.7.140:3000/herlanS_/ipphone-bridge 3 years ago
  herlanS_ fd658e45a6 Merge remote-tracking branch 'bitbucket/master' 3 years ago
  herlanS_ f59446df6b fix license number under 100 3 years ago

BIN
classes/artifacts/ipphone_bridge_jar/ipphone-bridge.jar


+ 6 - 0
pom.xml

@@ -81,6 +81,12 @@
 			<artifactId>commons-io</artifactId>
 			<version>2.6</version>
 		</dependency>
+		<dependency>
+			<groupId>org.apache.commons</groupId>
+			<artifactId>commons-lang3</artifactId>
+			<version>3.12.0</version>
+		</dependency>
+
 		<dependency>
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-test</artifactId>

+ 2 - 1
src/main/kotlin/co/id/datacomsolusindo/ipphonebridge/BridgeFIlter.kt

@@ -2,6 +2,7 @@ package co.id.datacomsolusindo.ipphonebridge
 
 import com.fasterxml.jackson.databind.ObjectMapper
 import com.fasterxml.jackson.databind.ObjectWriter
+import org.apache.commons.lang3.StringUtils
 import org.apache.logging.log4j.LogManager
 import org.ini4j.Wini
 import org.springframework.core.Ordered
@@ -103,7 +104,7 @@ class BridgeFilter(private val template: SimpMessagingTemplate, val resourceLoad
                     val partStr = ow.writeValueAsString(rb).chunked(chunkSize)
                     val partialID = UUID.randomUUID().toString()
                     val st2 = System.nanoTime()
-                    if (!ClientHolder.get().containsKey(clientNumber.toString())) {
+                    if (!ClientHolder.get().containsKey(StringUtils.leftPad(clientNumber.toString(), 3, '0'))) {
 //                        subscribeGW /topic/request/reqID
 //                        sendGW "/app/partial/$client"
                         chain.doFilter(request, response)

+ 7 - 4
src/main/kotlin/co/id/datacomsolusindo/ipphonebridge/SocketChecker.kt

@@ -1,22 +1,25 @@
 package co.id.datacomsolusindo.ipphonebridge
 
-import org.apache.logging.log4j.LogManager
 import org.springframework.messaging.handler.annotation.DestinationVariable
 import org.springframework.messaging.handler.annotation.MessageMapping
 import org.springframework.messaging.handler.annotation.SendTo
 import org.springframework.stereotype.Controller
 
 @Controller
-class SocketChecker {
+class SocketChecker() {
 
     @MessageMapping("/hi")
     @SendTo("/topic/healthCheck")
     @Throws(Exception::class)
     fun greeting(message: MutableMap<*, *>): MutableMap<*, *> {
-        return mutableMapOf(Pair("Hi", "I'am Ok"))
+        return if (!ClientHolder.get().containsKey(message["Hi"])) {
+            mutableMapOf(Pair("Hi", "I'am Ok"), Pair("dc", message["Hi"]))
+        } else {
+            mutableMapOf(Pair("Hi", "I'am Ok"))
+        }
     }
 
-    fun collectChunk(message: SocketChunkData, id: String){
+    fun collectChunk(message: SocketChunkData, id: String) {
         if (message.totalPart == 1) {
 //                println("one part only with id $id")
             Singletons.responseQue.getOrPut(id) {

+ 4 - 0
src/main/resources/META-INF/MANIFEST.MF

@@ -0,0 +1,4 @@
+Manifest-Version: 1.0
+Main-Class: co.id.datacomsolusindo.ipphonebridge.IpPhoneBridgeApplicatio
+ nKt
+