This commit is contained in:
2021-10-18 17:54:09 +02:00
commit bdabf0017a
28 changed files with 463 additions and 0 deletions

View File

@ -0,0 +1,41 @@
package de.vincentschweiger.calltoj;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Base64;
/**
* Mo. 18/10/2021 17:32
*
* @author cook1e
*/
public class CallToJ {
private static String snom_webadmin_user = "admin";
private static String snom_webadmin_pw = "x7eff15";
private static String hostname_snom = "snom765-901777.getcom.de";
public static void main(String[] args) throws java.io.IOException {
String number;
if (args.length < 1) {
number = "015904183517";
} else {
number = args[0];
// Replace cause of firefox and callto handling stuff
number = number.replace("callto://", "");
number = number.replace("tel://", "");
number = number.replace("sip://", "");
number = number.replace("+49", "0");
number = number.replace("%20", "");
}
System.out.println("Using Snom phone to dial number " + number);
URL url = new URL("http://" + hostname_snom + "/command.htm?number=" + number + "&outgoing_uri=URI");
String encoding = Base64.getEncoder().encodeToString((snom_webadmin_user + ":" + snom_webadmin_pw).getBytes());
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setDoOutput(false);
connection.setRequestProperty("Authorization", "Basic " + encoding);
connection.getResponseCode();
}
}