问题
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
回答1:
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
.
来源:https://stackoverflow.com/questions/43367898/twilio-quick-start-project-is-not-working