【问题标题】:How would I get recorded calls by phone number on twilio?如何通过 twilio 上的电话号码获得录音电话?
【发布时间】:2016-12-16 02:16:04
【问题描述】:

我想知道如何获取特定电话号码的所有录音。假设我单击电话号码为 423-1234-1323 的页面,我希望能够列出该页面上的所有录音并从该页面播放它们。我该怎么做。我能够获得每一个录音,但不仅仅是我想要的。

$recordings = $client->account->recordings;

foreach ($client->account->calls->getIterator(0, 50, array( 'From' => $phoneNumber )) as $call) {

$recordings = $call->录音;

$recordings = $recordings->client->last_response->calls;

dd($recordings);返回 $recordings; }

-返回是

Services_Twilio_AutoPagingIterator

{#696 ▼

#generator: array:2 [▶]
#args: null
#items: array:9 [▼

0 => Services_Twilio_Rest_Recording

{#704 ▼

#subresources: array:1 [▶]

+“客户端”:Services_Twilio

{#643}

+"sid": ""

+"account_sid": ""

+"call_sid": ""

+“持续时间”:“9”

+"date_created": ""

+"api_version": "2010-04-01"

+"date_updated": ""

+“状态”:“完成”

+“来源”:空

+“频道”:1

+“价格”:“-0.00250”

+"price_unit": "美元"

+"uri": "/2010-04-01/Accounts//Recordings/R"

}

1 => Services_Twilio_Rest_Recording {#706 ▶}

}

这些录音是为所有人准备的,而不仅仅是我想要的号码。即使在代码中我将它传递给 $phoneNumber 以进行过滤,但这对过滤它没有任何作用。

【问题讨论】:

  • 请向我们展示相关代码,并给我们一个输入和输出的例子,以及您期望的输出的解释。见stackoverflow.com/help/mcve
  • 我希望结果是,如果我点击电话号码 1,如果我点击电话号码 2,通过号码 1 录制的所有录音都将显示相同的内容
  • 您应该编辑您的问题并在此处添加相关信息。

标签: javascript laravel-5.2 laravel-blade twilio-php twilio-api


【解决方案1】:

您可以检查CallSid of the recordingPhoneNumberSid 是否有您希望过滤的号码。

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$token = "your_auth_token"; 
$client = new Services_Twilio($sid, $token);

// Loop over the list of recordings and echo a property for each one
foreach ($client->account->recordings->getIterator(0, 50, array(
        "CallSid>" => // is in list of Calls for a given phone number.
    )) as $recording
) {
    echo $recording->call_sid;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-03
    • 1970-01-01
    • 1970-01-01
    • 2013-11-14
    • 1970-01-01
    相关资源
    最近更新 更多