I created a twilio account to make voice calls using api rest.
This is my methods:
public function llamadaout_get(){
$sid = 'XXXXXXXXXXXXXXXXX';
$token = 'XXXXXXXXXXXXXXX';
$client = new Client($sid, $token);
$call = $client->calls->create(
'+34XXXXXXX', // Call this number
'+34XXXXXXXXXX', // From a valid Twilio number
array(
'url' => 'http://xxxxxxxx:3000/api/calltek/twilio/in'
)
);
}
public function llamadain_get(){
$sayMessage = 'Gracias por contactar con xxxxxx. En breves un operario se pondrá en contacto con usted.';
$twiml = new Twilio\Twiml();
$twiml->say($sayMessage, array('voice' => 'alice'));
$twiml->dial("+34XXXXXXXX");
header("Content-type: text/xml");
echo $twiml;
}
I have two urls:
http://xxxxxx:3000/api/calltek/twilio/out -> llamadaout_get() http://xxxxxx:3000/api/calltek/twilio/in -> llamadaout_in()
Twilio sends me this error:
An attempt to retrieve content from http://gestios.calltek.es:3000/api/calltek/twilio/in returned the HTTP status code 404
But when i access to the url, i recieve this:
<Response>
<Say voice="alice">
Gracias por contactar con xxxxxx. En breves un operario se pondrá en contacto con usted.
</Say>
<Dial>+34XXXXXXXX</Dial>
</Response>