0

I am facing a small problem while using Twilio conference. When i run the code, it call the participant number. When participant take up the call, then audio with "There is an Application Error, Sorry" played. I want to play the waiting URL audio on picking the phone. This is code i have used.

require_once('Services/Twilio.php');
$API_VERSION = '2010-04-01';
$ACCOUNT_SID = 'ACf4c0952bf89b57ce2a600b6f6b388c9';
$AUTH_TOKEN = '{{ auth token }}';
$client = new TwilioRestClient($ACCOUNT_SID, $AUTH_TOKEN);
$participants = array('+917201990754');
foreach ($participants as $participant)
{
    $vars = array(
        'From' => '+1 510-491-0176',
        'To' => $participant,
        'Url' => 'http://192.168.0.19/twilio/conference.xml');
    $response = $client->request("/$API_VERSION/Accounts/$ACCOUNT_SID/Calls", "POST", $vars);

if ($response->isError)
{
    echo "Something went terribly wrong. {$response->ErrorMessage}";
}
else {
    echo '<ul>';
        foreach ($response->ResponseXml->Conferences->Conference as $conference)
        {
            echo '<li>'.$conference->FriendlyName.'</li>';
            $response2 = $client->request("/$API_VERSION/Accounts/$ACCOUNT_SID/Conferences/{$conference->Sid}/Participants", "GET");
            echo '<ul>';
            foreach ($response2->ResponseXml->Participants->Participant as $participant)
            {
                echo '<li>'.$participant->CallSid.'</li>';
            }
            echo '</ul>';
        }
        echo '</ul>';
}
}

Below is the xml code that i have used.

<Response>
<Dial hangupOnStar="true">
    <Conference>YourConference</Conference>
</Dial>
<Gather action="http://example.com/processConferenceMenu?confName=YourConference" numDigits="1">
    <Say>To mute all participants, press one</Say>
    <Say>To leave the conference, press two</Say>
</Gather>

I have google it and googling it since 10 days but not getting any proper solution. Will you please provide the working example of conference call with waiting url?

philnash
  • 70,667
  • 10
  • 60
  • 88
Momin IqbalAhmed
  • 950
  • 6
  • 13

1 Answers1

1

Twilio developer evangelist here.

I notice your code sets the URL for the call you are making to 192.168.0.19. IP addresses in the 192.168.x.x range tend to be local to your own network. Therefore, Twilio will be unable to reach the URL and retrieve the TwiML required to direct the call to the conference.

When you are testing applications locally, we recommend using ngrok to test your webhook URLs. I also wrote up why I like using ngrok to test Twilio applications.

So, I'd look into making sure that Twilio can reach your application. Once it can, your <Conference> should start working.

philnash
  • 70,667
  • 10
  • 60
  • 88
  • Than you sir. It means there is no mistake in code above. I need to overcome solution for local network, right? – Momin IqbalAhmed Apr 15 '16 at 11:11
  • If i test on our development server (i.e. live server) there there will be no issue, right? – Momin IqbalAhmed Apr 15 '16 at 11:12
  • I can't see an error in that code that would cause the application error message. You can also check this is the reason in the [Alerts section of your Twilio dashboard](https://www.twilio.com/user/account/monitor/alerts). If you have a bunch of alerts for a "11200 HTTP Retrieval Failure" then Twilio cannot reach your application. You can either deploy publicly to test, or use a tool like ngrok to expose your local application. – philnash Apr 15 '16 at 11:14
  • ok. i will try ngrok and will be back if suffering from any issue :) Hope you will be there. Thank you once again – Momin IqbalAhmed Apr 15 '16 at 11:19