Search code examples
twiliotwilio-apitwilio-php

Twilio Browser Call Sends Wrong Call Sid in POST


I have setup browser calls and in my TwiML App , setup the Status CallBack url . Twilio posts the status in the format

array (
  'ApiVersion' => '2010-04-01',
  'Called' => NULL,
  'CallStatus' => 'completed',
  'Duration' => '1',
  'From' => 'client:browser',
  'CallDuration' => '13',
  'Direction' => 'inbound',
  'Timestamp' => 'Mon, 16 Apr 2018 19:35:26 +0000',
  'AccountSid' => 'asdasdasdadasdasdasdasdasdasdas',
  'CallbackSource' => 'call-progress-events',
  'ApplicationSid' => 'rwerwerwerwewewewewwrwe',
  'Caller' => 'client:browser',
  'SequenceNumber' => '0',
  'To' => NULL,
  'CallSid' => 'CA9c6408108969fsf6f1c53396003d931',
)  

I am trying to get the call to ,from and other details. I did was

$callsid = $_POST['CallSid'];
$call = $client->calls($callsid)->fetch();

But it failed everytime. When I checked my dashboard for the CallSod , it is different from what they sent in the webhook.

Is there something I am missing ?


Solution

  • Resolved it. I need to get the Child Call SID to get that information .

    $call = $client->calls->read(
        array("ParentCallSid" => $callsid )
    );