twiliotwilio-php

Get Caller From value in Twilio


I've written a script which generates a wordpress post each time a call is received to log a serevice event within our call centre application which is working correctly in as much as the call is handled correctly and a wordpress post is created, but I'm not able to pass the value of the person who is calling to Wordpress. As you can see below I've tried several things. Here is the code I'm currently using:

$response = new TwiML;
$response = new VoiceResponse();

// $caller = $fromCaller;
$caller = $call['from'];
$caller .= $call['callerid'];
$caller .= $dial['callerid'];
$content = 'Service Request received from ' . $caller;

// Register the Request in to Wordpress
// Create post object
$my_post = array(
  'post_title'      =>  'Service Event',
  'post_type'       =>  'mce_service',
  'post_content'    =>  $content,
  'post_status'     =>  'private',
  'post_author'     =>  1
);

// Insert the post into the database
wp_insert_post( $my_post );

Anyone able to point me in the right direction as clearly I'm missing something and the docs aren't helping me.


Solution

  • I found what I was looking for and posting an answer to my own question as it may help others.

    $caller = $_REQUEST["From"];