Reputation: 709
I want to build a voice chat program for a group of friends, as several of them were hit by viruses that we believe to have been sent from an unknown user for Skype. Skype also has other security problems where users can gain access to a user on their friends lists's IP, allowing for DDoS's and other such things. To help stop this, I want to build a simple voice chat program that I can host on my computer (or from a separate server, if it ever comes to that). I've heard that Java's built in APIs work for this, but which APIs should I specifically use, and what are some good sources/tutorials/videos to learn these?
Upvotes: 1
Views: 1329
Reputation: 22715
Twilio will most likely fit your requirement. You can get started here: Twilio Quick Start.
It allows you to initiate and receive calls, even SMS. You will need to learn a bit of TwiML, but it's relatively simple.
The site has good sample code on common use cases. Here's a sample Java program that sends SMS messages.
Here's one that initiates an outgoing call - excerpt from the Twilio site:
import java.util.Map;
import java.util.HashMap;
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.Account;
import com.twilio.sdk.resource.instance.Call;
import com.twilio.sdk.resource.factory.CallFactory;
public class MakeCall {
public static final String ACCOUNT_SID = "AC123";
public static final String AUTH_TOKEN = "456bef";
public static void main(String[] args) throws TwilioRestException {
TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);
Account mainAccount = client.getAccount();
CallFactory callFactory = mainAccount.getCallFactory();
Map<String, String> callParams = new HashMap<String, String>();
callParams.put("To", "5105551212"); // Replace with your phone number
callParams.put("From", "(510) 555-1212"); // Replace with a Twilio number
callParams.put("Url", "http://demo.twilio.com/welcome/voice/");
// Make the call
Call call = callFactory.create(callParams);
// Print the call SID (a 32 digit hex like CA123..)
System.out.println(call.getSid());
}
}
Important Note: Twilio has a free trial, but it will eventually involve some cost.
Upvotes: 2