简体   繁体   English

我可以使用哪种Java API来构建简单的语音通信程序?

[英]What kinds Java APIs can I use to build a simple voice communications program?

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发送的病毒所感染。 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. Skype还存在其他安全问题,用户可以在其朋友列表的IP上访问该用户,从而允许进行DDoS和其他此类操作。 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? 我听说Java的内置API可以做到这一点,但是我应该专门使用哪些API,可以从哪些好的资源/教程/视频中学习呢?

Twilio will most likely fit your requirement. Twilio很可能会满足您的要求。 You can get started here: Twilio Quick Start . 您可以从这里开始: Twilio快速入门

It allows you to initiate and receive calls, even SMS. 它允许您发起和接听电话,甚至短信。 You will need to learn a bit of TwiML , but it's relatively simple. 您将需要学习一些TwiML ,但这是相对简单的。

The site has good sample code on common use cases. 该站点提供了有关常见用例的良好示例代码。 Here's a sample Java program that sends SMS messages . 这是一个发送SMS消息的示例Java程序。

Here's one that initiates an outgoing call - excerpt from the Twilio site: 这是一个发起拨出电话的电话 -来自Twilio网站的摘录:

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. 重要说明: Twilio有免费试用版 ,但最终会涉及一些费用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何制作一个简单的 gradle 构建脚本来编译 Java 程序? - How can I make a simple gradle build script to compile a java program? 在Java程序中使用Apache Ant API以编程方式构建源文件 - Using Apache Ant APIs in Java program to programmatically build source files C ++和Java程序之间的交互/通信 - Interactions/Communications between a C++ and a Java program 简单的java程序无法运行 - Simple java program can not be run 使用gradle构建一个非常简单的java程序 - Using gradle to build a very simple java program 如何使用Java构建简单的安全Web服务? - How can I build simple secure web service with Java? 我必须在GAE Endpoints API中使用CollectionResponse作为返回类型,还是可以使用实体的Java集合? - Do I have to to use CollectionResponse as a return type in GAE Endpoints APIs or I can use java collections of entities? 商业智能:构建Java BB应用程序最重要的API是什么? - Business Intelligence: What are the most importants APIs to build a Java BB application? 与证书的Java WS客户端-服务器通信,我应该使用哪些框架/ API? - java WS client-server communication with certificates, what frameworks/apis should i use? 我正在用Java开发一个简单的绘画程序,我可以绘画,但是当我最小化窗口或调整大小时,我的绘画消失了。 我如何让他们留下来? - I am making a simple paint program in java, I can draw but when I minimize the window or resize what I painted goes away. How do I get them to stay?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM