Stacy Thompson
Stacy Thompson

Reputation: 718

Twilio Twilio/Rest/Calls.php error

whenever I am trying to make a conference call it says application error and I get an error in error log as :

PHP Warning: strlen() expects parameter 1 to be string, array given in /home/aan/public_html/twilio/twilio-php-4.11.0/Services/Twilio/Rest/Calls.php on line 16

Here is the code

<?php

require("twilio-php-4.11.0/Services/Twilio/Twiml.php");

    if($_REQUEST['Digits'] != '1') {
        header("Location: twiml.php");
        die;
    }

   $MODERATOR = $_GET['phone'];

$response = new Services_Twilio_Twiml();


$dial = $response->dial($MODERATOR);
  $dial->conference('My conference', array(
                'startConferenceOnEnter' => True
                ));

I have already made the call and gathered the digit , but when I dial second number and try to make these as conference I get this error

Upvotes: 3

Views: 671

Answers (2)

NomanJaved
NomanJaved

Reputation: 1380

I usually use TwiML for making a conference call, It's simple to implement.

$my_conference = "My Conference";
$statusCallbackUrl = "https://example.net/Welcome/conference_control"; // call back url    
<Response>
  <Dial> 
    <Conference beep="false" statusCallback="<?php echo $statusCallbackUrl; ?>" 
      statusCallbackEvent="start end join leave mute hold" endConferenceOnExit="true" 
      startConferenceOnEnter="true"> 
        <?php echo $my_conference; ?>
    </Conference>
  </Dial>
</Response>

Hopefully, it will help you.

Upvotes: 2

Megan Speir
Megan Speir

Reputation: 3811

header("content-type: text/xml"); 
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; 
?> 
<Response> 
 <Dial><?php echo $phone ?></Dial> 
</Response>

The snippet here was OP's fix for encountering an error using twilio-php library.

Upvotes: 0

Related Questions