first test success 05/12/2024

This commit is contained in:
2024-12-05 15:14:42 +07:00
parent 079c56a14b
commit 6a54013eda
2 changed files with 15 additions and 2 deletions

View File

@@ -152,6 +152,7 @@ public class Main {
@Override @Override
public void CalleePickup(SIP_Response resp) { public void CalleePickup(SIP_Response resp) {
Logger.info("Callee Pickup, Response: {}",resp); Logger.info("Callee Pickup, Response: {}",resp);
oncallResponse = resp;
SipStatus = "Communication with "+resp.CallID; SipStatus = "Communication with "+resp.CallID;
} }
}); });
@@ -245,6 +246,15 @@ public class Main {
} }
break; break;
case "call": case "call":
int extension = ParseInt(req.getData(),-1) ;
if (extension>0){
if (Call(""+extension)){
resp = new SocketioResponse("success", "Call to "+extension+" is successful");
} else {
resp = new SocketioResponse("error", "Call to "+extension+" is failed");
}
} else resp = new SocketioResponse("error", "Invalid Extension");
break;
case "getDiskInfo": case "getDiskInfo":
resp = new SocketioResponse("error", "Not Implemented"); resp = new SocketioResponse("error", "Not Implemented");
break; break;
@@ -265,7 +275,7 @@ public class Main {
callButton.setOnLongPress(vv->{ callButton.setOnLongPress(vv->{
Logger.info("Call Button Long Pressed"); Logger.info("Call Button Long Pressed");
//pickupCall(); //pickupCall();
CallTest("100"); Call("100");
}); });
callButton.setOnShortPress(vv->{ callButton.setOnShortPress(vv->{
Logger.info("Call Button Short Pressed"); Logger.info("Call Button Short Pressed");
@@ -357,6 +367,10 @@ public class Main {
return MessageFormat.format("sip:{0}@{1}", extension, client.getServerAddress()); return MessageFormat.format("sip:{0}@{1}", extension, client.getServerAddress());
} }
private static boolean Call(String extension){
return client.Call(CreateSipCallNumber(extension));
}
@SuppressWarnings("unused") @SuppressWarnings("unused")
private static void CallTest(String extension){ private static void CallTest(String extension){
String callnumber = CreateSipCallNumber(extension); String callnumber = CreateSipCallNumber(extension);

View File

@@ -12,7 +12,6 @@ import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.InputStream; import java.io.InputStream;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.LinkOption;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.Properties; import java.util.Properties;