1
votes

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

2
Is that the complete PHP file? Seems like that error would only happen if the create function was getting called somewhere: github.com/twilio/twilio-php/blob/4.11.0/Services/Twilio/Rest/…Devin Rader
@DevinRader Thanks for answering. This issue is resolved.Stacy Thompson
Hey Stacy, glad you resolved the issue! Would you mind posting your fix in answer section so others can benefit and you can get upvotes :)Megan Speir
@MeganSpeir I changed it to ..... header("content-type: text/xml"); echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; ?> <Response> <Dial><?php echo $phone ?></Dial> </Response>Stacy Thompson

2 Answers

0
votes
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.

0
votes

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.