update
parent
b016db5eeb
commit
f965a38bee
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,2 +1,2 @@
|
||||||
#Mon Oct 18 17:31:34 CEST 2021
|
#Mon Sep 18 19:46:51 CEST 2023
|
||||||
gradle.version=7.1
|
gradle.version=8.3
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -1,14 +1,13 @@
|
||||||
package de.vincentschweiger.calltoj;
|
package de.vincentschweiger.calltoj;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
|
||||||
import org.yaml.snakeyaml.Yaml;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import javax.swing.*;
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.yaml.snakeyaml.Yaml;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mo. 18/10/2021 17:32
|
* Mo. 18/10/2021 17:32
|
||||||
|
@ -17,14 +16,16 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||||
public class CallToJ {
|
public class CallToJ {
|
||||||
private static final File configFile = new File(new File(System.getProperty("user.home")), ".callto.yaml");
|
private static final File configFile =
|
||||||
|
new File(new File(System.getProperty("user.home")), ".callto.yaml");
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
try {
|
try {
|
||||||
if (!configFile.exists()) {
|
if (!configFile.exists()) {
|
||||||
configFile.createNewFile();
|
configFile.createNewFile();
|
||||||
FileOutputStream outputStream = new FileOutputStream(configFile);
|
FileOutputStream outputStream = new FileOutputStream(configFile);
|
||||||
InputStream inputStream = CallToJ.class.getResourceAsStream("/template.yaml");
|
InputStream inputStream =
|
||||||
|
CallToJ.class.getResourceAsStream("/template.yaml");
|
||||||
if (inputStream != null) {
|
if (inputStream != null) {
|
||||||
IOUtils.copy(inputStream, outputStream);
|
IOUtils.copy(inputStream, outputStream);
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
|
@ -35,7 +36,9 @@ public class CallToJ {
|
||||||
System.exit(-1);
|
System.exit(-1);
|
||||||
}
|
}
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
JOptionPane.showMessageDialog(null, "You have to configure CallToJ!\n See .callto.yaml in your home directory!");
|
JOptionPane.showMessageDialog(
|
||||||
|
null,
|
||||||
|
"You have to configure CallToJ!\n See .callto.yaml in your home directory!");
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,6 +56,8 @@ public class CallToJ {
|
||||||
} else {
|
} else {
|
||||||
number = args[0];
|
number = args[0];
|
||||||
// Replace cause of firefox and callto handling stuff
|
// Replace cause of firefox and callto handling stuff
|
||||||
|
number = number.replace("callto:", "");
|
||||||
|
number = number.replace("tel:", "");
|
||||||
number = number.replace("callto://", "");
|
number = number.replace("callto://", "");
|
||||||
number = number.replace("tel://", "");
|
number = number.replace("tel://", "");
|
||||||
number = number.replace("sip://", "");
|
number = number.replace("sip://", "");
|
||||||
|
@ -62,8 +67,10 @@ public class CallToJ {
|
||||||
|
|
||||||
System.out.println("Using Snom phone to dial number " + number);
|
System.out.println("Using Snom phone to dial number " + number);
|
||||||
|
|
||||||
URL url = new URL("http://" + hostname_snom + "/command.htm?number=" + number + "&outgoing_uri=URI");
|
URL url = new URL("http://" + hostname_snom +
|
||||||
String encoding = Base64.getEncoder().encodeToString((snom_webadmin_user + ":" + snom_webadmin_pw).getBytes());
|
"/command.htm?number=" + number + "&outgoing_uri=URI");
|
||||||
|
String encoding = Base64.getEncoder().encodeToString(
|
||||||
|
(snom_webadmin_user + ":" + snom_webadmin_pw).getBytes());
|
||||||
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
|
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
|
||||||
connection.setRequestMethod("GET");
|
connection.setRequestMethod("GET");
|
||||||
connection.setDoOutput(false);
|
connection.setDoOutput(false);
|
||||||
|
|
Loading…
Reference in New Issue