Menu

Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Calls Between Twilio Clients

Outgoing and Incoming Capabilities

Calling from one client to another requires that you provide both the incoming and outgoing capabilities in the Capability Token. It also means we can't just use the hard-coded value of "joey" for the client name for the incoming capability. Each client needs to be uniquely addressable by their client name. Assuming the server knows who the client is, it can be sure to provide a unique client name when generating the token.

You will also need a TwiML App SID and have your server application provide this SID to the outgoing capability of the token generator.

        
        
        
        

        Routing Calls from one Client to Another

        As you may have learned in our Outgoing Calls with Twilio Client guide, your TwiML App needs to be configured to return TwiML that will instruct Twilio how to connect your outbound call. In our case, we want to provide it the client name of another client to call, as opposed to an external phone number. Our server application can then generate the appropriate TwiML <Dial> verb, using the <Client> verb inside of that to indicate we want to call another client.

              
              
              
              

              Calling Another Client

              What we want to do is have the client make a call to another client. In order to do this, our client needs to pass a parameter to our TwiML App. The parameter can be anything you like, but we'll use "To" to indicate to whom we wish to make a call. In our Outgoing Calls with Twilio Client guide, this was a phone number, but now it will be a client name.

                    
                    
                    
                    

                    Receiving a Call from Another Client

                    To accept a call, you only need to listen for the incoming event. That event will pass you a connection object on which you can call the accept() method.

                          
                          
                          
                          

                          For more about receiving calls with Twilio Client, see our Incoming Calls with Twilio Client guide.

                          David Prothero
                          Rate this page:

                          Need some help?

                          We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.