首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在不知道sid的情况下检索php中的两个转录文本

在不知道sid的情况下检索php中的两个转录文本
EN

Stack Overflow用户
提问于 2013-10-25 19:42:59
回答 3查看 661关注 0票数 1

我正在做一个twilio应用程序,它的声音被转录,然后转换成文本。在检索转录文本之前,一切都是有用的。我知道,如果我知道"sid“,我可以检索转录代码,但是如果我想要动态的转录代码,而不知道"sid”,该怎么办?换句话说,我想从电话号码"555-555-1212“中找到最新的抄本,我能找到的只有下面的代码。

代码语言:javascript
运行
复制
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library
// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "AC1240edf87a1d3b6717472af6deda4ce7";
$token = "{{ auth_token }}";
$client = new Services_Twilio($sid, $token);
$client->account->transcriptions->delete("TR8c61027b709ffb038236612dc5af8723");
?>

提前感谢!迭戈

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2013-11-16 17:32:55

修正我原来的问题=)

代码语言:javascript
运行
复制
<?php
//RETRIEVE NUMBERS LAST TRANSCRIPTION
$client = new Services_Twilio($sid, $token);
$i=0;
foreach($client->account->transcriptions->getIterator(0, 50, array('Status' =>  'completed', 'To' => ''.$_GET['number'].'')) as $call)  {  
//now use the sid to get the transcription text using a seperate rest call.
if($i==1) break;
$transcription = $client->account->transcriptions->get($call->sid);
$sms_text = $transcription->transcription_text;
$i++;
}
?>
票数 0
EN

Stack Overflow用户

发布于 2013-10-26 11:17:04

您需要获得呼叫的SID,但是如果您知道电话号码,并且可以选择要查找的日期范围(我的PHP已经生疏了,所以您可能需要将其连接起来),这就很容易做到了:

代码语言:javascript
运行
复制
// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "{{ sid }}"; 
$token = "{{ auth_token }}"; 
$client = new Services_Twilio($sid, $token);

// Get calls to a number on or after a certain date.
foreach ($client->account->calls->getIterator(0, 50, array("Status" => "completed", "To" => "555-555-1212","StartTime" => "2013-10-26")) as $call)  {
    echo $call->sid
    //now use the sid to get the transcription text using a seperate rest call.
    $transcription = $client->account->transcriptions->get($call->sid);
    echo $transcription->transcription_text;    
}
票数 0
EN

Stack Overflow用户

发布于 2013-11-17 05:56:10

这里的福音传道者。

另一个选项是,如果使用<Record>谓词,则可以设置transcribeCallback参数:

https://www.twilio.com/docs/api/twiml/record#attributes-transcribe-callback

这允许您给Twilio一个URL,我们将在完成转录时请求该URL。

希望这能有所帮助。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19598195

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档