1

As subject says I am reading api docs for twilio but even after brainstorming for 2 hours I am still unable to figure out exactly how can I receive a call from twilio on my web application and answer the call with my own voice like we do in a real phone.

I know how to respond a call when someone call your twilio number but that's only text to speech conversion like their "Hello Monkey" example application but nothing so far about answering a call using their API.

Can anyone please explain how can we do that? Not everything, just main concept and few references if possible

I am using Laravel so would be good if it's in php

Muhammad
  • 921
  • 2
  • 11
  • 29

2 Answers2

4

Twilio evangelist here.

I would suggest working through the Twilio Client for JavaScript Quickstart. This will walk you through both the server and client side code needed to build a phone in your browser, showing you how to both make outbound calls from the browser to a PSTN phone as well as receive incoming PSTN calls in the browser.

The magic that you are looking for in either of those cases is the <Dial> verb. When an incoming PSTN call comes into Twilio, you can use the Dial verb to tell Twilio to dial and bridge that call with a Client instance:

<Dial>
    <Client>jenny</Client>
</Dial>

When and instance of client make an outbound call and wants to connect to a PSTN phone number you again us the Dial verb:

<Dial>
    <Number>+15555555555</Number>
</Dial>

The quickstart shows in more detail how this works.

Hope that helps.

Devin Rader
  • 10,260
  • 1
  • 20
  • 32
0

You tried the Twilio PHP lib? As for Laravel... Incoming call? No problem!

Please try to use Google before asking questions! I think one important trait to any programmer is the ability to organize the idea of "what you want", and then google each step to get it that you want...

Maxinne
  • 1,693
  • 2
  • 23
  • 47
  • `$twilio->call('+18085551212', function ($message) { $message->say('Hello'); $message->play('https://api.twilio.com/cowbell.mp3', ['loop' => 5]); });` What I am trying to do is play my voice instead of mp3 here - I tried those resources but couldn't find anything about it - I could be totally stupid and may not be noticing something important that's why I am asking for help here - Google can't help stupids like me that's why I use StackOverflow - Thanks for the response – Muhammad May 30 '15 at 06:04
  • Ok, sorry if I was a little rude with you, but you need to better state what you want... You comment should basically be your question. I think you should delete this question, and create a new one specifically with what you want to do, or where you are failling. You are trying to place a call that plays your voice (That is on an MP3 file), or you are trying to answer (receive) a call listen to it? – Maxinne May 30 '15 at 15:28
  • I am trying to figure out how to answer a call and listen to it - not just recording but real time talk like we do on Phone – Muhammad May 31 '15 at 00:32
  • 1
    I guess **Devin Rader** reply got you covered... You should mark it as correct and try to do what he said, and then ask a new question if any trouble appear, or you need help with the next steps... – Maxinne May 31 '15 at 01:29