start项目无法正常工作

start项目无法正常工作

本文介绍了Twilio quick_start项目无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注首次推出Twilio。我使用在Heroku上部署Twilio。提供像 twilio_account_sid,twilio_auth_token,twilio_caller_id twilio_app_id 这样的参数。我创建了一个TwiML应用程序,并在Heroku上部署了我的应用程序URL并将其设置为GET。

然后将Twilio Quickstart项目导入到Android Studio中,并将设置为 > TOKEN_SERVICE_URL 到Heroku上的应用程序URL。我运行应用程序,没有错误,但在logcat 设备已停止监听传入连接



在两台设备上运行应用程序,注册一个名称并尝试调用它。我收到能力令牌,但没有任何反应。没有贝贝,没有声音,也没有什么,但是当我尝试使用浏览器上的应用程序URL进行调用时,会播放试听警告声,并且我看到一条消息,说明呼叫已成功,然后立即结束而不连接。我的帐户有其初始信用;大约$ 11.0。



我还在Twilio的Debugger中看到了一个 XML验证警告 - 12200 。我在四天内尝试并搜寻了很多。请帮我弄清楚问题并解决。我在等你们。



在此先感谢。



编辑:下面是我在Twilio调试器控制台中获得的身体响应:

 <!DOCTYPE html> 
< html>
< head>
< title> Hello Client Monkey Quicker Starter'< / title>
< script type =text / javascript
src =// media.twiliocdn.com/sdk/js/client/v1.3/twilio.min.js\"></脚本>
< script type =text / javascript
src =https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js><< ; /脚本>
< link href =// static0.twilio.com/packages/quickstart/client.css
type =text / css =stylesheet/>
< script type =text / javascript>

Twilio.Device.setup( eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzY29wZSI6InNjb3BlOmNsaWVudDppbmNvbWluZz9jbGllbnROYW1lPWNoYXJsZXMgc2NvcGU6Y2xpZW50Om91dGdvaW5nP2FwcFNpZD1BUDNhYWVlYmVmYWUwMDEyZmVlZGRlOTU3N2FkYzdkNDUxJmNsaWVudE5hbWU9Y2hhcmxlcyIsImlzcyI6IkFDM2UyOGQ0OGRjOWExM2NlMzIzNjZmY2M1OTU1ZmI5OWMiLCJleHAiOjE0OTIzMjc0MzR9.WdnE5GRkM9 - MRj9MZlEIjTvGb5U7XXWQj2rBDaj2uE,{调试:真});

Twilio.Device.ready(function(device){
$(#log)。text(Client'charles'ready);
});

Twilio.Device.error(function(error){
$(#log)。text(Error:+ error.message);
});

Twilio.Device.connect(函数(conn){
$(#log)。text(成功建立的调用);
});

Twilio.Device.disconnect(function(conn){
$(#log)。text(Call ended);
});

Twilio.Device.incoming(function(conn){
$(#log)。text(Incoming connection from+ conn.parameters.From);
//接受传入的连接并启动双向音频
conn.accept();
});

函数call(){
//获取电话号码或客户端将呼叫连接到
params = {PhoneNumber:$(#number)。val ()};
Twilio.Device.connect(params);
}

函数hangup(){
Twilio.Device.disconnectAll();
}
< / script>
< / head>
< body>
< button class =callonclick =call();>
呼叫
< / button>
< button class =hanguponclick =hangup();>
挂断
< /按钮>
< input type =textid =numbername =number
placeholder =输入电话号码或


解决方案

Twilio开发者们在这里传福音。

所以,你遇到的问题是你的TwiML应用程序指向你的应用程序的错误路径,你当前正在指向实际返回应用程序前端的根路径 / ,你需要更新您的TwiML应用程序以指向您已部署的URL和路径 / voice


I'm following Twilio Quickstart to launch Twilio for the first time. I deployed Twilio on Heroku using this link. Giving it parameters required like twilio_account_sid, twilio_auth_token, twilio_caller_id and twilio_app_id. I created a TwiML app and entered my app URL deployed on Heroku to it and set its method to GET.

Then imported Twilio Quickstart project into Android Studio, and set TOKEN_SERVICE_URL to my application URL on Heroku. I run the application, got no error but this message on logcat Device has stopped listening for incoming connections.

I'm running the app on two devices, register one by another name and try to call it. I get Capability Token, but nothing happens. No beeb, no sound, and nothing, but when I try calling using app URL on the browser, a trial warning sound plays and I see a message saying Call Established Successfully, then ends immediately without connecting. My account has its initial credit; about $11.0.

I also see a XML Validation Warning - 12200 in Debugger on Twilio. I tried and searched a lot in four days. Please help me figure out the problem and solve it. I'm waiting for you guys.

Thanks in Advance.

Edit: Here is my body response I'm getting in Twilio debugger console:

    <!DOCTYPE html>
<html>
    <head>
        <title>Hello Client Monkey Quicker Starter'</title>
        <script type="text/javascript"
      src="//media.twiliocdn.com/sdk/js/client/v1.3/twilio.min.js"></script>
        <script type="text/javascript"
      src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
        <link href="//static0.twilio.com/packages/quickstart/client.css"
      type="text/css" rel="stylesheet" />
        <script type="text/javascript">

    Twilio.Device.setup("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzY29wZSI6InNjb3BlOmNsaWVudDppbmNvbWluZz9jbGllbnROYW1lPWNoYXJsZXMgc2NvcGU6Y2xpZW50Om91dGdvaW5nP2FwcFNpZD1BUDNhYWVlYmVmYWUwMDEyZmVlZGRlOTU3N2FkYzdkNDUxJmNsaWVudE5hbWU9Y2hhcmxlcyIsImlzcyI6IkFDM2UyOGQ0OGRjOWExM2NlMzIzNjZmY2M1OTU1ZmI5OWMiLCJleHAiOjE0OTIzMjc0MzR9.WdnE5GRkM9--MRj9MZlEIjTvGb5U7XXWQj2rBDaj2uE", {debug: true});

      Twilio.Device.ready(function (device) {
        $("#log").text("Client 'charles' is ready");
      });

      Twilio.Device.error(function (error) {
        $("#log").text("Error: " + error.message);
      });

      Twilio.Device.connect(function (conn) {
        $("#log").text("Successfully established call");
      });

      Twilio.Device.disconnect(function (conn) {
        $("#log").text("Call ended");
      });

      Twilio.Device.incoming(function (conn) {
        $("#log").text("Incoming connection from " + conn.parameters.From);
        // accept the incoming connection and start two-way audio
        conn.accept();
      });

      function call() {
        // get the phone number or client to connect the call to
        params = {"PhoneNumber": $("#number").val()};
        Twilio.Device.connect(params);
      }

      function hangup() {
        Twilio.Device.disconnectAll();
      }
    </script>
    </head>
    <body>
        <button class="call" onclick="call();">
      Call
    </button>
        <button class="hangup" onclick="hangup();">
      Hangup
    </button>
        <input type="text" id="number" name="number"
      placeholder="Enter a phone number or
解决方案

Twilio developer evangelist here.

So, the problem you have is that your TwiML application is pointing to the wrong path on your application. You're currently pointing at the root path / which actually returns the front end of the application. You need to update your TwiML application to point to the URL you have deployed it at and the path /voice.

这篇关于Twilio quick_start项目无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 20:14