我們如何使用Twilio android sdk將應用程序和應用程序調用到手機。主要問題是當初始化呼叫時,我們的呼叫會自動終止。這是用於呼出呼叫的PHP側腳本,但呼出呼叫不起作用,呼叫在初始化狀態時自動終止。Twilio撥出電話不工作,它會自動終止
outgoing.php
<?php
header('Content-type: text/xml');
include 'db.php';
require 'twilio-twilio-php-788b98f/Services/Twilio.php';
require('twilio-twilio-php-788b98f/Services/Twilio/Capability.php');
$accountSid = '';
$authToken = '';
$applicationSid ='';
// Twilio REST API version
$version = "2010-04-01";
// put a phone number you've verified with Twilio to use as a caller ID number
$From = $_REQUEST['From']; // Dialer Number Twilio User or Non Twilio User
// put your default Twilio Client name here, for when a phone number isn't given
$To = $_REQUEST['To']; // Dialer Number Twilio User or Non Twilio User
$client = new Services_Twilio($accountSid, $authToken, $version);
// Initiate a new outbound call
$call = $client->account->calls->create(
$From, // The number of the phone initiating the call
$To, // The number of the phone receiving call
'http://sitelink.coml/basic-call.php');
$a= $call->sid;
?>
basiccall.php
<Response>
<?php
// if the From is from "client:basic" (e.g. the iOS App), redirect to the normal
// quickstart URL to say a nice "Welcome to Twilio Client" message.
// Otherwise, if the From is a phone number, have it call the client named "basic"
// to dial into the iOS app.
$from = isset($_REQUEST["From"]) ? $_REQUEST["From"] : "";
if ($from == "client:basic")
{ // redirect to the sample app URL
?>
<Say>Welcome to Twilio Client. You have successfully made a call from your i o s application!</Say>
<?php
}
else if (preg_match("/^\+?\d+$/", $from)) // (zero or one '+' chars, then one or more digits)
{ // else if it's from a phone number, dial the client named "basic"
?>
<Say>Call from Beckon Delve</Say>
<Dial>
<Client>basic</Client>
</Dial>
<?php
}
?>
</Response>
你有可能在這裏添加一些代碼嗎?我想知道是否有人不可能根據這篇簡短的文章解決這個問題。 – halfer
可以給我發送的PHP腳本 –
否 - 堆棧溢出不是一個地方,你可以讓人們免費工作。如果您可以提出具體而詳細的問題,指出您得到的錯誤類型,您應該能夠得到正確的幫助。 – halfer